google_cloud_dialogflow_v2/client.rs
1// Copyright 2025 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14//
15// Code generated by sidekick. DO NOT EDIT.
16#![allow(rustdoc::redundant_explicit_links)]
17#![allow(rustdoc::broken_intra_doc_links)]
18
19/// Implements a client for the Dialogflow API.
20///
21/// # Example
22/// ```
23/// # use google_cloud_dialogflow_v2::client::Agents;
24/// use google_cloud_gax::paginator::ItemPaginator as _;
25/// # async fn sample() -> Result<(), Box<dyn std::error::Error>> {
26/// let client = Agents::builder().build().await?;
27/// let mut list = client.search_agents()
28/// /* set fields */
29/// .by_item();
30/// while let Some(item) = list.next().await.transpose()? {
31/// println!("{:?}", item);
32/// }
33/// # Ok(()) }
34/// ```
35///
36/// # Service Description
37///
38/// Service for managing [Agents][google.cloud.dialogflow.v2.Agent].
39///
40/// [google.cloud.dialogflow.v2.Agent]: crate::model::Agent
41///
42/// # Configuration
43///
44/// To configure `Agents` use the `with_*` methods in the type returned
45/// by [builder()][Agents::builder]. The default configuration should
46/// work for most applications. Common configuration changes include
47///
48/// * [with_endpoint()]: by default this client uses the global default endpoint
49/// (`https://dialogflow.googleapis.com`). Applications using regional
50/// endpoints or running in restricted networks (e.g. a network configured
51// with [Private Google Access with VPC Service Controls]) may want to
52/// override this default.
53/// * [with_credentials()]: by default this client uses
54/// [Application Default Credentials]. Applications using custom
55/// authentication may need to override this default.
56///
57/// [with_endpoint()]: super::builder::agents::ClientBuilder::with_endpoint
58/// [with_credentials()]: super::builder::agents::ClientBuilder::with_credentials
59/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
60/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
61///
62/// # Pooling and Cloning
63///
64/// `Agents` holds a connection pool internally, it is advised to
65/// create one and reuse it. You do not need to wrap `Agents` in
66/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
67/// already uses an `Arc` internally.
68#[cfg(feature = "agents")]
69#[cfg_attr(docsrs, doc(cfg(feature = "agents")))]
70#[derive(Clone, Debug)]
71pub struct Agents {
72 inner: std::sync::Arc<dyn super::stub::dynamic::Agents>,
73}
74
75#[cfg(feature = "agents")]
76impl Agents {
77 /// Returns a builder for [Agents].
78 ///
79 /// ```
80 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
81 /// # use google_cloud_dialogflow_v2::client::Agents;
82 /// let client = Agents::builder().build().await?;
83 /// # Ok(()) }
84 /// ```
85 pub fn builder() -> super::builder::agents::ClientBuilder {
86 crate::new_client_builder(super::builder::agents::client::Factory)
87 }
88
89 /// Creates a new client from the provided stub.
90 ///
91 /// The most common case for calling this function is in tests mocking the
92 /// client's behavior.
93 pub fn from_stub<T>(stub: T) -> Self
94 where
95 T: super::stub::Agents + 'static,
96 {
97 Self {
98 inner: std::sync::Arc::new(stub),
99 }
100 }
101
102 pub(crate) async fn new(
103 config: gaxi::options::ClientConfig,
104 ) -> crate::ClientBuilderResult<Self> {
105 let inner = Self::build_inner(config).await?;
106 Ok(Self { inner })
107 }
108
109 async fn build_inner(
110 conf: gaxi::options::ClientConfig,
111 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::Agents>> {
112 if gaxi::options::tracing_enabled(&conf) {
113 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
114 }
115 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
116 }
117
118 async fn build_transport(
119 conf: gaxi::options::ClientConfig,
120 ) -> crate::ClientBuilderResult<impl super::stub::Agents> {
121 super::transport::Agents::new(conf).await
122 }
123
124 async fn build_with_tracing(
125 conf: gaxi::options::ClientConfig,
126 ) -> crate::ClientBuilderResult<impl super::stub::Agents> {
127 Self::build_transport(conf)
128 .await
129 .map(super::tracing::Agents::new)
130 }
131
132 /// Retrieves the specified agent.
133 ///
134 /// # Example
135 /// ```
136 /// # use google_cloud_dialogflow_v2::client::Agents;
137 /// use google_cloud_dialogflow_v2::Result;
138 /// async fn sample(
139 /// client: &Agents
140 /// ) -> Result<()> {
141 /// let response = client.get_agent()
142 /// /* set fields */
143 /// .send().await?;
144 /// println!("response {:?}", response);
145 /// Ok(())
146 /// }
147 /// ```
148 pub fn get_agent(&self) -> super::builder::agents::GetAgent {
149 super::builder::agents::GetAgent::new(self.inner.clone())
150 }
151
152 /// Creates/updates the specified agent.
153 ///
154 /// Note: You should always train an agent prior to sending it queries. See the
155 /// [training
156 /// documentation](https://cloud.google.com/dialogflow/es/docs/training).
157 ///
158 /// # Example
159 /// ```
160 /// # use google_cloud_dialogflow_v2::client::Agents;
161 /// use google_cloud_dialogflow_v2::Result;
162 /// async fn sample(
163 /// client: &Agents
164 /// ) -> Result<()> {
165 /// let response = client.set_agent()
166 /// /* set fields */
167 /// .send().await?;
168 /// println!("response {:?}", response);
169 /// Ok(())
170 /// }
171 /// ```
172 pub fn set_agent(&self) -> super::builder::agents::SetAgent {
173 super::builder::agents::SetAgent::new(self.inner.clone())
174 }
175
176 /// Deletes the specified agent.
177 ///
178 /// # Example
179 /// ```
180 /// # use google_cloud_dialogflow_v2::client::Agents;
181 /// use google_cloud_dialogflow_v2::Result;
182 /// async fn sample(
183 /// client: &Agents
184 /// ) -> Result<()> {
185 /// client.delete_agent()
186 /// /* set fields */
187 /// .send().await?;
188 /// Ok(())
189 /// }
190 /// ```
191 pub fn delete_agent(&self) -> super::builder::agents::DeleteAgent {
192 super::builder::agents::DeleteAgent::new(self.inner.clone())
193 }
194
195 /// Returns the list of agents.
196 ///
197 /// Since there is at most one conversational agent per project, this method is
198 /// useful primarily for listing all agents across projects the caller has
199 /// access to. One can achieve that with a wildcard project collection id "-".
200 /// Refer to [List
201 /// Sub-Collections](https://cloud.google.com/apis/design/design_patterns#list_sub-collections).
202 ///
203 /// # Example
204 /// ```
205 /// # use google_cloud_dialogflow_v2::client::Agents;
206 /// use google_cloud_gax::paginator::ItemPaginator as _;
207 /// use google_cloud_dialogflow_v2::Result;
208 /// async fn sample(
209 /// client: &Agents
210 /// ) -> Result<()> {
211 /// let mut list = client.search_agents()
212 /// /* set fields */
213 /// .by_item();
214 /// while let Some(item) = list.next().await.transpose()? {
215 /// println!("{:?}", item);
216 /// }
217 /// Ok(())
218 /// }
219 /// ```
220 pub fn search_agents(&self) -> super::builder::agents::SearchAgents {
221 super::builder::agents::SearchAgents::new(self.inner.clone())
222 }
223
224 /// Trains the specified agent.
225 ///
226 /// This method is a [long-running
227 /// operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations).
228 /// The returned `Operation` type has the following method-specific fields:
229 ///
230 /// - `metadata`: An empty [Struct
231 /// message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct)
232 /// - `response`: An [Empty
233 /// message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
234 ///
235 /// Note: You should always train an agent prior to sending it queries. See the
236 /// [training
237 /// documentation](https://cloud.google.com/dialogflow/es/docs/training).
238 ///
239 /// # Long running operations
240 ///
241 /// This method is used to start, and/or poll a [long-running Operation].
242 /// The [Working with long-running operations] chapter in the [user guide]
243 /// covers these operations in detail.
244 ///
245 /// [long-running operation]: https://google.aip.dev/151
246 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
247 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
248 ///
249 /// # Example
250 /// ```
251 /// # use google_cloud_dialogflow_v2::client::Agents;
252 /// use google_cloud_lro::Poller;
253 /// use google_cloud_dialogflow_v2::Result;
254 /// async fn sample(
255 /// client: &Agents
256 /// ) -> Result<()> {
257 /// client.train_agent()
258 /// /* set fields */
259 /// .poller().until_done().await?;
260 /// Ok(())
261 /// }
262 /// ```
263 pub fn train_agent(&self) -> super::builder::agents::TrainAgent {
264 super::builder::agents::TrainAgent::new(self.inner.clone())
265 }
266
267 /// Exports the specified agent to a ZIP file.
268 ///
269 /// This method is a [long-running
270 /// operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations).
271 /// The returned `Operation` type has the following method-specific fields:
272 ///
273 /// - `metadata`: An empty [Struct
274 /// message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct)
275 /// - `response`:
276 /// [ExportAgentResponse][google.cloud.dialogflow.v2.ExportAgentResponse]
277 ///
278 /// [google.cloud.dialogflow.v2.ExportAgentResponse]: crate::model::ExportAgentResponse
279 ///
280 /// # Long running operations
281 ///
282 /// This method is used to start, and/or poll a [long-running Operation].
283 /// The [Working with long-running operations] chapter in the [user guide]
284 /// covers these operations in detail.
285 ///
286 /// [long-running operation]: https://google.aip.dev/151
287 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
288 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
289 ///
290 /// # Example
291 /// ```
292 /// # use google_cloud_dialogflow_v2::client::Agents;
293 /// use google_cloud_lro::Poller;
294 /// use google_cloud_dialogflow_v2::Result;
295 /// async fn sample(
296 /// client: &Agents
297 /// ) -> Result<()> {
298 /// let response = client.export_agent()
299 /// /* set fields */
300 /// .poller().until_done().await?;
301 /// println!("response {:?}", response);
302 /// Ok(())
303 /// }
304 /// ```
305 pub fn export_agent(&self) -> super::builder::agents::ExportAgent {
306 super::builder::agents::ExportAgent::new(self.inner.clone())
307 }
308
309 /// Imports the specified agent from a ZIP file.
310 ///
311 /// Uploads new intents and entity types without deleting the existing ones.
312 /// Intents and entity types with the same name are replaced with the new
313 /// versions from
314 /// [ImportAgentRequest][google.cloud.dialogflow.v2.ImportAgentRequest]. After
315 /// the import, the imported draft agent will be trained automatically (unless
316 /// disabled in agent settings). However, once the import is done, training may
317 /// not be completed yet. Please call
318 /// [TrainAgent][google.cloud.dialogflow.v2.Agents.TrainAgent] and wait for the
319 /// operation it returns in order to train explicitly.
320 ///
321 /// This method is a [long-running
322 /// operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations).
323 /// The returned `Operation` type has the following method-specific fields:
324 ///
325 /// - `metadata`: An empty [Struct
326 /// message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct)
327 /// - `response`: An [Empty
328 /// message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
329 ///
330 /// The operation only tracks when importing is complete, not when it is done
331 /// training.
332 ///
333 /// Note: You should always train an agent prior to sending it queries. See the
334 /// [training
335 /// documentation](https://cloud.google.com/dialogflow/es/docs/training).
336 ///
337 /// [google.cloud.dialogflow.v2.Agents.TrainAgent]: crate::client::Agents::train_agent
338 /// [google.cloud.dialogflow.v2.ImportAgentRequest]: crate::model::ImportAgentRequest
339 ///
340 /// # Long running operations
341 ///
342 /// This method is used to start, and/or poll a [long-running Operation].
343 /// The [Working with long-running operations] chapter in the [user guide]
344 /// covers these operations in detail.
345 ///
346 /// [long-running operation]: https://google.aip.dev/151
347 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
348 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
349 ///
350 /// # Example
351 /// ```
352 /// # use google_cloud_dialogflow_v2::client::Agents;
353 /// use google_cloud_lro::Poller;
354 /// use google_cloud_dialogflow_v2::Result;
355 /// async fn sample(
356 /// client: &Agents
357 /// ) -> Result<()> {
358 /// client.import_agent()
359 /// /* set fields */
360 /// .poller().until_done().await?;
361 /// Ok(())
362 /// }
363 /// ```
364 pub fn import_agent(&self) -> super::builder::agents::ImportAgent {
365 super::builder::agents::ImportAgent::new(self.inner.clone())
366 }
367
368 /// Restores the specified agent from a ZIP file.
369 ///
370 /// Replaces the current agent version with a new one. All the intents and
371 /// entity types in the older version are deleted. After the restore, the
372 /// restored draft agent will be trained automatically (unless disabled in
373 /// agent settings). However, once the restore is done, training may not be
374 /// completed yet. Please call
375 /// [TrainAgent][google.cloud.dialogflow.v2.Agents.TrainAgent] and wait for the
376 /// operation it returns in order to train explicitly.
377 ///
378 /// This method is a [long-running
379 /// operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations).
380 /// The returned `Operation` type has the following method-specific fields:
381 ///
382 /// - `metadata`: An empty [Struct
383 /// message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct)
384 /// - `response`: An [Empty
385 /// message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
386 ///
387 /// The operation only tracks when restoring is complete, not when it is done
388 /// training.
389 ///
390 /// Note: You should always train an agent prior to sending it queries. See the
391 /// [training
392 /// documentation](https://cloud.google.com/dialogflow/es/docs/training).
393 ///
394 /// [google.cloud.dialogflow.v2.Agents.TrainAgent]: crate::client::Agents::train_agent
395 ///
396 /// # Long running operations
397 ///
398 /// This method is used to start, and/or poll a [long-running Operation].
399 /// The [Working with long-running operations] chapter in the [user guide]
400 /// covers these operations in detail.
401 ///
402 /// [long-running operation]: https://google.aip.dev/151
403 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
404 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
405 ///
406 /// # Example
407 /// ```
408 /// # use google_cloud_dialogflow_v2::client::Agents;
409 /// use google_cloud_lro::Poller;
410 /// use google_cloud_dialogflow_v2::Result;
411 /// async fn sample(
412 /// client: &Agents
413 /// ) -> Result<()> {
414 /// client.restore_agent()
415 /// /* set fields */
416 /// .poller().until_done().await?;
417 /// Ok(())
418 /// }
419 /// ```
420 pub fn restore_agent(&self) -> super::builder::agents::RestoreAgent {
421 super::builder::agents::RestoreAgent::new(self.inner.clone())
422 }
423
424 /// Gets agent validation result. Agent validation is performed during
425 /// training time and is updated automatically when training is completed.
426 ///
427 /// # Example
428 /// ```
429 /// # use google_cloud_dialogflow_v2::client::Agents;
430 /// use google_cloud_dialogflow_v2::Result;
431 /// async fn sample(
432 /// client: &Agents
433 /// ) -> Result<()> {
434 /// let response = client.get_validation_result()
435 /// /* set fields */
436 /// .send().await?;
437 /// println!("response {:?}", response);
438 /// Ok(())
439 /// }
440 /// ```
441 pub fn get_validation_result(&self) -> super::builder::agents::GetValidationResult {
442 super::builder::agents::GetValidationResult::new(self.inner.clone())
443 }
444
445 /// Lists information about the supported locations for this service.
446 ///
447 /// # Example
448 /// ```
449 /// # use google_cloud_dialogflow_v2::client::Agents;
450 /// use google_cloud_gax::paginator::ItemPaginator as _;
451 /// use google_cloud_dialogflow_v2::Result;
452 /// async fn sample(
453 /// client: &Agents
454 /// ) -> Result<()> {
455 /// let mut list = client.list_locations()
456 /// /* set fields */
457 /// .by_item();
458 /// while let Some(item) = list.next().await.transpose()? {
459 /// println!("{:?}", item);
460 /// }
461 /// Ok(())
462 /// }
463 /// ```
464 pub fn list_locations(&self) -> super::builder::agents::ListLocations {
465 super::builder::agents::ListLocations::new(self.inner.clone())
466 }
467
468 /// Gets information about a location.
469 ///
470 /// # Example
471 /// ```
472 /// # use google_cloud_dialogflow_v2::client::Agents;
473 /// use google_cloud_dialogflow_v2::Result;
474 /// async fn sample(
475 /// client: &Agents
476 /// ) -> Result<()> {
477 /// let response = client.get_location()
478 /// /* set fields */
479 /// .send().await?;
480 /// println!("response {:?}", response);
481 /// Ok(())
482 /// }
483 /// ```
484 pub fn get_location(&self) -> super::builder::agents::GetLocation {
485 super::builder::agents::GetLocation::new(self.inner.clone())
486 }
487
488 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
489 ///
490 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
491 ///
492 /// # Example
493 /// ```
494 /// # use google_cloud_dialogflow_v2::client::Agents;
495 /// use google_cloud_gax::paginator::ItemPaginator as _;
496 /// use google_cloud_dialogflow_v2::Result;
497 /// async fn sample(
498 /// client: &Agents
499 /// ) -> Result<()> {
500 /// let mut list = client.list_operations()
501 /// /* set fields */
502 /// .by_item();
503 /// while let Some(item) = list.next().await.transpose()? {
504 /// println!("{:?}", item);
505 /// }
506 /// Ok(())
507 /// }
508 /// ```
509 pub fn list_operations(&self) -> super::builder::agents::ListOperations {
510 super::builder::agents::ListOperations::new(self.inner.clone())
511 }
512
513 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
514 ///
515 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
516 ///
517 /// # Example
518 /// ```
519 /// # use google_cloud_dialogflow_v2::client::Agents;
520 /// use google_cloud_dialogflow_v2::Result;
521 /// async fn sample(
522 /// client: &Agents
523 /// ) -> Result<()> {
524 /// let response = client.get_operation()
525 /// /* set fields */
526 /// .send().await?;
527 /// println!("response {:?}", response);
528 /// Ok(())
529 /// }
530 /// ```
531 pub fn get_operation(&self) -> super::builder::agents::GetOperation {
532 super::builder::agents::GetOperation::new(self.inner.clone())
533 }
534
535 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
536 ///
537 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
538 ///
539 /// # Example
540 /// ```
541 /// # use google_cloud_dialogflow_v2::client::Agents;
542 /// use google_cloud_dialogflow_v2::Result;
543 /// async fn sample(
544 /// client: &Agents
545 /// ) -> Result<()> {
546 /// client.cancel_operation()
547 /// /* set fields */
548 /// .send().await?;
549 /// Ok(())
550 /// }
551 /// ```
552 pub fn cancel_operation(&self) -> super::builder::agents::CancelOperation {
553 super::builder::agents::CancelOperation::new(self.inner.clone())
554 }
555}
556
557/// Implements a client for the Dialogflow API.
558///
559/// # Example
560/// ```
561/// # use google_cloud_dialogflow_v2::client::AnswerRecords;
562/// use google_cloud_gax::paginator::ItemPaginator as _;
563/// # async fn sample() -> Result<(), Box<dyn std::error::Error>> {
564/// let client = AnswerRecords::builder().build().await?;
565/// let parent = "parent_value";
566/// let mut list = client.list_answer_records()
567/// .set_parent(parent)
568/// .by_item();
569/// while let Some(item) = list.next().await.transpose()? {
570/// println!("{:?}", item);
571/// }
572/// # Ok(()) }
573/// ```
574///
575/// # Service Description
576///
577/// Service for managing
578/// [AnswerRecords][google.cloud.dialogflow.v2.AnswerRecord].
579///
580/// [google.cloud.dialogflow.v2.AnswerRecord]: crate::model::AnswerRecord
581///
582/// # Configuration
583///
584/// To configure `AnswerRecords` use the `with_*` methods in the type returned
585/// by [builder()][AnswerRecords::builder]. The default configuration should
586/// work for most applications. Common configuration changes include
587///
588/// * [with_endpoint()]: by default this client uses the global default endpoint
589/// (`https://dialogflow.googleapis.com`). Applications using regional
590/// endpoints or running in restricted networks (e.g. a network configured
591// with [Private Google Access with VPC Service Controls]) may want to
592/// override this default.
593/// * [with_credentials()]: by default this client uses
594/// [Application Default Credentials]. Applications using custom
595/// authentication may need to override this default.
596///
597/// [with_endpoint()]: super::builder::answer_records::ClientBuilder::with_endpoint
598/// [with_credentials()]: super::builder::answer_records::ClientBuilder::with_credentials
599/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
600/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
601///
602/// # Pooling and Cloning
603///
604/// `AnswerRecords` holds a connection pool internally, it is advised to
605/// create one and reuse it. You do not need to wrap `AnswerRecords` in
606/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
607/// already uses an `Arc` internally.
608#[cfg(feature = "answer-records")]
609#[cfg_attr(docsrs, doc(cfg(feature = "answer-records")))]
610#[derive(Clone, Debug)]
611pub struct AnswerRecords {
612 inner: std::sync::Arc<dyn super::stub::dynamic::AnswerRecords>,
613}
614
615#[cfg(feature = "answer-records")]
616impl AnswerRecords {
617 /// Returns a builder for [AnswerRecords].
618 ///
619 /// ```
620 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
621 /// # use google_cloud_dialogflow_v2::client::AnswerRecords;
622 /// let client = AnswerRecords::builder().build().await?;
623 /// # Ok(()) }
624 /// ```
625 pub fn builder() -> super::builder::answer_records::ClientBuilder {
626 crate::new_client_builder(super::builder::answer_records::client::Factory)
627 }
628
629 /// Creates a new client from the provided stub.
630 ///
631 /// The most common case for calling this function is in tests mocking the
632 /// client's behavior.
633 pub fn from_stub<T>(stub: T) -> Self
634 where
635 T: super::stub::AnswerRecords + 'static,
636 {
637 Self {
638 inner: std::sync::Arc::new(stub),
639 }
640 }
641
642 pub(crate) async fn new(
643 config: gaxi::options::ClientConfig,
644 ) -> crate::ClientBuilderResult<Self> {
645 let inner = Self::build_inner(config).await?;
646 Ok(Self { inner })
647 }
648
649 async fn build_inner(
650 conf: gaxi::options::ClientConfig,
651 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::AnswerRecords>> {
652 if gaxi::options::tracing_enabled(&conf) {
653 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
654 }
655 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
656 }
657
658 async fn build_transport(
659 conf: gaxi::options::ClientConfig,
660 ) -> crate::ClientBuilderResult<impl super::stub::AnswerRecords> {
661 super::transport::AnswerRecords::new(conf).await
662 }
663
664 async fn build_with_tracing(
665 conf: gaxi::options::ClientConfig,
666 ) -> crate::ClientBuilderResult<impl super::stub::AnswerRecords> {
667 Self::build_transport(conf)
668 .await
669 .map(super::tracing::AnswerRecords::new)
670 }
671
672 /// Returns the list of all answer records in the specified project in reverse
673 /// chronological order.
674 ///
675 /// # Example
676 /// ```
677 /// # use google_cloud_dialogflow_v2::client::AnswerRecords;
678 /// use google_cloud_gax::paginator::ItemPaginator as _;
679 /// use google_cloud_dialogflow_v2::Result;
680 /// async fn sample(
681 /// client: &AnswerRecords, parent: &str
682 /// ) -> Result<()> {
683 /// let mut list = client.list_answer_records()
684 /// .set_parent(parent)
685 /// .by_item();
686 /// while let Some(item) = list.next().await.transpose()? {
687 /// println!("{:?}", item);
688 /// }
689 /// Ok(())
690 /// }
691 /// ```
692 pub fn list_answer_records(&self) -> super::builder::answer_records::ListAnswerRecords {
693 super::builder::answer_records::ListAnswerRecords::new(self.inner.clone())
694 }
695
696 /// Updates the specified answer record.
697 ///
698 /// # Example
699 /// ```
700 /// # use google_cloud_dialogflow_v2::client::AnswerRecords;
701 /// # extern crate wkt as google_cloud_wkt;
702 /// use google_cloud_wkt::FieldMask;
703 /// use google_cloud_dialogflow_v2::model::AnswerRecord;
704 /// use google_cloud_dialogflow_v2::Result;
705 /// async fn sample(
706 /// client: &AnswerRecords, name: &str
707 /// ) -> Result<()> {
708 /// let response = client.update_answer_record()
709 /// .set_answer_record(
710 /// AnswerRecord::new().set_name(name)/* set fields */
711 /// )
712 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
713 /// .send().await?;
714 /// println!("response {:?}", response);
715 /// Ok(())
716 /// }
717 /// ```
718 pub fn update_answer_record(&self) -> super::builder::answer_records::UpdateAnswerRecord {
719 super::builder::answer_records::UpdateAnswerRecord::new(self.inner.clone())
720 }
721
722 /// Lists information about the supported locations for this service.
723 ///
724 /// # Example
725 /// ```
726 /// # use google_cloud_dialogflow_v2::client::AnswerRecords;
727 /// use google_cloud_gax::paginator::ItemPaginator as _;
728 /// use google_cloud_dialogflow_v2::Result;
729 /// async fn sample(
730 /// client: &AnswerRecords
731 /// ) -> Result<()> {
732 /// let mut list = client.list_locations()
733 /// /* set fields */
734 /// .by_item();
735 /// while let Some(item) = list.next().await.transpose()? {
736 /// println!("{:?}", item);
737 /// }
738 /// Ok(())
739 /// }
740 /// ```
741 pub fn list_locations(&self) -> super::builder::answer_records::ListLocations {
742 super::builder::answer_records::ListLocations::new(self.inner.clone())
743 }
744
745 /// Gets information about a location.
746 ///
747 /// # Example
748 /// ```
749 /// # use google_cloud_dialogflow_v2::client::AnswerRecords;
750 /// use google_cloud_dialogflow_v2::Result;
751 /// async fn sample(
752 /// client: &AnswerRecords
753 /// ) -> Result<()> {
754 /// let response = client.get_location()
755 /// /* set fields */
756 /// .send().await?;
757 /// println!("response {:?}", response);
758 /// Ok(())
759 /// }
760 /// ```
761 pub fn get_location(&self) -> super::builder::answer_records::GetLocation {
762 super::builder::answer_records::GetLocation::new(self.inner.clone())
763 }
764
765 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
766 ///
767 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
768 ///
769 /// # Example
770 /// ```
771 /// # use google_cloud_dialogflow_v2::client::AnswerRecords;
772 /// use google_cloud_gax::paginator::ItemPaginator as _;
773 /// use google_cloud_dialogflow_v2::Result;
774 /// async fn sample(
775 /// client: &AnswerRecords
776 /// ) -> Result<()> {
777 /// let mut list = client.list_operations()
778 /// /* set fields */
779 /// .by_item();
780 /// while let Some(item) = list.next().await.transpose()? {
781 /// println!("{:?}", item);
782 /// }
783 /// Ok(())
784 /// }
785 /// ```
786 pub fn list_operations(&self) -> super::builder::answer_records::ListOperations {
787 super::builder::answer_records::ListOperations::new(self.inner.clone())
788 }
789
790 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
791 ///
792 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
793 ///
794 /// # Example
795 /// ```
796 /// # use google_cloud_dialogflow_v2::client::AnswerRecords;
797 /// use google_cloud_dialogflow_v2::Result;
798 /// async fn sample(
799 /// client: &AnswerRecords
800 /// ) -> Result<()> {
801 /// let response = client.get_operation()
802 /// /* set fields */
803 /// .send().await?;
804 /// println!("response {:?}", response);
805 /// Ok(())
806 /// }
807 /// ```
808 pub fn get_operation(&self) -> super::builder::answer_records::GetOperation {
809 super::builder::answer_records::GetOperation::new(self.inner.clone())
810 }
811
812 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
813 ///
814 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
815 ///
816 /// # Example
817 /// ```
818 /// # use google_cloud_dialogflow_v2::client::AnswerRecords;
819 /// use google_cloud_dialogflow_v2::Result;
820 /// async fn sample(
821 /// client: &AnswerRecords
822 /// ) -> Result<()> {
823 /// client.cancel_operation()
824 /// /* set fields */
825 /// .send().await?;
826 /// Ok(())
827 /// }
828 /// ```
829 pub fn cancel_operation(&self) -> super::builder::answer_records::CancelOperation {
830 super::builder::answer_records::CancelOperation::new(self.inner.clone())
831 }
832}
833
834/// Implements a client for the Dialogflow API.
835///
836/// # Example
837/// ```
838/// # use google_cloud_dialogflow_v2::client::Contexts;
839/// use google_cloud_gax::paginator::ItemPaginator as _;
840/// # async fn sample() -> Result<(), Box<dyn std::error::Error>> {
841/// let client = Contexts::builder().build().await?;
842/// let parent = "parent_value";
843/// let mut list = client.list_contexts()
844/// .set_parent(parent)
845/// .by_item();
846/// while let Some(item) = list.next().await.transpose()? {
847/// println!("{:?}", item);
848/// }
849/// # Ok(()) }
850/// ```
851///
852/// # Service Description
853///
854/// Service for managing [Contexts][google.cloud.dialogflow.v2.Context].
855///
856/// [google.cloud.dialogflow.v2.Context]: crate::model::Context
857///
858/// # Configuration
859///
860/// To configure `Contexts` use the `with_*` methods in the type returned
861/// by [builder()][Contexts::builder]. The default configuration should
862/// work for most applications. Common configuration changes include
863///
864/// * [with_endpoint()]: by default this client uses the global default endpoint
865/// (`https://dialogflow.googleapis.com`). Applications using regional
866/// endpoints or running in restricted networks (e.g. a network configured
867// with [Private Google Access with VPC Service Controls]) may want to
868/// override this default.
869/// * [with_credentials()]: by default this client uses
870/// [Application Default Credentials]. Applications using custom
871/// authentication may need to override this default.
872///
873/// [with_endpoint()]: super::builder::contexts::ClientBuilder::with_endpoint
874/// [with_credentials()]: super::builder::contexts::ClientBuilder::with_credentials
875/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
876/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
877///
878/// # Pooling and Cloning
879///
880/// `Contexts` holds a connection pool internally, it is advised to
881/// create one and reuse it. You do not need to wrap `Contexts` in
882/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
883/// already uses an `Arc` internally.
884#[cfg(feature = "contexts")]
885#[cfg_attr(docsrs, doc(cfg(feature = "contexts")))]
886#[derive(Clone, Debug)]
887pub struct Contexts {
888 inner: std::sync::Arc<dyn super::stub::dynamic::Contexts>,
889}
890
891#[cfg(feature = "contexts")]
892impl Contexts {
893 /// Returns a builder for [Contexts].
894 ///
895 /// ```
896 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
897 /// # use google_cloud_dialogflow_v2::client::Contexts;
898 /// let client = Contexts::builder().build().await?;
899 /// # Ok(()) }
900 /// ```
901 pub fn builder() -> super::builder::contexts::ClientBuilder {
902 crate::new_client_builder(super::builder::contexts::client::Factory)
903 }
904
905 /// Creates a new client from the provided stub.
906 ///
907 /// The most common case for calling this function is in tests mocking the
908 /// client's behavior.
909 pub fn from_stub<T>(stub: T) -> Self
910 where
911 T: super::stub::Contexts + 'static,
912 {
913 Self {
914 inner: std::sync::Arc::new(stub),
915 }
916 }
917
918 pub(crate) async fn new(
919 config: gaxi::options::ClientConfig,
920 ) -> crate::ClientBuilderResult<Self> {
921 let inner = Self::build_inner(config).await?;
922 Ok(Self { inner })
923 }
924
925 async fn build_inner(
926 conf: gaxi::options::ClientConfig,
927 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::Contexts>> {
928 if gaxi::options::tracing_enabled(&conf) {
929 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
930 }
931 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
932 }
933
934 async fn build_transport(
935 conf: gaxi::options::ClientConfig,
936 ) -> crate::ClientBuilderResult<impl super::stub::Contexts> {
937 super::transport::Contexts::new(conf).await
938 }
939
940 async fn build_with_tracing(
941 conf: gaxi::options::ClientConfig,
942 ) -> crate::ClientBuilderResult<impl super::stub::Contexts> {
943 Self::build_transport(conf)
944 .await
945 .map(super::tracing::Contexts::new)
946 }
947
948 /// Returns the list of all contexts in the specified session.
949 ///
950 /// # Example
951 /// ```
952 /// # use google_cloud_dialogflow_v2::client::Contexts;
953 /// use google_cloud_gax::paginator::ItemPaginator as _;
954 /// use google_cloud_dialogflow_v2::Result;
955 /// async fn sample(
956 /// client: &Contexts, parent: &str
957 /// ) -> Result<()> {
958 /// let mut list = client.list_contexts()
959 /// .set_parent(parent)
960 /// .by_item();
961 /// while let Some(item) = list.next().await.transpose()? {
962 /// println!("{:?}", item);
963 /// }
964 /// Ok(())
965 /// }
966 /// ```
967 pub fn list_contexts(&self) -> super::builder::contexts::ListContexts {
968 super::builder::contexts::ListContexts::new(self.inner.clone())
969 }
970
971 /// Retrieves the specified context.
972 ///
973 /// # Example
974 /// ```
975 /// # use google_cloud_dialogflow_v2::client::Contexts;
976 /// use google_cloud_dialogflow_v2::Result;
977 /// async fn sample(
978 /// client: &Contexts, name: &str
979 /// ) -> Result<()> {
980 /// let response = client.get_context()
981 /// .set_name(name)
982 /// .send().await?;
983 /// println!("response {:?}", response);
984 /// Ok(())
985 /// }
986 /// ```
987 pub fn get_context(&self) -> super::builder::contexts::GetContext {
988 super::builder::contexts::GetContext::new(self.inner.clone())
989 }
990
991 /// Creates a context.
992 ///
993 /// If the specified context already exists, overrides the context.
994 ///
995 /// # Example
996 /// ```
997 /// # use google_cloud_dialogflow_v2::client::Contexts;
998 /// use google_cloud_dialogflow_v2::model::Context;
999 /// use google_cloud_dialogflow_v2::Result;
1000 /// async fn sample(
1001 /// client: &Contexts, parent: &str
1002 /// ) -> Result<()> {
1003 /// let response = client.create_context()
1004 /// .set_parent(parent)
1005 /// .set_context(
1006 /// Context::new()/* set fields */
1007 /// )
1008 /// .send().await?;
1009 /// println!("response {:?}", response);
1010 /// Ok(())
1011 /// }
1012 /// ```
1013 pub fn create_context(&self) -> super::builder::contexts::CreateContext {
1014 super::builder::contexts::CreateContext::new(self.inner.clone())
1015 }
1016
1017 /// Updates the specified context.
1018 ///
1019 /// # Example
1020 /// ```
1021 /// # use google_cloud_dialogflow_v2::client::Contexts;
1022 /// # extern crate wkt as google_cloud_wkt;
1023 /// use google_cloud_wkt::FieldMask;
1024 /// use google_cloud_dialogflow_v2::model::Context;
1025 /// use google_cloud_dialogflow_v2::Result;
1026 /// async fn sample(
1027 /// client: &Contexts, name: &str
1028 /// ) -> Result<()> {
1029 /// let response = client.update_context()
1030 /// .set_context(
1031 /// Context::new().set_name(name)/* set fields */
1032 /// )
1033 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
1034 /// .send().await?;
1035 /// println!("response {:?}", response);
1036 /// Ok(())
1037 /// }
1038 /// ```
1039 pub fn update_context(&self) -> super::builder::contexts::UpdateContext {
1040 super::builder::contexts::UpdateContext::new(self.inner.clone())
1041 }
1042
1043 /// Deletes the specified context.
1044 ///
1045 /// # Example
1046 /// ```
1047 /// # use google_cloud_dialogflow_v2::client::Contexts;
1048 /// use google_cloud_dialogflow_v2::Result;
1049 /// async fn sample(
1050 /// client: &Contexts, name: &str
1051 /// ) -> Result<()> {
1052 /// client.delete_context()
1053 /// .set_name(name)
1054 /// .send().await?;
1055 /// Ok(())
1056 /// }
1057 /// ```
1058 pub fn delete_context(&self) -> super::builder::contexts::DeleteContext {
1059 super::builder::contexts::DeleteContext::new(self.inner.clone())
1060 }
1061
1062 /// Deletes all active contexts in the specified session.
1063 ///
1064 /// # Example
1065 /// ```
1066 /// # use google_cloud_dialogflow_v2::client::Contexts;
1067 /// use google_cloud_dialogflow_v2::Result;
1068 /// async fn sample(
1069 /// client: &Contexts
1070 /// ) -> Result<()> {
1071 /// client.delete_all_contexts()
1072 /// /* set fields */
1073 /// .send().await?;
1074 /// Ok(())
1075 /// }
1076 /// ```
1077 pub fn delete_all_contexts(&self) -> super::builder::contexts::DeleteAllContexts {
1078 super::builder::contexts::DeleteAllContexts::new(self.inner.clone())
1079 }
1080
1081 /// Lists information about the supported locations for this service.
1082 ///
1083 /// # Example
1084 /// ```
1085 /// # use google_cloud_dialogflow_v2::client::Contexts;
1086 /// use google_cloud_gax::paginator::ItemPaginator as _;
1087 /// use google_cloud_dialogflow_v2::Result;
1088 /// async fn sample(
1089 /// client: &Contexts
1090 /// ) -> Result<()> {
1091 /// let mut list = client.list_locations()
1092 /// /* set fields */
1093 /// .by_item();
1094 /// while let Some(item) = list.next().await.transpose()? {
1095 /// println!("{:?}", item);
1096 /// }
1097 /// Ok(())
1098 /// }
1099 /// ```
1100 pub fn list_locations(&self) -> super::builder::contexts::ListLocations {
1101 super::builder::contexts::ListLocations::new(self.inner.clone())
1102 }
1103
1104 /// Gets information about a location.
1105 ///
1106 /// # Example
1107 /// ```
1108 /// # use google_cloud_dialogflow_v2::client::Contexts;
1109 /// use google_cloud_dialogflow_v2::Result;
1110 /// async fn sample(
1111 /// client: &Contexts
1112 /// ) -> Result<()> {
1113 /// let response = client.get_location()
1114 /// /* set fields */
1115 /// .send().await?;
1116 /// println!("response {:?}", response);
1117 /// Ok(())
1118 /// }
1119 /// ```
1120 pub fn get_location(&self) -> super::builder::contexts::GetLocation {
1121 super::builder::contexts::GetLocation::new(self.inner.clone())
1122 }
1123
1124 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1125 ///
1126 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1127 ///
1128 /// # Example
1129 /// ```
1130 /// # use google_cloud_dialogflow_v2::client::Contexts;
1131 /// use google_cloud_gax::paginator::ItemPaginator as _;
1132 /// use google_cloud_dialogflow_v2::Result;
1133 /// async fn sample(
1134 /// client: &Contexts
1135 /// ) -> Result<()> {
1136 /// let mut list = client.list_operations()
1137 /// /* set fields */
1138 /// .by_item();
1139 /// while let Some(item) = list.next().await.transpose()? {
1140 /// println!("{:?}", item);
1141 /// }
1142 /// Ok(())
1143 /// }
1144 /// ```
1145 pub fn list_operations(&self) -> super::builder::contexts::ListOperations {
1146 super::builder::contexts::ListOperations::new(self.inner.clone())
1147 }
1148
1149 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1150 ///
1151 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1152 ///
1153 /// # Example
1154 /// ```
1155 /// # use google_cloud_dialogflow_v2::client::Contexts;
1156 /// use google_cloud_dialogflow_v2::Result;
1157 /// async fn sample(
1158 /// client: &Contexts
1159 /// ) -> Result<()> {
1160 /// let response = client.get_operation()
1161 /// /* set fields */
1162 /// .send().await?;
1163 /// println!("response {:?}", response);
1164 /// Ok(())
1165 /// }
1166 /// ```
1167 pub fn get_operation(&self) -> super::builder::contexts::GetOperation {
1168 super::builder::contexts::GetOperation::new(self.inner.clone())
1169 }
1170
1171 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1172 ///
1173 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1174 ///
1175 /// # Example
1176 /// ```
1177 /// # use google_cloud_dialogflow_v2::client::Contexts;
1178 /// use google_cloud_dialogflow_v2::Result;
1179 /// async fn sample(
1180 /// client: &Contexts
1181 /// ) -> Result<()> {
1182 /// client.cancel_operation()
1183 /// /* set fields */
1184 /// .send().await?;
1185 /// Ok(())
1186 /// }
1187 /// ```
1188 pub fn cancel_operation(&self) -> super::builder::contexts::CancelOperation {
1189 super::builder::contexts::CancelOperation::new(self.inner.clone())
1190 }
1191}
1192
1193/// Implements a client for the Dialogflow API.
1194///
1195/// # Example
1196/// ```
1197/// # use google_cloud_dialogflow_v2::client::Conversations;
1198/// use google_cloud_gax::paginator::ItemPaginator as _;
1199/// # async fn sample() -> Result<(), Box<dyn std::error::Error>> {
1200/// let client = Conversations::builder().build().await?;
1201/// let parent = "parent_value";
1202/// let mut list = client.list_conversations()
1203/// .set_parent(parent)
1204/// .by_item();
1205/// while let Some(item) = list.next().await.transpose()? {
1206/// println!("{:?}", item);
1207/// }
1208/// # Ok(()) }
1209/// ```
1210///
1211/// # Service Description
1212///
1213/// Service for managing
1214/// [Conversations][google.cloud.dialogflow.v2.Conversation].
1215///
1216/// [google.cloud.dialogflow.v2.Conversation]: crate::model::Conversation
1217///
1218/// # Configuration
1219///
1220/// To configure `Conversations` use the `with_*` methods in the type returned
1221/// by [builder()][Conversations::builder]. The default configuration should
1222/// work for most applications. Common configuration changes include
1223///
1224/// * [with_endpoint()]: by default this client uses the global default endpoint
1225/// (`https://dialogflow.googleapis.com`). Applications using regional
1226/// endpoints or running in restricted networks (e.g. a network configured
1227// with [Private Google Access with VPC Service Controls]) may want to
1228/// override this default.
1229/// * [with_credentials()]: by default this client uses
1230/// [Application Default Credentials]. Applications using custom
1231/// authentication may need to override this default.
1232///
1233/// [with_endpoint()]: super::builder::conversations::ClientBuilder::with_endpoint
1234/// [with_credentials()]: super::builder::conversations::ClientBuilder::with_credentials
1235/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
1236/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
1237///
1238/// # Pooling and Cloning
1239///
1240/// `Conversations` holds a connection pool internally, it is advised to
1241/// create one and reuse it. You do not need to wrap `Conversations` in
1242/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
1243/// already uses an `Arc` internally.
1244#[cfg(feature = "conversations")]
1245#[cfg_attr(docsrs, doc(cfg(feature = "conversations")))]
1246#[derive(Clone, Debug)]
1247pub struct Conversations {
1248 inner: std::sync::Arc<dyn super::stub::dynamic::Conversations>,
1249}
1250
1251#[cfg(feature = "conversations")]
1252impl Conversations {
1253 /// Returns a builder for [Conversations].
1254 ///
1255 /// ```
1256 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
1257 /// # use google_cloud_dialogflow_v2::client::Conversations;
1258 /// let client = Conversations::builder().build().await?;
1259 /// # Ok(()) }
1260 /// ```
1261 pub fn builder() -> super::builder::conversations::ClientBuilder {
1262 crate::new_client_builder(super::builder::conversations::client::Factory)
1263 }
1264
1265 /// Creates a new client from the provided stub.
1266 ///
1267 /// The most common case for calling this function is in tests mocking the
1268 /// client's behavior.
1269 pub fn from_stub<T>(stub: T) -> Self
1270 where
1271 T: super::stub::Conversations + 'static,
1272 {
1273 Self {
1274 inner: std::sync::Arc::new(stub),
1275 }
1276 }
1277
1278 pub(crate) async fn new(
1279 config: gaxi::options::ClientConfig,
1280 ) -> crate::ClientBuilderResult<Self> {
1281 let inner = Self::build_inner(config).await?;
1282 Ok(Self { inner })
1283 }
1284
1285 async fn build_inner(
1286 conf: gaxi::options::ClientConfig,
1287 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::Conversations>> {
1288 if gaxi::options::tracing_enabled(&conf) {
1289 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
1290 }
1291 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
1292 }
1293
1294 async fn build_transport(
1295 conf: gaxi::options::ClientConfig,
1296 ) -> crate::ClientBuilderResult<impl super::stub::Conversations> {
1297 super::transport::Conversations::new(conf).await
1298 }
1299
1300 async fn build_with_tracing(
1301 conf: gaxi::options::ClientConfig,
1302 ) -> crate::ClientBuilderResult<impl super::stub::Conversations> {
1303 Self::build_transport(conf)
1304 .await
1305 .map(super::tracing::Conversations::new)
1306 }
1307
1308 /// Creates a new conversation. Conversations are auto-completed after 24
1309 /// hours.
1310 ///
1311 /// Conversation Lifecycle:
1312 /// There are two stages during a conversation: Automated Agent Stage and
1313 /// Assist Stage.
1314 ///
1315 /// For Automated Agent Stage, there will be a dialogflow agent responding to
1316 /// user queries.
1317 ///
1318 /// For Assist Stage, there's no dialogflow agent responding to user queries.
1319 /// But we will provide suggestions which are generated from conversation.
1320 ///
1321 /// If
1322 /// [Conversation.conversation_profile][google.cloud.dialogflow.v2.Conversation.conversation_profile]
1323 /// is configured for a dialogflow agent, conversation will start from
1324 /// `Automated Agent Stage`, otherwise, it will start from `Assist Stage`. And
1325 /// during `Automated Agent Stage`, once an
1326 /// [Intent][google.cloud.dialogflow.v2.Intent] with
1327 /// [Intent.live_agent_handoff][google.cloud.dialogflow.v2.Intent.live_agent_handoff]
1328 /// is triggered, conversation will transfer to Assist Stage.
1329 ///
1330 /// [google.cloud.dialogflow.v2.Conversation.conversation_profile]: crate::model::Conversation::conversation_profile
1331 /// [google.cloud.dialogflow.v2.Intent]: crate::model::Intent
1332 /// [google.cloud.dialogflow.v2.Intent.live_agent_handoff]: crate::model::Intent::live_agent_handoff
1333 ///
1334 /// # Example
1335 /// ```
1336 /// # use google_cloud_dialogflow_v2::client::Conversations;
1337 /// use google_cloud_dialogflow_v2::model::Conversation;
1338 /// use google_cloud_dialogflow_v2::Result;
1339 /// async fn sample(
1340 /// client: &Conversations, parent: &str
1341 /// ) -> Result<()> {
1342 /// let response = client.create_conversation()
1343 /// .set_parent(parent)
1344 /// .set_conversation_id("conversation_id_value")
1345 /// .set_conversation(
1346 /// Conversation::new()/* set fields */
1347 /// )
1348 /// .send().await?;
1349 /// println!("response {:?}", response);
1350 /// Ok(())
1351 /// }
1352 /// ```
1353 pub fn create_conversation(&self) -> super::builder::conversations::CreateConversation {
1354 super::builder::conversations::CreateConversation::new(self.inner.clone())
1355 }
1356
1357 /// Returns the list of all conversations in the specified project.
1358 ///
1359 /// # Example
1360 /// ```
1361 /// # use google_cloud_dialogflow_v2::client::Conversations;
1362 /// use google_cloud_gax::paginator::ItemPaginator as _;
1363 /// use google_cloud_dialogflow_v2::Result;
1364 /// async fn sample(
1365 /// client: &Conversations, parent: &str
1366 /// ) -> Result<()> {
1367 /// let mut list = client.list_conversations()
1368 /// .set_parent(parent)
1369 /// .by_item();
1370 /// while let Some(item) = list.next().await.transpose()? {
1371 /// println!("{:?}", item);
1372 /// }
1373 /// Ok(())
1374 /// }
1375 /// ```
1376 pub fn list_conversations(&self) -> super::builder::conversations::ListConversations {
1377 super::builder::conversations::ListConversations::new(self.inner.clone())
1378 }
1379
1380 /// Retrieves the specific conversation.
1381 ///
1382 /// # Example
1383 /// ```
1384 /// # use google_cloud_dialogflow_v2::client::Conversations;
1385 /// use google_cloud_dialogflow_v2::Result;
1386 /// async fn sample(
1387 /// client: &Conversations, name: &str
1388 /// ) -> Result<()> {
1389 /// let response = client.get_conversation()
1390 /// .set_name(name)
1391 /// .send().await?;
1392 /// println!("response {:?}", response);
1393 /// Ok(())
1394 /// }
1395 /// ```
1396 pub fn get_conversation(&self) -> super::builder::conversations::GetConversation {
1397 super::builder::conversations::GetConversation::new(self.inner.clone())
1398 }
1399
1400 /// Completes the specified conversation. Finished conversations are purged
1401 /// from the database after 30 days.
1402 ///
1403 /// # Example
1404 /// ```
1405 /// # use google_cloud_dialogflow_v2::client::Conversations;
1406 /// use google_cloud_dialogflow_v2::Result;
1407 /// async fn sample(
1408 /// client: &Conversations
1409 /// ) -> Result<()> {
1410 /// let response = client.complete_conversation()
1411 /// /* set fields */
1412 /// .send().await?;
1413 /// println!("response {:?}", response);
1414 /// Ok(())
1415 /// }
1416 /// ```
1417 pub fn complete_conversation(&self) -> super::builder::conversations::CompleteConversation {
1418 super::builder::conversations::CompleteConversation::new(self.inner.clone())
1419 }
1420
1421 /// Data ingestion API.
1422 /// Ingests context references for an existing conversation.
1423 ///
1424 /// # Example
1425 /// ```
1426 /// # use google_cloud_dialogflow_v2::client::Conversations;
1427 /// use google_cloud_dialogflow_v2::Result;
1428 /// async fn sample(
1429 /// client: &Conversations
1430 /// ) -> Result<()> {
1431 /// let response = client.ingest_context_references()
1432 /// /* set fields */
1433 /// .send().await?;
1434 /// println!("response {:?}", response);
1435 /// Ok(())
1436 /// }
1437 /// ```
1438 pub fn ingest_context_references(
1439 &self,
1440 ) -> super::builder::conversations::IngestContextReferences {
1441 super::builder::conversations::IngestContextReferences::new(self.inner.clone())
1442 }
1443
1444 /// Lists messages that belong to a given conversation.
1445 /// `messages` are ordered by `create_time` in descending order. To fetch
1446 /// updates without duplication, send request with filter
1447 /// `create_time_epoch_microseconds >
1448 /// [first item's create_time of previous request]` and empty page_token.
1449 ///
1450 /// # Example
1451 /// ```
1452 /// # use google_cloud_dialogflow_v2::client::Conversations;
1453 /// use google_cloud_gax::paginator::ItemPaginator as _;
1454 /// use google_cloud_dialogflow_v2::Result;
1455 /// async fn sample(
1456 /// client: &Conversations, parent: &str
1457 /// ) -> Result<()> {
1458 /// let mut list = client.list_messages()
1459 /// .set_parent(parent)
1460 /// .by_item();
1461 /// while let Some(item) = list.next().await.transpose()? {
1462 /// println!("{:?}", item);
1463 /// }
1464 /// Ok(())
1465 /// }
1466 /// ```
1467 pub fn list_messages(&self) -> super::builder::conversations::ListMessages {
1468 super::builder::conversations::ListMessages::new(self.inner.clone())
1469 }
1470
1471 /// Suggests summary for a conversation based on specific historical messages.
1472 /// The range of the messages to be used for summary can be specified in the
1473 /// request.
1474 ///
1475 /// # Example
1476 /// ```
1477 /// # use google_cloud_dialogflow_v2::client::Conversations;
1478 /// use google_cloud_dialogflow_v2::Result;
1479 /// async fn sample(
1480 /// client: &Conversations
1481 /// ) -> Result<()> {
1482 /// let response = client.suggest_conversation_summary()
1483 /// /* set fields */
1484 /// .send().await?;
1485 /// println!("response {:?}", response);
1486 /// Ok(())
1487 /// }
1488 /// ```
1489 pub fn suggest_conversation_summary(
1490 &self,
1491 ) -> super::builder::conversations::SuggestConversationSummary {
1492 super::builder::conversations::SuggestConversationSummary::new(self.inner.clone())
1493 }
1494
1495 /// Generates and returns a summary for a conversation that does not have a
1496 /// resource created for it.
1497 ///
1498 /// # Example
1499 /// ```
1500 /// # use google_cloud_dialogflow_v2::client::Conversations;
1501 /// use google_cloud_dialogflow_v2::Result;
1502 /// async fn sample(
1503 /// client: &Conversations
1504 /// ) -> Result<()> {
1505 /// let response = client.generate_stateless_summary()
1506 /// /* set fields */
1507 /// .send().await?;
1508 /// println!("response {:?}", response);
1509 /// Ok(())
1510 /// }
1511 /// ```
1512 pub fn generate_stateless_summary(
1513 &self,
1514 ) -> super::builder::conversations::GenerateStatelessSummary {
1515 super::builder::conversations::GenerateStatelessSummary::new(self.inner.clone())
1516 }
1517
1518 /// Generates and returns a suggestion for a conversation that does not have a
1519 /// resource created for it.
1520 ///
1521 /// # Example
1522 /// ```
1523 /// # use google_cloud_dialogflow_v2::client::Conversations;
1524 /// use google_cloud_dialogflow_v2::Result;
1525 /// async fn sample(
1526 /// client: &Conversations
1527 /// ) -> Result<()> {
1528 /// let response = client.generate_stateless_suggestion()
1529 /// /* set fields */
1530 /// .send().await?;
1531 /// println!("response {:?}", response);
1532 /// Ok(())
1533 /// }
1534 /// ```
1535 pub fn generate_stateless_suggestion(
1536 &self,
1537 ) -> super::builder::conversations::GenerateStatelessSuggestion {
1538 super::builder::conversations::GenerateStatelessSuggestion::new(self.inner.clone())
1539 }
1540
1541 /// Get answers for the given query based on knowledge documents.
1542 ///
1543 /// # Example
1544 /// ```
1545 /// # use google_cloud_dialogflow_v2::client::Conversations;
1546 /// use google_cloud_dialogflow_v2::Result;
1547 /// async fn sample(
1548 /// client: &Conversations
1549 /// ) -> Result<()> {
1550 /// let response = client.search_knowledge()
1551 /// /* set fields */
1552 /// .send().await?;
1553 /// println!("response {:?}", response);
1554 /// Ok(())
1555 /// }
1556 /// ```
1557 pub fn search_knowledge(&self) -> super::builder::conversations::SearchKnowledge {
1558 super::builder::conversations::SearchKnowledge::new(self.inner.clone())
1559 }
1560
1561 /// Generates all the suggestions using generators configured in the
1562 /// conversation profile. A generator is used only if its trigger event is
1563 /// matched.
1564 ///
1565 /// # Example
1566 /// ```
1567 /// # use google_cloud_dialogflow_v2::client::Conversations;
1568 /// use google_cloud_dialogflow_v2::Result;
1569 /// async fn sample(
1570 /// client: &Conversations
1571 /// ) -> Result<()> {
1572 /// let response = client.generate_suggestions()
1573 /// /* set fields */
1574 /// .send().await?;
1575 /// println!("response {:?}", response);
1576 /// Ok(())
1577 /// }
1578 /// ```
1579 pub fn generate_suggestions(&self) -> super::builder::conversations::GenerateSuggestions {
1580 super::builder::conversations::GenerateSuggestions::new(self.inner.clone())
1581 }
1582
1583 /// Lists information about the supported locations for this service.
1584 ///
1585 /// # Example
1586 /// ```
1587 /// # use google_cloud_dialogflow_v2::client::Conversations;
1588 /// use google_cloud_gax::paginator::ItemPaginator as _;
1589 /// use google_cloud_dialogflow_v2::Result;
1590 /// async fn sample(
1591 /// client: &Conversations
1592 /// ) -> Result<()> {
1593 /// let mut list = client.list_locations()
1594 /// /* set fields */
1595 /// .by_item();
1596 /// while let Some(item) = list.next().await.transpose()? {
1597 /// println!("{:?}", item);
1598 /// }
1599 /// Ok(())
1600 /// }
1601 /// ```
1602 pub fn list_locations(&self) -> super::builder::conversations::ListLocations {
1603 super::builder::conversations::ListLocations::new(self.inner.clone())
1604 }
1605
1606 /// Gets information about a location.
1607 ///
1608 /// # Example
1609 /// ```
1610 /// # use google_cloud_dialogflow_v2::client::Conversations;
1611 /// use google_cloud_dialogflow_v2::Result;
1612 /// async fn sample(
1613 /// client: &Conversations
1614 /// ) -> Result<()> {
1615 /// let response = client.get_location()
1616 /// /* set fields */
1617 /// .send().await?;
1618 /// println!("response {:?}", response);
1619 /// Ok(())
1620 /// }
1621 /// ```
1622 pub fn get_location(&self) -> super::builder::conversations::GetLocation {
1623 super::builder::conversations::GetLocation::new(self.inner.clone())
1624 }
1625
1626 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1627 ///
1628 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1629 ///
1630 /// # Example
1631 /// ```
1632 /// # use google_cloud_dialogflow_v2::client::Conversations;
1633 /// use google_cloud_gax::paginator::ItemPaginator as _;
1634 /// use google_cloud_dialogflow_v2::Result;
1635 /// async fn sample(
1636 /// client: &Conversations
1637 /// ) -> Result<()> {
1638 /// let mut list = client.list_operations()
1639 /// /* set fields */
1640 /// .by_item();
1641 /// while let Some(item) = list.next().await.transpose()? {
1642 /// println!("{:?}", item);
1643 /// }
1644 /// Ok(())
1645 /// }
1646 /// ```
1647 pub fn list_operations(&self) -> super::builder::conversations::ListOperations {
1648 super::builder::conversations::ListOperations::new(self.inner.clone())
1649 }
1650
1651 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1652 ///
1653 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1654 ///
1655 /// # Example
1656 /// ```
1657 /// # use google_cloud_dialogflow_v2::client::Conversations;
1658 /// use google_cloud_dialogflow_v2::Result;
1659 /// async fn sample(
1660 /// client: &Conversations
1661 /// ) -> Result<()> {
1662 /// let response = client.get_operation()
1663 /// /* set fields */
1664 /// .send().await?;
1665 /// println!("response {:?}", response);
1666 /// Ok(())
1667 /// }
1668 /// ```
1669 pub fn get_operation(&self) -> super::builder::conversations::GetOperation {
1670 super::builder::conversations::GetOperation::new(self.inner.clone())
1671 }
1672
1673 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1674 ///
1675 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1676 ///
1677 /// # Example
1678 /// ```
1679 /// # use google_cloud_dialogflow_v2::client::Conversations;
1680 /// use google_cloud_dialogflow_v2::Result;
1681 /// async fn sample(
1682 /// client: &Conversations
1683 /// ) -> Result<()> {
1684 /// client.cancel_operation()
1685 /// /* set fields */
1686 /// .send().await?;
1687 /// Ok(())
1688 /// }
1689 /// ```
1690 pub fn cancel_operation(&self) -> super::builder::conversations::CancelOperation {
1691 super::builder::conversations::CancelOperation::new(self.inner.clone())
1692 }
1693}
1694
1695/// Implements a client for the Dialogflow API.
1696///
1697/// # Example
1698/// ```
1699/// # use google_cloud_dialogflow_v2::client::ConversationDatasets;
1700/// use google_cloud_gax::paginator::ItemPaginator as _;
1701/// # async fn sample() -> Result<(), Box<dyn std::error::Error>> {
1702/// let client = ConversationDatasets::builder().build().await?;
1703/// let parent = "parent_value";
1704/// let mut list = client.list_conversation_datasets()
1705/// .set_parent(parent)
1706/// .by_item();
1707/// while let Some(item) = list.next().await.transpose()? {
1708/// println!("{:?}", item);
1709/// }
1710/// # Ok(()) }
1711/// ```
1712///
1713/// # Service Description
1714///
1715/// Conversation datasets.
1716///
1717/// Conversation datasets contain raw conversation files and their
1718/// customizable metadata that can be used for model training.
1719///
1720/// # Configuration
1721///
1722/// To configure `ConversationDatasets` use the `with_*` methods in the type returned
1723/// by [builder()][ConversationDatasets::builder]. The default configuration should
1724/// work for most applications. Common configuration changes include
1725///
1726/// * [with_endpoint()]: by default this client uses the global default endpoint
1727/// (`https://dialogflow.googleapis.com`). Applications using regional
1728/// endpoints or running in restricted networks (e.g. a network configured
1729// with [Private Google Access with VPC Service Controls]) may want to
1730/// override this default.
1731/// * [with_credentials()]: by default this client uses
1732/// [Application Default Credentials]. Applications using custom
1733/// authentication may need to override this default.
1734///
1735/// [with_endpoint()]: super::builder::conversation_datasets::ClientBuilder::with_endpoint
1736/// [with_credentials()]: super::builder::conversation_datasets::ClientBuilder::with_credentials
1737/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
1738/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
1739///
1740/// # Pooling and Cloning
1741///
1742/// `ConversationDatasets` holds a connection pool internally, it is advised to
1743/// create one and reuse it. You do not need to wrap `ConversationDatasets` in
1744/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
1745/// already uses an `Arc` internally.
1746#[cfg(feature = "conversation-datasets")]
1747#[cfg_attr(docsrs, doc(cfg(feature = "conversation-datasets")))]
1748#[derive(Clone, Debug)]
1749pub struct ConversationDatasets {
1750 inner: std::sync::Arc<dyn super::stub::dynamic::ConversationDatasets>,
1751}
1752
1753#[cfg(feature = "conversation-datasets")]
1754impl ConversationDatasets {
1755 /// Returns a builder for [ConversationDatasets].
1756 ///
1757 /// ```
1758 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
1759 /// # use google_cloud_dialogflow_v2::client::ConversationDatasets;
1760 /// let client = ConversationDatasets::builder().build().await?;
1761 /// # Ok(()) }
1762 /// ```
1763 pub fn builder() -> super::builder::conversation_datasets::ClientBuilder {
1764 crate::new_client_builder(super::builder::conversation_datasets::client::Factory)
1765 }
1766
1767 /// Creates a new client from the provided stub.
1768 ///
1769 /// The most common case for calling this function is in tests mocking the
1770 /// client's behavior.
1771 pub fn from_stub<T>(stub: T) -> Self
1772 where
1773 T: super::stub::ConversationDatasets + 'static,
1774 {
1775 Self {
1776 inner: std::sync::Arc::new(stub),
1777 }
1778 }
1779
1780 pub(crate) async fn new(
1781 config: gaxi::options::ClientConfig,
1782 ) -> crate::ClientBuilderResult<Self> {
1783 let inner = Self::build_inner(config).await?;
1784 Ok(Self { inner })
1785 }
1786
1787 async fn build_inner(
1788 conf: gaxi::options::ClientConfig,
1789 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::ConversationDatasets>>
1790 {
1791 if gaxi::options::tracing_enabled(&conf) {
1792 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
1793 }
1794 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
1795 }
1796
1797 async fn build_transport(
1798 conf: gaxi::options::ClientConfig,
1799 ) -> crate::ClientBuilderResult<impl super::stub::ConversationDatasets> {
1800 super::transport::ConversationDatasets::new(conf).await
1801 }
1802
1803 async fn build_with_tracing(
1804 conf: gaxi::options::ClientConfig,
1805 ) -> crate::ClientBuilderResult<impl super::stub::ConversationDatasets> {
1806 Self::build_transport(conf)
1807 .await
1808 .map(super::tracing::ConversationDatasets::new)
1809 }
1810
1811 /// Creates a new conversation dataset.
1812 ///
1813 /// This method is a [long-running
1814 /// operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations).
1815 /// The returned `Operation` type has the following method-specific fields:
1816 ///
1817 /// - `metadata`:
1818 /// [CreateConversationDatasetOperationMetadata][google.cloud.dialogflow.v2.CreateConversationDatasetOperationMetadata]
1819 /// - `response`:
1820 /// [ConversationDataset][google.cloud.dialogflow.v2.ConversationDataset]
1821 ///
1822 /// [google.cloud.dialogflow.v2.ConversationDataset]: crate::model::ConversationDataset
1823 /// [google.cloud.dialogflow.v2.CreateConversationDatasetOperationMetadata]: crate::model::CreateConversationDatasetOperationMetadata
1824 ///
1825 /// # Long running operations
1826 ///
1827 /// This method is used to start, and/or poll a [long-running Operation].
1828 /// The [Working with long-running operations] chapter in the [user guide]
1829 /// covers these operations in detail.
1830 ///
1831 /// [long-running operation]: https://google.aip.dev/151
1832 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1833 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1834 ///
1835 /// # Example
1836 /// ```
1837 /// # use google_cloud_dialogflow_v2::client::ConversationDatasets;
1838 /// use google_cloud_lro::Poller;
1839 /// use google_cloud_dialogflow_v2::model::ConversationDataset;
1840 /// use google_cloud_dialogflow_v2::Result;
1841 /// async fn sample(
1842 /// client: &ConversationDatasets, parent: &str
1843 /// ) -> Result<()> {
1844 /// let response = client.create_conversation_dataset()
1845 /// .set_parent(parent)
1846 /// .set_conversation_dataset(
1847 /// ConversationDataset::new()/* set fields */
1848 /// )
1849 /// .poller().until_done().await?;
1850 /// println!("response {:?}", response);
1851 /// Ok(())
1852 /// }
1853 /// ```
1854 pub fn create_conversation_dataset(
1855 &self,
1856 ) -> super::builder::conversation_datasets::CreateConversationDataset {
1857 super::builder::conversation_datasets::CreateConversationDataset::new(self.inner.clone())
1858 }
1859
1860 /// Retrieves the specified conversation dataset.
1861 ///
1862 /// # Example
1863 /// ```
1864 /// # use google_cloud_dialogflow_v2::client::ConversationDatasets;
1865 /// use google_cloud_dialogflow_v2::Result;
1866 /// async fn sample(
1867 /// client: &ConversationDatasets, name: &str
1868 /// ) -> Result<()> {
1869 /// let response = client.get_conversation_dataset()
1870 /// .set_name(name)
1871 /// .send().await?;
1872 /// println!("response {:?}", response);
1873 /// Ok(())
1874 /// }
1875 /// ```
1876 pub fn get_conversation_dataset(
1877 &self,
1878 ) -> super::builder::conversation_datasets::GetConversationDataset {
1879 super::builder::conversation_datasets::GetConversationDataset::new(self.inner.clone())
1880 }
1881
1882 /// Returns the list of all conversation datasets in the specified
1883 /// project and location.
1884 ///
1885 /// # Example
1886 /// ```
1887 /// # use google_cloud_dialogflow_v2::client::ConversationDatasets;
1888 /// use google_cloud_gax::paginator::ItemPaginator as _;
1889 /// use google_cloud_dialogflow_v2::Result;
1890 /// async fn sample(
1891 /// client: &ConversationDatasets, parent: &str
1892 /// ) -> Result<()> {
1893 /// let mut list = client.list_conversation_datasets()
1894 /// .set_parent(parent)
1895 /// .by_item();
1896 /// while let Some(item) = list.next().await.transpose()? {
1897 /// println!("{:?}", item);
1898 /// }
1899 /// Ok(())
1900 /// }
1901 /// ```
1902 pub fn list_conversation_datasets(
1903 &self,
1904 ) -> super::builder::conversation_datasets::ListConversationDatasets {
1905 super::builder::conversation_datasets::ListConversationDatasets::new(self.inner.clone())
1906 }
1907
1908 /// Deletes the specified conversation dataset.
1909 ///
1910 /// This method is a [long-running
1911 /// operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations).
1912 /// The returned `Operation` type has the following method-specific fields:
1913 ///
1914 /// - `metadata`:
1915 /// [DeleteConversationDatasetOperationMetadata][google.cloud.dialogflow.v2.DeleteConversationDatasetOperationMetadata]
1916 /// - `response`: An [Empty
1917 /// message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
1918 ///
1919 /// [google.cloud.dialogflow.v2.DeleteConversationDatasetOperationMetadata]: crate::model::DeleteConversationDatasetOperationMetadata
1920 ///
1921 /// # Long running operations
1922 ///
1923 /// This method is used to start, and/or poll a [long-running Operation].
1924 /// The [Working with long-running operations] chapter in the [user guide]
1925 /// covers these operations in detail.
1926 ///
1927 /// [long-running operation]: https://google.aip.dev/151
1928 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1929 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1930 ///
1931 /// # Example
1932 /// ```
1933 /// # use google_cloud_dialogflow_v2::client::ConversationDatasets;
1934 /// use google_cloud_lro::Poller;
1935 /// use google_cloud_dialogflow_v2::Result;
1936 /// async fn sample(
1937 /// client: &ConversationDatasets, name: &str
1938 /// ) -> Result<()> {
1939 /// client.delete_conversation_dataset()
1940 /// .set_name(name)
1941 /// .poller().until_done().await?;
1942 /// Ok(())
1943 /// }
1944 /// ```
1945 pub fn delete_conversation_dataset(
1946 &self,
1947 ) -> super::builder::conversation_datasets::DeleteConversationDataset {
1948 super::builder::conversation_datasets::DeleteConversationDataset::new(self.inner.clone())
1949 }
1950
1951 /// Import data into the specified conversation dataset. Note that it
1952 /// is not allowed to import data to a conversation dataset that
1953 /// already has data in it.
1954 ///
1955 /// This method is a [long-running
1956 /// operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations).
1957 /// The returned `Operation` type has the following method-specific fields:
1958 ///
1959 /// - `metadata`:
1960 /// [ImportConversationDataOperationMetadata][google.cloud.dialogflow.v2.ImportConversationDataOperationMetadata]
1961 /// - `response`:
1962 /// [ImportConversationDataOperationResponse][google.cloud.dialogflow.v2.ImportConversationDataOperationResponse]
1963 ///
1964 /// [google.cloud.dialogflow.v2.ImportConversationDataOperationMetadata]: crate::model::ImportConversationDataOperationMetadata
1965 /// [google.cloud.dialogflow.v2.ImportConversationDataOperationResponse]: crate::model::ImportConversationDataOperationResponse
1966 ///
1967 /// # Long running operations
1968 ///
1969 /// This method is used to start, and/or poll a [long-running Operation].
1970 /// The [Working with long-running operations] chapter in the [user guide]
1971 /// covers these operations in detail.
1972 ///
1973 /// [long-running operation]: https://google.aip.dev/151
1974 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1975 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1976 ///
1977 /// # Example
1978 /// ```
1979 /// # use google_cloud_dialogflow_v2::client::ConversationDatasets;
1980 /// use google_cloud_lro::Poller;
1981 /// use google_cloud_dialogflow_v2::Result;
1982 /// async fn sample(
1983 /// client: &ConversationDatasets
1984 /// ) -> Result<()> {
1985 /// let response = client.import_conversation_data()
1986 /// /* set fields */
1987 /// .poller().until_done().await?;
1988 /// println!("response {:?}", response);
1989 /// Ok(())
1990 /// }
1991 /// ```
1992 pub fn import_conversation_data(
1993 &self,
1994 ) -> super::builder::conversation_datasets::ImportConversationData {
1995 super::builder::conversation_datasets::ImportConversationData::new(self.inner.clone())
1996 }
1997
1998 /// Lists information about the supported locations for this service.
1999 ///
2000 /// # Example
2001 /// ```
2002 /// # use google_cloud_dialogflow_v2::client::ConversationDatasets;
2003 /// use google_cloud_gax::paginator::ItemPaginator as _;
2004 /// use google_cloud_dialogflow_v2::Result;
2005 /// async fn sample(
2006 /// client: &ConversationDatasets
2007 /// ) -> Result<()> {
2008 /// let mut list = client.list_locations()
2009 /// /* set fields */
2010 /// .by_item();
2011 /// while let Some(item) = list.next().await.transpose()? {
2012 /// println!("{:?}", item);
2013 /// }
2014 /// Ok(())
2015 /// }
2016 /// ```
2017 pub fn list_locations(&self) -> super::builder::conversation_datasets::ListLocations {
2018 super::builder::conversation_datasets::ListLocations::new(self.inner.clone())
2019 }
2020
2021 /// Gets information about a location.
2022 ///
2023 /// # Example
2024 /// ```
2025 /// # use google_cloud_dialogflow_v2::client::ConversationDatasets;
2026 /// use google_cloud_dialogflow_v2::Result;
2027 /// async fn sample(
2028 /// client: &ConversationDatasets
2029 /// ) -> Result<()> {
2030 /// let response = client.get_location()
2031 /// /* set fields */
2032 /// .send().await?;
2033 /// println!("response {:?}", response);
2034 /// Ok(())
2035 /// }
2036 /// ```
2037 pub fn get_location(&self) -> super::builder::conversation_datasets::GetLocation {
2038 super::builder::conversation_datasets::GetLocation::new(self.inner.clone())
2039 }
2040
2041 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2042 ///
2043 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
2044 ///
2045 /// # Example
2046 /// ```
2047 /// # use google_cloud_dialogflow_v2::client::ConversationDatasets;
2048 /// use google_cloud_gax::paginator::ItemPaginator as _;
2049 /// use google_cloud_dialogflow_v2::Result;
2050 /// async fn sample(
2051 /// client: &ConversationDatasets
2052 /// ) -> Result<()> {
2053 /// let mut list = client.list_operations()
2054 /// /* set fields */
2055 /// .by_item();
2056 /// while let Some(item) = list.next().await.transpose()? {
2057 /// println!("{:?}", item);
2058 /// }
2059 /// Ok(())
2060 /// }
2061 /// ```
2062 pub fn list_operations(&self) -> super::builder::conversation_datasets::ListOperations {
2063 super::builder::conversation_datasets::ListOperations::new(self.inner.clone())
2064 }
2065
2066 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2067 ///
2068 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
2069 ///
2070 /// # Example
2071 /// ```
2072 /// # use google_cloud_dialogflow_v2::client::ConversationDatasets;
2073 /// use google_cloud_dialogflow_v2::Result;
2074 /// async fn sample(
2075 /// client: &ConversationDatasets
2076 /// ) -> Result<()> {
2077 /// let response = client.get_operation()
2078 /// /* set fields */
2079 /// .send().await?;
2080 /// println!("response {:?}", response);
2081 /// Ok(())
2082 /// }
2083 /// ```
2084 pub fn get_operation(&self) -> super::builder::conversation_datasets::GetOperation {
2085 super::builder::conversation_datasets::GetOperation::new(self.inner.clone())
2086 }
2087
2088 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2089 ///
2090 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
2091 ///
2092 /// # Example
2093 /// ```
2094 /// # use google_cloud_dialogflow_v2::client::ConversationDatasets;
2095 /// use google_cloud_dialogflow_v2::Result;
2096 /// async fn sample(
2097 /// client: &ConversationDatasets
2098 /// ) -> Result<()> {
2099 /// client.cancel_operation()
2100 /// /* set fields */
2101 /// .send().await?;
2102 /// Ok(())
2103 /// }
2104 /// ```
2105 pub fn cancel_operation(&self) -> super::builder::conversation_datasets::CancelOperation {
2106 super::builder::conversation_datasets::CancelOperation::new(self.inner.clone())
2107 }
2108}
2109
2110/// Implements a client for the Dialogflow API.
2111///
2112/// # Example
2113/// ```
2114/// # use google_cloud_dialogflow_v2::client::ConversationModels;
2115/// use google_cloud_gax::paginator::ItemPaginator as _;
2116/// # async fn sample() -> Result<(), Box<dyn std::error::Error>> {
2117/// let client = ConversationModels::builder().build().await?;
2118/// let parent = "parent_value";
2119/// let mut list = client.list_conversation_models()
2120/// .set_parent(parent)
2121/// .by_item();
2122/// while let Some(item) = list.next().await.transpose()? {
2123/// println!("{:?}", item);
2124/// }
2125/// # Ok(()) }
2126/// ```
2127///
2128/// # Service Description
2129///
2130/// Manages a collection of models for human agent assistant.
2131///
2132/// # Configuration
2133///
2134/// To configure `ConversationModels` use the `with_*` methods in the type returned
2135/// by [builder()][ConversationModels::builder]. The default configuration should
2136/// work for most applications. Common configuration changes include
2137///
2138/// * [with_endpoint()]: by default this client uses the global default endpoint
2139/// (`https://dialogflow.googleapis.com`). Applications using regional
2140/// endpoints or running in restricted networks (e.g. a network configured
2141// with [Private Google Access with VPC Service Controls]) may want to
2142/// override this default.
2143/// * [with_credentials()]: by default this client uses
2144/// [Application Default Credentials]. Applications using custom
2145/// authentication may need to override this default.
2146///
2147/// [with_endpoint()]: super::builder::conversation_models::ClientBuilder::with_endpoint
2148/// [with_credentials()]: super::builder::conversation_models::ClientBuilder::with_credentials
2149/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
2150/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
2151///
2152/// # Pooling and Cloning
2153///
2154/// `ConversationModels` holds a connection pool internally, it is advised to
2155/// create one and reuse it. You do not need to wrap `ConversationModels` in
2156/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
2157/// already uses an `Arc` internally.
2158#[cfg(feature = "conversation-models")]
2159#[cfg_attr(docsrs, doc(cfg(feature = "conversation-models")))]
2160#[derive(Clone, Debug)]
2161pub struct ConversationModels {
2162 inner: std::sync::Arc<dyn super::stub::dynamic::ConversationModels>,
2163}
2164
2165#[cfg(feature = "conversation-models")]
2166impl ConversationModels {
2167 /// Returns a builder for [ConversationModels].
2168 ///
2169 /// ```
2170 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
2171 /// # use google_cloud_dialogflow_v2::client::ConversationModels;
2172 /// let client = ConversationModels::builder().build().await?;
2173 /// # Ok(()) }
2174 /// ```
2175 pub fn builder() -> super::builder::conversation_models::ClientBuilder {
2176 crate::new_client_builder(super::builder::conversation_models::client::Factory)
2177 }
2178
2179 /// Creates a new client from the provided stub.
2180 ///
2181 /// The most common case for calling this function is in tests mocking the
2182 /// client's behavior.
2183 pub fn from_stub<T>(stub: T) -> Self
2184 where
2185 T: super::stub::ConversationModels + 'static,
2186 {
2187 Self {
2188 inner: std::sync::Arc::new(stub),
2189 }
2190 }
2191
2192 pub(crate) async fn new(
2193 config: gaxi::options::ClientConfig,
2194 ) -> crate::ClientBuilderResult<Self> {
2195 let inner = Self::build_inner(config).await?;
2196 Ok(Self { inner })
2197 }
2198
2199 async fn build_inner(
2200 conf: gaxi::options::ClientConfig,
2201 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::ConversationModels>>
2202 {
2203 if gaxi::options::tracing_enabled(&conf) {
2204 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
2205 }
2206 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
2207 }
2208
2209 async fn build_transport(
2210 conf: gaxi::options::ClientConfig,
2211 ) -> crate::ClientBuilderResult<impl super::stub::ConversationModels> {
2212 super::transport::ConversationModels::new(conf).await
2213 }
2214
2215 async fn build_with_tracing(
2216 conf: gaxi::options::ClientConfig,
2217 ) -> crate::ClientBuilderResult<impl super::stub::ConversationModels> {
2218 Self::build_transport(conf)
2219 .await
2220 .map(super::tracing::ConversationModels::new)
2221 }
2222
2223 /// Creates a model.
2224 ///
2225 /// This method is a [long-running
2226 /// operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations).
2227 /// The returned `Operation` type has the following method-specific fields:
2228 ///
2229 /// - `metadata`:
2230 /// [CreateConversationModelOperationMetadata][google.cloud.dialogflow.v2.CreateConversationModelOperationMetadata]
2231 /// - `response`:
2232 /// [ConversationModel][google.cloud.dialogflow.v2.ConversationModel]
2233 ///
2234 /// [google.cloud.dialogflow.v2.ConversationModel]: crate::model::ConversationModel
2235 /// [google.cloud.dialogflow.v2.CreateConversationModelOperationMetadata]: crate::model::CreateConversationModelOperationMetadata
2236 ///
2237 /// # Long running operations
2238 ///
2239 /// This method is used to start, and/or poll a [long-running Operation].
2240 /// The [Working with long-running operations] chapter in the [user guide]
2241 /// covers these operations in detail.
2242 ///
2243 /// [long-running operation]: https://google.aip.dev/151
2244 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2245 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2246 ///
2247 /// # Example
2248 /// ```
2249 /// # use google_cloud_dialogflow_v2::client::ConversationModels;
2250 /// use google_cloud_lro::Poller;
2251 /// use google_cloud_dialogflow_v2::model::ConversationModel;
2252 /// use google_cloud_dialogflow_v2::Result;
2253 /// async fn sample(
2254 /// client: &ConversationModels, parent: &str
2255 /// ) -> Result<()> {
2256 /// let response = client.create_conversation_model()
2257 /// .set_parent(parent)
2258 /// .set_conversation_model(
2259 /// ConversationModel::new()/* set fields */
2260 /// )
2261 /// .poller().until_done().await?;
2262 /// println!("response {:?}", response);
2263 /// Ok(())
2264 /// }
2265 /// ```
2266 pub fn create_conversation_model(
2267 &self,
2268 ) -> super::builder::conversation_models::CreateConversationModel {
2269 super::builder::conversation_models::CreateConversationModel::new(self.inner.clone())
2270 }
2271
2272 /// Gets conversation model.
2273 ///
2274 /// # Example
2275 /// ```
2276 /// # use google_cloud_dialogflow_v2::client::ConversationModels;
2277 /// use google_cloud_dialogflow_v2::Result;
2278 /// async fn sample(
2279 /// client: &ConversationModels
2280 /// ) -> Result<()> {
2281 /// let response = client.get_conversation_model()
2282 /// /* set fields */
2283 /// .send().await?;
2284 /// println!("response {:?}", response);
2285 /// Ok(())
2286 /// }
2287 /// ```
2288 pub fn get_conversation_model(
2289 &self,
2290 ) -> super::builder::conversation_models::GetConversationModel {
2291 super::builder::conversation_models::GetConversationModel::new(self.inner.clone())
2292 }
2293
2294 /// Lists conversation models.
2295 ///
2296 /// # Example
2297 /// ```
2298 /// # use google_cloud_dialogflow_v2::client::ConversationModels;
2299 /// use google_cloud_gax::paginator::ItemPaginator as _;
2300 /// use google_cloud_dialogflow_v2::Result;
2301 /// async fn sample(
2302 /// client: &ConversationModels, parent: &str
2303 /// ) -> Result<()> {
2304 /// let mut list = client.list_conversation_models()
2305 /// .set_parent(parent)
2306 /// .by_item();
2307 /// while let Some(item) = list.next().await.transpose()? {
2308 /// println!("{:?}", item);
2309 /// }
2310 /// Ok(())
2311 /// }
2312 /// ```
2313 pub fn list_conversation_models(
2314 &self,
2315 ) -> super::builder::conversation_models::ListConversationModels {
2316 super::builder::conversation_models::ListConversationModels::new(self.inner.clone())
2317 }
2318
2319 /// Deletes a model.
2320 ///
2321 /// This method is a [long-running
2322 /// operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations).
2323 /// The returned `Operation` type has the following method-specific fields:
2324 ///
2325 /// - `metadata`:
2326 /// [DeleteConversationModelOperationMetadata][google.cloud.dialogflow.v2.DeleteConversationModelOperationMetadata]
2327 /// - `response`: An [Empty
2328 /// message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
2329 ///
2330 /// [google.cloud.dialogflow.v2.DeleteConversationModelOperationMetadata]: crate::model::DeleteConversationModelOperationMetadata
2331 ///
2332 /// # Long running operations
2333 ///
2334 /// This method is used to start, and/or poll a [long-running Operation].
2335 /// The [Working with long-running operations] chapter in the [user guide]
2336 /// covers these operations in detail.
2337 ///
2338 /// [long-running operation]: https://google.aip.dev/151
2339 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2340 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2341 ///
2342 /// # Example
2343 /// ```
2344 /// # use google_cloud_dialogflow_v2::client::ConversationModels;
2345 /// use google_cloud_lro::Poller;
2346 /// use google_cloud_dialogflow_v2::Result;
2347 /// async fn sample(
2348 /// client: &ConversationModels
2349 /// ) -> Result<()> {
2350 /// client.delete_conversation_model()
2351 /// /* set fields */
2352 /// .poller().until_done().await?;
2353 /// Ok(())
2354 /// }
2355 /// ```
2356 pub fn delete_conversation_model(
2357 &self,
2358 ) -> super::builder::conversation_models::DeleteConversationModel {
2359 super::builder::conversation_models::DeleteConversationModel::new(self.inner.clone())
2360 }
2361
2362 /// Deploys a model. If a model is already deployed, deploying it
2363 /// has no effect. A model can only serve prediction requests after it gets
2364 /// deployed. For article suggestion, custom model will not be used unless
2365 /// it is deployed.
2366 ///
2367 /// This method is a [long-running
2368 /// operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations).
2369 /// The returned `Operation` type has the following method-specific fields:
2370 ///
2371 /// - `metadata`:
2372 /// [DeployConversationModelOperationMetadata][google.cloud.dialogflow.v2.DeployConversationModelOperationMetadata]
2373 /// - `response`: An [Empty
2374 /// message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
2375 ///
2376 /// [google.cloud.dialogflow.v2.DeployConversationModelOperationMetadata]: crate::model::DeployConversationModelOperationMetadata
2377 ///
2378 /// # Long running operations
2379 ///
2380 /// This method is used to start, and/or poll a [long-running Operation].
2381 /// The [Working with long-running operations] chapter in the [user guide]
2382 /// covers these operations in detail.
2383 ///
2384 /// [long-running operation]: https://google.aip.dev/151
2385 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2386 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2387 ///
2388 /// # Example
2389 /// ```
2390 /// # use google_cloud_dialogflow_v2::client::ConversationModels;
2391 /// use google_cloud_lro::Poller;
2392 /// use google_cloud_dialogflow_v2::Result;
2393 /// async fn sample(
2394 /// client: &ConversationModels
2395 /// ) -> Result<()> {
2396 /// client.deploy_conversation_model()
2397 /// /* set fields */
2398 /// .poller().until_done().await?;
2399 /// Ok(())
2400 /// }
2401 /// ```
2402 pub fn deploy_conversation_model(
2403 &self,
2404 ) -> super::builder::conversation_models::DeployConversationModel {
2405 super::builder::conversation_models::DeployConversationModel::new(self.inner.clone())
2406 }
2407
2408 /// Undeploys a model. If the model is not deployed this method has no effect.
2409 /// If the model is currently being used:
2410 ///
2411 /// - For article suggestion, article suggestion will fallback to the default
2412 /// model if model is undeployed.
2413 ///
2414 /// This method is a [long-running
2415 /// operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations).
2416 /// The returned `Operation` type has the following method-specific fields:
2417 ///
2418 /// - `metadata`:
2419 /// [UndeployConversationModelOperationMetadata][google.cloud.dialogflow.v2.UndeployConversationModelOperationMetadata]
2420 /// - `response`: An [Empty
2421 /// message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
2422 ///
2423 /// [google.cloud.dialogflow.v2.UndeployConversationModelOperationMetadata]: crate::model::UndeployConversationModelOperationMetadata
2424 ///
2425 /// # Long running operations
2426 ///
2427 /// This method is used to start, and/or poll a [long-running Operation].
2428 /// The [Working with long-running operations] chapter in the [user guide]
2429 /// covers these operations in detail.
2430 ///
2431 /// [long-running operation]: https://google.aip.dev/151
2432 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2433 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2434 ///
2435 /// # Example
2436 /// ```
2437 /// # use google_cloud_dialogflow_v2::client::ConversationModels;
2438 /// use google_cloud_lro::Poller;
2439 /// use google_cloud_dialogflow_v2::Result;
2440 /// async fn sample(
2441 /// client: &ConversationModels
2442 /// ) -> Result<()> {
2443 /// client.undeploy_conversation_model()
2444 /// /* set fields */
2445 /// .poller().until_done().await?;
2446 /// Ok(())
2447 /// }
2448 /// ```
2449 pub fn undeploy_conversation_model(
2450 &self,
2451 ) -> super::builder::conversation_models::UndeployConversationModel {
2452 super::builder::conversation_models::UndeployConversationModel::new(self.inner.clone())
2453 }
2454
2455 /// Gets an evaluation of conversation model.
2456 ///
2457 /// # Example
2458 /// ```
2459 /// # use google_cloud_dialogflow_v2::client::ConversationModels;
2460 /// use google_cloud_dialogflow_v2::Result;
2461 /// async fn sample(
2462 /// client: &ConversationModels
2463 /// ) -> Result<()> {
2464 /// let response = client.get_conversation_model_evaluation()
2465 /// /* set fields */
2466 /// .send().await?;
2467 /// println!("response {:?}", response);
2468 /// Ok(())
2469 /// }
2470 /// ```
2471 pub fn get_conversation_model_evaluation(
2472 &self,
2473 ) -> super::builder::conversation_models::GetConversationModelEvaluation {
2474 super::builder::conversation_models::GetConversationModelEvaluation::new(self.inner.clone())
2475 }
2476
2477 /// Lists evaluations of a conversation model.
2478 ///
2479 /// # Example
2480 /// ```
2481 /// # use google_cloud_dialogflow_v2::client::ConversationModels;
2482 /// use google_cloud_gax::paginator::ItemPaginator as _;
2483 /// use google_cloud_dialogflow_v2::Result;
2484 /// async fn sample(
2485 /// client: &ConversationModels, parent: &str
2486 /// ) -> Result<()> {
2487 /// let mut list = client.list_conversation_model_evaluations()
2488 /// .set_parent(parent)
2489 /// .by_item();
2490 /// while let Some(item) = list.next().await.transpose()? {
2491 /// println!("{:?}", item);
2492 /// }
2493 /// Ok(())
2494 /// }
2495 /// ```
2496 pub fn list_conversation_model_evaluations(
2497 &self,
2498 ) -> super::builder::conversation_models::ListConversationModelEvaluations {
2499 super::builder::conversation_models::ListConversationModelEvaluations::new(
2500 self.inner.clone(),
2501 )
2502 }
2503
2504 /// Creates evaluation of a conversation model.
2505 ///
2506 /// # Long running operations
2507 ///
2508 /// This method is used to start, and/or poll a [long-running Operation].
2509 /// The [Working with long-running operations] chapter in the [user guide]
2510 /// covers these operations in detail.
2511 ///
2512 /// [long-running operation]: https://google.aip.dev/151
2513 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2514 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2515 ///
2516 /// # Example
2517 /// ```
2518 /// # use google_cloud_dialogflow_v2::client::ConversationModels;
2519 /// use google_cloud_lro::Poller;
2520 /// use google_cloud_dialogflow_v2::Result;
2521 /// async fn sample(
2522 /// client: &ConversationModels
2523 /// ) -> Result<()> {
2524 /// let response = client.create_conversation_model_evaluation()
2525 /// /* set fields */
2526 /// .poller().until_done().await?;
2527 /// println!("response {:?}", response);
2528 /// Ok(())
2529 /// }
2530 /// ```
2531 pub fn create_conversation_model_evaluation(
2532 &self,
2533 ) -> super::builder::conversation_models::CreateConversationModelEvaluation {
2534 super::builder::conversation_models::CreateConversationModelEvaluation::new(
2535 self.inner.clone(),
2536 )
2537 }
2538
2539 /// Lists information about the supported locations for this service.
2540 ///
2541 /// # Example
2542 /// ```
2543 /// # use google_cloud_dialogflow_v2::client::ConversationModels;
2544 /// use google_cloud_gax::paginator::ItemPaginator as _;
2545 /// use google_cloud_dialogflow_v2::Result;
2546 /// async fn sample(
2547 /// client: &ConversationModels
2548 /// ) -> Result<()> {
2549 /// let mut list = client.list_locations()
2550 /// /* set fields */
2551 /// .by_item();
2552 /// while let Some(item) = list.next().await.transpose()? {
2553 /// println!("{:?}", item);
2554 /// }
2555 /// Ok(())
2556 /// }
2557 /// ```
2558 pub fn list_locations(&self) -> super::builder::conversation_models::ListLocations {
2559 super::builder::conversation_models::ListLocations::new(self.inner.clone())
2560 }
2561
2562 /// Gets information about a location.
2563 ///
2564 /// # Example
2565 /// ```
2566 /// # use google_cloud_dialogflow_v2::client::ConversationModels;
2567 /// use google_cloud_dialogflow_v2::Result;
2568 /// async fn sample(
2569 /// client: &ConversationModels
2570 /// ) -> Result<()> {
2571 /// let response = client.get_location()
2572 /// /* set fields */
2573 /// .send().await?;
2574 /// println!("response {:?}", response);
2575 /// Ok(())
2576 /// }
2577 /// ```
2578 pub fn get_location(&self) -> super::builder::conversation_models::GetLocation {
2579 super::builder::conversation_models::GetLocation::new(self.inner.clone())
2580 }
2581
2582 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2583 ///
2584 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
2585 ///
2586 /// # Example
2587 /// ```
2588 /// # use google_cloud_dialogflow_v2::client::ConversationModels;
2589 /// use google_cloud_gax::paginator::ItemPaginator as _;
2590 /// use google_cloud_dialogflow_v2::Result;
2591 /// async fn sample(
2592 /// client: &ConversationModels
2593 /// ) -> Result<()> {
2594 /// let mut list = client.list_operations()
2595 /// /* set fields */
2596 /// .by_item();
2597 /// while let Some(item) = list.next().await.transpose()? {
2598 /// println!("{:?}", item);
2599 /// }
2600 /// Ok(())
2601 /// }
2602 /// ```
2603 pub fn list_operations(&self) -> super::builder::conversation_models::ListOperations {
2604 super::builder::conversation_models::ListOperations::new(self.inner.clone())
2605 }
2606
2607 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2608 ///
2609 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
2610 ///
2611 /// # Example
2612 /// ```
2613 /// # use google_cloud_dialogflow_v2::client::ConversationModels;
2614 /// use google_cloud_dialogflow_v2::Result;
2615 /// async fn sample(
2616 /// client: &ConversationModels
2617 /// ) -> Result<()> {
2618 /// let response = client.get_operation()
2619 /// /* set fields */
2620 /// .send().await?;
2621 /// println!("response {:?}", response);
2622 /// Ok(())
2623 /// }
2624 /// ```
2625 pub fn get_operation(&self) -> super::builder::conversation_models::GetOperation {
2626 super::builder::conversation_models::GetOperation::new(self.inner.clone())
2627 }
2628
2629 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2630 ///
2631 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
2632 ///
2633 /// # Example
2634 /// ```
2635 /// # use google_cloud_dialogflow_v2::client::ConversationModels;
2636 /// use google_cloud_dialogflow_v2::Result;
2637 /// async fn sample(
2638 /// client: &ConversationModels
2639 /// ) -> Result<()> {
2640 /// client.cancel_operation()
2641 /// /* set fields */
2642 /// .send().await?;
2643 /// Ok(())
2644 /// }
2645 /// ```
2646 pub fn cancel_operation(&self) -> super::builder::conversation_models::CancelOperation {
2647 super::builder::conversation_models::CancelOperation::new(self.inner.clone())
2648 }
2649}
2650
2651/// Implements a client for the Dialogflow API.
2652///
2653/// # Example
2654/// ```
2655/// # use google_cloud_dialogflow_v2::client::ConversationProfiles;
2656/// use google_cloud_gax::paginator::ItemPaginator as _;
2657/// # async fn sample() -> Result<(), Box<dyn std::error::Error>> {
2658/// let client = ConversationProfiles::builder().build().await?;
2659/// let parent = "parent_value";
2660/// let mut list = client.list_conversation_profiles()
2661/// .set_parent(parent)
2662/// .by_item();
2663/// while let Some(item) = list.next().await.transpose()? {
2664/// println!("{:?}", item);
2665/// }
2666/// # Ok(()) }
2667/// ```
2668///
2669/// # Service Description
2670///
2671/// Service for managing
2672/// [ConversationProfiles][google.cloud.dialogflow.v2.ConversationProfile].
2673///
2674/// [google.cloud.dialogflow.v2.ConversationProfile]: crate::model::ConversationProfile
2675///
2676/// # Configuration
2677///
2678/// To configure `ConversationProfiles` use the `with_*` methods in the type returned
2679/// by [builder()][ConversationProfiles::builder]. The default configuration should
2680/// work for most applications. Common configuration changes include
2681///
2682/// * [with_endpoint()]: by default this client uses the global default endpoint
2683/// (`https://dialogflow.googleapis.com`). Applications using regional
2684/// endpoints or running in restricted networks (e.g. a network configured
2685// with [Private Google Access with VPC Service Controls]) may want to
2686/// override this default.
2687/// * [with_credentials()]: by default this client uses
2688/// [Application Default Credentials]. Applications using custom
2689/// authentication may need to override this default.
2690///
2691/// [with_endpoint()]: super::builder::conversation_profiles::ClientBuilder::with_endpoint
2692/// [with_credentials()]: super::builder::conversation_profiles::ClientBuilder::with_credentials
2693/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
2694/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
2695///
2696/// # Pooling and Cloning
2697///
2698/// `ConversationProfiles` holds a connection pool internally, it is advised to
2699/// create one and reuse it. You do not need to wrap `ConversationProfiles` in
2700/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
2701/// already uses an `Arc` internally.
2702#[cfg(feature = "conversation-profiles")]
2703#[cfg_attr(docsrs, doc(cfg(feature = "conversation-profiles")))]
2704#[derive(Clone, Debug)]
2705pub struct ConversationProfiles {
2706 inner: std::sync::Arc<dyn super::stub::dynamic::ConversationProfiles>,
2707}
2708
2709#[cfg(feature = "conversation-profiles")]
2710impl ConversationProfiles {
2711 /// Returns a builder for [ConversationProfiles].
2712 ///
2713 /// ```
2714 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
2715 /// # use google_cloud_dialogflow_v2::client::ConversationProfiles;
2716 /// let client = ConversationProfiles::builder().build().await?;
2717 /// # Ok(()) }
2718 /// ```
2719 pub fn builder() -> super::builder::conversation_profiles::ClientBuilder {
2720 crate::new_client_builder(super::builder::conversation_profiles::client::Factory)
2721 }
2722
2723 /// Creates a new client from the provided stub.
2724 ///
2725 /// The most common case for calling this function is in tests mocking the
2726 /// client's behavior.
2727 pub fn from_stub<T>(stub: T) -> Self
2728 where
2729 T: super::stub::ConversationProfiles + 'static,
2730 {
2731 Self {
2732 inner: std::sync::Arc::new(stub),
2733 }
2734 }
2735
2736 pub(crate) async fn new(
2737 config: gaxi::options::ClientConfig,
2738 ) -> crate::ClientBuilderResult<Self> {
2739 let inner = Self::build_inner(config).await?;
2740 Ok(Self { inner })
2741 }
2742
2743 async fn build_inner(
2744 conf: gaxi::options::ClientConfig,
2745 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::ConversationProfiles>>
2746 {
2747 if gaxi::options::tracing_enabled(&conf) {
2748 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
2749 }
2750 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
2751 }
2752
2753 async fn build_transport(
2754 conf: gaxi::options::ClientConfig,
2755 ) -> crate::ClientBuilderResult<impl super::stub::ConversationProfiles> {
2756 super::transport::ConversationProfiles::new(conf).await
2757 }
2758
2759 async fn build_with_tracing(
2760 conf: gaxi::options::ClientConfig,
2761 ) -> crate::ClientBuilderResult<impl super::stub::ConversationProfiles> {
2762 Self::build_transport(conf)
2763 .await
2764 .map(super::tracing::ConversationProfiles::new)
2765 }
2766
2767 /// Returns the list of all conversation profiles in the specified project.
2768 ///
2769 /// # Example
2770 /// ```
2771 /// # use google_cloud_dialogflow_v2::client::ConversationProfiles;
2772 /// use google_cloud_gax::paginator::ItemPaginator as _;
2773 /// use google_cloud_dialogflow_v2::Result;
2774 /// async fn sample(
2775 /// client: &ConversationProfiles, parent: &str
2776 /// ) -> Result<()> {
2777 /// let mut list = client.list_conversation_profiles()
2778 /// .set_parent(parent)
2779 /// .by_item();
2780 /// while let Some(item) = list.next().await.transpose()? {
2781 /// println!("{:?}", item);
2782 /// }
2783 /// Ok(())
2784 /// }
2785 /// ```
2786 pub fn list_conversation_profiles(
2787 &self,
2788 ) -> super::builder::conversation_profiles::ListConversationProfiles {
2789 super::builder::conversation_profiles::ListConversationProfiles::new(self.inner.clone())
2790 }
2791
2792 /// Retrieves the specified conversation profile.
2793 ///
2794 /// # Example
2795 /// ```
2796 /// # use google_cloud_dialogflow_v2::client::ConversationProfiles;
2797 /// use google_cloud_dialogflow_v2::Result;
2798 /// async fn sample(
2799 /// client: &ConversationProfiles, name: &str
2800 /// ) -> Result<()> {
2801 /// let response = client.get_conversation_profile()
2802 /// .set_name(name)
2803 /// .send().await?;
2804 /// println!("response {:?}", response);
2805 /// Ok(())
2806 /// }
2807 /// ```
2808 pub fn get_conversation_profile(
2809 &self,
2810 ) -> super::builder::conversation_profiles::GetConversationProfile {
2811 super::builder::conversation_profiles::GetConversationProfile::new(self.inner.clone())
2812 }
2813
2814 /// Creates a conversation profile in the specified project.
2815 ///
2816 /// [ConversationProfile.create_time][google.cloud.dialogflow.v2.ConversationProfile.create_time]
2817 /// and
2818 /// [ConversationProfile.update_time][google.cloud.dialogflow.v2.ConversationProfile.update_time]
2819 /// aren't populated in the response. You can retrieve them via
2820 /// [GetConversationProfile][google.cloud.dialogflow.v2.ConversationProfiles.GetConversationProfile]
2821 /// API.
2822 ///
2823 /// [google.cloud.dialogflow.v2.ConversationProfile.create_time]: crate::model::ConversationProfile::create_time
2824 /// [google.cloud.dialogflow.v2.ConversationProfile.update_time]: crate::model::ConversationProfile::update_time
2825 /// [google.cloud.dialogflow.v2.ConversationProfiles.GetConversationProfile]: crate::client::ConversationProfiles::get_conversation_profile
2826 ///
2827 /// # Example
2828 /// ```
2829 /// # use google_cloud_dialogflow_v2::client::ConversationProfiles;
2830 /// use google_cloud_dialogflow_v2::model::ConversationProfile;
2831 /// use google_cloud_dialogflow_v2::Result;
2832 /// async fn sample(
2833 /// client: &ConversationProfiles, parent: &str
2834 /// ) -> Result<()> {
2835 /// let response = client.create_conversation_profile()
2836 /// .set_parent(parent)
2837 /// .set_conversation_profile(
2838 /// ConversationProfile::new()/* set fields */
2839 /// )
2840 /// .send().await?;
2841 /// println!("response {:?}", response);
2842 /// Ok(())
2843 /// }
2844 /// ```
2845 pub fn create_conversation_profile(
2846 &self,
2847 ) -> super::builder::conversation_profiles::CreateConversationProfile {
2848 super::builder::conversation_profiles::CreateConversationProfile::new(self.inner.clone())
2849 }
2850
2851 /// Updates the specified conversation profile.
2852 ///
2853 /// [ConversationProfile.create_time][google.cloud.dialogflow.v2.ConversationProfile.create_time]
2854 /// and
2855 /// [ConversationProfile.update_time][google.cloud.dialogflow.v2.ConversationProfile.update_time]
2856 /// aren't populated in the response. You can retrieve them via
2857 /// [GetConversationProfile][google.cloud.dialogflow.v2.ConversationProfiles.GetConversationProfile]
2858 /// API.
2859 ///
2860 /// [google.cloud.dialogflow.v2.ConversationProfile.create_time]: crate::model::ConversationProfile::create_time
2861 /// [google.cloud.dialogflow.v2.ConversationProfile.update_time]: crate::model::ConversationProfile::update_time
2862 /// [google.cloud.dialogflow.v2.ConversationProfiles.GetConversationProfile]: crate::client::ConversationProfiles::get_conversation_profile
2863 ///
2864 /// # Example
2865 /// ```
2866 /// # use google_cloud_dialogflow_v2::client::ConversationProfiles;
2867 /// # extern crate wkt as google_cloud_wkt;
2868 /// use google_cloud_wkt::FieldMask;
2869 /// use google_cloud_dialogflow_v2::model::ConversationProfile;
2870 /// use google_cloud_dialogflow_v2::Result;
2871 /// async fn sample(
2872 /// client: &ConversationProfiles, name: &str
2873 /// ) -> Result<()> {
2874 /// let response = client.update_conversation_profile()
2875 /// .set_conversation_profile(
2876 /// ConversationProfile::new().set_name(name)/* set fields */
2877 /// )
2878 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
2879 /// .send().await?;
2880 /// println!("response {:?}", response);
2881 /// Ok(())
2882 /// }
2883 /// ```
2884 pub fn update_conversation_profile(
2885 &self,
2886 ) -> super::builder::conversation_profiles::UpdateConversationProfile {
2887 super::builder::conversation_profiles::UpdateConversationProfile::new(self.inner.clone())
2888 }
2889
2890 /// Deletes the specified conversation profile.
2891 ///
2892 /// # Example
2893 /// ```
2894 /// # use google_cloud_dialogflow_v2::client::ConversationProfiles;
2895 /// use google_cloud_dialogflow_v2::Result;
2896 /// async fn sample(
2897 /// client: &ConversationProfiles, name: &str
2898 /// ) -> Result<()> {
2899 /// client.delete_conversation_profile()
2900 /// .set_name(name)
2901 /// .send().await?;
2902 /// Ok(())
2903 /// }
2904 /// ```
2905 pub fn delete_conversation_profile(
2906 &self,
2907 ) -> super::builder::conversation_profiles::DeleteConversationProfile {
2908 super::builder::conversation_profiles::DeleteConversationProfile::new(self.inner.clone())
2909 }
2910
2911 /// Adds or updates a suggestion feature in a conversation profile.
2912 /// If the conversation profile contains the type of suggestion feature for
2913 /// the participant role, it will update it. Otherwise it will insert the
2914 /// suggestion feature.
2915 ///
2916 /// This method is a [long-running
2917 /// operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations).
2918 /// The returned `Operation` type has the following method-specific fields:
2919 ///
2920 /// - `metadata`:
2921 /// [SetSuggestionFeatureConfigOperationMetadata][google.cloud.dialogflow.v2.SetSuggestionFeatureConfigOperationMetadata]
2922 /// - `response`:
2923 /// [ConversationProfile][google.cloud.dialogflow.v2.ConversationProfile]
2924 ///
2925 /// If a long running operation to add or update suggestion feature
2926 /// config for the same conversation profile, participant role and suggestion
2927 /// feature type exists, please cancel the existing long running operation
2928 /// before sending such request, otherwise the request will be rejected.
2929 ///
2930 /// [google.cloud.dialogflow.v2.ConversationProfile]: crate::model::ConversationProfile
2931 /// [google.cloud.dialogflow.v2.SetSuggestionFeatureConfigOperationMetadata]: crate::model::SetSuggestionFeatureConfigOperationMetadata
2932 ///
2933 /// # Long running operations
2934 ///
2935 /// This method is used to start, and/or poll a [long-running Operation].
2936 /// The [Working with long-running operations] chapter in the [user guide]
2937 /// covers these operations in detail.
2938 ///
2939 /// [long-running operation]: https://google.aip.dev/151
2940 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2941 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2942 ///
2943 /// # Example
2944 /// ```
2945 /// # use google_cloud_dialogflow_v2::client::ConversationProfiles;
2946 /// use google_cloud_lro::Poller;
2947 /// use google_cloud_dialogflow_v2::Result;
2948 /// async fn sample(
2949 /// client: &ConversationProfiles
2950 /// ) -> Result<()> {
2951 /// let response = client.set_suggestion_feature_config()
2952 /// /* set fields */
2953 /// .poller().until_done().await?;
2954 /// println!("response {:?}", response);
2955 /// Ok(())
2956 /// }
2957 /// ```
2958 pub fn set_suggestion_feature_config(
2959 &self,
2960 ) -> super::builder::conversation_profiles::SetSuggestionFeatureConfig {
2961 super::builder::conversation_profiles::SetSuggestionFeatureConfig::new(self.inner.clone())
2962 }
2963
2964 /// Clears a suggestion feature from a conversation profile for the given
2965 /// participant role.
2966 ///
2967 /// This method is a [long-running
2968 /// operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations).
2969 /// The returned `Operation` type has the following method-specific fields:
2970 ///
2971 /// - `metadata`:
2972 /// [ClearSuggestionFeatureConfigOperationMetadata][google.cloud.dialogflow.v2.ClearSuggestionFeatureConfigOperationMetadata]
2973 /// - `response`:
2974 /// [ConversationProfile][google.cloud.dialogflow.v2.ConversationProfile]
2975 ///
2976 /// [google.cloud.dialogflow.v2.ClearSuggestionFeatureConfigOperationMetadata]: crate::model::ClearSuggestionFeatureConfigOperationMetadata
2977 /// [google.cloud.dialogflow.v2.ConversationProfile]: crate::model::ConversationProfile
2978 ///
2979 /// # Long running operations
2980 ///
2981 /// This method is used to start, and/or poll a [long-running Operation].
2982 /// The [Working with long-running operations] chapter in the [user guide]
2983 /// covers these operations in detail.
2984 ///
2985 /// [long-running operation]: https://google.aip.dev/151
2986 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2987 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2988 ///
2989 /// # Example
2990 /// ```
2991 /// # use google_cloud_dialogflow_v2::client::ConversationProfiles;
2992 /// use google_cloud_lro::Poller;
2993 /// use google_cloud_dialogflow_v2::Result;
2994 /// async fn sample(
2995 /// client: &ConversationProfiles
2996 /// ) -> Result<()> {
2997 /// let response = client.clear_suggestion_feature_config()
2998 /// /* set fields */
2999 /// .poller().until_done().await?;
3000 /// println!("response {:?}", response);
3001 /// Ok(())
3002 /// }
3003 /// ```
3004 pub fn clear_suggestion_feature_config(
3005 &self,
3006 ) -> super::builder::conversation_profiles::ClearSuggestionFeatureConfig {
3007 super::builder::conversation_profiles::ClearSuggestionFeatureConfig::new(self.inner.clone())
3008 }
3009
3010 /// Lists information about the supported locations for this service.
3011 ///
3012 /// # Example
3013 /// ```
3014 /// # use google_cloud_dialogflow_v2::client::ConversationProfiles;
3015 /// use google_cloud_gax::paginator::ItemPaginator as _;
3016 /// use google_cloud_dialogflow_v2::Result;
3017 /// async fn sample(
3018 /// client: &ConversationProfiles
3019 /// ) -> Result<()> {
3020 /// let mut list = client.list_locations()
3021 /// /* set fields */
3022 /// .by_item();
3023 /// while let Some(item) = list.next().await.transpose()? {
3024 /// println!("{:?}", item);
3025 /// }
3026 /// Ok(())
3027 /// }
3028 /// ```
3029 pub fn list_locations(&self) -> super::builder::conversation_profiles::ListLocations {
3030 super::builder::conversation_profiles::ListLocations::new(self.inner.clone())
3031 }
3032
3033 /// Gets information about a location.
3034 ///
3035 /// # Example
3036 /// ```
3037 /// # use google_cloud_dialogflow_v2::client::ConversationProfiles;
3038 /// use google_cloud_dialogflow_v2::Result;
3039 /// async fn sample(
3040 /// client: &ConversationProfiles
3041 /// ) -> Result<()> {
3042 /// let response = client.get_location()
3043 /// /* set fields */
3044 /// .send().await?;
3045 /// println!("response {:?}", response);
3046 /// Ok(())
3047 /// }
3048 /// ```
3049 pub fn get_location(&self) -> super::builder::conversation_profiles::GetLocation {
3050 super::builder::conversation_profiles::GetLocation::new(self.inner.clone())
3051 }
3052
3053 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3054 ///
3055 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
3056 ///
3057 /// # Example
3058 /// ```
3059 /// # use google_cloud_dialogflow_v2::client::ConversationProfiles;
3060 /// use google_cloud_gax::paginator::ItemPaginator as _;
3061 /// use google_cloud_dialogflow_v2::Result;
3062 /// async fn sample(
3063 /// client: &ConversationProfiles
3064 /// ) -> Result<()> {
3065 /// let mut list = client.list_operations()
3066 /// /* set fields */
3067 /// .by_item();
3068 /// while let Some(item) = list.next().await.transpose()? {
3069 /// println!("{:?}", item);
3070 /// }
3071 /// Ok(())
3072 /// }
3073 /// ```
3074 pub fn list_operations(&self) -> super::builder::conversation_profiles::ListOperations {
3075 super::builder::conversation_profiles::ListOperations::new(self.inner.clone())
3076 }
3077
3078 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3079 ///
3080 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
3081 ///
3082 /// # Example
3083 /// ```
3084 /// # use google_cloud_dialogflow_v2::client::ConversationProfiles;
3085 /// use google_cloud_dialogflow_v2::Result;
3086 /// async fn sample(
3087 /// client: &ConversationProfiles
3088 /// ) -> Result<()> {
3089 /// let response = client.get_operation()
3090 /// /* set fields */
3091 /// .send().await?;
3092 /// println!("response {:?}", response);
3093 /// Ok(())
3094 /// }
3095 /// ```
3096 pub fn get_operation(&self) -> super::builder::conversation_profiles::GetOperation {
3097 super::builder::conversation_profiles::GetOperation::new(self.inner.clone())
3098 }
3099
3100 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3101 ///
3102 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
3103 ///
3104 /// # Example
3105 /// ```
3106 /// # use google_cloud_dialogflow_v2::client::ConversationProfiles;
3107 /// use google_cloud_dialogflow_v2::Result;
3108 /// async fn sample(
3109 /// client: &ConversationProfiles
3110 /// ) -> Result<()> {
3111 /// client.cancel_operation()
3112 /// /* set fields */
3113 /// .send().await?;
3114 /// Ok(())
3115 /// }
3116 /// ```
3117 pub fn cancel_operation(&self) -> super::builder::conversation_profiles::CancelOperation {
3118 super::builder::conversation_profiles::CancelOperation::new(self.inner.clone())
3119 }
3120}
3121
3122/// Implements a client for the Dialogflow API.
3123///
3124/// # Example
3125/// ```
3126/// # use google_cloud_dialogflow_v2::client::Documents;
3127/// use google_cloud_gax::paginator::ItemPaginator as _;
3128/// # async fn sample() -> Result<(), Box<dyn std::error::Error>> {
3129/// let client = Documents::builder().build().await?;
3130/// let parent = "parent_value";
3131/// let mut list = client.list_documents()
3132/// .set_parent(parent)
3133/// .by_item();
3134/// while let Some(item) = list.next().await.transpose()? {
3135/// println!("{:?}", item);
3136/// }
3137/// # Ok(()) }
3138/// ```
3139///
3140/// # Service Description
3141///
3142/// Service for managing knowledge
3143/// [Documents][google.cloud.dialogflow.v2.Document].
3144///
3145/// [google.cloud.dialogflow.v2.Document]: crate::model::Document
3146///
3147/// # Configuration
3148///
3149/// To configure `Documents` use the `with_*` methods in the type returned
3150/// by [builder()][Documents::builder]. The default configuration should
3151/// work for most applications. Common configuration changes include
3152///
3153/// * [with_endpoint()]: by default this client uses the global default endpoint
3154/// (`https://dialogflow.googleapis.com`). Applications using regional
3155/// endpoints or running in restricted networks (e.g. a network configured
3156// with [Private Google Access with VPC Service Controls]) may want to
3157/// override this default.
3158/// * [with_credentials()]: by default this client uses
3159/// [Application Default Credentials]. Applications using custom
3160/// authentication may need to override this default.
3161///
3162/// [with_endpoint()]: super::builder::documents::ClientBuilder::with_endpoint
3163/// [with_credentials()]: super::builder::documents::ClientBuilder::with_credentials
3164/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
3165/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
3166///
3167/// # Pooling and Cloning
3168///
3169/// `Documents` holds a connection pool internally, it is advised to
3170/// create one and reuse it. You do not need to wrap `Documents` in
3171/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
3172/// already uses an `Arc` internally.
3173#[cfg(feature = "documents")]
3174#[cfg_attr(docsrs, doc(cfg(feature = "documents")))]
3175#[derive(Clone, Debug)]
3176pub struct Documents {
3177 inner: std::sync::Arc<dyn super::stub::dynamic::Documents>,
3178}
3179
3180#[cfg(feature = "documents")]
3181impl Documents {
3182 /// Returns a builder for [Documents].
3183 ///
3184 /// ```
3185 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
3186 /// # use google_cloud_dialogflow_v2::client::Documents;
3187 /// let client = Documents::builder().build().await?;
3188 /// # Ok(()) }
3189 /// ```
3190 pub fn builder() -> super::builder::documents::ClientBuilder {
3191 crate::new_client_builder(super::builder::documents::client::Factory)
3192 }
3193
3194 /// Creates a new client from the provided stub.
3195 ///
3196 /// The most common case for calling this function is in tests mocking the
3197 /// client's behavior.
3198 pub fn from_stub<T>(stub: T) -> Self
3199 where
3200 T: super::stub::Documents + 'static,
3201 {
3202 Self {
3203 inner: std::sync::Arc::new(stub),
3204 }
3205 }
3206
3207 pub(crate) async fn new(
3208 config: gaxi::options::ClientConfig,
3209 ) -> crate::ClientBuilderResult<Self> {
3210 let inner = Self::build_inner(config).await?;
3211 Ok(Self { inner })
3212 }
3213
3214 async fn build_inner(
3215 conf: gaxi::options::ClientConfig,
3216 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::Documents>> {
3217 if gaxi::options::tracing_enabled(&conf) {
3218 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
3219 }
3220 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
3221 }
3222
3223 async fn build_transport(
3224 conf: gaxi::options::ClientConfig,
3225 ) -> crate::ClientBuilderResult<impl super::stub::Documents> {
3226 super::transport::Documents::new(conf).await
3227 }
3228
3229 async fn build_with_tracing(
3230 conf: gaxi::options::ClientConfig,
3231 ) -> crate::ClientBuilderResult<impl super::stub::Documents> {
3232 Self::build_transport(conf)
3233 .await
3234 .map(super::tracing::Documents::new)
3235 }
3236
3237 /// Returns the list of all documents of the knowledge base.
3238 ///
3239 /// # Example
3240 /// ```
3241 /// # use google_cloud_dialogflow_v2::client::Documents;
3242 /// use google_cloud_gax::paginator::ItemPaginator as _;
3243 /// use google_cloud_dialogflow_v2::Result;
3244 /// async fn sample(
3245 /// client: &Documents, parent: &str
3246 /// ) -> Result<()> {
3247 /// let mut list = client.list_documents()
3248 /// .set_parent(parent)
3249 /// .by_item();
3250 /// while let Some(item) = list.next().await.transpose()? {
3251 /// println!("{:?}", item);
3252 /// }
3253 /// Ok(())
3254 /// }
3255 /// ```
3256 pub fn list_documents(&self) -> super::builder::documents::ListDocuments {
3257 super::builder::documents::ListDocuments::new(self.inner.clone())
3258 }
3259
3260 /// Retrieves the specified document.
3261 ///
3262 /// # Example
3263 /// ```
3264 /// # use google_cloud_dialogflow_v2::client::Documents;
3265 /// use google_cloud_dialogflow_v2::Result;
3266 /// async fn sample(
3267 /// client: &Documents, name: &str
3268 /// ) -> Result<()> {
3269 /// let response = client.get_document()
3270 /// .set_name(name)
3271 /// .send().await?;
3272 /// println!("response {:?}", response);
3273 /// Ok(())
3274 /// }
3275 /// ```
3276 pub fn get_document(&self) -> super::builder::documents::GetDocument {
3277 super::builder::documents::GetDocument::new(self.inner.clone())
3278 }
3279
3280 /// Creates a new document.
3281 ///
3282 /// This method is a [long-running
3283 /// operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation).
3284 /// The returned `Operation` type has the following method-specific fields:
3285 ///
3286 /// - `metadata`:
3287 /// [KnowledgeOperationMetadata][google.cloud.dialogflow.v2.KnowledgeOperationMetadata]
3288 /// - `response`: [Document][google.cloud.dialogflow.v2.Document]
3289 ///
3290 /// [google.cloud.dialogflow.v2.Document]: crate::model::Document
3291 /// [google.cloud.dialogflow.v2.KnowledgeOperationMetadata]: crate::model::KnowledgeOperationMetadata
3292 ///
3293 /// # Long running operations
3294 ///
3295 /// This method is used to start, and/or poll a [long-running Operation].
3296 /// The [Working with long-running operations] chapter in the [user guide]
3297 /// covers these operations in detail.
3298 ///
3299 /// [long-running operation]: https://google.aip.dev/151
3300 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
3301 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
3302 ///
3303 /// # Example
3304 /// ```
3305 /// # use google_cloud_dialogflow_v2::client::Documents;
3306 /// use google_cloud_lro::Poller;
3307 /// use google_cloud_dialogflow_v2::model::Document;
3308 /// use google_cloud_dialogflow_v2::Result;
3309 /// async fn sample(
3310 /// client: &Documents, parent: &str
3311 /// ) -> Result<()> {
3312 /// let response = client.create_document()
3313 /// .set_parent(parent)
3314 /// .set_document(
3315 /// Document::new()/* set fields */
3316 /// )
3317 /// .poller().until_done().await?;
3318 /// println!("response {:?}", response);
3319 /// Ok(())
3320 /// }
3321 /// ```
3322 pub fn create_document(&self) -> super::builder::documents::CreateDocument {
3323 super::builder::documents::CreateDocument::new(self.inner.clone())
3324 }
3325
3326 /// Creates documents by importing data from external sources.
3327 /// Dialogflow supports up to 350 documents in each request. If you try to
3328 /// import more, Dialogflow will return an error.
3329 ///
3330 /// This method is a [long-running
3331 /// operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation).
3332 /// The returned `Operation` type has the following method-specific fields:
3333 ///
3334 /// - `metadata`:
3335 /// [KnowledgeOperationMetadata][google.cloud.dialogflow.v2.KnowledgeOperationMetadata]
3336 /// - `response`:
3337 /// [ImportDocumentsResponse][google.cloud.dialogflow.v2.ImportDocumentsResponse]
3338 ///
3339 /// [google.cloud.dialogflow.v2.ImportDocumentsResponse]: crate::model::ImportDocumentsResponse
3340 /// [google.cloud.dialogflow.v2.KnowledgeOperationMetadata]: crate::model::KnowledgeOperationMetadata
3341 ///
3342 /// # Long running operations
3343 ///
3344 /// This method is used to start, and/or poll a [long-running Operation].
3345 /// The [Working with long-running operations] chapter in the [user guide]
3346 /// covers these operations in detail.
3347 ///
3348 /// [long-running operation]: https://google.aip.dev/151
3349 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
3350 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
3351 ///
3352 /// # Example
3353 /// ```
3354 /// # use google_cloud_dialogflow_v2::client::Documents;
3355 /// use google_cloud_lro::Poller;
3356 /// use google_cloud_dialogflow_v2::Result;
3357 /// async fn sample(
3358 /// client: &Documents
3359 /// ) -> Result<()> {
3360 /// let response = client.import_documents()
3361 /// /* set fields */
3362 /// .poller().until_done().await?;
3363 /// println!("response {:?}", response);
3364 /// Ok(())
3365 /// }
3366 /// ```
3367 pub fn import_documents(&self) -> super::builder::documents::ImportDocuments {
3368 super::builder::documents::ImportDocuments::new(self.inner.clone())
3369 }
3370
3371 /// Deletes the specified document.
3372 ///
3373 /// This method is a [long-running
3374 /// operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation).
3375 /// The returned `Operation` type has the following method-specific fields:
3376 ///
3377 /// - `metadata`:
3378 /// [KnowledgeOperationMetadata][google.cloud.dialogflow.v2.KnowledgeOperationMetadata]
3379 /// - `response`: An [Empty
3380 /// message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
3381 ///
3382 /// [google.cloud.dialogflow.v2.KnowledgeOperationMetadata]: crate::model::KnowledgeOperationMetadata
3383 ///
3384 /// # Long running operations
3385 ///
3386 /// This method is used to start, and/or poll a [long-running Operation].
3387 /// The [Working with long-running operations] chapter in the [user guide]
3388 /// covers these operations in detail.
3389 ///
3390 /// [long-running operation]: https://google.aip.dev/151
3391 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
3392 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
3393 ///
3394 /// # Example
3395 /// ```
3396 /// # use google_cloud_dialogflow_v2::client::Documents;
3397 /// use google_cloud_lro::Poller;
3398 /// use google_cloud_dialogflow_v2::Result;
3399 /// async fn sample(
3400 /// client: &Documents, name: &str
3401 /// ) -> Result<()> {
3402 /// client.delete_document()
3403 /// .set_name(name)
3404 /// .poller().until_done().await?;
3405 /// Ok(())
3406 /// }
3407 /// ```
3408 pub fn delete_document(&self) -> super::builder::documents::DeleteDocument {
3409 super::builder::documents::DeleteDocument::new(self.inner.clone())
3410 }
3411
3412 /// Updates the specified document.
3413 ///
3414 /// This method is a [long-running
3415 /// operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation).
3416 /// The returned `Operation` type has the following method-specific fields:
3417 ///
3418 /// - `metadata`:
3419 /// [KnowledgeOperationMetadata][google.cloud.dialogflow.v2.KnowledgeOperationMetadata]
3420 /// - `response`: [Document][google.cloud.dialogflow.v2.Document]
3421 ///
3422 /// [google.cloud.dialogflow.v2.Document]: crate::model::Document
3423 /// [google.cloud.dialogflow.v2.KnowledgeOperationMetadata]: crate::model::KnowledgeOperationMetadata
3424 ///
3425 /// # Long running operations
3426 ///
3427 /// This method is used to start, and/or poll a [long-running Operation].
3428 /// The [Working with long-running operations] chapter in the [user guide]
3429 /// covers these operations in detail.
3430 ///
3431 /// [long-running operation]: https://google.aip.dev/151
3432 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
3433 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
3434 ///
3435 /// # Example
3436 /// ```
3437 /// # use google_cloud_dialogflow_v2::client::Documents;
3438 /// use google_cloud_lro::Poller;
3439 /// # extern crate wkt as google_cloud_wkt;
3440 /// use google_cloud_wkt::FieldMask;
3441 /// use google_cloud_dialogflow_v2::model::Document;
3442 /// use google_cloud_dialogflow_v2::Result;
3443 /// async fn sample(
3444 /// client: &Documents, name: &str
3445 /// ) -> Result<()> {
3446 /// let response = client.update_document()
3447 /// .set_document(
3448 /// Document::new().set_name(name)/* set fields */
3449 /// )
3450 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
3451 /// .poller().until_done().await?;
3452 /// println!("response {:?}", response);
3453 /// Ok(())
3454 /// }
3455 /// ```
3456 pub fn update_document(&self) -> super::builder::documents::UpdateDocument {
3457 super::builder::documents::UpdateDocument::new(self.inner.clone())
3458 }
3459
3460 /// Reloads the specified document from its specified source, content_uri or
3461 /// content. The previously loaded content of the document will be deleted.
3462 /// Note: Even when the content of the document has not changed, there still
3463 /// may be side effects because of internal implementation changes.
3464 ///
3465 /// This method is a [long-running
3466 /// operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation).
3467 /// The returned `Operation` type has the following method-specific fields:
3468 ///
3469 /// - `metadata`:
3470 /// [KnowledgeOperationMetadata][google.cloud.dialogflow.v2.KnowledgeOperationMetadata]
3471 /// - `response`: [Document][google.cloud.dialogflow.v2.Document]
3472 ///
3473 /// Note: The `projects.agent.knowledgeBases.documents` resource is deprecated;
3474 /// only use `projects.knowledgeBases.documents`.
3475 ///
3476 /// [google.cloud.dialogflow.v2.Document]: crate::model::Document
3477 /// [google.cloud.dialogflow.v2.KnowledgeOperationMetadata]: crate::model::KnowledgeOperationMetadata
3478 ///
3479 /// # Long running operations
3480 ///
3481 /// This method is used to start, and/or poll a [long-running Operation].
3482 /// The [Working with long-running operations] chapter in the [user guide]
3483 /// covers these operations in detail.
3484 ///
3485 /// [long-running operation]: https://google.aip.dev/151
3486 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
3487 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
3488 ///
3489 /// # Example
3490 /// ```
3491 /// # use google_cloud_dialogflow_v2::client::Documents;
3492 /// use google_cloud_lro::Poller;
3493 /// use google_cloud_dialogflow_v2::Result;
3494 /// async fn sample(
3495 /// client: &Documents
3496 /// ) -> Result<()> {
3497 /// let response = client.reload_document()
3498 /// /* set fields */
3499 /// .poller().until_done().await?;
3500 /// println!("response {:?}", response);
3501 /// Ok(())
3502 /// }
3503 /// ```
3504 pub fn reload_document(&self) -> super::builder::documents::ReloadDocument {
3505 super::builder::documents::ReloadDocument::new(self.inner.clone())
3506 }
3507
3508 /// Exports a smart messaging candidate document into the specified
3509 /// destination.
3510 ///
3511 /// This method is a [long-running
3512 /// operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation).
3513 /// The returned `Operation` type has the following method-specific fields:
3514 ///
3515 /// - `metadata`:
3516 /// [KnowledgeOperationMetadata][google.cloud.dialogflow.v2.KnowledgeOperationMetadata]
3517 /// - `response`: [Document][google.cloud.dialogflow.v2.Document]
3518 ///
3519 /// [google.cloud.dialogflow.v2.Document]: crate::model::Document
3520 /// [google.cloud.dialogflow.v2.KnowledgeOperationMetadata]: crate::model::KnowledgeOperationMetadata
3521 ///
3522 /// # Long running operations
3523 ///
3524 /// This method is used to start, and/or poll a [long-running Operation].
3525 /// The [Working with long-running operations] chapter in the [user guide]
3526 /// covers these operations in detail.
3527 ///
3528 /// [long-running operation]: https://google.aip.dev/151
3529 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
3530 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
3531 ///
3532 /// # Example
3533 /// ```
3534 /// # use google_cloud_dialogflow_v2::client::Documents;
3535 /// use google_cloud_lro::Poller;
3536 /// use google_cloud_dialogflow_v2::Result;
3537 /// async fn sample(
3538 /// client: &Documents
3539 /// ) -> Result<()> {
3540 /// let response = client.export_document()
3541 /// /* set fields */
3542 /// .poller().until_done().await?;
3543 /// println!("response {:?}", response);
3544 /// Ok(())
3545 /// }
3546 /// ```
3547 pub fn export_document(&self) -> super::builder::documents::ExportDocument {
3548 super::builder::documents::ExportDocument::new(self.inner.clone())
3549 }
3550
3551 /// Lists information about the supported locations for this service.
3552 ///
3553 /// # Example
3554 /// ```
3555 /// # use google_cloud_dialogflow_v2::client::Documents;
3556 /// use google_cloud_gax::paginator::ItemPaginator as _;
3557 /// use google_cloud_dialogflow_v2::Result;
3558 /// async fn sample(
3559 /// client: &Documents
3560 /// ) -> Result<()> {
3561 /// let mut list = client.list_locations()
3562 /// /* set fields */
3563 /// .by_item();
3564 /// while let Some(item) = list.next().await.transpose()? {
3565 /// println!("{:?}", item);
3566 /// }
3567 /// Ok(())
3568 /// }
3569 /// ```
3570 pub fn list_locations(&self) -> super::builder::documents::ListLocations {
3571 super::builder::documents::ListLocations::new(self.inner.clone())
3572 }
3573
3574 /// Gets information about a location.
3575 ///
3576 /// # Example
3577 /// ```
3578 /// # use google_cloud_dialogflow_v2::client::Documents;
3579 /// use google_cloud_dialogflow_v2::Result;
3580 /// async fn sample(
3581 /// client: &Documents
3582 /// ) -> Result<()> {
3583 /// let response = client.get_location()
3584 /// /* set fields */
3585 /// .send().await?;
3586 /// println!("response {:?}", response);
3587 /// Ok(())
3588 /// }
3589 /// ```
3590 pub fn get_location(&self) -> super::builder::documents::GetLocation {
3591 super::builder::documents::GetLocation::new(self.inner.clone())
3592 }
3593
3594 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3595 ///
3596 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
3597 ///
3598 /// # Example
3599 /// ```
3600 /// # use google_cloud_dialogflow_v2::client::Documents;
3601 /// use google_cloud_gax::paginator::ItemPaginator as _;
3602 /// use google_cloud_dialogflow_v2::Result;
3603 /// async fn sample(
3604 /// client: &Documents
3605 /// ) -> Result<()> {
3606 /// let mut list = client.list_operations()
3607 /// /* set fields */
3608 /// .by_item();
3609 /// while let Some(item) = list.next().await.transpose()? {
3610 /// println!("{:?}", item);
3611 /// }
3612 /// Ok(())
3613 /// }
3614 /// ```
3615 pub fn list_operations(&self) -> super::builder::documents::ListOperations {
3616 super::builder::documents::ListOperations::new(self.inner.clone())
3617 }
3618
3619 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3620 ///
3621 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
3622 ///
3623 /// # Example
3624 /// ```
3625 /// # use google_cloud_dialogflow_v2::client::Documents;
3626 /// use google_cloud_dialogflow_v2::Result;
3627 /// async fn sample(
3628 /// client: &Documents
3629 /// ) -> Result<()> {
3630 /// let response = client.get_operation()
3631 /// /* set fields */
3632 /// .send().await?;
3633 /// println!("response {:?}", response);
3634 /// Ok(())
3635 /// }
3636 /// ```
3637 pub fn get_operation(&self) -> super::builder::documents::GetOperation {
3638 super::builder::documents::GetOperation::new(self.inner.clone())
3639 }
3640
3641 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3642 ///
3643 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
3644 ///
3645 /// # Example
3646 /// ```
3647 /// # use google_cloud_dialogflow_v2::client::Documents;
3648 /// use google_cloud_dialogflow_v2::Result;
3649 /// async fn sample(
3650 /// client: &Documents
3651 /// ) -> Result<()> {
3652 /// client.cancel_operation()
3653 /// /* set fields */
3654 /// .send().await?;
3655 /// Ok(())
3656 /// }
3657 /// ```
3658 pub fn cancel_operation(&self) -> super::builder::documents::CancelOperation {
3659 super::builder::documents::CancelOperation::new(self.inner.clone())
3660 }
3661}
3662
3663/// Implements a client for the Dialogflow API.
3664///
3665/// # Example
3666/// ```
3667/// # use google_cloud_dialogflow_v2::client::EncryptionSpecService;
3668/// # async fn sample() -> Result<(), Box<dyn std::error::Error>> {
3669/// let client = EncryptionSpecService::builder().build().await?;
3670/// let name = "name_value";
3671/// let response = client.get_encryption_spec()
3672/// .set_name(name)
3673/// .send().await?;
3674/// println!("response {:?}", response);
3675/// # Ok(()) }
3676/// ```
3677///
3678/// # Service Description
3679///
3680/// Manages encryption spec settings for Dialogflow and Agent Assist.
3681///
3682/// # Configuration
3683///
3684/// To configure `EncryptionSpecService` use the `with_*` methods in the type returned
3685/// by [builder()][EncryptionSpecService::builder]. The default configuration should
3686/// work for most applications. Common configuration changes include
3687///
3688/// * [with_endpoint()]: by default this client uses the global default endpoint
3689/// (`https://dialogflow.googleapis.com`). Applications using regional
3690/// endpoints or running in restricted networks (e.g. a network configured
3691// with [Private Google Access with VPC Service Controls]) may want to
3692/// override this default.
3693/// * [with_credentials()]: by default this client uses
3694/// [Application Default Credentials]. Applications using custom
3695/// authentication may need to override this default.
3696///
3697/// [with_endpoint()]: super::builder::encryption_spec_service::ClientBuilder::with_endpoint
3698/// [with_credentials()]: super::builder::encryption_spec_service::ClientBuilder::with_credentials
3699/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
3700/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
3701///
3702/// # Pooling and Cloning
3703///
3704/// `EncryptionSpecService` holds a connection pool internally, it is advised to
3705/// create one and reuse it. You do not need to wrap `EncryptionSpecService` in
3706/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
3707/// already uses an `Arc` internally.
3708#[cfg(feature = "encryption-spec-service")]
3709#[cfg_attr(docsrs, doc(cfg(feature = "encryption-spec-service")))]
3710#[derive(Clone, Debug)]
3711pub struct EncryptionSpecService {
3712 inner: std::sync::Arc<dyn super::stub::dynamic::EncryptionSpecService>,
3713}
3714
3715#[cfg(feature = "encryption-spec-service")]
3716impl EncryptionSpecService {
3717 /// Returns a builder for [EncryptionSpecService].
3718 ///
3719 /// ```
3720 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
3721 /// # use google_cloud_dialogflow_v2::client::EncryptionSpecService;
3722 /// let client = EncryptionSpecService::builder().build().await?;
3723 /// # Ok(()) }
3724 /// ```
3725 pub fn builder() -> super::builder::encryption_spec_service::ClientBuilder {
3726 crate::new_client_builder(super::builder::encryption_spec_service::client::Factory)
3727 }
3728
3729 /// Creates a new client from the provided stub.
3730 ///
3731 /// The most common case for calling this function is in tests mocking the
3732 /// client's behavior.
3733 pub fn from_stub<T>(stub: T) -> Self
3734 where
3735 T: super::stub::EncryptionSpecService + 'static,
3736 {
3737 Self {
3738 inner: std::sync::Arc::new(stub),
3739 }
3740 }
3741
3742 pub(crate) async fn new(
3743 config: gaxi::options::ClientConfig,
3744 ) -> crate::ClientBuilderResult<Self> {
3745 let inner = Self::build_inner(config).await?;
3746 Ok(Self { inner })
3747 }
3748
3749 async fn build_inner(
3750 conf: gaxi::options::ClientConfig,
3751 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::EncryptionSpecService>>
3752 {
3753 if gaxi::options::tracing_enabled(&conf) {
3754 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
3755 }
3756 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
3757 }
3758
3759 async fn build_transport(
3760 conf: gaxi::options::ClientConfig,
3761 ) -> crate::ClientBuilderResult<impl super::stub::EncryptionSpecService> {
3762 super::transport::EncryptionSpecService::new(conf).await
3763 }
3764
3765 async fn build_with_tracing(
3766 conf: gaxi::options::ClientConfig,
3767 ) -> crate::ClientBuilderResult<impl super::stub::EncryptionSpecService> {
3768 Self::build_transport(conf)
3769 .await
3770 .map(super::tracing::EncryptionSpecService::new)
3771 }
3772
3773 /// Gets location-level encryption key specification.
3774 ///
3775 /// # Example
3776 /// ```
3777 /// # use google_cloud_dialogflow_v2::client::EncryptionSpecService;
3778 /// use google_cloud_dialogflow_v2::Result;
3779 /// async fn sample(
3780 /// client: &EncryptionSpecService, name: &str
3781 /// ) -> Result<()> {
3782 /// let response = client.get_encryption_spec()
3783 /// .set_name(name)
3784 /// .send().await?;
3785 /// println!("response {:?}", response);
3786 /// Ok(())
3787 /// }
3788 /// ```
3789 pub fn get_encryption_spec(
3790 &self,
3791 ) -> super::builder::encryption_spec_service::GetEncryptionSpec {
3792 super::builder::encryption_spec_service::GetEncryptionSpec::new(self.inner.clone())
3793 }
3794
3795 /// Initializes a location-level encryption key specification. An error will
3796 /// be thrown if the location has resources already created before the
3797 /// initialization. Once the encryption specification is initialized at a
3798 /// location, it is immutable and all newly created resources under the
3799 /// location will be encrypted with the existing specification.
3800 ///
3801 /// # Long running operations
3802 ///
3803 /// This method is used to start, and/or poll a [long-running Operation].
3804 /// The [Working with long-running operations] chapter in the [user guide]
3805 /// covers these operations in detail.
3806 ///
3807 /// [long-running operation]: https://google.aip.dev/151
3808 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
3809 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
3810 ///
3811 /// # Example
3812 /// ```
3813 /// # use google_cloud_dialogflow_v2::client::EncryptionSpecService;
3814 /// use google_cloud_lro::Poller;
3815 /// use google_cloud_dialogflow_v2::Result;
3816 /// async fn sample(
3817 /// client: &EncryptionSpecService
3818 /// ) -> Result<()> {
3819 /// let response = client.initialize_encryption_spec()
3820 /// /* set fields */
3821 /// .poller().until_done().await?;
3822 /// println!("response {:?}", response);
3823 /// Ok(())
3824 /// }
3825 /// ```
3826 pub fn initialize_encryption_spec(
3827 &self,
3828 ) -> super::builder::encryption_spec_service::InitializeEncryptionSpec {
3829 super::builder::encryption_spec_service::InitializeEncryptionSpec::new(self.inner.clone())
3830 }
3831
3832 /// Lists information about the supported locations for this service.
3833 ///
3834 /// # Example
3835 /// ```
3836 /// # use google_cloud_dialogflow_v2::client::EncryptionSpecService;
3837 /// use google_cloud_gax::paginator::ItemPaginator as _;
3838 /// use google_cloud_dialogflow_v2::Result;
3839 /// async fn sample(
3840 /// client: &EncryptionSpecService
3841 /// ) -> Result<()> {
3842 /// let mut list = client.list_locations()
3843 /// /* set fields */
3844 /// .by_item();
3845 /// while let Some(item) = list.next().await.transpose()? {
3846 /// println!("{:?}", item);
3847 /// }
3848 /// Ok(())
3849 /// }
3850 /// ```
3851 pub fn list_locations(&self) -> super::builder::encryption_spec_service::ListLocations {
3852 super::builder::encryption_spec_service::ListLocations::new(self.inner.clone())
3853 }
3854
3855 /// Gets information about a location.
3856 ///
3857 /// # Example
3858 /// ```
3859 /// # use google_cloud_dialogflow_v2::client::EncryptionSpecService;
3860 /// use google_cloud_dialogflow_v2::Result;
3861 /// async fn sample(
3862 /// client: &EncryptionSpecService
3863 /// ) -> Result<()> {
3864 /// let response = client.get_location()
3865 /// /* set fields */
3866 /// .send().await?;
3867 /// println!("response {:?}", response);
3868 /// Ok(())
3869 /// }
3870 /// ```
3871 pub fn get_location(&self) -> super::builder::encryption_spec_service::GetLocation {
3872 super::builder::encryption_spec_service::GetLocation::new(self.inner.clone())
3873 }
3874
3875 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3876 ///
3877 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
3878 ///
3879 /// # Example
3880 /// ```
3881 /// # use google_cloud_dialogflow_v2::client::EncryptionSpecService;
3882 /// use google_cloud_gax::paginator::ItemPaginator as _;
3883 /// use google_cloud_dialogflow_v2::Result;
3884 /// async fn sample(
3885 /// client: &EncryptionSpecService
3886 /// ) -> Result<()> {
3887 /// let mut list = client.list_operations()
3888 /// /* set fields */
3889 /// .by_item();
3890 /// while let Some(item) = list.next().await.transpose()? {
3891 /// println!("{:?}", item);
3892 /// }
3893 /// Ok(())
3894 /// }
3895 /// ```
3896 pub fn list_operations(&self) -> super::builder::encryption_spec_service::ListOperations {
3897 super::builder::encryption_spec_service::ListOperations::new(self.inner.clone())
3898 }
3899
3900 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3901 ///
3902 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
3903 ///
3904 /// # Example
3905 /// ```
3906 /// # use google_cloud_dialogflow_v2::client::EncryptionSpecService;
3907 /// use google_cloud_dialogflow_v2::Result;
3908 /// async fn sample(
3909 /// client: &EncryptionSpecService
3910 /// ) -> Result<()> {
3911 /// let response = client.get_operation()
3912 /// /* set fields */
3913 /// .send().await?;
3914 /// println!("response {:?}", response);
3915 /// Ok(())
3916 /// }
3917 /// ```
3918 pub fn get_operation(&self) -> super::builder::encryption_spec_service::GetOperation {
3919 super::builder::encryption_spec_service::GetOperation::new(self.inner.clone())
3920 }
3921
3922 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3923 ///
3924 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
3925 ///
3926 /// # Example
3927 /// ```
3928 /// # use google_cloud_dialogflow_v2::client::EncryptionSpecService;
3929 /// use google_cloud_dialogflow_v2::Result;
3930 /// async fn sample(
3931 /// client: &EncryptionSpecService
3932 /// ) -> Result<()> {
3933 /// client.cancel_operation()
3934 /// /* set fields */
3935 /// .send().await?;
3936 /// Ok(())
3937 /// }
3938 /// ```
3939 pub fn cancel_operation(&self) -> super::builder::encryption_spec_service::CancelOperation {
3940 super::builder::encryption_spec_service::CancelOperation::new(self.inner.clone())
3941 }
3942}
3943
3944/// Implements a client for the Dialogflow API.
3945///
3946/// # Example
3947/// ```
3948/// # use google_cloud_dialogflow_v2::client::EntityTypes;
3949/// use google_cloud_gax::paginator::ItemPaginator as _;
3950/// # async fn sample() -> Result<(), Box<dyn std::error::Error>> {
3951/// let client = EntityTypes::builder().build().await?;
3952/// let parent = "parent_value";
3953/// let mut list = client.list_entity_types()
3954/// .set_parent(parent)
3955/// .by_item();
3956/// while let Some(item) = list.next().await.transpose()? {
3957/// println!("{:?}", item);
3958/// }
3959/// # Ok(()) }
3960/// ```
3961///
3962/// # Service Description
3963///
3964/// Service for managing [EntityTypes][google.cloud.dialogflow.v2.EntityType].
3965///
3966/// [google.cloud.dialogflow.v2.EntityType]: crate::model::EntityType
3967///
3968/// # Configuration
3969///
3970/// To configure `EntityTypes` use the `with_*` methods in the type returned
3971/// by [builder()][EntityTypes::builder]. The default configuration should
3972/// work for most applications. Common configuration changes include
3973///
3974/// * [with_endpoint()]: by default this client uses the global default endpoint
3975/// (`https://dialogflow.googleapis.com`). Applications using regional
3976/// endpoints or running in restricted networks (e.g. a network configured
3977// with [Private Google Access with VPC Service Controls]) may want to
3978/// override this default.
3979/// * [with_credentials()]: by default this client uses
3980/// [Application Default Credentials]. Applications using custom
3981/// authentication may need to override this default.
3982///
3983/// [with_endpoint()]: super::builder::entity_types::ClientBuilder::with_endpoint
3984/// [with_credentials()]: super::builder::entity_types::ClientBuilder::with_credentials
3985/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
3986/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
3987///
3988/// # Pooling and Cloning
3989///
3990/// `EntityTypes` holds a connection pool internally, it is advised to
3991/// create one and reuse it. You do not need to wrap `EntityTypes` in
3992/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
3993/// already uses an `Arc` internally.
3994#[cfg(feature = "entity-types")]
3995#[cfg_attr(docsrs, doc(cfg(feature = "entity-types")))]
3996#[derive(Clone, Debug)]
3997pub struct EntityTypes {
3998 inner: std::sync::Arc<dyn super::stub::dynamic::EntityTypes>,
3999}
4000
4001#[cfg(feature = "entity-types")]
4002impl EntityTypes {
4003 /// Returns a builder for [EntityTypes].
4004 ///
4005 /// ```
4006 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
4007 /// # use google_cloud_dialogflow_v2::client::EntityTypes;
4008 /// let client = EntityTypes::builder().build().await?;
4009 /// # Ok(()) }
4010 /// ```
4011 pub fn builder() -> super::builder::entity_types::ClientBuilder {
4012 crate::new_client_builder(super::builder::entity_types::client::Factory)
4013 }
4014
4015 /// Creates a new client from the provided stub.
4016 ///
4017 /// The most common case for calling this function is in tests mocking the
4018 /// client's behavior.
4019 pub fn from_stub<T>(stub: T) -> Self
4020 where
4021 T: super::stub::EntityTypes + 'static,
4022 {
4023 Self {
4024 inner: std::sync::Arc::new(stub),
4025 }
4026 }
4027
4028 pub(crate) async fn new(
4029 config: gaxi::options::ClientConfig,
4030 ) -> crate::ClientBuilderResult<Self> {
4031 let inner = Self::build_inner(config).await?;
4032 Ok(Self { inner })
4033 }
4034
4035 async fn build_inner(
4036 conf: gaxi::options::ClientConfig,
4037 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::EntityTypes>> {
4038 if gaxi::options::tracing_enabled(&conf) {
4039 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
4040 }
4041 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
4042 }
4043
4044 async fn build_transport(
4045 conf: gaxi::options::ClientConfig,
4046 ) -> crate::ClientBuilderResult<impl super::stub::EntityTypes> {
4047 super::transport::EntityTypes::new(conf).await
4048 }
4049
4050 async fn build_with_tracing(
4051 conf: gaxi::options::ClientConfig,
4052 ) -> crate::ClientBuilderResult<impl super::stub::EntityTypes> {
4053 Self::build_transport(conf)
4054 .await
4055 .map(super::tracing::EntityTypes::new)
4056 }
4057
4058 /// Returns the list of all entity types in the specified agent.
4059 ///
4060 /// # Example
4061 /// ```
4062 /// # use google_cloud_dialogflow_v2::client::EntityTypes;
4063 /// use google_cloud_gax::paginator::ItemPaginator as _;
4064 /// use google_cloud_dialogflow_v2::Result;
4065 /// async fn sample(
4066 /// client: &EntityTypes, parent: &str
4067 /// ) -> Result<()> {
4068 /// let mut list = client.list_entity_types()
4069 /// .set_parent(parent)
4070 /// .by_item();
4071 /// while let Some(item) = list.next().await.transpose()? {
4072 /// println!("{:?}", item);
4073 /// }
4074 /// Ok(())
4075 /// }
4076 /// ```
4077 pub fn list_entity_types(&self) -> super::builder::entity_types::ListEntityTypes {
4078 super::builder::entity_types::ListEntityTypes::new(self.inner.clone())
4079 }
4080
4081 /// Retrieves the specified entity type.
4082 ///
4083 /// # Example
4084 /// ```
4085 /// # use google_cloud_dialogflow_v2::client::EntityTypes;
4086 /// use google_cloud_dialogflow_v2::Result;
4087 /// async fn sample(
4088 /// client: &EntityTypes, name: &str
4089 /// ) -> Result<()> {
4090 /// let response = client.get_entity_type()
4091 /// .set_name(name)
4092 /// .send().await?;
4093 /// println!("response {:?}", response);
4094 /// Ok(())
4095 /// }
4096 /// ```
4097 pub fn get_entity_type(&self) -> super::builder::entity_types::GetEntityType {
4098 super::builder::entity_types::GetEntityType::new(self.inner.clone())
4099 }
4100
4101 /// Creates an entity type in the specified agent.
4102 ///
4103 /// Note: You should always train an agent prior to sending it queries. See the
4104 /// [training
4105 /// documentation](https://cloud.google.com/dialogflow/es/docs/training).
4106 ///
4107 /// # Example
4108 /// ```
4109 /// # use google_cloud_dialogflow_v2::client::EntityTypes;
4110 /// use google_cloud_dialogflow_v2::model::EntityType;
4111 /// use google_cloud_dialogflow_v2::Result;
4112 /// async fn sample(
4113 /// client: &EntityTypes, parent: &str
4114 /// ) -> Result<()> {
4115 /// let response = client.create_entity_type()
4116 /// .set_parent(parent)
4117 /// .set_entity_type(
4118 /// EntityType::new()/* set fields */
4119 /// )
4120 /// .send().await?;
4121 /// println!("response {:?}", response);
4122 /// Ok(())
4123 /// }
4124 /// ```
4125 pub fn create_entity_type(&self) -> super::builder::entity_types::CreateEntityType {
4126 super::builder::entity_types::CreateEntityType::new(self.inner.clone())
4127 }
4128
4129 /// Updates the specified entity type.
4130 ///
4131 /// Note: You should always train an agent prior to sending it queries. See the
4132 /// [training
4133 /// documentation](https://cloud.google.com/dialogflow/es/docs/training).
4134 ///
4135 /// # Example
4136 /// ```
4137 /// # use google_cloud_dialogflow_v2::client::EntityTypes;
4138 /// # extern crate wkt as google_cloud_wkt;
4139 /// use google_cloud_wkt::FieldMask;
4140 /// use google_cloud_dialogflow_v2::model::EntityType;
4141 /// use google_cloud_dialogflow_v2::Result;
4142 /// async fn sample(
4143 /// client: &EntityTypes, name: &str
4144 /// ) -> Result<()> {
4145 /// let response = client.update_entity_type()
4146 /// .set_entity_type(
4147 /// EntityType::new().set_name(name)/* set fields */
4148 /// )
4149 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
4150 /// .send().await?;
4151 /// println!("response {:?}", response);
4152 /// Ok(())
4153 /// }
4154 /// ```
4155 pub fn update_entity_type(&self) -> super::builder::entity_types::UpdateEntityType {
4156 super::builder::entity_types::UpdateEntityType::new(self.inner.clone())
4157 }
4158
4159 /// Deletes the specified entity type.
4160 ///
4161 /// Note: You should always train an agent prior to sending it queries. See the
4162 /// [training
4163 /// documentation](https://cloud.google.com/dialogflow/es/docs/training).
4164 ///
4165 /// # Example
4166 /// ```
4167 /// # use google_cloud_dialogflow_v2::client::EntityTypes;
4168 /// use google_cloud_dialogflow_v2::Result;
4169 /// async fn sample(
4170 /// client: &EntityTypes, name: &str
4171 /// ) -> Result<()> {
4172 /// client.delete_entity_type()
4173 /// .set_name(name)
4174 /// .send().await?;
4175 /// Ok(())
4176 /// }
4177 /// ```
4178 pub fn delete_entity_type(&self) -> super::builder::entity_types::DeleteEntityType {
4179 super::builder::entity_types::DeleteEntityType::new(self.inner.clone())
4180 }
4181
4182 /// Updates/Creates multiple entity types in the specified agent.
4183 ///
4184 /// This method is a [long-running
4185 /// operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations).
4186 /// The returned `Operation` type has the following method-specific fields:
4187 ///
4188 /// - `metadata`: An empty [Struct
4189 /// message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct)
4190 /// - `response`:
4191 /// [BatchUpdateEntityTypesResponse][google.cloud.dialogflow.v2.BatchUpdateEntityTypesResponse]
4192 ///
4193 /// Note: You should always train an agent prior to sending it queries. See the
4194 /// [training
4195 /// documentation](https://cloud.google.com/dialogflow/es/docs/training).
4196 ///
4197 /// [google.cloud.dialogflow.v2.BatchUpdateEntityTypesResponse]: crate::model::BatchUpdateEntityTypesResponse
4198 ///
4199 /// # Long running operations
4200 ///
4201 /// This method is used to start, and/or poll a [long-running Operation].
4202 /// The [Working with long-running operations] chapter in the [user guide]
4203 /// covers these operations in detail.
4204 ///
4205 /// [long-running operation]: https://google.aip.dev/151
4206 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
4207 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
4208 ///
4209 /// # Example
4210 /// ```
4211 /// # use google_cloud_dialogflow_v2::client::EntityTypes;
4212 /// use google_cloud_lro::Poller;
4213 /// use google_cloud_dialogflow_v2::Result;
4214 /// async fn sample(
4215 /// client: &EntityTypes
4216 /// ) -> Result<()> {
4217 /// let response = client.batch_update_entity_types()
4218 /// /* set fields */
4219 /// .poller().until_done().await?;
4220 /// println!("response {:?}", response);
4221 /// Ok(())
4222 /// }
4223 /// ```
4224 pub fn batch_update_entity_types(
4225 &self,
4226 ) -> super::builder::entity_types::BatchUpdateEntityTypes {
4227 super::builder::entity_types::BatchUpdateEntityTypes::new(self.inner.clone())
4228 }
4229
4230 /// Deletes entity types in the specified agent.
4231 ///
4232 /// This method is a [long-running
4233 /// operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations).
4234 /// The returned `Operation` type has the following method-specific fields:
4235 ///
4236 /// - `metadata`: An empty [Struct
4237 /// message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct)
4238 /// - `response`: An [Empty
4239 /// message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
4240 ///
4241 /// Note: You should always train an agent prior to sending it queries. See the
4242 /// [training
4243 /// documentation](https://cloud.google.com/dialogflow/es/docs/training).
4244 ///
4245 /// # Long running operations
4246 ///
4247 /// This method is used to start, and/or poll a [long-running Operation].
4248 /// The [Working with long-running operations] chapter in the [user guide]
4249 /// covers these operations in detail.
4250 ///
4251 /// [long-running operation]: https://google.aip.dev/151
4252 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
4253 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
4254 ///
4255 /// # Example
4256 /// ```
4257 /// # use google_cloud_dialogflow_v2::client::EntityTypes;
4258 /// use google_cloud_lro::Poller;
4259 /// use google_cloud_dialogflow_v2::Result;
4260 /// async fn sample(
4261 /// client: &EntityTypes
4262 /// ) -> Result<()> {
4263 /// client.batch_delete_entity_types()
4264 /// /* set fields */
4265 /// .poller().until_done().await?;
4266 /// Ok(())
4267 /// }
4268 /// ```
4269 pub fn batch_delete_entity_types(
4270 &self,
4271 ) -> super::builder::entity_types::BatchDeleteEntityTypes {
4272 super::builder::entity_types::BatchDeleteEntityTypes::new(self.inner.clone())
4273 }
4274
4275 /// Creates multiple new entities in the specified entity type.
4276 ///
4277 /// This method is a [long-running
4278 /// operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations).
4279 /// The returned `Operation` type has the following method-specific fields:
4280 ///
4281 /// - `metadata`: An empty [Struct
4282 /// message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct)
4283 /// - `response`: An [Empty
4284 /// message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
4285 ///
4286 /// Note: You should always train an agent prior to sending it queries. See the
4287 /// [training
4288 /// documentation](https://cloud.google.com/dialogflow/es/docs/training).
4289 ///
4290 /// # Long running operations
4291 ///
4292 /// This method is used to start, and/or poll a [long-running Operation].
4293 /// The [Working with long-running operations] chapter in the [user guide]
4294 /// covers these operations in detail.
4295 ///
4296 /// [long-running operation]: https://google.aip.dev/151
4297 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
4298 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
4299 ///
4300 /// # Example
4301 /// ```
4302 /// # use google_cloud_dialogflow_v2::client::EntityTypes;
4303 /// use google_cloud_lro::Poller;
4304 /// use google_cloud_dialogflow_v2::Result;
4305 /// async fn sample(
4306 /// client: &EntityTypes
4307 /// ) -> Result<()> {
4308 /// client.batch_create_entities()
4309 /// /* set fields */
4310 /// .poller().until_done().await?;
4311 /// Ok(())
4312 /// }
4313 /// ```
4314 pub fn batch_create_entities(&self) -> super::builder::entity_types::BatchCreateEntities {
4315 super::builder::entity_types::BatchCreateEntities::new(self.inner.clone())
4316 }
4317
4318 /// Updates or creates multiple entities in the specified entity type. This
4319 /// method does not affect entities in the entity type that aren't explicitly
4320 /// specified in the request.
4321 ///
4322 /// This method is a [long-running
4323 /// operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations).
4324 /// The returned `Operation` type has the following method-specific fields:
4325 ///
4326 /// - `metadata`: An empty [Struct
4327 /// message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct)
4328 /// - `response`: An [Empty
4329 /// message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
4330 ///
4331 /// Note: You should always train an agent prior to sending it queries. See the
4332 /// [training
4333 /// documentation](https://cloud.google.com/dialogflow/es/docs/training).
4334 ///
4335 /// # Long running operations
4336 ///
4337 /// This method is used to start, and/or poll a [long-running Operation].
4338 /// The [Working with long-running operations] chapter in the [user guide]
4339 /// covers these operations in detail.
4340 ///
4341 /// [long-running operation]: https://google.aip.dev/151
4342 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
4343 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
4344 ///
4345 /// # Example
4346 /// ```
4347 /// # use google_cloud_dialogflow_v2::client::EntityTypes;
4348 /// use google_cloud_lro::Poller;
4349 /// use google_cloud_dialogflow_v2::Result;
4350 /// async fn sample(
4351 /// client: &EntityTypes
4352 /// ) -> Result<()> {
4353 /// client.batch_update_entities()
4354 /// /* set fields */
4355 /// .poller().until_done().await?;
4356 /// Ok(())
4357 /// }
4358 /// ```
4359 pub fn batch_update_entities(&self) -> super::builder::entity_types::BatchUpdateEntities {
4360 super::builder::entity_types::BatchUpdateEntities::new(self.inner.clone())
4361 }
4362
4363 /// Deletes entities in the specified entity type.
4364 ///
4365 /// This method is a [long-running
4366 /// operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations).
4367 /// The returned `Operation` type has the following method-specific fields:
4368 ///
4369 /// - `metadata`: An empty [Struct
4370 /// message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct)
4371 /// - `response`: An [Empty
4372 /// message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
4373 ///
4374 /// Note: You should always train an agent prior to sending it queries. See the
4375 /// [training
4376 /// documentation](https://cloud.google.com/dialogflow/es/docs/training).
4377 ///
4378 /// # Long running operations
4379 ///
4380 /// This method is used to start, and/or poll a [long-running Operation].
4381 /// The [Working with long-running operations] chapter in the [user guide]
4382 /// covers these operations in detail.
4383 ///
4384 /// [long-running operation]: https://google.aip.dev/151
4385 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
4386 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
4387 ///
4388 /// # Example
4389 /// ```
4390 /// # use google_cloud_dialogflow_v2::client::EntityTypes;
4391 /// use google_cloud_lro::Poller;
4392 /// use google_cloud_dialogflow_v2::Result;
4393 /// async fn sample(
4394 /// client: &EntityTypes
4395 /// ) -> Result<()> {
4396 /// client.batch_delete_entities()
4397 /// /* set fields */
4398 /// .poller().until_done().await?;
4399 /// Ok(())
4400 /// }
4401 /// ```
4402 pub fn batch_delete_entities(&self) -> super::builder::entity_types::BatchDeleteEntities {
4403 super::builder::entity_types::BatchDeleteEntities::new(self.inner.clone())
4404 }
4405
4406 /// Lists information about the supported locations for this service.
4407 ///
4408 /// # Example
4409 /// ```
4410 /// # use google_cloud_dialogflow_v2::client::EntityTypes;
4411 /// use google_cloud_gax::paginator::ItemPaginator as _;
4412 /// use google_cloud_dialogflow_v2::Result;
4413 /// async fn sample(
4414 /// client: &EntityTypes
4415 /// ) -> Result<()> {
4416 /// let mut list = client.list_locations()
4417 /// /* set fields */
4418 /// .by_item();
4419 /// while let Some(item) = list.next().await.transpose()? {
4420 /// println!("{:?}", item);
4421 /// }
4422 /// Ok(())
4423 /// }
4424 /// ```
4425 pub fn list_locations(&self) -> super::builder::entity_types::ListLocations {
4426 super::builder::entity_types::ListLocations::new(self.inner.clone())
4427 }
4428
4429 /// Gets information about a location.
4430 ///
4431 /// # Example
4432 /// ```
4433 /// # use google_cloud_dialogflow_v2::client::EntityTypes;
4434 /// use google_cloud_dialogflow_v2::Result;
4435 /// async fn sample(
4436 /// client: &EntityTypes
4437 /// ) -> Result<()> {
4438 /// let response = client.get_location()
4439 /// /* set fields */
4440 /// .send().await?;
4441 /// println!("response {:?}", response);
4442 /// Ok(())
4443 /// }
4444 /// ```
4445 pub fn get_location(&self) -> super::builder::entity_types::GetLocation {
4446 super::builder::entity_types::GetLocation::new(self.inner.clone())
4447 }
4448
4449 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
4450 ///
4451 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
4452 ///
4453 /// # Example
4454 /// ```
4455 /// # use google_cloud_dialogflow_v2::client::EntityTypes;
4456 /// use google_cloud_gax::paginator::ItemPaginator as _;
4457 /// use google_cloud_dialogflow_v2::Result;
4458 /// async fn sample(
4459 /// client: &EntityTypes
4460 /// ) -> Result<()> {
4461 /// let mut list = client.list_operations()
4462 /// /* set fields */
4463 /// .by_item();
4464 /// while let Some(item) = list.next().await.transpose()? {
4465 /// println!("{:?}", item);
4466 /// }
4467 /// Ok(())
4468 /// }
4469 /// ```
4470 pub fn list_operations(&self) -> super::builder::entity_types::ListOperations {
4471 super::builder::entity_types::ListOperations::new(self.inner.clone())
4472 }
4473
4474 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
4475 ///
4476 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
4477 ///
4478 /// # Example
4479 /// ```
4480 /// # use google_cloud_dialogflow_v2::client::EntityTypes;
4481 /// use google_cloud_dialogflow_v2::Result;
4482 /// async fn sample(
4483 /// client: &EntityTypes
4484 /// ) -> Result<()> {
4485 /// let response = client.get_operation()
4486 /// /* set fields */
4487 /// .send().await?;
4488 /// println!("response {:?}", response);
4489 /// Ok(())
4490 /// }
4491 /// ```
4492 pub fn get_operation(&self) -> super::builder::entity_types::GetOperation {
4493 super::builder::entity_types::GetOperation::new(self.inner.clone())
4494 }
4495
4496 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
4497 ///
4498 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
4499 ///
4500 /// # Example
4501 /// ```
4502 /// # use google_cloud_dialogflow_v2::client::EntityTypes;
4503 /// use google_cloud_dialogflow_v2::Result;
4504 /// async fn sample(
4505 /// client: &EntityTypes
4506 /// ) -> Result<()> {
4507 /// client.cancel_operation()
4508 /// /* set fields */
4509 /// .send().await?;
4510 /// Ok(())
4511 /// }
4512 /// ```
4513 pub fn cancel_operation(&self) -> super::builder::entity_types::CancelOperation {
4514 super::builder::entity_types::CancelOperation::new(self.inner.clone())
4515 }
4516}
4517
4518/// Implements a client for the Dialogflow API.
4519///
4520/// # Example
4521/// ```
4522/// # use google_cloud_dialogflow_v2::client::Environments;
4523/// use google_cloud_gax::paginator::ItemPaginator as _;
4524/// # async fn sample() -> Result<(), Box<dyn std::error::Error>> {
4525/// let client = Environments::builder().build().await?;
4526/// let parent = "parent_value";
4527/// let mut list = client.list_environments()
4528/// .set_parent(parent)
4529/// .by_item();
4530/// while let Some(item) = list.next().await.transpose()? {
4531/// println!("{:?}", item);
4532/// }
4533/// # Ok(()) }
4534/// ```
4535///
4536/// # Service Description
4537///
4538/// Service for managing [Environments][google.cloud.dialogflow.v2.Environment].
4539///
4540/// [google.cloud.dialogflow.v2.Environment]: crate::model::Environment
4541///
4542/// # Configuration
4543///
4544/// To configure `Environments` use the `with_*` methods in the type returned
4545/// by [builder()][Environments::builder]. The default configuration should
4546/// work for most applications. Common configuration changes include
4547///
4548/// * [with_endpoint()]: by default this client uses the global default endpoint
4549/// (`https://dialogflow.googleapis.com`). Applications using regional
4550/// endpoints or running in restricted networks (e.g. a network configured
4551// with [Private Google Access with VPC Service Controls]) may want to
4552/// override this default.
4553/// * [with_credentials()]: by default this client uses
4554/// [Application Default Credentials]. Applications using custom
4555/// authentication may need to override this default.
4556///
4557/// [with_endpoint()]: super::builder::environments::ClientBuilder::with_endpoint
4558/// [with_credentials()]: super::builder::environments::ClientBuilder::with_credentials
4559/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
4560/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
4561///
4562/// # Pooling and Cloning
4563///
4564/// `Environments` holds a connection pool internally, it is advised to
4565/// create one and reuse it. You do not need to wrap `Environments` in
4566/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
4567/// already uses an `Arc` internally.
4568#[cfg(feature = "environments")]
4569#[cfg_attr(docsrs, doc(cfg(feature = "environments")))]
4570#[derive(Clone, Debug)]
4571pub struct Environments {
4572 inner: std::sync::Arc<dyn super::stub::dynamic::Environments>,
4573}
4574
4575#[cfg(feature = "environments")]
4576impl Environments {
4577 /// Returns a builder for [Environments].
4578 ///
4579 /// ```
4580 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
4581 /// # use google_cloud_dialogflow_v2::client::Environments;
4582 /// let client = Environments::builder().build().await?;
4583 /// # Ok(()) }
4584 /// ```
4585 pub fn builder() -> super::builder::environments::ClientBuilder {
4586 crate::new_client_builder(super::builder::environments::client::Factory)
4587 }
4588
4589 /// Creates a new client from the provided stub.
4590 ///
4591 /// The most common case for calling this function is in tests mocking the
4592 /// client's behavior.
4593 pub fn from_stub<T>(stub: T) -> Self
4594 where
4595 T: super::stub::Environments + 'static,
4596 {
4597 Self {
4598 inner: std::sync::Arc::new(stub),
4599 }
4600 }
4601
4602 pub(crate) async fn new(
4603 config: gaxi::options::ClientConfig,
4604 ) -> crate::ClientBuilderResult<Self> {
4605 let inner = Self::build_inner(config).await?;
4606 Ok(Self { inner })
4607 }
4608
4609 async fn build_inner(
4610 conf: gaxi::options::ClientConfig,
4611 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::Environments>> {
4612 if gaxi::options::tracing_enabled(&conf) {
4613 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
4614 }
4615 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
4616 }
4617
4618 async fn build_transport(
4619 conf: gaxi::options::ClientConfig,
4620 ) -> crate::ClientBuilderResult<impl super::stub::Environments> {
4621 super::transport::Environments::new(conf).await
4622 }
4623
4624 async fn build_with_tracing(
4625 conf: gaxi::options::ClientConfig,
4626 ) -> crate::ClientBuilderResult<impl super::stub::Environments> {
4627 Self::build_transport(conf)
4628 .await
4629 .map(super::tracing::Environments::new)
4630 }
4631
4632 /// Returns the list of all non-default environments of the specified agent.
4633 ///
4634 /// # Example
4635 /// ```
4636 /// # use google_cloud_dialogflow_v2::client::Environments;
4637 /// use google_cloud_gax::paginator::ItemPaginator as _;
4638 /// use google_cloud_dialogflow_v2::Result;
4639 /// async fn sample(
4640 /// client: &Environments, parent: &str
4641 /// ) -> Result<()> {
4642 /// let mut list = client.list_environments()
4643 /// .set_parent(parent)
4644 /// .by_item();
4645 /// while let Some(item) = list.next().await.transpose()? {
4646 /// println!("{:?}", item);
4647 /// }
4648 /// Ok(())
4649 /// }
4650 /// ```
4651 pub fn list_environments(&self) -> super::builder::environments::ListEnvironments {
4652 super::builder::environments::ListEnvironments::new(self.inner.clone())
4653 }
4654
4655 /// Retrieves the specified agent environment.
4656 ///
4657 /// # Example
4658 /// ```
4659 /// # use google_cloud_dialogflow_v2::client::Environments;
4660 /// use google_cloud_dialogflow_v2::Result;
4661 /// async fn sample(
4662 /// client: &Environments, name: &str
4663 /// ) -> Result<()> {
4664 /// let response = client.get_environment()
4665 /// .set_name(name)
4666 /// .send().await?;
4667 /// println!("response {:?}", response);
4668 /// Ok(())
4669 /// }
4670 /// ```
4671 pub fn get_environment(&self) -> super::builder::environments::GetEnvironment {
4672 super::builder::environments::GetEnvironment::new(self.inner.clone())
4673 }
4674
4675 /// Creates an agent environment.
4676 ///
4677 /// # Example
4678 /// ```
4679 /// # use google_cloud_dialogflow_v2::client::Environments;
4680 /// use google_cloud_dialogflow_v2::model::Environment;
4681 /// use google_cloud_dialogflow_v2::Result;
4682 /// async fn sample(
4683 /// client: &Environments, parent: &str
4684 /// ) -> Result<()> {
4685 /// let response = client.create_environment()
4686 /// .set_parent(parent)
4687 /// .set_environment_id("environment_id_value")
4688 /// .set_environment(
4689 /// Environment::new()/* set fields */
4690 /// )
4691 /// .send().await?;
4692 /// println!("response {:?}", response);
4693 /// Ok(())
4694 /// }
4695 /// ```
4696 pub fn create_environment(&self) -> super::builder::environments::CreateEnvironment {
4697 super::builder::environments::CreateEnvironment::new(self.inner.clone())
4698 }
4699
4700 /// Updates the specified agent environment.
4701 ///
4702 /// This method allows you to deploy new agent versions into the environment.
4703 /// When an environment is pointed to a new agent version by setting
4704 /// `environment.agent_version`, the environment is temporarily set to the
4705 /// `LOADING` state. During that time, the environment continues serving the
4706 /// previous version of the agent. After the new agent version is done loading,
4707 /// the environment is set back to the `RUNNING` state.
4708 /// You can use "-" as Environment ID in environment name to update an agent
4709 /// version in the default environment. WARNING: this will negate all recent
4710 /// changes to the draft agent and can't be undone. You may want to save the
4711 /// draft agent to a version before calling this method.
4712 ///
4713 /// # Example
4714 /// ```
4715 /// # use google_cloud_dialogflow_v2::client::Environments;
4716 /// # extern crate wkt as google_cloud_wkt;
4717 /// use google_cloud_wkt::FieldMask;
4718 /// use google_cloud_dialogflow_v2::model::Environment;
4719 /// use google_cloud_dialogflow_v2::Result;
4720 /// async fn sample(
4721 /// client: &Environments, name: &str
4722 /// ) -> Result<()> {
4723 /// let response = client.update_environment()
4724 /// .set_environment(
4725 /// Environment::new().set_name(name)/* set fields */
4726 /// )
4727 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
4728 /// .send().await?;
4729 /// println!("response {:?}", response);
4730 /// Ok(())
4731 /// }
4732 /// ```
4733 pub fn update_environment(&self) -> super::builder::environments::UpdateEnvironment {
4734 super::builder::environments::UpdateEnvironment::new(self.inner.clone())
4735 }
4736
4737 /// Deletes the specified agent environment.
4738 ///
4739 /// # Example
4740 /// ```
4741 /// # use google_cloud_dialogflow_v2::client::Environments;
4742 /// use google_cloud_dialogflow_v2::Result;
4743 /// async fn sample(
4744 /// client: &Environments, name: &str
4745 /// ) -> Result<()> {
4746 /// client.delete_environment()
4747 /// .set_name(name)
4748 /// .send().await?;
4749 /// Ok(())
4750 /// }
4751 /// ```
4752 pub fn delete_environment(&self) -> super::builder::environments::DeleteEnvironment {
4753 super::builder::environments::DeleteEnvironment::new(self.inner.clone())
4754 }
4755
4756 /// Gets the history of the specified environment.
4757 ///
4758 /// # Example
4759 /// ```
4760 /// # use google_cloud_dialogflow_v2::client::Environments;
4761 /// use google_cloud_gax::paginator::ItemPaginator as _;
4762 /// use google_cloud_dialogflow_v2::Result;
4763 /// async fn sample(
4764 /// client: &Environments
4765 /// ) -> Result<()> {
4766 /// let mut list = client.get_environment_history()
4767 /// /* set fields */
4768 /// .by_item();
4769 /// while let Some(item) = list.next().await.transpose()? {
4770 /// println!("{:?}", item);
4771 /// }
4772 /// Ok(())
4773 /// }
4774 /// ```
4775 pub fn get_environment_history(&self) -> super::builder::environments::GetEnvironmentHistory {
4776 super::builder::environments::GetEnvironmentHistory::new(self.inner.clone())
4777 }
4778
4779 /// Lists information about the supported locations for this service.
4780 ///
4781 /// # Example
4782 /// ```
4783 /// # use google_cloud_dialogflow_v2::client::Environments;
4784 /// use google_cloud_gax::paginator::ItemPaginator as _;
4785 /// use google_cloud_dialogflow_v2::Result;
4786 /// async fn sample(
4787 /// client: &Environments
4788 /// ) -> Result<()> {
4789 /// let mut list = client.list_locations()
4790 /// /* set fields */
4791 /// .by_item();
4792 /// while let Some(item) = list.next().await.transpose()? {
4793 /// println!("{:?}", item);
4794 /// }
4795 /// Ok(())
4796 /// }
4797 /// ```
4798 pub fn list_locations(&self) -> super::builder::environments::ListLocations {
4799 super::builder::environments::ListLocations::new(self.inner.clone())
4800 }
4801
4802 /// Gets information about a location.
4803 ///
4804 /// # Example
4805 /// ```
4806 /// # use google_cloud_dialogflow_v2::client::Environments;
4807 /// use google_cloud_dialogflow_v2::Result;
4808 /// async fn sample(
4809 /// client: &Environments
4810 /// ) -> Result<()> {
4811 /// let response = client.get_location()
4812 /// /* set fields */
4813 /// .send().await?;
4814 /// println!("response {:?}", response);
4815 /// Ok(())
4816 /// }
4817 /// ```
4818 pub fn get_location(&self) -> super::builder::environments::GetLocation {
4819 super::builder::environments::GetLocation::new(self.inner.clone())
4820 }
4821
4822 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
4823 ///
4824 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
4825 ///
4826 /// # Example
4827 /// ```
4828 /// # use google_cloud_dialogflow_v2::client::Environments;
4829 /// use google_cloud_gax::paginator::ItemPaginator as _;
4830 /// use google_cloud_dialogflow_v2::Result;
4831 /// async fn sample(
4832 /// client: &Environments
4833 /// ) -> Result<()> {
4834 /// let mut list = client.list_operations()
4835 /// /* set fields */
4836 /// .by_item();
4837 /// while let Some(item) = list.next().await.transpose()? {
4838 /// println!("{:?}", item);
4839 /// }
4840 /// Ok(())
4841 /// }
4842 /// ```
4843 pub fn list_operations(&self) -> super::builder::environments::ListOperations {
4844 super::builder::environments::ListOperations::new(self.inner.clone())
4845 }
4846
4847 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
4848 ///
4849 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
4850 ///
4851 /// # Example
4852 /// ```
4853 /// # use google_cloud_dialogflow_v2::client::Environments;
4854 /// use google_cloud_dialogflow_v2::Result;
4855 /// async fn sample(
4856 /// client: &Environments
4857 /// ) -> Result<()> {
4858 /// let response = client.get_operation()
4859 /// /* set fields */
4860 /// .send().await?;
4861 /// println!("response {:?}", response);
4862 /// Ok(())
4863 /// }
4864 /// ```
4865 pub fn get_operation(&self) -> super::builder::environments::GetOperation {
4866 super::builder::environments::GetOperation::new(self.inner.clone())
4867 }
4868
4869 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
4870 ///
4871 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
4872 ///
4873 /// # Example
4874 /// ```
4875 /// # use google_cloud_dialogflow_v2::client::Environments;
4876 /// use google_cloud_dialogflow_v2::Result;
4877 /// async fn sample(
4878 /// client: &Environments
4879 /// ) -> Result<()> {
4880 /// client.cancel_operation()
4881 /// /* set fields */
4882 /// .send().await?;
4883 /// Ok(())
4884 /// }
4885 /// ```
4886 pub fn cancel_operation(&self) -> super::builder::environments::CancelOperation {
4887 super::builder::environments::CancelOperation::new(self.inner.clone())
4888 }
4889}
4890
4891/// Implements a client for the Dialogflow API.
4892///
4893/// # Example
4894/// ```
4895/// # use google_cloud_dialogflow_v2::client::Fulfillments;
4896/// # async fn sample() -> Result<(), Box<dyn std::error::Error>> {
4897/// let client = Fulfillments::builder().build().await?;
4898/// let name = "name_value";
4899/// let response = client.get_fulfillment()
4900/// .set_name(name)
4901/// .send().await?;
4902/// println!("response {:?}", response);
4903/// # Ok(()) }
4904/// ```
4905///
4906/// # Service Description
4907///
4908/// Service for managing [Fulfillments][google.cloud.dialogflow.v2.Fulfillment].
4909///
4910/// [google.cloud.dialogflow.v2.Fulfillment]: crate::model::Fulfillment
4911///
4912/// # Configuration
4913///
4914/// To configure `Fulfillments` use the `with_*` methods in the type returned
4915/// by [builder()][Fulfillments::builder]. The default configuration should
4916/// work for most applications. Common configuration changes include
4917///
4918/// * [with_endpoint()]: by default this client uses the global default endpoint
4919/// (`https://dialogflow.googleapis.com`). Applications using regional
4920/// endpoints or running in restricted networks (e.g. a network configured
4921// with [Private Google Access with VPC Service Controls]) may want to
4922/// override this default.
4923/// * [with_credentials()]: by default this client uses
4924/// [Application Default Credentials]. Applications using custom
4925/// authentication may need to override this default.
4926///
4927/// [with_endpoint()]: super::builder::fulfillments::ClientBuilder::with_endpoint
4928/// [with_credentials()]: super::builder::fulfillments::ClientBuilder::with_credentials
4929/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
4930/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
4931///
4932/// # Pooling and Cloning
4933///
4934/// `Fulfillments` holds a connection pool internally, it is advised to
4935/// create one and reuse it. You do not need to wrap `Fulfillments` in
4936/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
4937/// already uses an `Arc` internally.
4938#[cfg(feature = "fulfillments")]
4939#[cfg_attr(docsrs, doc(cfg(feature = "fulfillments")))]
4940#[derive(Clone, Debug)]
4941pub struct Fulfillments {
4942 inner: std::sync::Arc<dyn super::stub::dynamic::Fulfillments>,
4943}
4944
4945#[cfg(feature = "fulfillments")]
4946impl Fulfillments {
4947 /// Returns a builder for [Fulfillments].
4948 ///
4949 /// ```
4950 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
4951 /// # use google_cloud_dialogflow_v2::client::Fulfillments;
4952 /// let client = Fulfillments::builder().build().await?;
4953 /// # Ok(()) }
4954 /// ```
4955 pub fn builder() -> super::builder::fulfillments::ClientBuilder {
4956 crate::new_client_builder(super::builder::fulfillments::client::Factory)
4957 }
4958
4959 /// Creates a new client from the provided stub.
4960 ///
4961 /// The most common case for calling this function is in tests mocking the
4962 /// client's behavior.
4963 pub fn from_stub<T>(stub: T) -> Self
4964 where
4965 T: super::stub::Fulfillments + 'static,
4966 {
4967 Self {
4968 inner: std::sync::Arc::new(stub),
4969 }
4970 }
4971
4972 pub(crate) async fn new(
4973 config: gaxi::options::ClientConfig,
4974 ) -> crate::ClientBuilderResult<Self> {
4975 let inner = Self::build_inner(config).await?;
4976 Ok(Self { inner })
4977 }
4978
4979 async fn build_inner(
4980 conf: gaxi::options::ClientConfig,
4981 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::Fulfillments>> {
4982 if gaxi::options::tracing_enabled(&conf) {
4983 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
4984 }
4985 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
4986 }
4987
4988 async fn build_transport(
4989 conf: gaxi::options::ClientConfig,
4990 ) -> crate::ClientBuilderResult<impl super::stub::Fulfillments> {
4991 super::transport::Fulfillments::new(conf).await
4992 }
4993
4994 async fn build_with_tracing(
4995 conf: gaxi::options::ClientConfig,
4996 ) -> crate::ClientBuilderResult<impl super::stub::Fulfillments> {
4997 Self::build_transport(conf)
4998 .await
4999 .map(super::tracing::Fulfillments::new)
5000 }
5001
5002 /// Retrieves the fulfillment.
5003 ///
5004 /// # Example
5005 /// ```
5006 /// # use google_cloud_dialogflow_v2::client::Fulfillments;
5007 /// use google_cloud_dialogflow_v2::Result;
5008 /// async fn sample(
5009 /// client: &Fulfillments, name: &str
5010 /// ) -> Result<()> {
5011 /// let response = client.get_fulfillment()
5012 /// .set_name(name)
5013 /// .send().await?;
5014 /// println!("response {:?}", response);
5015 /// Ok(())
5016 /// }
5017 /// ```
5018 pub fn get_fulfillment(&self) -> super::builder::fulfillments::GetFulfillment {
5019 super::builder::fulfillments::GetFulfillment::new(self.inner.clone())
5020 }
5021
5022 /// Updates the fulfillment.
5023 ///
5024 /// # Example
5025 /// ```
5026 /// # use google_cloud_dialogflow_v2::client::Fulfillments;
5027 /// # extern crate wkt as google_cloud_wkt;
5028 /// use google_cloud_wkt::FieldMask;
5029 /// use google_cloud_dialogflow_v2::model::Fulfillment;
5030 /// use google_cloud_dialogflow_v2::Result;
5031 /// async fn sample(
5032 /// client: &Fulfillments, name: &str
5033 /// ) -> Result<()> {
5034 /// let response = client.update_fulfillment()
5035 /// .set_fulfillment(
5036 /// Fulfillment::new().set_name(name)/* set fields */
5037 /// )
5038 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
5039 /// .send().await?;
5040 /// println!("response {:?}", response);
5041 /// Ok(())
5042 /// }
5043 /// ```
5044 pub fn update_fulfillment(&self) -> super::builder::fulfillments::UpdateFulfillment {
5045 super::builder::fulfillments::UpdateFulfillment::new(self.inner.clone())
5046 }
5047
5048 /// Lists information about the supported locations for this service.
5049 ///
5050 /// # Example
5051 /// ```
5052 /// # use google_cloud_dialogflow_v2::client::Fulfillments;
5053 /// use google_cloud_gax::paginator::ItemPaginator as _;
5054 /// use google_cloud_dialogflow_v2::Result;
5055 /// async fn sample(
5056 /// client: &Fulfillments
5057 /// ) -> Result<()> {
5058 /// let mut list = client.list_locations()
5059 /// /* set fields */
5060 /// .by_item();
5061 /// while let Some(item) = list.next().await.transpose()? {
5062 /// println!("{:?}", item);
5063 /// }
5064 /// Ok(())
5065 /// }
5066 /// ```
5067 pub fn list_locations(&self) -> super::builder::fulfillments::ListLocations {
5068 super::builder::fulfillments::ListLocations::new(self.inner.clone())
5069 }
5070
5071 /// Gets information about a location.
5072 ///
5073 /// # Example
5074 /// ```
5075 /// # use google_cloud_dialogflow_v2::client::Fulfillments;
5076 /// use google_cloud_dialogflow_v2::Result;
5077 /// async fn sample(
5078 /// client: &Fulfillments
5079 /// ) -> Result<()> {
5080 /// let response = client.get_location()
5081 /// /* set fields */
5082 /// .send().await?;
5083 /// println!("response {:?}", response);
5084 /// Ok(())
5085 /// }
5086 /// ```
5087 pub fn get_location(&self) -> super::builder::fulfillments::GetLocation {
5088 super::builder::fulfillments::GetLocation::new(self.inner.clone())
5089 }
5090
5091 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
5092 ///
5093 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
5094 ///
5095 /// # Example
5096 /// ```
5097 /// # use google_cloud_dialogflow_v2::client::Fulfillments;
5098 /// use google_cloud_gax::paginator::ItemPaginator as _;
5099 /// use google_cloud_dialogflow_v2::Result;
5100 /// async fn sample(
5101 /// client: &Fulfillments
5102 /// ) -> Result<()> {
5103 /// let mut list = client.list_operations()
5104 /// /* set fields */
5105 /// .by_item();
5106 /// while let Some(item) = list.next().await.transpose()? {
5107 /// println!("{:?}", item);
5108 /// }
5109 /// Ok(())
5110 /// }
5111 /// ```
5112 pub fn list_operations(&self) -> super::builder::fulfillments::ListOperations {
5113 super::builder::fulfillments::ListOperations::new(self.inner.clone())
5114 }
5115
5116 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
5117 ///
5118 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
5119 ///
5120 /// # Example
5121 /// ```
5122 /// # use google_cloud_dialogflow_v2::client::Fulfillments;
5123 /// use google_cloud_dialogflow_v2::Result;
5124 /// async fn sample(
5125 /// client: &Fulfillments
5126 /// ) -> Result<()> {
5127 /// let response = client.get_operation()
5128 /// /* set fields */
5129 /// .send().await?;
5130 /// println!("response {:?}", response);
5131 /// Ok(())
5132 /// }
5133 /// ```
5134 pub fn get_operation(&self) -> super::builder::fulfillments::GetOperation {
5135 super::builder::fulfillments::GetOperation::new(self.inner.clone())
5136 }
5137
5138 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
5139 ///
5140 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
5141 ///
5142 /// # Example
5143 /// ```
5144 /// # use google_cloud_dialogflow_v2::client::Fulfillments;
5145 /// use google_cloud_dialogflow_v2::Result;
5146 /// async fn sample(
5147 /// client: &Fulfillments
5148 /// ) -> Result<()> {
5149 /// client.cancel_operation()
5150 /// /* set fields */
5151 /// .send().await?;
5152 /// Ok(())
5153 /// }
5154 /// ```
5155 pub fn cancel_operation(&self) -> super::builder::fulfillments::CancelOperation {
5156 super::builder::fulfillments::CancelOperation::new(self.inner.clone())
5157 }
5158}
5159
5160/// Implements a client for the Dialogflow API.
5161///
5162/// # Example
5163/// ```
5164/// # use google_cloud_dialogflow_v2::client::Generators;
5165/// use google_cloud_gax::paginator::ItemPaginator as _;
5166/// # async fn sample() -> Result<(), Box<dyn std::error::Error>> {
5167/// let client = Generators::builder().build().await?;
5168/// let parent = "parent_value";
5169/// let mut list = client.list_generators()
5170/// .set_parent(parent)
5171/// .by_item();
5172/// while let Some(item) = list.next().await.transpose()? {
5173/// println!("{:?}", item);
5174/// }
5175/// # Ok(()) }
5176/// ```
5177///
5178/// # Service Description
5179///
5180/// Generator Service for LLM powered Agent Assist. This service manages the
5181/// configurations of user owned Generators, such as description, context and
5182/// instruction, input/output format, etc. The generator resources will be used
5183/// inside a conversation and will be triggered by TriggerEvent to query LLM for
5184/// answers.
5185///
5186/// # Configuration
5187///
5188/// To configure `Generators` use the `with_*` methods in the type returned
5189/// by [builder()][Generators::builder]. The default configuration should
5190/// work for most applications. Common configuration changes include
5191///
5192/// * [with_endpoint()]: by default this client uses the global default endpoint
5193/// (`https://dialogflow.googleapis.com`). Applications using regional
5194/// endpoints or running in restricted networks (e.g. a network configured
5195// with [Private Google Access with VPC Service Controls]) may want to
5196/// override this default.
5197/// * [with_credentials()]: by default this client uses
5198/// [Application Default Credentials]. Applications using custom
5199/// authentication may need to override this default.
5200///
5201/// [with_endpoint()]: super::builder::generators::ClientBuilder::with_endpoint
5202/// [with_credentials()]: super::builder::generators::ClientBuilder::with_credentials
5203/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
5204/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
5205///
5206/// # Pooling and Cloning
5207///
5208/// `Generators` holds a connection pool internally, it is advised to
5209/// create one and reuse it. You do not need to wrap `Generators` in
5210/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
5211/// already uses an `Arc` internally.
5212#[cfg(feature = "generators")]
5213#[cfg_attr(docsrs, doc(cfg(feature = "generators")))]
5214#[derive(Clone, Debug)]
5215pub struct Generators {
5216 inner: std::sync::Arc<dyn super::stub::dynamic::Generators>,
5217}
5218
5219#[cfg(feature = "generators")]
5220impl Generators {
5221 /// Returns a builder for [Generators].
5222 ///
5223 /// ```
5224 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
5225 /// # use google_cloud_dialogflow_v2::client::Generators;
5226 /// let client = Generators::builder().build().await?;
5227 /// # Ok(()) }
5228 /// ```
5229 pub fn builder() -> super::builder::generators::ClientBuilder {
5230 crate::new_client_builder(super::builder::generators::client::Factory)
5231 }
5232
5233 /// Creates a new client from the provided stub.
5234 ///
5235 /// The most common case for calling this function is in tests mocking the
5236 /// client's behavior.
5237 pub fn from_stub<T>(stub: T) -> Self
5238 where
5239 T: super::stub::Generators + 'static,
5240 {
5241 Self {
5242 inner: std::sync::Arc::new(stub),
5243 }
5244 }
5245
5246 pub(crate) async fn new(
5247 config: gaxi::options::ClientConfig,
5248 ) -> crate::ClientBuilderResult<Self> {
5249 let inner = Self::build_inner(config).await?;
5250 Ok(Self { inner })
5251 }
5252
5253 async fn build_inner(
5254 conf: gaxi::options::ClientConfig,
5255 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::Generators>> {
5256 if gaxi::options::tracing_enabled(&conf) {
5257 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
5258 }
5259 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
5260 }
5261
5262 async fn build_transport(
5263 conf: gaxi::options::ClientConfig,
5264 ) -> crate::ClientBuilderResult<impl super::stub::Generators> {
5265 super::transport::Generators::new(conf).await
5266 }
5267
5268 async fn build_with_tracing(
5269 conf: gaxi::options::ClientConfig,
5270 ) -> crate::ClientBuilderResult<impl super::stub::Generators> {
5271 Self::build_transport(conf)
5272 .await
5273 .map(super::tracing::Generators::new)
5274 }
5275
5276 /// Creates a generator.
5277 ///
5278 /// # Example
5279 /// ```
5280 /// # use google_cloud_dialogflow_v2::client::Generators;
5281 /// use google_cloud_dialogflow_v2::model::Generator;
5282 /// use google_cloud_dialogflow_v2::Result;
5283 /// async fn sample(
5284 /// client: &Generators, parent: &str
5285 /// ) -> Result<()> {
5286 /// let response = client.create_generator()
5287 /// .set_parent(parent)
5288 /// .set_generator_id("generator_id_value")
5289 /// .set_generator(
5290 /// Generator::new()/* set fields */
5291 /// )
5292 /// .send().await?;
5293 /// println!("response {:?}", response);
5294 /// Ok(())
5295 /// }
5296 /// ```
5297 pub fn create_generator(&self) -> super::builder::generators::CreateGenerator {
5298 super::builder::generators::CreateGenerator::new(self.inner.clone())
5299 }
5300
5301 /// Retrieves a generator.
5302 ///
5303 /// # Example
5304 /// ```
5305 /// # use google_cloud_dialogflow_v2::client::Generators;
5306 /// use google_cloud_dialogflow_v2::Result;
5307 /// async fn sample(
5308 /// client: &Generators, name: &str
5309 /// ) -> Result<()> {
5310 /// let response = client.get_generator()
5311 /// .set_name(name)
5312 /// .send().await?;
5313 /// println!("response {:?}", response);
5314 /// Ok(())
5315 /// }
5316 /// ```
5317 pub fn get_generator(&self) -> super::builder::generators::GetGenerator {
5318 super::builder::generators::GetGenerator::new(self.inner.clone())
5319 }
5320
5321 /// Lists generators.
5322 ///
5323 /// # Example
5324 /// ```
5325 /// # use google_cloud_dialogflow_v2::client::Generators;
5326 /// use google_cloud_gax::paginator::ItemPaginator as _;
5327 /// use google_cloud_dialogflow_v2::Result;
5328 /// async fn sample(
5329 /// client: &Generators, parent: &str
5330 /// ) -> Result<()> {
5331 /// let mut list = client.list_generators()
5332 /// .set_parent(parent)
5333 /// .by_item();
5334 /// while let Some(item) = list.next().await.transpose()? {
5335 /// println!("{:?}", item);
5336 /// }
5337 /// Ok(())
5338 /// }
5339 /// ```
5340 pub fn list_generators(&self) -> super::builder::generators::ListGenerators {
5341 super::builder::generators::ListGenerators::new(self.inner.clone())
5342 }
5343
5344 /// Deletes a generator.
5345 ///
5346 /// # Example
5347 /// ```
5348 /// # use google_cloud_dialogflow_v2::client::Generators;
5349 /// use google_cloud_dialogflow_v2::Result;
5350 /// async fn sample(
5351 /// client: &Generators, name: &str
5352 /// ) -> Result<()> {
5353 /// client.delete_generator()
5354 /// .set_name(name)
5355 /// .send().await?;
5356 /// Ok(())
5357 /// }
5358 /// ```
5359 pub fn delete_generator(&self) -> super::builder::generators::DeleteGenerator {
5360 super::builder::generators::DeleteGenerator::new(self.inner.clone())
5361 }
5362
5363 /// Updates a generator.
5364 ///
5365 /// # Example
5366 /// ```
5367 /// # use google_cloud_dialogflow_v2::client::Generators;
5368 /// # extern crate wkt as google_cloud_wkt;
5369 /// use google_cloud_wkt::FieldMask;
5370 /// use google_cloud_dialogflow_v2::model::Generator;
5371 /// use google_cloud_dialogflow_v2::Result;
5372 /// async fn sample(
5373 /// client: &Generators, name: &str
5374 /// ) -> Result<()> {
5375 /// let response = client.update_generator()
5376 /// .set_generator(
5377 /// Generator::new().set_name(name)/* set fields */
5378 /// )
5379 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
5380 /// .send().await?;
5381 /// println!("response {:?}", response);
5382 /// Ok(())
5383 /// }
5384 /// ```
5385 pub fn update_generator(&self) -> super::builder::generators::UpdateGenerator {
5386 super::builder::generators::UpdateGenerator::new(self.inner.clone())
5387 }
5388
5389 /// Lists information about the supported locations for this service.
5390 ///
5391 /// # Example
5392 /// ```
5393 /// # use google_cloud_dialogflow_v2::client::Generators;
5394 /// use google_cloud_gax::paginator::ItemPaginator as _;
5395 /// use google_cloud_dialogflow_v2::Result;
5396 /// async fn sample(
5397 /// client: &Generators
5398 /// ) -> Result<()> {
5399 /// let mut list = client.list_locations()
5400 /// /* set fields */
5401 /// .by_item();
5402 /// while let Some(item) = list.next().await.transpose()? {
5403 /// println!("{:?}", item);
5404 /// }
5405 /// Ok(())
5406 /// }
5407 /// ```
5408 pub fn list_locations(&self) -> super::builder::generators::ListLocations {
5409 super::builder::generators::ListLocations::new(self.inner.clone())
5410 }
5411
5412 /// Gets information about a location.
5413 ///
5414 /// # Example
5415 /// ```
5416 /// # use google_cloud_dialogflow_v2::client::Generators;
5417 /// use google_cloud_dialogflow_v2::Result;
5418 /// async fn sample(
5419 /// client: &Generators
5420 /// ) -> Result<()> {
5421 /// let response = client.get_location()
5422 /// /* set fields */
5423 /// .send().await?;
5424 /// println!("response {:?}", response);
5425 /// Ok(())
5426 /// }
5427 /// ```
5428 pub fn get_location(&self) -> super::builder::generators::GetLocation {
5429 super::builder::generators::GetLocation::new(self.inner.clone())
5430 }
5431
5432 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
5433 ///
5434 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
5435 ///
5436 /// # Example
5437 /// ```
5438 /// # use google_cloud_dialogflow_v2::client::Generators;
5439 /// use google_cloud_gax::paginator::ItemPaginator as _;
5440 /// use google_cloud_dialogflow_v2::Result;
5441 /// async fn sample(
5442 /// client: &Generators
5443 /// ) -> Result<()> {
5444 /// let mut list = client.list_operations()
5445 /// /* set fields */
5446 /// .by_item();
5447 /// while let Some(item) = list.next().await.transpose()? {
5448 /// println!("{:?}", item);
5449 /// }
5450 /// Ok(())
5451 /// }
5452 /// ```
5453 pub fn list_operations(&self) -> super::builder::generators::ListOperations {
5454 super::builder::generators::ListOperations::new(self.inner.clone())
5455 }
5456
5457 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
5458 ///
5459 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
5460 ///
5461 /// # Example
5462 /// ```
5463 /// # use google_cloud_dialogflow_v2::client::Generators;
5464 /// use google_cloud_dialogflow_v2::Result;
5465 /// async fn sample(
5466 /// client: &Generators
5467 /// ) -> Result<()> {
5468 /// let response = client.get_operation()
5469 /// /* set fields */
5470 /// .send().await?;
5471 /// println!("response {:?}", response);
5472 /// Ok(())
5473 /// }
5474 /// ```
5475 pub fn get_operation(&self) -> super::builder::generators::GetOperation {
5476 super::builder::generators::GetOperation::new(self.inner.clone())
5477 }
5478
5479 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
5480 ///
5481 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
5482 ///
5483 /// # Example
5484 /// ```
5485 /// # use google_cloud_dialogflow_v2::client::Generators;
5486 /// use google_cloud_dialogflow_v2::Result;
5487 /// async fn sample(
5488 /// client: &Generators
5489 /// ) -> Result<()> {
5490 /// client.cancel_operation()
5491 /// /* set fields */
5492 /// .send().await?;
5493 /// Ok(())
5494 /// }
5495 /// ```
5496 pub fn cancel_operation(&self) -> super::builder::generators::CancelOperation {
5497 super::builder::generators::CancelOperation::new(self.inner.clone())
5498 }
5499}
5500
5501/// Implements a client for the Dialogflow API.
5502///
5503/// # Example
5504/// ```
5505/// # use google_cloud_dialogflow_v2::client::GeneratorEvaluations;
5506/// use google_cloud_gax::paginator::ItemPaginator as _;
5507/// # async fn sample() -> Result<(), Box<dyn std::error::Error>> {
5508/// let client = GeneratorEvaluations::builder().build().await?;
5509/// let parent = "parent_value";
5510/// let mut list = client.list_generator_evaluations()
5511/// .set_parent(parent)
5512/// .by_item();
5513/// while let Some(item) = list.next().await.transpose()? {
5514/// println!("{:?}", item);
5515/// }
5516/// # Ok(()) }
5517/// ```
5518///
5519/// # Service Description
5520///
5521/// Service for managing generator evaluations.
5522///
5523/// # Configuration
5524///
5525/// To configure `GeneratorEvaluations` use the `with_*` methods in the type returned
5526/// by [builder()][GeneratorEvaluations::builder]. The default configuration should
5527/// work for most applications. Common configuration changes include
5528///
5529/// * [with_endpoint()]: by default this client uses the global default endpoint
5530/// (`https://dialogflow.googleapis.com`). Applications using regional
5531/// endpoints or running in restricted networks (e.g. a network configured
5532// with [Private Google Access with VPC Service Controls]) may want to
5533/// override this default.
5534/// * [with_credentials()]: by default this client uses
5535/// [Application Default Credentials]. Applications using custom
5536/// authentication may need to override this default.
5537///
5538/// [with_endpoint()]: super::builder::generator_evaluations::ClientBuilder::with_endpoint
5539/// [with_credentials()]: super::builder::generator_evaluations::ClientBuilder::with_credentials
5540/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
5541/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
5542///
5543/// # Pooling and Cloning
5544///
5545/// `GeneratorEvaluations` holds a connection pool internally, it is advised to
5546/// create one and reuse it. You do not need to wrap `GeneratorEvaluations` in
5547/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
5548/// already uses an `Arc` internally.
5549#[cfg(feature = "generator-evaluations")]
5550#[cfg_attr(docsrs, doc(cfg(feature = "generator-evaluations")))]
5551#[derive(Clone, Debug)]
5552pub struct GeneratorEvaluations {
5553 inner: std::sync::Arc<dyn super::stub::dynamic::GeneratorEvaluations>,
5554}
5555
5556#[cfg(feature = "generator-evaluations")]
5557impl GeneratorEvaluations {
5558 /// Returns a builder for [GeneratorEvaluations].
5559 ///
5560 /// ```
5561 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
5562 /// # use google_cloud_dialogflow_v2::client::GeneratorEvaluations;
5563 /// let client = GeneratorEvaluations::builder().build().await?;
5564 /// # Ok(()) }
5565 /// ```
5566 pub fn builder() -> super::builder::generator_evaluations::ClientBuilder {
5567 crate::new_client_builder(super::builder::generator_evaluations::client::Factory)
5568 }
5569
5570 /// Creates a new client from the provided stub.
5571 ///
5572 /// The most common case for calling this function is in tests mocking the
5573 /// client's behavior.
5574 pub fn from_stub<T>(stub: T) -> Self
5575 where
5576 T: super::stub::GeneratorEvaluations + 'static,
5577 {
5578 Self {
5579 inner: std::sync::Arc::new(stub),
5580 }
5581 }
5582
5583 pub(crate) async fn new(
5584 config: gaxi::options::ClientConfig,
5585 ) -> crate::ClientBuilderResult<Self> {
5586 let inner = Self::build_inner(config).await?;
5587 Ok(Self { inner })
5588 }
5589
5590 async fn build_inner(
5591 conf: gaxi::options::ClientConfig,
5592 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::GeneratorEvaluations>>
5593 {
5594 if gaxi::options::tracing_enabled(&conf) {
5595 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
5596 }
5597 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
5598 }
5599
5600 async fn build_transport(
5601 conf: gaxi::options::ClientConfig,
5602 ) -> crate::ClientBuilderResult<impl super::stub::GeneratorEvaluations> {
5603 super::transport::GeneratorEvaluations::new(conf).await
5604 }
5605
5606 async fn build_with_tracing(
5607 conf: gaxi::options::ClientConfig,
5608 ) -> crate::ClientBuilderResult<impl super::stub::GeneratorEvaluations> {
5609 Self::build_transport(conf)
5610 .await
5611 .map(super::tracing::GeneratorEvaluations::new)
5612 }
5613
5614 /// Creates evaluation of a generator.
5615 ///
5616 /// # Long running operations
5617 ///
5618 /// This method is used to start, and/or poll a [long-running Operation].
5619 /// The [Working with long-running operations] chapter in the [user guide]
5620 /// covers these operations in detail.
5621 ///
5622 /// [long-running operation]: https://google.aip.dev/151
5623 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
5624 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
5625 ///
5626 /// # Example
5627 /// ```
5628 /// # use google_cloud_dialogflow_v2::client::GeneratorEvaluations;
5629 /// use google_cloud_lro::Poller;
5630 /// use google_cloud_dialogflow_v2::model::GeneratorEvaluation;
5631 /// use google_cloud_dialogflow_v2::Result;
5632 /// async fn sample(
5633 /// client: &GeneratorEvaluations, parent: &str
5634 /// ) -> Result<()> {
5635 /// let response = client.create_generator_evaluation()
5636 /// .set_parent(parent)
5637 /// .set_generator_evaluation(
5638 /// GeneratorEvaluation::new()/* set fields */
5639 /// )
5640 /// .poller().until_done().await?;
5641 /// println!("response {:?}", response);
5642 /// Ok(())
5643 /// }
5644 /// ```
5645 pub fn create_generator_evaluation(
5646 &self,
5647 ) -> super::builder::generator_evaluations::CreateGeneratorEvaluation {
5648 super::builder::generator_evaluations::CreateGeneratorEvaluation::new(self.inner.clone())
5649 }
5650
5651 /// Gets an evaluation of generator.
5652 ///
5653 /// # Example
5654 /// ```
5655 /// # use google_cloud_dialogflow_v2::client::GeneratorEvaluations;
5656 /// use google_cloud_dialogflow_v2::Result;
5657 /// async fn sample(
5658 /// client: &GeneratorEvaluations, name: &str
5659 /// ) -> Result<()> {
5660 /// let response = client.get_generator_evaluation()
5661 /// .set_name(name)
5662 /// .send().await?;
5663 /// println!("response {:?}", response);
5664 /// Ok(())
5665 /// }
5666 /// ```
5667 pub fn get_generator_evaluation(
5668 &self,
5669 ) -> super::builder::generator_evaluations::GetGeneratorEvaluation {
5670 super::builder::generator_evaluations::GetGeneratorEvaluation::new(self.inner.clone())
5671 }
5672
5673 /// Lists evaluations of generator.
5674 ///
5675 /// # Example
5676 /// ```
5677 /// # use google_cloud_dialogflow_v2::client::GeneratorEvaluations;
5678 /// use google_cloud_gax::paginator::ItemPaginator as _;
5679 /// use google_cloud_dialogflow_v2::Result;
5680 /// async fn sample(
5681 /// client: &GeneratorEvaluations, parent: &str
5682 /// ) -> Result<()> {
5683 /// let mut list = client.list_generator_evaluations()
5684 /// .set_parent(parent)
5685 /// .by_item();
5686 /// while let Some(item) = list.next().await.transpose()? {
5687 /// println!("{:?}", item);
5688 /// }
5689 /// Ok(())
5690 /// }
5691 /// ```
5692 pub fn list_generator_evaluations(
5693 &self,
5694 ) -> super::builder::generator_evaluations::ListGeneratorEvaluations {
5695 super::builder::generator_evaluations::ListGeneratorEvaluations::new(self.inner.clone())
5696 }
5697
5698 /// Deletes an evaluation of generator.
5699 ///
5700 /// # Example
5701 /// ```
5702 /// # use google_cloud_dialogflow_v2::client::GeneratorEvaluations;
5703 /// use google_cloud_dialogflow_v2::Result;
5704 /// async fn sample(
5705 /// client: &GeneratorEvaluations, name: &str
5706 /// ) -> Result<()> {
5707 /// client.delete_generator_evaluation()
5708 /// .set_name(name)
5709 /// .send().await?;
5710 /// Ok(())
5711 /// }
5712 /// ```
5713 pub fn delete_generator_evaluation(
5714 &self,
5715 ) -> super::builder::generator_evaluations::DeleteGeneratorEvaluation {
5716 super::builder::generator_evaluations::DeleteGeneratorEvaluation::new(self.inner.clone())
5717 }
5718
5719 /// Lists information about the supported locations for this service.
5720 ///
5721 /// # Example
5722 /// ```
5723 /// # use google_cloud_dialogflow_v2::client::GeneratorEvaluations;
5724 /// use google_cloud_gax::paginator::ItemPaginator as _;
5725 /// use google_cloud_dialogflow_v2::Result;
5726 /// async fn sample(
5727 /// client: &GeneratorEvaluations
5728 /// ) -> Result<()> {
5729 /// let mut list = client.list_locations()
5730 /// /* set fields */
5731 /// .by_item();
5732 /// while let Some(item) = list.next().await.transpose()? {
5733 /// println!("{:?}", item);
5734 /// }
5735 /// Ok(())
5736 /// }
5737 /// ```
5738 pub fn list_locations(&self) -> super::builder::generator_evaluations::ListLocations {
5739 super::builder::generator_evaluations::ListLocations::new(self.inner.clone())
5740 }
5741
5742 /// Gets information about a location.
5743 ///
5744 /// # Example
5745 /// ```
5746 /// # use google_cloud_dialogflow_v2::client::GeneratorEvaluations;
5747 /// use google_cloud_dialogflow_v2::Result;
5748 /// async fn sample(
5749 /// client: &GeneratorEvaluations
5750 /// ) -> Result<()> {
5751 /// let response = client.get_location()
5752 /// /* set fields */
5753 /// .send().await?;
5754 /// println!("response {:?}", response);
5755 /// Ok(())
5756 /// }
5757 /// ```
5758 pub fn get_location(&self) -> super::builder::generator_evaluations::GetLocation {
5759 super::builder::generator_evaluations::GetLocation::new(self.inner.clone())
5760 }
5761
5762 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
5763 ///
5764 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
5765 ///
5766 /// # Example
5767 /// ```
5768 /// # use google_cloud_dialogflow_v2::client::GeneratorEvaluations;
5769 /// use google_cloud_gax::paginator::ItemPaginator as _;
5770 /// use google_cloud_dialogflow_v2::Result;
5771 /// async fn sample(
5772 /// client: &GeneratorEvaluations
5773 /// ) -> Result<()> {
5774 /// let mut list = client.list_operations()
5775 /// /* set fields */
5776 /// .by_item();
5777 /// while let Some(item) = list.next().await.transpose()? {
5778 /// println!("{:?}", item);
5779 /// }
5780 /// Ok(())
5781 /// }
5782 /// ```
5783 pub fn list_operations(&self) -> super::builder::generator_evaluations::ListOperations {
5784 super::builder::generator_evaluations::ListOperations::new(self.inner.clone())
5785 }
5786
5787 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
5788 ///
5789 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
5790 ///
5791 /// # Example
5792 /// ```
5793 /// # use google_cloud_dialogflow_v2::client::GeneratorEvaluations;
5794 /// use google_cloud_dialogflow_v2::Result;
5795 /// async fn sample(
5796 /// client: &GeneratorEvaluations
5797 /// ) -> Result<()> {
5798 /// let response = client.get_operation()
5799 /// /* set fields */
5800 /// .send().await?;
5801 /// println!("response {:?}", response);
5802 /// Ok(())
5803 /// }
5804 /// ```
5805 pub fn get_operation(&self) -> super::builder::generator_evaluations::GetOperation {
5806 super::builder::generator_evaluations::GetOperation::new(self.inner.clone())
5807 }
5808
5809 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
5810 ///
5811 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
5812 ///
5813 /// # Example
5814 /// ```
5815 /// # use google_cloud_dialogflow_v2::client::GeneratorEvaluations;
5816 /// use google_cloud_dialogflow_v2::Result;
5817 /// async fn sample(
5818 /// client: &GeneratorEvaluations
5819 /// ) -> Result<()> {
5820 /// client.cancel_operation()
5821 /// /* set fields */
5822 /// .send().await?;
5823 /// Ok(())
5824 /// }
5825 /// ```
5826 pub fn cancel_operation(&self) -> super::builder::generator_evaluations::CancelOperation {
5827 super::builder::generator_evaluations::CancelOperation::new(self.inner.clone())
5828 }
5829}
5830
5831/// Implements a client for the Dialogflow API.
5832///
5833/// # Example
5834/// ```
5835/// # use google_cloud_dialogflow_v2::client::Intents;
5836/// use google_cloud_gax::paginator::ItemPaginator as _;
5837/// # async fn sample() -> Result<(), Box<dyn std::error::Error>> {
5838/// let client = Intents::builder().build().await?;
5839/// let parent = "parent_value";
5840/// let mut list = client.list_intents()
5841/// .set_parent(parent)
5842/// .by_item();
5843/// while let Some(item) = list.next().await.transpose()? {
5844/// println!("{:?}", item);
5845/// }
5846/// # Ok(()) }
5847/// ```
5848///
5849/// # Service Description
5850///
5851/// Service for managing [Intents][google.cloud.dialogflow.v2.Intent].
5852///
5853/// [google.cloud.dialogflow.v2.Intent]: crate::model::Intent
5854///
5855/// # Configuration
5856///
5857/// To configure `Intents` use the `with_*` methods in the type returned
5858/// by [builder()][Intents::builder]. The default configuration should
5859/// work for most applications. Common configuration changes include
5860///
5861/// * [with_endpoint()]: by default this client uses the global default endpoint
5862/// (`https://dialogflow.googleapis.com`). Applications using regional
5863/// endpoints or running in restricted networks (e.g. a network configured
5864// with [Private Google Access with VPC Service Controls]) may want to
5865/// override this default.
5866/// * [with_credentials()]: by default this client uses
5867/// [Application Default Credentials]. Applications using custom
5868/// authentication may need to override this default.
5869///
5870/// [with_endpoint()]: super::builder::intents::ClientBuilder::with_endpoint
5871/// [with_credentials()]: super::builder::intents::ClientBuilder::with_credentials
5872/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
5873/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
5874///
5875/// # Pooling and Cloning
5876///
5877/// `Intents` holds a connection pool internally, it is advised to
5878/// create one and reuse it. You do not need to wrap `Intents` in
5879/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
5880/// already uses an `Arc` internally.
5881#[cfg(feature = "intents")]
5882#[cfg_attr(docsrs, doc(cfg(feature = "intents")))]
5883#[derive(Clone, Debug)]
5884pub struct Intents {
5885 inner: std::sync::Arc<dyn super::stub::dynamic::Intents>,
5886}
5887
5888#[cfg(feature = "intents")]
5889impl Intents {
5890 /// Returns a builder for [Intents].
5891 ///
5892 /// ```
5893 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
5894 /// # use google_cloud_dialogflow_v2::client::Intents;
5895 /// let client = Intents::builder().build().await?;
5896 /// # Ok(()) }
5897 /// ```
5898 pub fn builder() -> super::builder::intents::ClientBuilder {
5899 crate::new_client_builder(super::builder::intents::client::Factory)
5900 }
5901
5902 /// Creates a new client from the provided stub.
5903 ///
5904 /// The most common case for calling this function is in tests mocking the
5905 /// client's behavior.
5906 pub fn from_stub<T>(stub: T) -> Self
5907 where
5908 T: super::stub::Intents + 'static,
5909 {
5910 Self {
5911 inner: std::sync::Arc::new(stub),
5912 }
5913 }
5914
5915 pub(crate) async fn new(
5916 config: gaxi::options::ClientConfig,
5917 ) -> crate::ClientBuilderResult<Self> {
5918 let inner = Self::build_inner(config).await?;
5919 Ok(Self { inner })
5920 }
5921
5922 async fn build_inner(
5923 conf: gaxi::options::ClientConfig,
5924 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::Intents>> {
5925 if gaxi::options::tracing_enabled(&conf) {
5926 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
5927 }
5928 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
5929 }
5930
5931 async fn build_transport(
5932 conf: gaxi::options::ClientConfig,
5933 ) -> crate::ClientBuilderResult<impl super::stub::Intents> {
5934 super::transport::Intents::new(conf).await
5935 }
5936
5937 async fn build_with_tracing(
5938 conf: gaxi::options::ClientConfig,
5939 ) -> crate::ClientBuilderResult<impl super::stub::Intents> {
5940 Self::build_transport(conf)
5941 .await
5942 .map(super::tracing::Intents::new)
5943 }
5944
5945 /// Returns the list of all intents in the specified agent.
5946 ///
5947 /// # Example
5948 /// ```
5949 /// # use google_cloud_dialogflow_v2::client::Intents;
5950 /// use google_cloud_gax::paginator::ItemPaginator as _;
5951 /// use google_cloud_dialogflow_v2::Result;
5952 /// async fn sample(
5953 /// client: &Intents, parent: &str
5954 /// ) -> Result<()> {
5955 /// let mut list = client.list_intents()
5956 /// .set_parent(parent)
5957 /// .by_item();
5958 /// while let Some(item) = list.next().await.transpose()? {
5959 /// println!("{:?}", item);
5960 /// }
5961 /// Ok(())
5962 /// }
5963 /// ```
5964 pub fn list_intents(&self) -> super::builder::intents::ListIntents {
5965 super::builder::intents::ListIntents::new(self.inner.clone())
5966 }
5967
5968 /// Retrieves the specified intent.
5969 ///
5970 /// # Example
5971 /// ```
5972 /// # use google_cloud_dialogflow_v2::client::Intents;
5973 /// use google_cloud_dialogflow_v2::Result;
5974 /// async fn sample(
5975 /// client: &Intents, name: &str
5976 /// ) -> Result<()> {
5977 /// let response = client.get_intent()
5978 /// .set_name(name)
5979 /// .send().await?;
5980 /// println!("response {:?}", response);
5981 /// Ok(())
5982 /// }
5983 /// ```
5984 pub fn get_intent(&self) -> super::builder::intents::GetIntent {
5985 super::builder::intents::GetIntent::new(self.inner.clone())
5986 }
5987
5988 /// Creates an intent in the specified agent.
5989 ///
5990 /// Note: You should always train an agent prior to sending it queries. See the
5991 /// [training
5992 /// documentation](https://cloud.google.com/dialogflow/es/docs/training).
5993 ///
5994 /// # Example
5995 /// ```
5996 /// # use google_cloud_dialogflow_v2::client::Intents;
5997 /// use google_cloud_dialogflow_v2::model::Intent;
5998 /// use google_cloud_dialogflow_v2::Result;
5999 /// async fn sample(
6000 /// client: &Intents, parent: &str
6001 /// ) -> Result<()> {
6002 /// let response = client.create_intent()
6003 /// .set_parent(parent)
6004 /// .set_intent(
6005 /// Intent::new()/* set fields */
6006 /// )
6007 /// .send().await?;
6008 /// println!("response {:?}", response);
6009 /// Ok(())
6010 /// }
6011 /// ```
6012 pub fn create_intent(&self) -> super::builder::intents::CreateIntent {
6013 super::builder::intents::CreateIntent::new(self.inner.clone())
6014 }
6015
6016 /// Updates the specified intent.
6017 ///
6018 /// Note: You should always train an agent prior to sending it queries. See the
6019 /// [training
6020 /// documentation](https://cloud.google.com/dialogflow/es/docs/training).
6021 ///
6022 /// # Example
6023 /// ```
6024 /// # use google_cloud_dialogflow_v2::client::Intents;
6025 /// # extern crate wkt as google_cloud_wkt;
6026 /// use google_cloud_wkt::FieldMask;
6027 /// use google_cloud_dialogflow_v2::model::Intent;
6028 /// use google_cloud_dialogflow_v2::Result;
6029 /// async fn sample(
6030 /// client: &Intents, name: &str
6031 /// ) -> Result<()> {
6032 /// let response = client.update_intent()
6033 /// .set_intent(
6034 /// Intent::new().set_name(name)/* set fields */
6035 /// )
6036 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
6037 /// .send().await?;
6038 /// println!("response {:?}", response);
6039 /// Ok(())
6040 /// }
6041 /// ```
6042 pub fn update_intent(&self) -> super::builder::intents::UpdateIntent {
6043 super::builder::intents::UpdateIntent::new(self.inner.clone())
6044 }
6045
6046 /// Deletes the specified intent and its direct or indirect followup intents.
6047 ///
6048 /// Note: You should always train an agent prior to sending it queries. See the
6049 /// [training
6050 /// documentation](https://cloud.google.com/dialogflow/es/docs/training).
6051 ///
6052 /// # Example
6053 /// ```
6054 /// # use google_cloud_dialogflow_v2::client::Intents;
6055 /// use google_cloud_dialogflow_v2::Result;
6056 /// async fn sample(
6057 /// client: &Intents, name: &str
6058 /// ) -> Result<()> {
6059 /// client.delete_intent()
6060 /// .set_name(name)
6061 /// .send().await?;
6062 /// Ok(())
6063 /// }
6064 /// ```
6065 pub fn delete_intent(&self) -> super::builder::intents::DeleteIntent {
6066 super::builder::intents::DeleteIntent::new(self.inner.clone())
6067 }
6068
6069 /// Updates/Creates multiple intents in the specified agent.
6070 ///
6071 /// This method is a [long-running
6072 /// operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations).
6073 /// The returned `Operation` type has the following method-specific fields:
6074 ///
6075 /// - `metadata`: An empty [Struct
6076 /// message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct)
6077 /// - `response`:
6078 /// [BatchUpdateIntentsResponse][google.cloud.dialogflow.v2.BatchUpdateIntentsResponse]
6079 ///
6080 /// Note: You should always train an agent prior to sending it queries. See the
6081 /// [training
6082 /// documentation](https://cloud.google.com/dialogflow/es/docs/training).
6083 ///
6084 /// [google.cloud.dialogflow.v2.BatchUpdateIntentsResponse]: crate::model::BatchUpdateIntentsResponse
6085 ///
6086 /// # Long running operations
6087 ///
6088 /// This method is used to start, and/or poll a [long-running Operation].
6089 /// The [Working with long-running operations] chapter in the [user guide]
6090 /// covers these operations in detail.
6091 ///
6092 /// [long-running operation]: https://google.aip.dev/151
6093 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
6094 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
6095 ///
6096 /// # Example
6097 /// ```
6098 /// # use google_cloud_dialogflow_v2::client::Intents;
6099 /// use google_cloud_lro::Poller;
6100 /// use google_cloud_dialogflow_v2::Result;
6101 /// async fn sample(
6102 /// client: &Intents
6103 /// ) -> Result<()> {
6104 /// let response = client.batch_update_intents()
6105 /// /* set fields */
6106 /// .poller().until_done().await?;
6107 /// println!("response {:?}", response);
6108 /// Ok(())
6109 /// }
6110 /// ```
6111 pub fn batch_update_intents(&self) -> super::builder::intents::BatchUpdateIntents {
6112 super::builder::intents::BatchUpdateIntents::new(self.inner.clone())
6113 }
6114
6115 /// Deletes intents in the specified agent.
6116 ///
6117 /// This method is a [long-running
6118 /// operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations).
6119 /// The returned `Operation` type has the following method-specific fields:
6120 ///
6121 /// - `metadata`: An empty [Struct
6122 /// message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct)
6123 /// - `response`: An [Empty
6124 /// message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
6125 ///
6126 /// Note: You should always train an agent prior to sending it queries. See the
6127 /// [training
6128 /// documentation](https://cloud.google.com/dialogflow/es/docs/training).
6129 ///
6130 /// # Long running operations
6131 ///
6132 /// This method is used to start, and/or poll a [long-running Operation].
6133 /// The [Working with long-running operations] chapter in the [user guide]
6134 /// covers these operations in detail.
6135 ///
6136 /// [long-running operation]: https://google.aip.dev/151
6137 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
6138 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
6139 ///
6140 /// # Example
6141 /// ```
6142 /// # use google_cloud_dialogflow_v2::client::Intents;
6143 /// use google_cloud_lro::Poller;
6144 /// use google_cloud_dialogflow_v2::Result;
6145 /// async fn sample(
6146 /// client: &Intents
6147 /// ) -> Result<()> {
6148 /// client.batch_delete_intents()
6149 /// /* set fields */
6150 /// .poller().until_done().await?;
6151 /// Ok(())
6152 /// }
6153 /// ```
6154 pub fn batch_delete_intents(&self) -> super::builder::intents::BatchDeleteIntents {
6155 super::builder::intents::BatchDeleteIntents::new(self.inner.clone())
6156 }
6157
6158 /// Lists information about the supported locations for this service.
6159 ///
6160 /// # Example
6161 /// ```
6162 /// # use google_cloud_dialogflow_v2::client::Intents;
6163 /// use google_cloud_gax::paginator::ItemPaginator as _;
6164 /// use google_cloud_dialogflow_v2::Result;
6165 /// async fn sample(
6166 /// client: &Intents
6167 /// ) -> Result<()> {
6168 /// let mut list = client.list_locations()
6169 /// /* set fields */
6170 /// .by_item();
6171 /// while let Some(item) = list.next().await.transpose()? {
6172 /// println!("{:?}", item);
6173 /// }
6174 /// Ok(())
6175 /// }
6176 /// ```
6177 pub fn list_locations(&self) -> super::builder::intents::ListLocations {
6178 super::builder::intents::ListLocations::new(self.inner.clone())
6179 }
6180
6181 /// Gets information about a location.
6182 ///
6183 /// # Example
6184 /// ```
6185 /// # use google_cloud_dialogflow_v2::client::Intents;
6186 /// use google_cloud_dialogflow_v2::Result;
6187 /// async fn sample(
6188 /// client: &Intents
6189 /// ) -> Result<()> {
6190 /// let response = client.get_location()
6191 /// /* set fields */
6192 /// .send().await?;
6193 /// println!("response {:?}", response);
6194 /// Ok(())
6195 /// }
6196 /// ```
6197 pub fn get_location(&self) -> super::builder::intents::GetLocation {
6198 super::builder::intents::GetLocation::new(self.inner.clone())
6199 }
6200
6201 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
6202 ///
6203 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
6204 ///
6205 /// # Example
6206 /// ```
6207 /// # use google_cloud_dialogflow_v2::client::Intents;
6208 /// use google_cloud_gax::paginator::ItemPaginator as _;
6209 /// use google_cloud_dialogflow_v2::Result;
6210 /// async fn sample(
6211 /// client: &Intents
6212 /// ) -> Result<()> {
6213 /// let mut list = client.list_operations()
6214 /// /* set fields */
6215 /// .by_item();
6216 /// while let Some(item) = list.next().await.transpose()? {
6217 /// println!("{:?}", item);
6218 /// }
6219 /// Ok(())
6220 /// }
6221 /// ```
6222 pub fn list_operations(&self) -> super::builder::intents::ListOperations {
6223 super::builder::intents::ListOperations::new(self.inner.clone())
6224 }
6225
6226 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
6227 ///
6228 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
6229 ///
6230 /// # Example
6231 /// ```
6232 /// # use google_cloud_dialogflow_v2::client::Intents;
6233 /// use google_cloud_dialogflow_v2::Result;
6234 /// async fn sample(
6235 /// client: &Intents
6236 /// ) -> Result<()> {
6237 /// let response = client.get_operation()
6238 /// /* set fields */
6239 /// .send().await?;
6240 /// println!("response {:?}", response);
6241 /// Ok(())
6242 /// }
6243 /// ```
6244 pub fn get_operation(&self) -> super::builder::intents::GetOperation {
6245 super::builder::intents::GetOperation::new(self.inner.clone())
6246 }
6247
6248 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
6249 ///
6250 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
6251 ///
6252 /// # Example
6253 /// ```
6254 /// # use google_cloud_dialogflow_v2::client::Intents;
6255 /// use google_cloud_dialogflow_v2::Result;
6256 /// async fn sample(
6257 /// client: &Intents
6258 /// ) -> Result<()> {
6259 /// client.cancel_operation()
6260 /// /* set fields */
6261 /// .send().await?;
6262 /// Ok(())
6263 /// }
6264 /// ```
6265 pub fn cancel_operation(&self) -> super::builder::intents::CancelOperation {
6266 super::builder::intents::CancelOperation::new(self.inner.clone())
6267 }
6268}
6269
6270/// Implements a client for the Dialogflow API.
6271///
6272/// # Example
6273/// ```
6274/// # use google_cloud_dialogflow_v2::client::KnowledgeBases;
6275/// use google_cloud_gax::paginator::ItemPaginator as _;
6276/// # async fn sample() -> Result<(), Box<dyn std::error::Error>> {
6277/// let client = KnowledgeBases::builder().build().await?;
6278/// let parent = "parent_value";
6279/// let mut list = client.list_knowledge_bases()
6280/// .set_parent(parent)
6281/// .by_item();
6282/// while let Some(item) = list.next().await.transpose()? {
6283/// println!("{:?}", item);
6284/// }
6285/// # Ok(()) }
6286/// ```
6287///
6288/// # Service Description
6289///
6290/// Service for managing
6291/// [KnowledgeBases][google.cloud.dialogflow.v2.KnowledgeBase].
6292///
6293/// [google.cloud.dialogflow.v2.KnowledgeBase]: crate::model::KnowledgeBase
6294///
6295/// # Configuration
6296///
6297/// To configure `KnowledgeBases` use the `with_*` methods in the type returned
6298/// by [builder()][KnowledgeBases::builder]. The default configuration should
6299/// work for most applications. Common configuration changes include
6300///
6301/// * [with_endpoint()]: by default this client uses the global default endpoint
6302/// (`https://dialogflow.googleapis.com`). Applications using regional
6303/// endpoints or running in restricted networks (e.g. a network configured
6304// with [Private Google Access with VPC Service Controls]) may want to
6305/// override this default.
6306/// * [with_credentials()]: by default this client uses
6307/// [Application Default Credentials]. Applications using custom
6308/// authentication may need to override this default.
6309///
6310/// [with_endpoint()]: super::builder::knowledge_bases::ClientBuilder::with_endpoint
6311/// [with_credentials()]: super::builder::knowledge_bases::ClientBuilder::with_credentials
6312/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
6313/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
6314///
6315/// # Pooling and Cloning
6316///
6317/// `KnowledgeBases` holds a connection pool internally, it is advised to
6318/// create one and reuse it. You do not need to wrap `KnowledgeBases` in
6319/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
6320/// already uses an `Arc` internally.
6321#[cfg(feature = "knowledge-bases")]
6322#[cfg_attr(docsrs, doc(cfg(feature = "knowledge-bases")))]
6323#[derive(Clone, Debug)]
6324pub struct KnowledgeBases {
6325 inner: std::sync::Arc<dyn super::stub::dynamic::KnowledgeBases>,
6326}
6327
6328#[cfg(feature = "knowledge-bases")]
6329impl KnowledgeBases {
6330 /// Returns a builder for [KnowledgeBases].
6331 ///
6332 /// ```
6333 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
6334 /// # use google_cloud_dialogflow_v2::client::KnowledgeBases;
6335 /// let client = KnowledgeBases::builder().build().await?;
6336 /// # Ok(()) }
6337 /// ```
6338 pub fn builder() -> super::builder::knowledge_bases::ClientBuilder {
6339 crate::new_client_builder(super::builder::knowledge_bases::client::Factory)
6340 }
6341
6342 /// Creates a new client from the provided stub.
6343 ///
6344 /// The most common case for calling this function is in tests mocking the
6345 /// client's behavior.
6346 pub fn from_stub<T>(stub: T) -> Self
6347 where
6348 T: super::stub::KnowledgeBases + 'static,
6349 {
6350 Self {
6351 inner: std::sync::Arc::new(stub),
6352 }
6353 }
6354
6355 pub(crate) async fn new(
6356 config: gaxi::options::ClientConfig,
6357 ) -> crate::ClientBuilderResult<Self> {
6358 let inner = Self::build_inner(config).await?;
6359 Ok(Self { inner })
6360 }
6361
6362 async fn build_inner(
6363 conf: gaxi::options::ClientConfig,
6364 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::KnowledgeBases>> {
6365 if gaxi::options::tracing_enabled(&conf) {
6366 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
6367 }
6368 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
6369 }
6370
6371 async fn build_transport(
6372 conf: gaxi::options::ClientConfig,
6373 ) -> crate::ClientBuilderResult<impl super::stub::KnowledgeBases> {
6374 super::transport::KnowledgeBases::new(conf).await
6375 }
6376
6377 async fn build_with_tracing(
6378 conf: gaxi::options::ClientConfig,
6379 ) -> crate::ClientBuilderResult<impl super::stub::KnowledgeBases> {
6380 Self::build_transport(conf)
6381 .await
6382 .map(super::tracing::KnowledgeBases::new)
6383 }
6384
6385 /// Returns the list of all knowledge bases of the specified agent.
6386 ///
6387 /// # Example
6388 /// ```
6389 /// # use google_cloud_dialogflow_v2::client::KnowledgeBases;
6390 /// use google_cloud_gax::paginator::ItemPaginator as _;
6391 /// use google_cloud_dialogflow_v2::Result;
6392 /// async fn sample(
6393 /// client: &KnowledgeBases, parent: &str
6394 /// ) -> Result<()> {
6395 /// let mut list = client.list_knowledge_bases()
6396 /// .set_parent(parent)
6397 /// .by_item();
6398 /// while let Some(item) = list.next().await.transpose()? {
6399 /// println!("{:?}", item);
6400 /// }
6401 /// Ok(())
6402 /// }
6403 /// ```
6404 pub fn list_knowledge_bases(&self) -> super::builder::knowledge_bases::ListKnowledgeBases {
6405 super::builder::knowledge_bases::ListKnowledgeBases::new(self.inner.clone())
6406 }
6407
6408 /// Retrieves the specified knowledge base.
6409 ///
6410 /// # Example
6411 /// ```
6412 /// # use google_cloud_dialogflow_v2::client::KnowledgeBases;
6413 /// use google_cloud_dialogflow_v2::Result;
6414 /// async fn sample(
6415 /// client: &KnowledgeBases, name: &str
6416 /// ) -> Result<()> {
6417 /// let response = client.get_knowledge_base()
6418 /// .set_name(name)
6419 /// .send().await?;
6420 /// println!("response {:?}", response);
6421 /// Ok(())
6422 /// }
6423 /// ```
6424 pub fn get_knowledge_base(&self) -> super::builder::knowledge_bases::GetKnowledgeBase {
6425 super::builder::knowledge_bases::GetKnowledgeBase::new(self.inner.clone())
6426 }
6427
6428 /// Creates a knowledge base.
6429 ///
6430 /// # Example
6431 /// ```
6432 /// # use google_cloud_dialogflow_v2::client::KnowledgeBases;
6433 /// use google_cloud_dialogflow_v2::model::KnowledgeBase;
6434 /// use google_cloud_dialogflow_v2::Result;
6435 /// async fn sample(
6436 /// client: &KnowledgeBases, parent: &str
6437 /// ) -> Result<()> {
6438 /// let response = client.create_knowledge_base()
6439 /// .set_parent(parent)
6440 /// .set_knowledge_base(
6441 /// KnowledgeBase::new()/* set fields */
6442 /// )
6443 /// .send().await?;
6444 /// println!("response {:?}", response);
6445 /// Ok(())
6446 /// }
6447 /// ```
6448 pub fn create_knowledge_base(&self) -> super::builder::knowledge_bases::CreateKnowledgeBase {
6449 super::builder::knowledge_bases::CreateKnowledgeBase::new(self.inner.clone())
6450 }
6451
6452 /// Deletes the specified knowledge base.
6453 ///
6454 /// # Example
6455 /// ```
6456 /// # use google_cloud_dialogflow_v2::client::KnowledgeBases;
6457 /// use google_cloud_dialogflow_v2::Result;
6458 /// async fn sample(
6459 /// client: &KnowledgeBases, name: &str
6460 /// ) -> Result<()> {
6461 /// client.delete_knowledge_base()
6462 /// .set_name(name)
6463 /// .send().await?;
6464 /// Ok(())
6465 /// }
6466 /// ```
6467 pub fn delete_knowledge_base(&self) -> super::builder::knowledge_bases::DeleteKnowledgeBase {
6468 super::builder::knowledge_bases::DeleteKnowledgeBase::new(self.inner.clone())
6469 }
6470
6471 /// Updates the specified knowledge base.
6472 ///
6473 /// # Example
6474 /// ```
6475 /// # use google_cloud_dialogflow_v2::client::KnowledgeBases;
6476 /// # extern crate wkt as google_cloud_wkt;
6477 /// use google_cloud_wkt::FieldMask;
6478 /// use google_cloud_dialogflow_v2::model::KnowledgeBase;
6479 /// use google_cloud_dialogflow_v2::Result;
6480 /// async fn sample(
6481 /// client: &KnowledgeBases, name: &str
6482 /// ) -> Result<()> {
6483 /// let response = client.update_knowledge_base()
6484 /// .set_knowledge_base(
6485 /// KnowledgeBase::new().set_name(name)/* set fields */
6486 /// )
6487 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
6488 /// .send().await?;
6489 /// println!("response {:?}", response);
6490 /// Ok(())
6491 /// }
6492 /// ```
6493 pub fn update_knowledge_base(&self) -> super::builder::knowledge_bases::UpdateKnowledgeBase {
6494 super::builder::knowledge_bases::UpdateKnowledgeBase::new(self.inner.clone())
6495 }
6496
6497 /// Lists information about the supported locations for this service.
6498 ///
6499 /// # Example
6500 /// ```
6501 /// # use google_cloud_dialogflow_v2::client::KnowledgeBases;
6502 /// use google_cloud_gax::paginator::ItemPaginator as _;
6503 /// use google_cloud_dialogflow_v2::Result;
6504 /// async fn sample(
6505 /// client: &KnowledgeBases
6506 /// ) -> Result<()> {
6507 /// let mut list = client.list_locations()
6508 /// /* set fields */
6509 /// .by_item();
6510 /// while let Some(item) = list.next().await.transpose()? {
6511 /// println!("{:?}", item);
6512 /// }
6513 /// Ok(())
6514 /// }
6515 /// ```
6516 pub fn list_locations(&self) -> super::builder::knowledge_bases::ListLocations {
6517 super::builder::knowledge_bases::ListLocations::new(self.inner.clone())
6518 }
6519
6520 /// Gets information about a location.
6521 ///
6522 /// # Example
6523 /// ```
6524 /// # use google_cloud_dialogflow_v2::client::KnowledgeBases;
6525 /// use google_cloud_dialogflow_v2::Result;
6526 /// async fn sample(
6527 /// client: &KnowledgeBases
6528 /// ) -> Result<()> {
6529 /// let response = client.get_location()
6530 /// /* set fields */
6531 /// .send().await?;
6532 /// println!("response {:?}", response);
6533 /// Ok(())
6534 /// }
6535 /// ```
6536 pub fn get_location(&self) -> super::builder::knowledge_bases::GetLocation {
6537 super::builder::knowledge_bases::GetLocation::new(self.inner.clone())
6538 }
6539
6540 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
6541 ///
6542 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
6543 ///
6544 /// # Example
6545 /// ```
6546 /// # use google_cloud_dialogflow_v2::client::KnowledgeBases;
6547 /// use google_cloud_gax::paginator::ItemPaginator as _;
6548 /// use google_cloud_dialogflow_v2::Result;
6549 /// async fn sample(
6550 /// client: &KnowledgeBases
6551 /// ) -> Result<()> {
6552 /// let mut list = client.list_operations()
6553 /// /* set fields */
6554 /// .by_item();
6555 /// while let Some(item) = list.next().await.transpose()? {
6556 /// println!("{:?}", item);
6557 /// }
6558 /// Ok(())
6559 /// }
6560 /// ```
6561 pub fn list_operations(&self) -> super::builder::knowledge_bases::ListOperations {
6562 super::builder::knowledge_bases::ListOperations::new(self.inner.clone())
6563 }
6564
6565 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
6566 ///
6567 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
6568 ///
6569 /// # Example
6570 /// ```
6571 /// # use google_cloud_dialogflow_v2::client::KnowledgeBases;
6572 /// use google_cloud_dialogflow_v2::Result;
6573 /// async fn sample(
6574 /// client: &KnowledgeBases
6575 /// ) -> Result<()> {
6576 /// let response = client.get_operation()
6577 /// /* set fields */
6578 /// .send().await?;
6579 /// println!("response {:?}", response);
6580 /// Ok(())
6581 /// }
6582 /// ```
6583 pub fn get_operation(&self) -> super::builder::knowledge_bases::GetOperation {
6584 super::builder::knowledge_bases::GetOperation::new(self.inner.clone())
6585 }
6586
6587 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
6588 ///
6589 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
6590 ///
6591 /// # Example
6592 /// ```
6593 /// # use google_cloud_dialogflow_v2::client::KnowledgeBases;
6594 /// use google_cloud_dialogflow_v2::Result;
6595 /// async fn sample(
6596 /// client: &KnowledgeBases
6597 /// ) -> Result<()> {
6598 /// client.cancel_operation()
6599 /// /* set fields */
6600 /// .send().await?;
6601 /// Ok(())
6602 /// }
6603 /// ```
6604 pub fn cancel_operation(&self) -> super::builder::knowledge_bases::CancelOperation {
6605 super::builder::knowledge_bases::CancelOperation::new(self.inner.clone())
6606 }
6607}
6608
6609/// Implements a client for the Dialogflow API.
6610///
6611/// # Example
6612/// ```
6613/// # use google_cloud_dialogflow_v2::client::Participants;
6614/// use google_cloud_gax::paginator::ItemPaginator as _;
6615/// # async fn sample() -> Result<(), Box<dyn std::error::Error>> {
6616/// let client = Participants::builder().build().await?;
6617/// let parent = "parent_value";
6618/// let mut list = client.list_participants()
6619/// .set_parent(parent)
6620/// .by_item();
6621/// while let Some(item) = list.next().await.transpose()? {
6622/// println!("{:?}", item);
6623/// }
6624/// # Ok(()) }
6625/// ```
6626///
6627/// # Service Description
6628///
6629/// Service for managing [Participants][google.cloud.dialogflow.v2.Participant].
6630///
6631/// [google.cloud.dialogflow.v2.Participant]: crate::model::Participant
6632///
6633/// # Configuration
6634///
6635/// To configure `Participants` use the `with_*` methods in the type returned
6636/// by [builder()][Participants::builder]. The default configuration should
6637/// work for most applications. Common configuration changes include
6638///
6639/// * [with_endpoint()]: by default this client uses the global default endpoint
6640/// (`https://dialogflow.googleapis.com`). Applications using regional
6641/// endpoints or running in restricted networks (e.g. a network configured
6642// with [Private Google Access with VPC Service Controls]) may want to
6643/// override this default.
6644/// * [with_credentials()]: by default this client uses
6645/// [Application Default Credentials]. Applications using custom
6646/// authentication may need to override this default.
6647///
6648/// [with_endpoint()]: super::builder::participants::ClientBuilder::with_endpoint
6649/// [with_credentials()]: super::builder::participants::ClientBuilder::with_credentials
6650/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
6651/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
6652///
6653/// # Pooling and Cloning
6654///
6655/// `Participants` holds a connection pool internally, it is advised to
6656/// create one and reuse it. You do not need to wrap `Participants` in
6657/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
6658/// already uses an `Arc` internally.
6659#[cfg(feature = "participants")]
6660#[cfg_attr(docsrs, doc(cfg(feature = "participants")))]
6661#[derive(Clone, Debug)]
6662pub struct Participants {
6663 inner: std::sync::Arc<dyn super::stub::dynamic::Participants>,
6664}
6665
6666#[cfg(feature = "participants")]
6667impl Participants {
6668 /// Returns a builder for [Participants].
6669 ///
6670 /// ```
6671 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
6672 /// # use google_cloud_dialogflow_v2::client::Participants;
6673 /// let client = Participants::builder().build().await?;
6674 /// # Ok(()) }
6675 /// ```
6676 pub fn builder() -> super::builder::participants::ClientBuilder {
6677 crate::new_client_builder(super::builder::participants::client::Factory)
6678 }
6679
6680 /// Creates a new client from the provided stub.
6681 ///
6682 /// The most common case for calling this function is in tests mocking the
6683 /// client's behavior.
6684 pub fn from_stub<T>(stub: T) -> Self
6685 where
6686 T: super::stub::Participants + 'static,
6687 {
6688 Self {
6689 inner: std::sync::Arc::new(stub),
6690 }
6691 }
6692
6693 pub(crate) async fn new(
6694 config: gaxi::options::ClientConfig,
6695 ) -> crate::ClientBuilderResult<Self> {
6696 let inner = Self::build_inner(config).await?;
6697 Ok(Self { inner })
6698 }
6699
6700 async fn build_inner(
6701 conf: gaxi::options::ClientConfig,
6702 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::Participants>> {
6703 if gaxi::options::tracing_enabled(&conf) {
6704 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
6705 }
6706 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
6707 }
6708
6709 async fn build_transport(
6710 conf: gaxi::options::ClientConfig,
6711 ) -> crate::ClientBuilderResult<impl super::stub::Participants> {
6712 super::transport::Participants::new(conf).await
6713 }
6714
6715 async fn build_with_tracing(
6716 conf: gaxi::options::ClientConfig,
6717 ) -> crate::ClientBuilderResult<impl super::stub::Participants> {
6718 Self::build_transport(conf)
6719 .await
6720 .map(super::tracing::Participants::new)
6721 }
6722
6723 /// Creates a new participant in a conversation.
6724 ///
6725 /// # Example
6726 /// ```
6727 /// # use google_cloud_dialogflow_v2::client::Participants;
6728 /// use google_cloud_dialogflow_v2::model::Participant;
6729 /// use google_cloud_dialogflow_v2::Result;
6730 /// async fn sample(
6731 /// client: &Participants, parent: &str
6732 /// ) -> Result<()> {
6733 /// let response = client.create_participant()
6734 /// .set_parent(parent)
6735 /// .set_participant(
6736 /// Participant::new()/* set fields */
6737 /// )
6738 /// .send().await?;
6739 /// println!("response {:?}", response);
6740 /// Ok(())
6741 /// }
6742 /// ```
6743 pub fn create_participant(&self) -> super::builder::participants::CreateParticipant {
6744 super::builder::participants::CreateParticipant::new(self.inner.clone())
6745 }
6746
6747 /// Retrieves a conversation participant.
6748 ///
6749 /// # Example
6750 /// ```
6751 /// # use google_cloud_dialogflow_v2::client::Participants;
6752 /// use google_cloud_dialogflow_v2::Result;
6753 /// async fn sample(
6754 /// client: &Participants, name: &str
6755 /// ) -> Result<()> {
6756 /// let response = client.get_participant()
6757 /// .set_name(name)
6758 /// .send().await?;
6759 /// println!("response {:?}", response);
6760 /// Ok(())
6761 /// }
6762 /// ```
6763 pub fn get_participant(&self) -> super::builder::participants::GetParticipant {
6764 super::builder::participants::GetParticipant::new(self.inner.clone())
6765 }
6766
6767 /// Returns the list of all participants in the specified conversation.
6768 ///
6769 /// # Example
6770 /// ```
6771 /// # use google_cloud_dialogflow_v2::client::Participants;
6772 /// use google_cloud_gax::paginator::ItemPaginator as _;
6773 /// use google_cloud_dialogflow_v2::Result;
6774 /// async fn sample(
6775 /// client: &Participants, parent: &str
6776 /// ) -> Result<()> {
6777 /// let mut list = client.list_participants()
6778 /// .set_parent(parent)
6779 /// .by_item();
6780 /// while let Some(item) = list.next().await.transpose()? {
6781 /// println!("{:?}", item);
6782 /// }
6783 /// Ok(())
6784 /// }
6785 /// ```
6786 pub fn list_participants(&self) -> super::builder::participants::ListParticipants {
6787 super::builder::participants::ListParticipants::new(self.inner.clone())
6788 }
6789
6790 /// Updates the specified participant.
6791 ///
6792 /// # Example
6793 /// ```
6794 /// # use google_cloud_dialogflow_v2::client::Participants;
6795 /// # extern crate wkt as google_cloud_wkt;
6796 /// use google_cloud_wkt::FieldMask;
6797 /// use google_cloud_dialogflow_v2::model::Participant;
6798 /// use google_cloud_dialogflow_v2::Result;
6799 /// async fn sample(
6800 /// client: &Participants, name: &str
6801 /// ) -> Result<()> {
6802 /// let response = client.update_participant()
6803 /// .set_participant(
6804 /// Participant::new().set_name(name)/* set fields */
6805 /// )
6806 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
6807 /// .send().await?;
6808 /// println!("response {:?}", response);
6809 /// Ok(())
6810 /// }
6811 /// ```
6812 pub fn update_participant(&self) -> super::builder::participants::UpdateParticipant {
6813 super::builder::participants::UpdateParticipant::new(self.inner.clone())
6814 }
6815
6816 /// Adds a text (chat, for example), or audio (phone recording, for example)
6817 /// message from a participant into the conversation.
6818 ///
6819 /// Note: Always use agent versions for production traffic
6820 /// sent to virtual agents. See [Versions and
6821 /// environments](https://cloud.google.com/dialogflow/es/docs/agents-versions).
6822 ///
6823 /// # Example
6824 /// ```
6825 /// # use google_cloud_dialogflow_v2::client::Participants;
6826 /// use google_cloud_dialogflow_v2::Result;
6827 /// async fn sample(
6828 /// client: &Participants
6829 /// ) -> Result<()> {
6830 /// let response = client.analyze_content()
6831 /// /* set fields */
6832 /// .send().await?;
6833 /// println!("response {:?}", response);
6834 /// Ok(())
6835 /// }
6836 /// ```
6837 pub fn analyze_content(&self) -> super::builder::participants::AnalyzeContent {
6838 super::builder::participants::AnalyzeContent::new(self.inner.clone())
6839 }
6840
6841 /// Gets suggested articles for a participant based on specific historical
6842 /// messages.
6843 ///
6844 /// # Example
6845 /// ```
6846 /// # use google_cloud_dialogflow_v2::client::Participants;
6847 /// use google_cloud_dialogflow_v2::Result;
6848 /// async fn sample(
6849 /// client: &Participants
6850 /// ) -> Result<()> {
6851 /// let response = client.suggest_articles()
6852 /// /* set fields */
6853 /// .send().await?;
6854 /// println!("response {:?}", response);
6855 /// Ok(())
6856 /// }
6857 /// ```
6858 pub fn suggest_articles(&self) -> super::builder::participants::SuggestArticles {
6859 super::builder::participants::SuggestArticles::new(self.inner.clone())
6860 }
6861
6862 /// Gets suggested faq answers for a participant based on specific historical
6863 /// messages.
6864 ///
6865 /// # Example
6866 /// ```
6867 /// # use google_cloud_dialogflow_v2::client::Participants;
6868 /// use google_cloud_dialogflow_v2::Result;
6869 /// async fn sample(
6870 /// client: &Participants
6871 /// ) -> Result<()> {
6872 /// let response = client.suggest_faq_answers()
6873 /// /* set fields */
6874 /// .send().await?;
6875 /// println!("response {:?}", response);
6876 /// Ok(())
6877 /// }
6878 /// ```
6879 pub fn suggest_faq_answers(&self) -> super::builder::participants::SuggestFaqAnswers {
6880 super::builder::participants::SuggestFaqAnswers::new(self.inner.clone())
6881 }
6882
6883 /// Gets smart replies for a participant based on specific historical
6884 /// messages.
6885 ///
6886 /// # Example
6887 /// ```
6888 /// # use google_cloud_dialogflow_v2::client::Participants;
6889 /// use google_cloud_dialogflow_v2::Result;
6890 /// async fn sample(
6891 /// client: &Participants
6892 /// ) -> Result<()> {
6893 /// let response = client.suggest_smart_replies()
6894 /// /* set fields */
6895 /// .send().await?;
6896 /// println!("response {:?}", response);
6897 /// Ok(())
6898 /// }
6899 /// ```
6900 pub fn suggest_smart_replies(&self) -> super::builder::participants::SuggestSmartReplies {
6901 super::builder::participants::SuggestSmartReplies::new(self.inner.clone())
6902 }
6903
6904 /// Gets knowledge assist suggestions based on historical messages.
6905 ///
6906 /// # Example
6907 /// ```
6908 /// # use google_cloud_dialogflow_v2::client::Participants;
6909 /// use google_cloud_dialogflow_v2::Result;
6910 /// async fn sample(
6911 /// client: &Participants
6912 /// ) -> Result<()> {
6913 /// let response = client.suggest_knowledge_assist()
6914 /// /* set fields */
6915 /// .send().await?;
6916 /// println!("response {:?}", response);
6917 /// Ok(())
6918 /// }
6919 /// ```
6920 pub fn suggest_knowledge_assist(&self) -> super::builder::participants::SuggestKnowledgeAssist {
6921 super::builder::participants::SuggestKnowledgeAssist::new(self.inner.clone())
6922 }
6923
6924 /// Lists information about the supported locations for this service.
6925 ///
6926 /// # Example
6927 /// ```
6928 /// # use google_cloud_dialogflow_v2::client::Participants;
6929 /// use google_cloud_gax::paginator::ItemPaginator as _;
6930 /// use google_cloud_dialogflow_v2::Result;
6931 /// async fn sample(
6932 /// client: &Participants
6933 /// ) -> Result<()> {
6934 /// let mut list = client.list_locations()
6935 /// /* set fields */
6936 /// .by_item();
6937 /// while let Some(item) = list.next().await.transpose()? {
6938 /// println!("{:?}", item);
6939 /// }
6940 /// Ok(())
6941 /// }
6942 /// ```
6943 pub fn list_locations(&self) -> super::builder::participants::ListLocations {
6944 super::builder::participants::ListLocations::new(self.inner.clone())
6945 }
6946
6947 /// Gets information about a location.
6948 ///
6949 /// # Example
6950 /// ```
6951 /// # use google_cloud_dialogflow_v2::client::Participants;
6952 /// use google_cloud_dialogflow_v2::Result;
6953 /// async fn sample(
6954 /// client: &Participants
6955 /// ) -> Result<()> {
6956 /// let response = client.get_location()
6957 /// /* set fields */
6958 /// .send().await?;
6959 /// println!("response {:?}", response);
6960 /// Ok(())
6961 /// }
6962 /// ```
6963 pub fn get_location(&self) -> super::builder::participants::GetLocation {
6964 super::builder::participants::GetLocation::new(self.inner.clone())
6965 }
6966
6967 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
6968 ///
6969 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
6970 ///
6971 /// # Example
6972 /// ```
6973 /// # use google_cloud_dialogflow_v2::client::Participants;
6974 /// use google_cloud_gax::paginator::ItemPaginator as _;
6975 /// use google_cloud_dialogflow_v2::Result;
6976 /// async fn sample(
6977 /// client: &Participants
6978 /// ) -> Result<()> {
6979 /// let mut list = client.list_operations()
6980 /// /* set fields */
6981 /// .by_item();
6982 /// while let Some(item) = list.next().await.transpose()? {
6983 /// println!("{:?}", item);
6984 /// }
6985 /// Ok(())
6986 /// }
6987 /// ```
6988 pub fn list_operations(&self) -> super::builder::participants::ListOperations {
6989 super::builder::participants::ListOperations::new(self.inner.clone())
6990 }
6991
6992 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
6993 ///
6994 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
6995 ///
6996 /// # Example
6997 /// ```
6998 /// # use google_cloud_dialogflow_v2::client::Participants;
6999 /// use google_cloud_dialogflow_v2::Result;
7000 /// async fn sample(
7001 /// client: &Participants
7002 /// ) -> Result<()> {
7003 /// let response = client.get_operation()
7004 /// /* set fields */
7005 /// .send().await?;
7006 /// println!("response {:?}", response);
7007 /// Ok(())
7008 /// }
7009 /// ```
7010 pub fn get_operation(&self) -> super::builder::participants::GetOperation {
7011 super::builder::participants::GetOperation::new(self.inner.clone())
7012 }
7013
7014 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
7015 ///
7016 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
7017 ///
7018 /// # Example
7019 /// ```
7020 /// # use google_cloud_dialogflow_v2::client::Participants;
7021 /// use google_cloud_dialogflow_v2::Result;
7022 /// async fn sample(
7023 /// client: &Participants
7024 /// ) -> Result<()> {
7025 /// client.cancel_operation()
7026 /// /* set fields */
7027 /// .send().await?;
7028 /// Ok(())
7029 /// }
7030 /// ```
7031 pub fn cancel_operation(&self) -> super::builder::participants::CancelOperation {
7032 super::builder::participants::CancelOperation::new(self.inner.clone())
7033 }
7034}
7035
7036/// Implements a client for the Dialogflow API.
7037///
7038/// # Example
7039/// ```
7040/// # use google_cloud_dialogflow_v2::client::Sessions;
7041/// # async fn sample() -> Result<(), Box<dyn std::error::Error>> {
7042/// let client = Sessions::builder().build().await?;
7043/// let response = client.detect_intent()
7044/// /* set fields */
7045/// .send().await?;
7046/// println!("response {:?}", response);
7047/// # Ok(()) }
7048/// ```
7049///
7050/// # Service Description
7051///
7052/// A service used for session interactions.
7053///
7054/// For more information, see the [API interactions
7055/// guide](https://cloud.google.com/dialogflow/docs/api-overview).
7056///
7057/// # Configuration
7058///
7059/// To configure `Sessions` use the `with_*` methods in the type returned
7060/// by [builder()][Sessions::builder]. The default configuration should
7061/// work for most applications. Common configuration changes include
7062///
7063/// * [with_endpoint()]: by default this client uses the global default endpoint
7064/// (`https://dialogflow.googleapis.com`). Applications using regional
7065/// endpoints or running in restricted networks (e.g. a network configured
7066// with [Private Google Access with VPC Service Controls]) may want to
7067/// override this default.
7068/// * [with_credentials()]: by default this client uses
7069/// [Application Default Credentials]. Applications using custom
7070/// authentication may need to override this default.
7071///
7072/// [with_endpoint()]: super::builder::sessions::ClientBuilder::with_endpoint
7073/// [with_credentials()]: super::builder::sessions::ClientBuilder::with_credentials
7074/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
7075/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
7076///
7077/// # Pooling and Cloning
7078///
7079/// `Sessions` holds a connection pool internally, it is advised to
7080/// create one and reuse it. You do not need to wrap `Sessions` in
7081/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
7082/// already uses an `Arc` internally.
7083#[cfg(feature = "sessions")]
7084#[cfg_attr(docsrs, doc(cfg(feature = "sessions")))]
7085#[derive(Clone, Debug)]
7086pub struct Sessions {
7087 inner: std::sync::Arc<dyn super::stub::dynamic::Sessions>,
7088}
7089
7090#[cfg(feature = "sessions")]
7091impl Sessions {
7092 /// Returns a builder for [Sessions].
7093 ///
7094 /// ```
7095 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
7096 /// # use google_cloud_dialogflow_v2::client::Sessions;
7097 /// let client = Sessions::builder().build().await?;
7098 /// # Ok(()) }
7099 /// ```
7100 pub fn builder() -> super::builder::sessions::ClientBuilder {
7101 crate::new_client_builder(super::builder::sessions::client::Factory)
7102 }
7103
7104 /// Creates a new client from the provided stub.
7105 ///
7106 /// The most common case for calling this function is in tests mocking the
7107 /// client's behavior.
7108 pub fn from_stub<T>(stub: T) -> Self
7109 where
7110 T: super::stub::Sessions + 'static,
7111 {
7112 Self {
7113 inner: std::sync::Arc::new(stub),
7114 }
7115 }
7116
7117 pub(crate) async fn new(
7118 config: gaxi::options::ClientConfig,
7119 ) -> crate::ClientBuilderResult<Self> {
7120 let inner = Self::build_inner(config).await?;
7121 Ok(Self { inner })
7122 }
7123
7124 async fn build_inner(
7125 conf: gaxi::options::ClientConfig,
7126 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::Sessions>> {
7127 if gaxi::options::tracing_enabled(&conf) {
7128 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
7129 }
7130 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
7131 }
7132
7133 async fn build_transport(
7134 conf: gaxi::options::ClientConfig,
7135 ) -> crate::ClientBuilderResult<impl super::stub::Sessions> {
7136 super::transport::Sessions::new(conf).await
7137 }
7138
7139 async fn build_with_tracing(
7140 conf: gaxi::options::ClientConfig,
7141 ) -> crate::ClientBuilderResult<impl super::stub::Sessions> {
7142 Self::build_transport(conf)
7143 .await
7144 .map(super::tracing::Sessions::new)
7145 }
7146
7147 /// Processes a natural language query and returns structured, actionable data
7148 /// as a result. This method is not idempotent, because it may cause contexts
7149 /// and session entity types to be updated, which in turn might affect
7150 /// results of future queries.
7151 ///
7152 /// If you might use
7153 /// [Agent Assist](https://cloud.google.com/dialogflow/docs/#aa)
7154 /// or other CCAI products now or in the future, consider using
7155 /// [AnalyzeContent][google.cloud.dialogflow.v2.Participants.AnalyzeContent]
7156 /// instead of `DetectIntent`. `AnalyzeContent` has additional
7157 /// functionality for Agent Assist and other CCAI products.
7158 ///
7159 /// Note: Always use agent versions for production traffic.
7160 /// See [Versions and
7161 /// environments](https://cloud.google.com/dialogflow/es/docs/agents-versions).
7162 ///
7163 /// [google.cloud.dialogflow.v2.Participants.AnalyzeContent]: crate::client::Participants::analyze_content
7164 ///
7165 /// # Example
7166 /// ```
7167 /// # use google_cloud_dialogflow_v2::client::Sessions;
7168 /// use google_cloud_dialogflow_v2::Result;
7169 /// async fn sample(
7170 /// client: &Sessions
7171 /// ) -> Result<()> {
7172 /// let response = client.detect_intent()
7173 /// /* set fields */
7174 /// .send().await?;
7175 /// println!("response {:?}", response);
7176 /// Ok(())
7177 /// }
7178 /// ```
7179 pub fn detect_intent(&self) -> super::builder::sessions::DetectIntent {
7180 super::builder::sessions::DetectIntent::new(self.inner.clone())
7181 }
7182
7183 /// Lists information about the supported locations for this service.
7184 ///
7185 /// # Example
7186 /// ```
7187 /// # use google_cloud_dialogflow_v2::client::Sessions;
7188 /// use google_cloud_gax::paginator::ItemPaginator as _;
7189 /// use google_cloud_dialogflow_v2::Result;
7190 /// async fn sample(
7191 /// client: &Sessions
7192 /// ) -> Result<()> {
7193 /// let mut list = client.list_locations()
7194 /// /* set fields */
7195 /// .by_item();
7196 /// while let Some(item) = list.next().await.transpose()? {
7197 /// println!("{:?}", item);
7198 /// }
7199 /// Ok(())
7200 /// }
7201 /// ```
7202 pub fn list_locations(&self) -> super::builder::sessions::ListLocations {
7203 super::builder::sessions::ListLocations::new(self.inner.clone())
7204 }
7205
7206 /// Gets information about a location.
7207 ///
7208 /// # Example
7209 /// ```
7210 /// # use google_cloud_dialogflow_v2::client::Sessions;
7211 /// use google_cloud_dialogflow_v2::Result;
7212 /// async fn sample(
7213 /// client: &Sessions
7214 /// ) -> Result<()> {
7215 /// let response = client.get_location()
7216 /// /* set fields */
7217 /// .send().await?;
7218 /// println!("response {:?}", response);
7219 /// Ok(())
7220 /// }
7221 /// ```
7222 pub fn get_location(&self) -> super::builder::sessions::GetLocation {
7223 super::builder::sessions::GetLocation::new(self.inner.clone())
7224 }
7225
7226 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
7227 ///
7228 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
7229 ///
7230 /// # Example
7231 /// ```
7232 /// # use google_cloud_dialogflow_v2::client::Sessions;
7233 /// use google_cloud_gax::paginator::ItemPaginator as _;
7234 /// use google_cloud_dialogflow_v2::Result;
7235 /// async fn sample(
7236 /// client: &Sessions
7237 /// ) -> Result<()> {
7238 /// let mut list = client.list_operations()
7239 /// /* set fields */
7240 /// .by_item();
7241 /// while let Some(item) = list.next().await.transpose()? {
7242 /// println!("{:?}", item);
7243 /// }
7244 /// Ok(())
7245 /// }
7246 /// ```
7247 pub fn list_operations(&self) -> super::builder::sessions::ListOperations {
7248 super::builder::sessions::ListOperations::new(self.inner.clone())
7249 }
7250
7251 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
7252 ///
7253 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
7254 ///
7255 /// # Example
7256 /// ```
7257 /// # use google_cloud_dialogflow_v2::client::Sessions;
7258 /// use google_cloud_dialogflow_v2::Result;
7259 /// async fn sample(
7260 /// client: &Sessions
7261 /// ) -> Result<()> {
7262 /// let response = client.get_operation()
7263 /// /* set fields */
7264 /// .send().await?;
7265 /// println!("response {:?}", response);
7266 /// Ok(())
7267 /// }
7268 /// ```
7269 pub fn get_operation(&self) -> super::builder::sessions::GetOperation {
7270 super::builder::sessions::GetOperation::new(self.inner.clone())
7271 }
7272
7273 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
7274 ///
7275 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
7276 ///
7277 /// # Example
7278 /// ```
7279 /// # use google_cloud_dialogflow_v2::client::Sessions;
7280 /// use google_cloud_dialogflow_v2::Result;
7281 /// async fn sample(
7282 /// client: &Sessions
7283 /// ) -> Result<()> {
7284 /// client.cancel_operation()
7285 /// /* set fields */
7286 /// .send().await?;
7287 /// Ok(())
7288 /// }
7289 /// ```
7290 pub fn cancel_operation(&self) -> super::builder::sessions::CancelOperation {
7291 super::builder::sessions::CancelOperation::new(self.inner.clone())
7292 }
7293}
7294
7295/// Implements a client for the Dialogflow API.
7296///
7297/// # Example
7298/// ```
7299/// # use google_cloud_dialogflow_v2::client::SessionEntityTypes;
7300/// use google_cloud_gax::paginator::ItemPaginator as _;
7301/// # async fn sample() -> Result<(), Box<dyn std::error::Error>> {
7302/// let client = SessionEntityTypes::builder().build().await?;
7303/// let parent = "parent_value";
7304/// let mut list = client.list_session_entity_types()
7305/// .set_parent(parent)
7306/// .by_item();
7307/// while let Some(item) = list.next().await.transpose()? {
7308/// println!("{:?}", item);
7309/// }
7310/// # Ok(()) }
7311/// ```
7312///
7313/// # Service Description
7314///
7315/// Service for managing
7316/// [SessionEntityTypes][google.cloud.dialogflow.v2.SessionEntityType].
7317///
7318/// [google.cloud.dialogflow.v2.SessionEntityType]: crate::model::SessionEntityType
7319///
7320/// # Configuration
7321///
7322/// To configure `SessionEntityTypes` use the `with_*` methods in the type returned
7323/// by [builder()][SessionEntityTypes::builder]. The default configuration should
7324/// work for most applications. Common configuration changes include
7325///
7326/// * [with_endpoint()]: by default this client uses the global default endpoint
7327/// (`https://dialogflow.googleapis.com`). Applications using regional
7328/// endpoints or running in restricted networks (e.g. a network configured
7329// with [Private Google Access with VPC Service Controls]) may want to
7330/// override this default.
7331/// * [with_credentials()]: by default this client uses
7332/// [Application Default Credentials]. Applications using custom
7333/// authentication may need to override this default.
7334///
7335/// [with_endpoint()]: super::builder::session_entity_types::ClientBuilder::with_endpoint
7336/// [with_credentials()]: super::builder::session_entity_types::ClientBuilder::with_credentials
7337/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
7338/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
7339///
7340/// # Pooling and Cloning
7341///
7342/// `SessionEntityTypes` holds a connection pool internally, it is advised to
7343/// create one and reuse it. You do not need to wrap `SessionEntityTypes` in
7344/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
7345/// already uses an `Arc` internally.
7346#[cfg(feature = "session-entity-types")]
7347#[cfg_attr(docsrs, doc(cfg(feature = "session-entity-types")))]
7348#[derive(Clone, Debug)]
7349pub struct SessionEntityTypes {
7350 inner: std::sync::Arc<dyn super::stub::dynamic::SessionEntityTypes>,
7351}
7352
7353#[cfg(feature = "session-entity-types")]
7354impl SessionEntityTypes {
7355 /// Returns a builder for [SessionEntityTypes].
7356 ///
7357 /// ```
7358 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
7359 /// # use google_cloud_dialogflow_v2::client::SessionEntityTypes;
7360 /// let client = SessionEntityTypes::builder().build().await?;
7361 /// # Ok(()) }
7362 /// ```
7363 pub fn builder() -> super::builder::session_entity_types::ClientBuilder {
7364 crate::new_client_builder(super::builder::session_entity_types::client::Factory)
7365 }
7366
7367 /// Creates a new client from the provided stub.
7368 ///
7369 /// The most common case for calling this function is in tests mocking the
7370 /// client's behavior.
7371 pub fn from_stub<T>(stub: T) -> Self
7372 where
7373 T: super::stub::SessionEntityTypes + 'static,
7374 {
7375 Self {
7376 inner: std::sync::Arc::new(stub),
7377 }
7378 }
7379
7380 pub(crate) async fn new(
7381 config: gaxi::options::ClientConfig,
7382 ) -> crate::ClientBuilderResult<Self> {
7383 let inner = Self::build_inner(config).await?;
7384 Ok(Self { inner })
7385 }
7386
7387 async fn build_inner(
7388 conf: gaxi::options::ClientConfig,
7389 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::SessionEntityTypes>>
7390 {
7391 if gaxi::options::tracing_enabled(&conf) {
7392 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
7393 }
7394 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
7395 }
7396
7397 async fn build_transport(
7398 conf: gaxi::options::ClientConfig,
7399 ) -> crate::ClientBuilderResult<impl super::stub::SessionEntityTypes> {
7400 super::transport::SessionEntityTypes::new(conf).await
7401 }
7402
7403 async fn build_with_tracing(
7404 conf: gaxi::options::ClientConfig,
7405 ) -> crate::ClientBuilderResult<impl super::stub::SessionEntityTypes> {
7406 Self::build_transport(conf)
7407 .await
7408 .map(super::tracing::SessionEntityTypes::new)
7409 }
7410
7411 /// Returns the list of all session entity types in the specified session.
7412 ///
7413 /// This method doesn't work with Google Assistant integration.
7414 /// Contact Dialogflow support if you need to use session entities
7415 /// with Google Assistant integration.
7416 ///
7417 /// # Example
7418 /// ```
7419 /// # use google_cloud_dialogflow_v2::client::SessionEntityTypes;
7420 /// use google_cloud_gax::paginator::ItemPaginator as _;
7421 /// use google_cloud_dialogflow_v2::Result;
7422 /// async fn sample(
7423 /// client: &SessionEntityTypes, parent: &str
7424 /// ) -> Result<()> {
7425 /// let mut list = client.list_session_entity_types()
7426 /// .set_parent(parent)
7427 /// .by_item();
7428 /// while let Some(item) = list.next().await.transpose()? {
7429 /// println!("{:?}", item);
7430 /// }
7431 /// Ok(())
7432 /// }
7433 /// ```
7434 pub fn list_session_entity_types(
7435 &self,
7436 ) -> super::builder::session_entity_types::ListSessionEntityTypes {
7437 super::builder::session_entity_types::ListSessionEntityTypes::new(self.inner.clone())
7438 }
7439
7440 /// Retrieves the specified session entity type.
7441 ///
7442 /// This method doesn't work with Google Assistant integration.
7443 /// Contact Dialogflow support if you need to use session entities
7444 /// with Google Assistant integration.
7445 ///
7446 /// # Example
7447 /// ```
7448 /// # use google_cloud_dialogflow_v2::client::SessionEntityTypes;
7449 /// use google_cloud_dialogflow_v2::Result;
7450 /// async fn sample(
7451 /// client: &SessionEntityTypes, name: &str
7452 /// ) -> Result<()> {
7453 /// let response = client.get_session_entity_type()
7454 /// .set_name(name)
7455 /// .send().await?;
7456 /// println!("response {:?}", response);
7457 /// Ok(())
7458 /// }
7459 /// ```
7460 pub fn get_session_entity_type(
7461 &self,
7462 ) -> super::builder::session_entity_types::GetSessionEntityType {
7463 super::builder::session_entity_types::GetSessionEntityType::new(self.inner.clone())
7464 }
7465
7466 /// Creates a session entity type.
7467 ///
7468 /// If the specified session entity type already exists, overrides the session
7469 /// entity type.
7470 ///
7471 /// This method doesn't work with Google Assistant integration.
7472 /// Contact Dialogflow support if you need to use session entities
7473 /// with Google Assistant integration.
7474 ///
7475 /// # Example
7476 /// ```
7477 /// # use google_cloud_dialogflow_v2::client::SessionEntityTypes;
7478 /// use google_cloud_dialogflow_v2::model::SessionEntityType;
7479 /// use google_cloud_dialogflow_v2::Result;
7480 /// async fn sample(
7481 /// client: &SessionEntityTypes, parent: &str
7482 /// ) -> Result<()> {
7483 /// let response = client.create_session_entity_type()
7484 /// .set_parent(parent)
7485 /// .set_session_entity_type(
7486 /// SessionEntityType::new()/* set fields */
7487 /// )
7488 /// .send().await?;
7489 /// println!("response {:?}", response);
7490 /// Ok(())
7491 /// }
7492 /// ```
7493 pub fn create_session_entity_type(
7494 &self,
7495 ) -> super::builder::session_entity_types::CreateSessionEntityType {
7496 super::builder::session_entity_types::CreateSessionEntityType::new(self.inner.clone())
7497 }
7498
7499 /// Updates the specified session entity type.
7500 ///
7501 /// This method doesn't work with Google Assistant integration.
7502 /// Contact Dialogflow support if you need to use session entities
7503 /// with Google Assistant integration.
7504 ///
7505 /// # Example
7506 /// ```
7507 /// # use google_cloud_dialogflow_v2::client::SessionEntityTypes;
7508 /// # extern crate wkt as google_cloud_wkt;
7509 /// use google_cloud_wkt::FieldMask;
7510 /// use google_cloud_dialogflow_v2::model::SessionEntityType;
7511 /// use google_cloud_dialogflow_v2::Result;
7512 /// async fn sample(
7513 /// client: &SessionEntityTypes, name: &str
7514 /// ) -> Result<()> {
7515 /// let response = client.update_session_entity_type()
7516 /// .set_session_entity_type(
7517 /// SessionEntityType::new().set_name(name)/* set fields */
7518 /// )
7519 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
7520 /// .send().await?;
7521 /// println!("response {:?}", response);
7522 /// Ok(())
7523 /// }
7524 /// ```
7525 pub fn update_session_entity_type(
7526 &self,
7527 ) -> super::builder::session_entity_types::UpdateSessionEntityType {
7528 super::builder::session_entity_types::UpdateSessionEntityType::new(self.inner.clone())
7529 }
7530
7531 /// Deletes the specified session entity type.
7532 ///
7533 /// This method doesn't work with Google Assistant integration.
7534 /// Contact Dialogflow support if you need to use session entities
7535 /// with Google Assistant integration.
7536 ///
7537 /// # Example
7538 /// ```
7539 /// # use google_cloud_dialogflow_v2::client::SessionEntityTypes;
7540 /// use google_cloud_dialogflow_v2::Result;
7541 /// async fn sample(
7542 /// client: &SessionEntityTypes, name: &str
7543 /// ) -> Result<()> {
7544 /// client.delete_session_entity_type()
7545 /// .set_name(name)
7546 /// .send().await?;
7547 /// Ok(())
7548 /// }
7549 /// ```
7550 pub fn delete_session_entity_type(
7551 &self,
7552 ) -> super::builder::session_entity_types::DeleteSessionEntityType {
7553 super::builder::session_entity_types::DeleteSessionEntityType::new(self.inner.clone())
7554 }
7555
7556 /// Lists information about the supported locations for this service.
7557 ///
7558 /// # Example
7559 /// ```
7560 /// # use google_cloud_dialogflow_v2::client::SessionEntityTypes;
7561 /// use google_cloud_gax::paginator::ItemPaginator as _;
7562 /// use google_cloud_dialogflow_v2::Result;
7563 /// async fn sample(
7564 /// client: &SessionEntityTypes
7565 /// ) -> Result<()> {
7566 /// let mut list = client.list_locations()
7567 /// /* set fields */
7568 /// .by_item();
7569 /// while let Some(item) = list.next().await.transpose()? {
7570 /// println!("{:?}", item);
7571 /// }
7572 /// Ok(())
7573 /// }
7574 /// ```
7575 pub fn list_locations(&self) -> super::builder::session_entity_types::ListLocations {
7576 super::builder::session_entity_types::ListLocations::new(self.inner.clone())
7577 }
7578
7579 /// Gets information about a location.
7580 ///
7581 /// # Example
7582 /// ```
7583 /// # use google_cloud_dialogflow_v2::client::SessionEntityTypes;
7584 /// use google_cloud_dialogflow_v2::Result;
7585 /// async fn sample(
7586 /// client: &SessionEntityTypes
7587 /// ) -> Result<()> {
7588 /// let response = client.get_location()
7589 /// /* set fields */
7590 /// .send().await?;
7591 /// println!("response {:?}", response);
7592 /// Ok(())
7593 /// }
7594 /// ```
7595 pub fn get_location(&self) -> super::builder::session_entity_types::GetLocation {
7596 super::builder::session_entity_types::GetLocation::new(self.inner.clone())
7597 }
7598
7599 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
7600 ///
7601 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
7602 ///
7603 /// # Example
7604 /// ```
7605 /// # use google_cloud_dialogflow_v2::client::SessionEntityTypes;
7606 /// use google_cloud_gax::paginator::ItemPaginator as _;
7607 /// use google_cloud_dialogflow_v2::Result;
7608 /// async fn sample(
7609 /// client: &SessionEntityTypes
7610 /// ) -> Result<()> {
7611 /// let mut list = client.list_operations()
7612 /// /* set fields */
7613 /// .by_item();
7614 /// while let Some(item) = list.next().await.transpose()? {
7615 /// println!("{:?}", item);
7616 /// }
7617 /// Ok(())
7618 /// }
7619 /// ```
7620 pub fn list_operations(&self) -> super::builder::session_entity_types::ListOperations {
7621 super::builder::session_entity_types::ListOperations::new(self.inner.clone())
7622 }
7623
7624 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
7625 ///
7626 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
7627 ///
7628 /// # Example
7629 /// ```
7630 /// # use google_cloud_dialogflow_v2::client::SessionEntityTypes;
7631 /// use google_cloud_dialogflow_v2::Result;
7632 /// async fn sample(
7633 /// client: &SessionEntityTypes
7634 /// ) -> Result<()> {
7635 /// let response = client.get_operation()
7636 /// /* set fields */
7637 /// .send().await?;
7638 /// println!("response {:?}", response);
7639 /// Ok(())
7640 /// }
7641 /// ```
7642 pub fn get_operation(&self) -> super::builder::session_entity_types::GetOperation {
7643 super::builder::session_entity_types::GetOperation::new(self.inner.clone())
7644 }
7645
7646 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
7647 ///
7648 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
7649 ///
7650 /// # Example
7651 /// ```
7652 /// # use google_cloud_dialogflow_v2::client::SessionEntityTypes;
7653 /// use google_cloud_dialogflow_v2::Result;
7654 /// async fn sample(
7655 /// client: &SessionEntityTypes
7656 /// ) -> Result<()> {
7657 /// client.cancel_operation()
7658 /// /* set fields */
7659 /// .send().await?;
7660 /// Ok(())
7661 /// }
7662 /// ```
7663 pub fn cancel_operation(&self) -> super::builder::session_entity_types::CancelOperation {
7664 super::builder::session_entity_types::CancelOperation::new(self.inner.clone())
7665 }
7666}
7667
7668/// Implements a client for the Dialogflow API.
7669///
7670/// # Example
7671/// ```
7672/// # use google_cloud_dialogflow_v2::client::SipTrunks;
7673/// use google_cloud_gax::paginator::ItemPaginator as _;
7674/// # async fn sample() -> Result<(), Box<dyn std::error::Error>> {
7675/// let client = SipTrunks::builder().build().await?;
7676/// let parent = "parent_value";
7677/// let mut list = client.list_sip_trunks()
7678/// .set_parent(parent)
7679/// .by_item();
7680/// while let Some(item) = list.next().await.transpose()? {
7681/// println!("{:?}", item);
7682/// }
7683/// # Ok(()) }
7684/// ```
7685///
7686/// # Service Description
7687///
7688/// Service for managing [SipTrunks][google.cloud.dialogflow.v2.SipTrunk].
7689///
7690/// [google.cloud.dialogflow.v2.SipTrunk]: crate::model::SipTrunk
7691///
7692/// # Configuration
7693///
7694/// To configure `SipTrunks` use the `with_*` methods in the type returned
7695/// by [builder()][SipTrunks::builder]. The default configuration should
7696/// work for most applications. Common configuration changes include
7697///
7698/// * [with_endpoint()]: by default this client uses the global default endpoint
7699/// (`https://dialogflow.googleapis.com`). Applications using regional
7700/// endpoints or running in restricted networks (e.g. a network configured
7701// with [Private Google Access with VPC Service Controls]) may want to
7702/// override this default.
7703/// * [with_credentials()]: by default this client uses
7704/// [Application Default Credentials]. Applications using custom
7705/// authentication may need to override this default.
7706///
7707/// [with_endpoint()]: super::builder::sip_trunks::ClientBuilder::with_endpoint
7708/// [with_credentials()]: super::builder::sip_trunks::ClientBuilder::with_credentials
7709/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
7710/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
7711///
7712/// # Pooling and Cloning
7713///
7714/// `SipTrunks` holds a connection pool internally, it is advised to
7715/// create one and reuse it. You do not need to wrap `SipTrunks` in
7716/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
7717/// already uses an `Arc` internally.
7718#[cfg(feature = "sip-trunks")]
7719#[cfg_attr(docsrs, doc(cfg(feature = "sip-trunks")))]
7720#[derive(Clone, Debug)]
7721pub struct SipTrunks {
7722 inner: std::sync::Arc<dyn super::stub::dynamic::SipTrunks>,
7723}
7724
7725#[cfg(feature = "sip-trunks")]
7726impl SipTrunks {
7727 /// Returns a builder for [SipTrunks].
7728 ///
7729 /// ```
7730 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
7731 /// # use google_cloud_dialogflow_v2::client::SipTrunks;
7732 /// let client = SipTrunks::builder().build().await?;
7733 /// # Ok(()) }
7734 /// ```
7735 pub fn builder() -> super::builder::sip_trunks::ClientBuilder {
7736 crate::new_client_builder(super::builder::sip_trunks::client::Factory)
7737 }
7738
7739 /// Creates a new client from the provided stub.
7740 ///
7741 /// The most common case for calling this function is in tests mocking the
7742 /// client's behavior.
7743 pub fn from_stub<T>(stub: T) -> Self
7744 where
7745 T: super::stub::SipTrunks + 'static,
7746 {
7747 Self {
7748 inner: std::sync::Arc::new(stub),
7749 }
7750 }
7751
7752 pub(crate) async fn new(
7753 config: gaxi::options::ClientConfig,
7754 ) -> crate::ClientBuilderResult<Self> {
7755 let inner = Self::build_inner(config).await?;
7756 Ok(Self { inner })
7757 }
7758
7759 async fn build_inner(
7760 conf: gaxi::options::ClientConfig,
7761 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::SipTrunks>> {
7762 if gaxi::options::tracing_enabled(&conf) {
7763 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
7764 }
7765 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
7766 }
7767
7768 async fn build_transport(
7769 conf: gaxi::options::ClientConfig,
7770 ) -> crate::ClientBuilderResult<impl super::stub::SipTrunks> {
7771 super::transport::SipTrunks::new(conf).await
7772 }
7773
7774 async fn build_with_tracing(
7775 conf: gaxi::options::ClientConfig,
7776 ) -> crate::ClientBuilderResult<impl super::stub::SipTrunks> {
7777 Self::build_transport(conf)
7778 .await
7779 .map(super::tracing::SipTrunks::new)
7780 }
7781
7782 /// Creates a SipTrunk for a specified location.
7783 ///
7784 /// # Example
7785 /// ```
7786 /// # use google_cloud_dialogflow_v2::client::SipTrunks;
7787 /// use google_cloud_dialogflow_v2::model::SipTrunk;
7788 /// use google_cloud_dialogflow_v2::Result;
7789 /// async fn sample(
7790 /// client: &SipTrunks, parent: &str
7791 /// ) -> Result<()> {
7792 /// let response = client.create_sip_trunk()
7793 /// .set_parent(parent)
7794 /// .set_sip_trunk(
7795 /// SipTrunk::new()/* set fields */
7796 /// )
7797 /// .send().await?;
7798 /// println!("response {:?}", response);
7799 /// Ok(())
7800 /// }
7801 /// ```
7802 pub fn create_sip_trunk(&self) -> super::builder::sip_trunks::CreateSipTrunk {
7803 super::builder::sip_trunks::CreateSipTrunk::new(self.inner.clone())
7804 }
7805
7806 /// Deletes a specified SipTrunk.
7807 ///
7808 /// # Example
7809 /// ```
7810 /// # use google_cloud_dialogflow_v2::client::SipTrunks;
7811 /// use google_cloud_dialogflow_v2::Result;
7812 /// async fn sample(
7813 /// client: &SipTrunks, name: &str
7814 /// ) -> Result<()> {
7815 /// client.delete_sip_trunk()
7816 /// .set_name(name)
7817 /// .send().await?;
7818 /// Ok(())
7819 /// }
7820 /// ```
7821 pub fn delete_sip_trunk(&self) -> super::builder::sip_trunks::DeleteSipTrunk {
7822 super::builder::sip_trunks::DeleteSipTrunk::new(self.inner.clone())
7823 }
7824
7825 /// Returns a list of SipTrunks in the specified location.
7826 ///
7827 /// # Example
7828 /// ```
7829 /// # use google_cloud_dialogflow_v2::client::SipTrunks;
7830 /// use google_cloud_gax::paginator::ItemPaginator as _;
7831 /// use google_cloud_dialogflow_v2::Result;
7832 /// async fn sample(
7833 /// client: &SipTrunks, parent: &str
7834 /// ) -> Result<()> {
7835 /// let mut list = client.list_sip_trunks()
7836 /// .set_parent(parent)
7837 /// .by_item();
7838 /// while let Some(item) = list.next().await.transpose()? {
7839 /// println!("{:?}", item);
7840 /// }
7841 /// Ok(())
7842 /// }
7843 /// ```
7844 pub fn list_sip_trunks(&self) -> super::builder::sip_trunks::ListSipTrunks {
7845 super::builder::sip_trunks::ListSipTrunks::new(self.inner.clone())
7846 }
7847
7848 /// Retrieves the specified SipTrunk.
7849 ///
7850 /// # Example
7851 /// ```
7852 /// # use google_cloud_dialogflow_v2::client::SipTrunks;
7853 /// use google_cloud_dialogflow_v2::Result;
7854 /// async fn sample(
7855 /// client: &SipTrunks, name: &str
7856 /// ) -> Result<()> {
7857 /// let response = client.get_sip_trunk()
7858 /// .set_name(name)
7859 /// .send().await?;
7860 /// println!("response {:?}", response);
7861 /// Ok(())
7862 /// }
7863 /// ```
7864 pub fn get_sip_trunk(&self) -> super::builder::sip_trunks::GetSipTrunk {
7865 super::builder::sip_trunks::GetSipTrunk::new(self.inner.clone())
7866 }
7867
7868 /// Updates the specified SipTrunk.
7869 ///
7870 /// # Example
7871 /// ```
7872 /// # use google_cloud_dialogflow_v2::client::SipTrunks;
7873 /// # extern crate wkt as google_cloud_wkt;
7874 /// use google_cloud_wkt::FieldMask;
7875 /// use google_cloud_dialogflow_v2::model::SipTrunk;
7876 /// use google_cloud_dialogflow_v2::Result;
7877 /// async fn sample(
7878 /// client: &SipTrunks, name: &str
7879 /// ) -> Result<()> {
7880 /// let response = client.update_sip_trunk()
7881 /// .set_sip_trunk(
7882 /// SipTrunk::new().set_name(name)/* set fields */
7883 /// )
7884 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
7885 /// .send().await?;
7886 /// println!("response {:?}", response);
7887 /// Ok(())
7888 /// }
7889 /// ```
7890 pub fn update_sip_trunk(&self) -> super::builder::sip_trunks::UpdateSipTrunk {
7891 super::builder::sip_trunks::UpdateSipTrunk::new(self.inner.clone())
7892 }
7893
7894 /// Lists information about the supported locations for this service.
7895 ///
7896 /// # Example
7897 /// ```
7898 /// # use google_cloud_dialogflow_v2::client::SipTrunks;
7899 /// use google_cloud_gax::paginator::ItemPaginator as _;
7900 /// use google_cloud_dialogflow_v2::Result;
7901 /// async fn sample(
7902 /// client: &SipTrunks
7903 /// ) -> Result<()> {
7904 /// let mut list = client.list_locations()
7905 /// /* set fields */
7906 /// .by_item();
7907 /// while let Some(item) = list.next().await.transpose()? {
7908 /// println!("{:?}", item);
7909 /// }
7910 /// Ok(())
7911 /// }
7912 /// ```
7913 pub fn list_locations(&self) -> super::builder::sip_trunks::ListLocations {
7914 super::builder::sip_trunks::ListLocations::new(self.inner.clone())
7915 }
7916
7917 /// Gets information about a location.
7918 ///
7919 /// # Example
7920 /// ```
7921 /// # use google_cloud_dialogflow_v2::client::SipTrunks;
7922 /// use google_cloud_dialogflow_v2::Result;
7923 /// async fn sample(
7924 /// client: &SipTrunks
7925 /// ) -> Result<()> {
7926 /// let response = client.get_location()
7927 /// /* set fields */
7928 /// .send().await?;
7929 /// println!("response {:?}", response);
7930 /// Ok(())
7931 /// }
7932 /// ```
7933 pub fn get_location(&self) -> super::builder::sip_trunks::GetLocation {
7934 super::builder::sip_trunks::GetLocation::new(self.inner.clone())
7935 }
7936
7937 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
7938 ///
7939 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
7940 ///
7941 /// # Example
7942 /// ```
7943 /// # use google_cloud_dialogflow_v2::client::SipTrunks;
7944 /// use google_cloud_gax::paginator::ItemPaginator as _;
7945 /// use google_cloud_dialogflow_v2::Result;
7946 /// async fn sample(
7947 /// client: &SipTrunks
7948 /// ) -> Result<()> {
7949 /// let mut list = client.list_operations()
7950 /// /* set fields */
7951 /// .by_item();
7952 /// while let Some(item) = list.next().await.transpose()? {
7953 /// println!("{:?}", item);
7954 /// }
7955 /// Ok(())
7956 /// }
7957 /// ```
7958 pub fn list_operations(&self) -> super::builder::sip_trunks::ListOperations {
7959 super::builder::sip_trunks::ListOperations::new(self.inner.clone())
7960 }
7961
7962 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
7963 ///
7964 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
7965 ///
7966 /// # Example
7967 /// ```
7968 /// # use google_cloud_dialogflow_v2::client::SipTrunks;
7969 /// use google_cloud_dialogflow_v2::Result;
7970 /// async fn sample(
7971 /// client: &SipTrunks
7972 /// ) -> Result<()> {
7973 /// let response = client.get_operation()
7974 /// /* set fields */
7975 /// .send().await?;
7976 /// println!("response {:?}", response);
7977 /// Ok(())
7978 /// }
7979 /// ```
7980 pub fn get_operation(&self) -> super::builder::sip_trunks::GetOperation {
7981 super::builder::sip_trunks::GetOperation::new(self.inner.clone())
7982 }
7983
7984 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
7985 ///
7986 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
7987 ///
7988 /// # Example
7989 /// ```
7990 /// # use google_cloud_dialogflow_v2::client::SipTrunks;
7991 /// use google_cloud_dialogflow_v2::Result;
7992 /// async fn sample(
7993 /// client: &SipTrunks
7994 /// ) -> Result<()> {
7995 /// client.cancel_operation()
7996 /// /* set fields */
7997 /// .send().await?;
7998 /// Ok(())
7999 /// }
8000 /// ```
8001 pub fn cancel_operation(&self) -> super::builder::sip_trunks::CancelOperation {
8002 super::builder::sip_trunks::CancelOperation::new(self.inner.clone())
8003 }
8004}
8005
8006/// Implements a client for the Dialogflow API.
8007///
8008/// # Example
8009/// ```
8010/// # use google_cloud_dialogflow_v2::client::Tools;
8011/// use google_cloud_gax::paginator::ItemPaginator as _;
8012/// # async fn sample() -> Result<(), Box<dyn std::error::Error>> {
8013/// let client = Tools::builder().build().await?;
8014/// let parent = "parent_value";
8015/// let mut list = client.list_tools()
8016/// .set_parent(parent)
8017/// .by_item();
8018/// while let Some(item) = list.next().await.transpose()? {
8019/// println!("{:?}", item);
8020/// }
8021/// # Ok(()) }
8022/// ```
8023///
8024/// # Service Description
8025///
8026/// Tool Service for LLM powered Agent Assist. Tools can be used to interact with
8027/// remote APIs (e.g. fetching orders) to retrieve additional information as
8028/// input to LLM.
8029///
8030/// # Configuration
8031///
8032/// To configure `Tools` use the `with_*` methods in the type returned
8033/// by [builder()][Tools::builder]. The default configuration should
8034/// work for most applications. Common configuration changes include
8035///
8036/// * [with_endpoint()]: by default this client uses the global default endpoint
8037/// (`https://dialogflow.googleapis.com`). Applications using regional
8038/// endpoints or running in restricted networks (e.g. a network configured
8039// with [Private Google Access with VPC Service Controls]) may want to
8040/// override this default.
8041/// * [with_credentials()]: by default this client uses
8042/// [Application Default Credentials]. Applications using custom
8043/// authentication may need to override this default.
8044///
8045/// [with_endpoint()]: super::builder::tools::ClientBuilder::with_endpoint
8046/// [with_credentials()]: super::builder::tools::ClientBuilder::with_credentials
8047/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
8048/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
8049///
8050/// # Pooling and Cloning
8051///
8052/// `Tools` holds a connection pool internally, it is advised to
8053/// create one and reuse it. You do not need to wrap `Tools` in
8054/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
8055/// already uses an `Arc` internally.
8056#[cfg(feature = "tools")]
8057#[cfg_attr(docsrs, doc(cfg(feature = "tools")))]
8058#[derive(Clone, Debug)]
8059pub struct Tools {
8060 inner: std::sync::Arc<dyn super::stub::dynamic::Tools>,
8061}
8062
8063#[cfg(feature = "tools")]
8064impl Tools {
8065 /// Returns a builder for [Tools].
8066 ///
8067 /// ```
8068 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
8069 /// # use google_cloud_dialogflow_v2::client::Tools;
8070 /// let client = Tools::builder().build().await?;
8071 /// # Ok(()) }
8072 /// ```
8073 pub fn builder() -> super::builder::tools::ClientBuilder {
8074 crate::new_client_builder(super::builder::tools::client::Factory)
8075 }
8076
8077 /// Creates a new client from the provided stub.
8078 ///
8079 /// The most common case for calling this function is in tests mocking the
8080 /// client's behavior.
8081 pub fn from_stub<T>(stub: T) -> Self
8082 where
8083 T: super::stub::Tools + 'static,
8084 {
8085 Self {
8086 inner: std::sync::Arc::new(stub),
8087 }
8088 }
8089
8090 pub(crate) async fn new(
8091 config: gaxi::options::ClientConfig,
8092 ) -> crate::ClientBuilderResult<Self> {
8093 let inner = Self::build_inner(config).await?;
8094 Ok(Self { inner })
8095 }
8096
8097 async fn build_inner(
8098 conf: gaxi::options::ClientConfig,
8099 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::Tools>> {
8100 if gaxi::options::tracing_enabled(&conf) {
8101 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
8102 }
8103 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
8104 }
8105
8106 async fn build_transport(
8107 conf: gaxi::options::ClientConfig,
8108 ) -> crate::ClientBuilderResult<impl super::stub::Tools> {
8109 super::transport::Tools::new(conf).await
8110 }
8111
8112 async fn build_with_tracing(
8113 conf: gaxi::options::ClientConfig,
8114 ) -> crate::ClientBuilderResult<impl super::stub::Tools> {
8115 Self::build_transport(conf)
8116 .await
8117 .map(super::tracing::Tools::new)
8118 }
8119
8120 /// Creates a tool.
8121 ///
8122 /// # Example
8123 /// ```
8124 /// # use google_cloud_dialogflow_v2::client::Tools;
8125 /// use google_cloud_dialogflow_v2::model::Tool;
8126 /// use google_cloud_dialogflow_v2::Result;
8127 /// async fn sample(
8128 /// client: &Tools, parent: &str
8129 /// ) -> Result<()> {
8130 /// let response = client.create_tool()
8131 /// .set_parent(parent)
8132 /// .set_tool_id("tool_id_value")
8133 /// .set_tool(
8134 /// Tool::new()/* set fields */
8135 /// )
8136 /// .send().await?;
8137 /// println!("response {:?}", response);
8138 /// Ok(())
8139 /// }
8140 /// ```
8141 pub fn create_tool(&self) -> super::builder::tools::CreateTool {
8142 super::builder::tools::CreateTool::new(self.inner.clone())
8143 }
8144
8145 /// Retrieves a tool.
8146 ///
8147 /// # Example
8148 /// ```
8149 /// # use google_cloud_dialogflow_v2::client::Tools;
8150 /// use google_cloud_dialogflow_v2::Result;
8151 /// async fn sample(
8152 /// client: &Tools, name: &str
8153 /// ) -> Result<()> {
8154 /// let response = client.get_tool()
8155 /// .set_name(name)
8156 /// .send().await?;
8157 /// println!("response {:?}", response);
8158 /// Ok(())
8159 /// }
8160 /// ```
8161 pub fn get_tool(&self) -> super::builder::tools::GetTool {
8162 super::builder::tools::GetTool::new(self.inner.clone())
8163 }
8164
8165 /// Lists tools.
8166 ///
8167 /// # Example
8168 /// ```
8169 /// # use google_cloud_dialogflow_v2::client::Tools;
8170 /// use google_cloud_gax::paginator::ItemPaginator as _;
8171 /// use google_cloud_dialogflow_v2::Result;
8172 /// async fn sample(
8173 /// client: &Tools, parent: &str
8174 /// ) -> Result<()> {
8175 /// let mut list = client.list_tools()
8176 /// .set_parent(parent)
8177 /// .by_item();
8178 /// while let Some(item) = list.next().await.transpose()? {
8179 /// println!("{:?}", item);
8180 /// }
8181 /// Ok(())
8182 /// }
8183 /// ```
8184 pub fn list_tools(&self) -> super::builder::tools::ListTools {
8185 super::builder::tools::ListTools::new(self.inner.clone())
8186 }
8187
8188 /// Deletes a tool.
8189 ///
8190 /// # Example
8191 /// ```
8192 /// # use google_cloud_dialogflow_v2::client::Tools;
8193 /// use google_cloud_dialogflow_v2::Result;
8194 /// async fn sample(
8195 /// client: &Tools, name: &str
8196 /// ) -> Result<()> {
8197 /// client.delete_tool()
8198 /// .set_name(name)
8199 /// .send().await?;
8200 /// Ok(())
8201 /// }
8202 /// ```
8203 pub fn delete_tool(&self) -> super::builder::tools::DeleteTool {
8204 super::builder::tools::DeleteTool::new(self.inner.clone())
8205 }
8206
8207 /// Updates a tool.
8208 ///
8209 /// # Example
8210 /// ```
8211 /// # use google_cloud_dialogflow_v2::client::Tools;
8212 /// # extern crate wkt as google_cloud_wkt;
8213 /// use google_cloud_wkt::FieldMask;
8214 /// use google_cloud_dialogflow_v2::model::Tool;
8215 /// use google_cloud_dialogflow_v2::Result;
8216 /// async fn sample(
8217 /// client: &Tools, name: &str
8218 /// ) -> Result<()> {
8219 /// let response = client.update_tool()
8220 /// .set_tool(
8221 /// Tool::new().set_name(name)/* set fields */
8222 /// )
8223 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
8224 /// .send().await?;
8225 /// println!("response {:?}", response);
8226 /// Ok(())
8227 /// }
8228 /// ```
8229 pub fn update_tool(&self) -> super::builder::tools::UpdateTool {
8230 super::builder::tools::UpdateTool::new(self.inner.clone())
8231 }
8232
8233 /// Lists information about the supported locations for this service.
8234 ///
8235 /// # Example
8236 /// ```
8237 /// # use google_cloud_dialogflow_v2::client::Tools;
8238 /// use google_cloud_gax::paginator::ItemPaginator as _;
8239 /// use google_cloud_dialogflow_v2::Result;
8240 /// async fn sample(
8241 /// client: &Tools
8242 /// ) -> Result<()> {
8243 /// let mut list = client.list_locations()
8244 /// /* set fields */
8245 /// .by_item();
8246 /// while let Some(item) = list.next().await.transpose()? {
8247 /// println!("{:?}", item);
8248 /// }
8249 /// Ok(())
8250 /// }
8251 /// ```
8252 pub fn list_locations(&self) -> super::builder::tools::ListLocations {
8253 super::builder::tools::ListLocations::new(self.inner.clone())
8254 }
8255
8256 /// Gets information about a location.
8257 ///
8258 /// # Example
8259 /// ```
8260 /// # use google_cloud_dialogflow_v2::client::Tools;
8261 /// use google_cloud_dialogflow_v2::Result;
8262 /// async fn sample(
8263 /// client: &Tools
8264 /// ) -> Result<()> {
8265 /// let response = client.get_location()
8266 /// /* set fields */
8267 /// .send().await?;
8268 /// println!("response {:?}", response);
8269 /// Ok(())
8270 /// }
8271 /// ```
8272 pub fn get_location(&self) -> super::builder::tools::GetLocation {
8273 super::builder::tools::GetLocation::new(self.inner.clone())
8274 }
8275
8276 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
8277 ///
8278 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
8279 ///
8280 /// # Example
8281 /// ```
8282 /// # use google_cloud_dialogflow_v2::client::Tools;
8283 /// use google_cloud_gax::paginator::ItemPaginator as _;
8284 /// use google_cloud_dialogflow_v2::Result;
8285 /// async fn sample(
8286 /// client: &Tools
8287 /// ) -> Result<()> {
8288 /// let mut list = client.list_operations()
8289 /// /* set fields */
8290 /// .by_item();
8291 /// while let Some(item) = list.next().await.transpose()? {
8292 /// println!("{:?}", item);
8293 /// }
8294 /// Ok(())
8295 /// }
8296 /// ```
8297 pub fn list_operations(&self) -> super::builder::tools::ListOperations {
8298 super::builder::tools::ListOperations::new(self.inner.clone())
8299 }
8300
8301 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
8302 ///
8303 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
8304 ///
8305 /// # Example
8306 /// ```
8307 /// # use google_cloud_dialogflow_v2::client::Tools;
8308 /// use google_cloud_dialogflow_v2::Result;
8309 /// async fn sample(
8310 /// client: &Tools
8311 /// ) -> Result<()> {
8312 /// let response = client.get_operation()
8313 /// /* set fields */
8314 /// .send().await?;
8315 /// println!("response {:?}", response);
8316 /// Ok(())
8317 /// }
8318 /// ```
8319 pub fn get_operation(&self) -> super::builder::tools::GetOperation {
8320 super::builder::tools::GetOperation::new(self.inner.clone())
8321 }
8322
8323 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
8324 ///
8325 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
8326 ///
8327 /// # Example
8328 /// ```
8329 /// # use google_cloud_dialogflow_v2::client::Tools;
8330 /// use google_cloud_dialogflow_v2::Result;
8331 /// async fn sample(
8332 /// client: &Tools
8333 /// ) -> Result<()> {
8334 /// client.cancel_operation()
8335 /// /* set fields */
8336 /// .send().await?;
8337 /// Ok(())
8338 /// }
8339 /// ```
8340 pub fn cancel_operation(&self) -> super::builder::tools::CancelOperation {
8341 super::builder::tools::CancelOperation::new(self.inner.clone())
8342 }
8343}
8344
8345/// Implements a client for the Dialogflow API.
8346///
8347/// # Example
8348/// ```
8349/// # use google_cloud_dialogflow_v2::client::Versions;
8350/// use google_cloud_gax::paginator::ItemPaginator as _;
8351/// # async fn sample() -> Result<(), Box<dyn std::error::Error>> {
8352/// let client = Versions::builder().build().await?;
8353/// let parent = "parent_value";
8354/// let mut list = client.list_versions()
8355/// .set_parent(parent)
8356/// .by_item();
8357/// while let Some(item) = list.next().await.transpose()? {
8358/// println!("{:?}", item);
8359/// }
8360/// # Ok(()) }
8361/// ```
8362///
8363/// # Service Description
8364///
8365/// Service for managing [Versions][google.cloud.dialogflow.v2.Version].
8366///
8367/// [google.cloud.dialogflow.v2.Version]: crate::model::Version
8368///
8369/// # Configuration
8370///
8371/// To configure `Versions` use the `with_*` methods in the type returned
8372/// by [builder()][Versions::builder]. The default configuration should
8373/// work for most applications. Common configuration changes include
8374///
8375/// * [with_endpoint()]: by default this client uses the global default endpoint
8376/// (`https://dialogflow.googleapis.com`). Applications using regional
8377/// endpoints or running in restricted networks (e.g. a network configured
8378// with [Private Google Access with VPC Service Controls]) may want to
8379/// override this default.
8380/// * [with_credentials()]: by default this client uses
8381/// [Application Default Credentials]. Applications using custom
8382/// authentication may need to override this default.
8383///
8384/// [with_endpoint()]: super::builder::versions::ClientBuilder::with_endpoint
8385/// [with_credentials()]: super::builder::versions::ClientBuilder::with_credentials
8386/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
8387/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
8388///
8389/// # Pooling and Cloning
8390///
8391/// `Versions` holds a connection pool internally, it is advised to
8392/// create one and reuse it. You do not need to wrap `Versions` in
8393/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
8394/// already uses an `Arc` internally.
8395#[cfg(feature = "versions")]
8396#[cfg_attr(docsrs, doc(cfg(feature = "versions")))]
8397#[derive(Clone, Debug)]
8398pub struct Versions {
8399 inner: std::sync::Arc<dyn super::stub::dynamic::Versions>,
8400}
8401
8402#[cfg(feature = "versions")]
8403impl Versions {
8404 /// Returns a builder for [Versions].
8405 ///
8406 /// ```
8407 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
8408 /// # use google_cloud_dialogflow_v2::client::Versions;
8409 /// let client = Versions::builder().build().await?;
8410 /// # Ok(()) }
8411 /// ```
8412 pub fn builder() -> super::builder::versions::ClientBuilder {
8413 crate::new_client_builder(super::builder::versions::client::Factory)
8414 }
8415
8416 /// Creates a new client from the provided stub.
8417 ///
8418 /// The most common case for calling this function is in tests mocking the
8419 /// client's behavior.
8420 pub fn from_stub<T>(stub: T) -> Self
8421 where
8422 T: super::stub::Versions + 'static,
8423 {
8424 Self {
8425 inner: std::sync::Arc::new(stub),
8426 }
8427 }
8428
8429 pub(crate) async fn new(
8430 config: gaxi::options::ClientConfig,
8431 ) -> crate::ClientBuilderResult<Self> {
8432 let inner = Self::build_inner(config).await?;
8433 Ok(Self { inner })
8434 }
8435
8436 async fn build_inner(
8437 conf: gaxi::options::ClientConfig,
8438 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::Versions>> {
8439 if gaxi::options::tracing_enabled(&conf) {
8440 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
8441 }
8442 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
8443 }
8444
8445 async fn build_transport(
8446 conf: gaxi::options::ClientConfig,
8447 ) -> crate::ClientBuilderResult<impl super::stub::Versions> {
8448 super::transport::Versions::new(conf).await
8449 }
8450
8451 async fn build_with_tracing(
8452 conf: gaxi::options::ClientConfig,
8453 ) -> crate::ClientBuilderResult<impl super::stub::Versions> {
8454 Self::build_transport(conf)
8455 .await
8456 .map(super::tracing::Versions::new)
8457 }
8458
8459 /// Returns the list of all versions of the specified agent.
8460 ///
8461 /// # Example
8462 /// ```
8463 /// # use google_cloud_dialogflow_v2::client::Versions;
8464 /// use google_cloud_gax::paginator::ItemPaginator as _;
8465 /// use google_cloud_dialogflow_v2::Result;
8466 /// async fn sample(
8467 /// client: &Versions, parent: &str
8468 /// ) -> Result<()> {
8469 /// let mut list = client.list_versions()
8470 /// .set_parent(parent)
8471 /// .by_item();
8472 /// while let Some(item) = list.next().await.transpose()? {
8473 /// println!("{:?}", item);
8474 /// }
8475 /// Ok(())
8476 /// }
8477 /// ```
8478 pub fn list_versions(&self) -> super::builder::versions::ListVersions {
8479 super::builder::versions::ListVersions::new(self.inner.clone())
8480 }
8481
8482 /// Retrieves the specified agent version.
8483 ///
8484 /// # Example
8485 /// ```
8486 /// # use google_cloud_dialogflow_v2::client::Versions;
8487 /// use google_cloud_dialogflow_v2::Result;
8488 /// async fn sample(
8489 /// client: &Versions, name: &str
8490 /// ) -> Result<()> {
8491 /// let response = client.get_version()
8492 /// .set_name(name)
8493 /// .send().await?;
8494 /// println!("response {:?}", response);
8495 /// Ok(())
8496 /// }
8497 /// ```
8498 pub fn get_version(&self) -> super::builder::versions::GetVersion {
8499 super::builder::versions::GetVersion::new(self.inner.clone())
8500 }
8501
8502 /// Creates an agent version.
8503 ///
8504 /// The new version points to the agent instance in the "default" environment.
8505 ///
8506 /// # Example
8507 /// ```
8508 /// # use google_cloud_dialogflow_v2::client::Versions;
8509 /// use google_cloud_dialogflow_v2::model::Version;
8510 /// use google_cloud_dialogflow_v2::Result;
8511 /// async fn sample(
8512 /// client: &Versions, parent: &str
8513 /// ) -> Result<()> {
8514 /// let response = client.create_version()
8515 /// .set_parent(parent)
8516 /// .set_version(
8517 /// Version::new()/* set fields */
8518 /// )
8519 /// .send().await?;
8520 /// println!("response {:?}", response);
8521 /// Ok(())
8522 /// }
8523 /// ```
8524 pub fn create_version(&self) -> super::builder::versions::CreateVersion {
8525 super::builder::versions::CreateVersion::new(self.inner.clone())
8526 }
8527
8528 /// Updates the specified agent version.
8529 ///
8530 /// Note that this method does not allow you to update the state of the agent
8531 /// the given version points to. It allows you to update only mutable
8532 /// properties of the version resource.
8533 ///
8534 /// # Example
8535 /// ```
8536 /// # use google_cloud_dialogflow_v2::client::Versions;
8537 /// # extern crate wkt as google_cloud_wkt;
8538 /// use google_cloud_wkt::FieldMask;
8539 /// use google_cloud_dialogflow_v2::model::Version;
8540 /// use google_cloud_dialogflow_v2::Result;
8541 /// async fn sample(
8542 /// client: &Versions, name: &str
8543 /// ) -> Result<()> {
8544 /// let response = client.update_version()
8545 /// .set_version(
8546 /// Version::new().set_name(name)/* set fields */
8547 /// )
8548 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
8549 /// .send().await?;
8550 /// println!("response {:?}", response);
8551 /// Ok(())
8552 /// }
8553 /// ```
8554 pub fn update_version(&self) -> super::builder::versions::UpdateVersion {
8555 super::builder::versions::UpdateVersion::new(self.inner.clone())
8556 }
8557
8558 /// Delete the specified agent version.
8559 ///
8560 /// # Example
8561 /// ```
8562 /// # use google_cloud_dialogflow_v2::client::Versions;
8563 /// use google_cloud_dialogflow_v2::Result;
8564 /// async fn sample(
8565 /// client: &Versions, name: &str
8566 /// ) -> Result<()> {
8567 /// client.delete_version()
8568 /// .set_name(name)
8569 /// .send().await?;
8570 /// Ok(())
8571 /// }
8572 /// ```
8573 pub fn delete_version(&self) -> super::builder::versions::DeleteVersion {
8574 super::builder::versions::DeleteVersion::new(self.inner.clone())
8575 }
8576
8577 /// Lists information about the supported locations for this service.
8578 ///
8579 /// # Example
8580 /// ```
8581 /// # use google_cloud_dialogflow_v2::client::Versions;
8582 /// use google_cloud_gax::paginator::ItemPaginator as _;
8583 /// use google_cloud_dialogflow_v2::Result;
8584 /// async fn sample(
8585 /// client: &Versions
8586 /// ) -> Result<()> {
8587 /// let mut list = client.list_locations()
8588 /// /* set fields */
8589 /// .by_item();
8590 /// while let Some(item) = list.next().await.transpose()? {
8591 /// println!("{:?}", item);
8592 /// }
8593 /// Ok(())
8594 /// }
8595 /// ```
8596 pub fn list_locations(&self) -> super::builder::versions::ListLocations {
8597 super::builder::versions::ListLocations::new(self.inner.clone())
8598 }
8599
8600 /// Gets information about a location.
8601 ///
8602 /// # Example
8603 /// ```
8604 /// # use google_cloud_dialogflow_v2::client::Versions;
8605 /// use google_cloud_dialogflow_v2::Result;
8606 /// async fn sample(
8607 /// client: &Versions
8608 /// ) -> Result<()> {
8609 /// let response = client.get_location()
8610 /// /* set fields */
8611 /// .send().await?;
8612 /// println!("response {:?}", response);
8613 /// Ok(())
8614 /// }
8615 /// ```
8616 pub fn get_location(&self) -> super::builder::versions::GetLocation {
8617 super::builder::versions::GetLocation::new(self.inner.clone())
8618 }
8619
8620 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
8621 ///
8622 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
8623 ///
8624 /// # Example
8625 /// ```
8626 /// # use google_cloud_dialogflow_v2::client::Versions;
8627 /// use google_cloud_gax::paginator::ItemPaginator as _;
8628 /// use google_cloud_dialogflow_v2::Result;
8629 /// async fn sample(
8630 /// client: &Versions
8631 /// ) -> Result<()> {
8632 /// let mut list = client.list_operations()
8633 /// /* set fields */
8634 /// .by_item();
8635 /// while let Some(item) = list.next().await.transpose()? {
8636 /// println!("{:?}", item);
8637 /// }
8638 /// Ok(())
8639 /// }
8640 /// ```
8641 pub fn list_operations(&self) -> super::builder::versions::ListOperations {
8642 super::builder::versions::ListOperations::new(self.inner.clone())
8643 }
8644
8645 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
8646 ///
8647 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
8648 ///
8649 /// # Example
8650 /// ```
8651 /// # use google_cloud_dialogflow_v2::client::Versions;
8652 /// use google_cloud_dialogflow_v2::Result;
8653 /// async fn sample(
8654 /// client: &Versions
8655 /// ) -> Result<()> {
8656 /// let response = client.get_operation()
8657 /// /* set fields */
8658 /// .send().await?;
8659 /// println!("response {:?}", response);
8660 /// Ok(())
8661 /// }
8662 /// ```
8663 pub fn get_operation(&self) -> super::builder::versions::GetOperation {
8664 super::builder::versions::GetOperation::new(self.inner.clone())
8665 }
8666
8667 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
8668 ///
8669 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
8670 ///
8671 /// # Example
8672 /// ```
8673 /// # use google_cloud_dialogflow_v2::client::Versions;
8674 /// use google_cloud_dialogflow_v2::Result;
8675 /// async fn sample(
8676 /// client: &Versions
8677 /// ) -> Result<()> {
8678 /// client.cancel_operation()
8679 /// /* set fields */
8680 /// .send().await?;
8681 /// Ok(())
8682 /// }
8683 /// ```
8684 pub fn cancel_operation(&self) -> super::builder::versions::CancelOperation {
8685 super::builder::versions::CancelOperation::new(self.inner.clone())
8686 }
8687}