Skip to main content

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::bare_urls)]
17#![allow(rustdoc::broken_intra_doc_links)]
18#![allow(rustdoc::invalid_html_tags)]
19#![allow(rustdoc::redundant_explicit_links)]
20
21/// Implements a client for the Dialogflow API.
22///
23/// # Example
24/// ```
25/// # use google_cloud_dialogflow_v2::client::Agents;
26/// use google_cloud_gax::paginator::ItemPaginator as _;
27/// async fn sample(
28/// ) -> anyhow::Result<()> {
29///     let client = Agents::builder().build().await?;
30///     let mut list = client.search_agents()
31///         /* set fields */
32///         .by_item();
33///     while let Some(item) = list.next().await.transpose()? {
34///         println!("{:?}", item);
35///     }
36///     Ok(())
37/// }
38/// ```
39///
40/// # Service Description
41///
42/// Service for managing [Agents][google.cloud.dialogflow.v2.Agent].
43///
44/// [google.cloud.dialogflow.v2.Agent]: crate::model::Agent
45///
46/// # Configuration
47///
48/// To configure `Agents` use the `with_*` methods in the type returned
49/// by [builder()][Agents::builder]. The default configuration should
50/// work for most applications. Common configuration changes include
51///
52/// * [with_endpoint()]: by default this client uses the global default endpoint
53///   (`https://dialogflow.googleapis.com`). Applications using regional
54///   endpoints or running in restricted networks (e.g. a network configured
55///   with [Private Google Access with VPC Service Controls]) may want to
56///   override this default.
57/// * [with_credentials()]: by default this client uses
58///   [Application Default Credentials]. Applications using custom
59///   authentication may need to override this default.
60///
61/// [with_endpoint()]: super::builder::agents::ClientBuilder::with_endpoint
62/// [with_credentials()]: super::builder::agents::ClientBuilder::with_credentials
63/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
64/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
65///
66/// # Pooling and Cloning
67///
68/// `Agents` holds a connection pool internally, it is advised to
69/// create one and reuse it. You do not need to wrap `Agents` in
70/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
71/// already uses an `Arc` internally.
72#[cfg(feature = "agents")]
73#[cfg_attr(docsrs, doc(cfg(feature = "agents")))]
74#[derive(Clone, Debug)]
75pub struct Agents {
76    inner: std::sync::Arc<dyn super::stub::dynamic::Agents>,
77}
78
79#[cfg(feature = "agents")]
80impl Agents {
81    /// Returns a builder for [Agents].
82    ///
83    /// ```
84    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
85    /// # use google_cloud_dialogflow_v2::client::Agents;
86    /// let client = Agents::builder().build().await?;
87    /// # Ok(()) }
88    /// ```
89    pub fn builder() -> super::builder::agents::ClientBuilder {
90        crate::new_client_builder(super::builder::agents::client::Factory)
91    }
92
93    /// Creates a new client from the provided stub.
94    ///
95    /// The most common case for calling this function is in tests mocking the
96    /// client's behavior.
97    pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
98    where
99        T: super::stub::Agents + 'static,
100    {
101        Self { inner: stub.into() }
102    }
103
104    pub(crate) async fn new(
105        config: gaxi::options::ClientConfig,
106    ) -> crate::ClientBuilderResult<Self> {
107        let inner = Self::build_inner(config).await?;
108        Ok(Self { inner })
109    }
110
111    async fn build_inner(
112        conf: gaxi::options::ClientConfig,
113    ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::Agents>> {
114        if gaxi::options::tracing_enabled(&conf) {
115            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
116        }
117        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
118    }
119
120    async fn build_transport(
121        conf: gaxi::options::ClientConfig,
122    ) -> crate::ClientBuilderResult<impl super::stub::Agents> {
123        super::transport::Agents::new(conf).await
124    }
125
126    async fn build_with_tracing(
127        conf: gaxi::options::ClientConfig,
128    ) -> crate::ClientBuilderResult<impl super::stub::Agents> {
129        Self::build_transport(conf)
130            .await
131            .map(super::tracing::Agents::new)
132    }
133
134    /// Retrieves the specified agent.
135    ///
136    /// # Example
137    /// ```
138    /// # use google_cloud_dialogflow_v2::client::Agents;
139    /// use google_cloud_dialogflow_v2::Result;
140    /// async fn sample(
141    ///    client: &Agents
142    /// ) -> Result<()> {
143    ///     let response = client.get_agent()
144    ///         /* set fields */
145    ///         .send().await?;
146    ///     println!("response {:?}", response);
147    ///     Ok(())
148    /// }
149    /// ```
150    pub fn get_agent(&self) -> super::builder::agents::GetAgent {
151        super::builder::agents::GetAgent::new(self.inner.clone())
152    }
153
154    /// Creates/updates the specified agent.
155    ///
156    /// Note: You should always train an agent prior to sending it queries. See the
157    /// [training
158    /// documentation](https://cloud.google.com/dialogflow/es/docs/training).
159    ///
160    /// # Example
161    /// ```
162    /// # use google_cloud_dialogflow_v2::client::Agents;
163    /// use google_cloud_dialogflow_v2::Result;
164    /// async fn sample(
165    ///    client: &Agents
166    /// ) -> Result<()> {
167    ///     let response = client.set_agent()
168    ///         /* set fields */
169    ///         .send().await?;
170    ///     println!("response {:?}", response);
171    ///     Ok(())
172    /// }
173    /// ```
174    pub fn set_agent(&self) -> super::builder::agents::SetAgent {
175        super::builder::agents::SetAgent::new(self.inner.clone())
176    }
177
178    /// Deletes the specified agent.
179    ///
180    /// # Example
181    /// ```
182    /// # use google_cloud_dialogflow_v2::client::Agents;
183    /// use google_cloud_dialogflow_v2::Result;
184    /// async fn sample(
185    ///    client: &Agents
186    /// ) -> Result<()> {
187    ///     client.delete_agent()
188    ///         /* set fields */
189    ///         .send().await?;
190    ///     Ok(())
191    /// }
192    /// ```
193    pub fn delete_agent(&self) -> super::builder::agents::DeleteAgent {
194        super::builder::agents::DeleteAgent::new(self.inner.clone())
195    }
196
197    /// Returns the list of agents.
198    ///
199    /// Since there is at most one conversational agent per project, this method is
200    /// useful primarily for listing all agents across projects the caller has
201    /// access to. One can achieve that with a wildcard project collection id "-".
202    /// Refer to [List
203    /// Sub-Collections](https://cloud.google.com/apis/design/design_patterns#list_sub-collections).
204    ///
205    /// # Example
206    /// ```
207    /// # use google_cloud_dialogflow_v2::client::Agents;
208    /// use google_cloud_gax::paginator::ItemPaginator as _;
209    /// use google_cloud_dialogflow_v2::Result;
210    /// async fn sample(
211    ///    client: &Agents
212    /// ) -> Result<()> {
213    ///     let mut list = client.search_agents()
214    ///         /* set fields */
215    ///         .by_item();
216    ///     while let Some(item) = list.next().await.transpose()? {
217    ///         println!("{:?}", item);
218    ///     }
219    ///     Ok(())
220    /// }
221    /// ```
222    pub fn search_agents(&self) -> super::builder::agents::SearchAgents {
223        super::builder::agents::SearchAgents::new(self.inner.clone())
224    }
225
226    /// Trains the specified agent.
227    ///
228    /// This method is a [long-running
229    /// operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations).
230    /// The returned `Operation` type has the following method-specific fields:
231    ///
232    /// - `metadata`: An empty [Struct
233    ///   message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct)
234    /// - `response`: An [Empty
235    ///   message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
236    ///
237    /// Note: You should always train an agent prior to sending it queries. See the
238    /// [training
239    /// documentation](https://cloud.google.com/dialogflow/es/docs/training).
240    ///
241    /// # Long running operations
242    ///
243    /// This method is used to start, and/or poll a [long-running Operation].
244    /// The [Working with long-running operations] chapter in the [user guide]
245    /// covers these operations in detail.
246    ///
247    /// [long-running operation]: https://google.aip.dev/151
248    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
249    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
250    ///
251    /// # Example
252    /// ```
253    /// # use google_cloud_dialogflow_v2::client::Agents;
254    /// use google_cloud_lro::Poller;
255    /// use google_cloud_dialogflow_v2::Result;
256    /// async fn sample(
257    ///    client: &Agents
258    /// ) -> Result<()> {
259    ///     client.train_agent()
260    ///         /* set fields */
261    ///         .poller().until_done().await?;
262    ///     Ok(())
263    /// }
264    /// ```
265    pub fn train_agent(&self) -> super::builder::agents::TrainAgent {
266        super::builder::agents::TrainAgent::new(self.inner.clone())
267    }
268
269    /// Exports the specified agent to a ZIP file.
270    ///
271    /// This method is a [long-running
272    /// operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations).
273    /// The returned `Operation` type has the following method-specific fields:
274    ///
275    /// - `metadata`: An empty [Struct
276    ///   message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct)
277    /// - `response`:
278    ///   [ExportAgentResponse][google.cloud.dialogflow.v2.ExportAgentResponse]
279    ///
280    /// [google.cloud.dialogflow.v2.ExportAgentResponse]: crate::model::ExportAgentResponse
281    ///
282    /// # Long running operations
283    ///
284    /// This method is used to start, and/or poll a [long-running Operation].
285    /// The [Working with long-running operations] chapter in the [user guide]
286    /// covers these operations in detail.
287    ///
288    /// [long-running operation]: https://google.aip.dev/151
289    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
290    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
291    ///
292    /// # Example
293    /// ```
294    /// # use google_cloud_dialogflow_v2::client::Agents;
295    /// use google_cloud_lro::Poller;
296    /// use google_cloud_dialogflow_v2::Result;
297    /// async fn sample(
298    ///    client: &Agents
299    /// ) -> Result<()> {
300    ///     let response = client.export_agent()
301    ///         /* set fields */
302    ///         .poller().until_done().await?;
303    ///     println!("response {:?}", response);
304    ///     Ok(())
305    /// }
306    /// ```
307    pub fn export_agent(&self) -> super::builder::agents::ExportAgent {
308        super::builder::agents::ExportAgent::new(self.inner.clone())
309    }
310
311    /// Imports the specified agent from a ZIP file.
312    ///
313    /// Uploads new intents and entity types without deleting the existing ones.
314    /// Intents and entity types with the same name are replaced with the new
315    /// versions from
316    /// [ImportAgentRequest][google.cloud.dialogflow.v2.ImportAgentRequest]. After
317    /// the import, the imported draft agent will be trained automatically (unless
318    /// disabled in agent settings). However, once the import is done, training may
319    /// not be completed yet. Please call
320    /// [TrainAgent][google.cloud.dialogflow.v2.Agents.TrainAgent] and wait for the
321    /// operation it returns in order to train explicitly.
322    ///
323    /// This method is a [long-running
324    /// operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations).
325    /// The returned `Operation` type has the following method-specific fields:
326    ///
327    /// - `metadata`: An empty [Struct
328    ///   message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct)
329    /// - `response`: An [Empty
330    ///   message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
331    ///
332    /// The operation only tracks when importing is complete, not when it is done
333    /// training.
334    ///
335    /// Note: You should always train an agent prior to sending it queries. See the
336    /// [training
337    /// documentation](https://cloud.google.com/dialogflow/es/docs/training).
338    ///
339    /// [google.cloud.dialogflow.v2.Agents.TrainAgent]: crate::client::Agents::train_agent
340    /// [google.cloud.dialogflow.v2.ImportAgentRequest]: crate::model::ImportAgentRequest
341    ///
342    /// # Long running operations
343    ///
344    /// This method is used to start, and/or poll a [long-running Operation].
345    /// The [Working with long-running operations] chapter in the [user guide]
346    /// covers these operations in detail.
347    ///
348    /// [long-running operation]: https://google.aip.dev/151
349    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
350    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
351    ///
352    /// # Example
353    /// ```
354    /// # use google_cloud_dialogflow_v2::client::Agents;
355    /// use google_cloud_lro::Poller;
356    /// use google_cloud_dialogflow_v2::Result;
357    /// async fn sample(
358    ///    client: &Agents
359    /// ) -> Result<()> {
360    ///     client.import_agent()
361    ///         /* set fields */
362    ///         .poller().until_done().await?;
363    ///     Ok(())
364    /// }
365    /// ```
366    pub fn import_agent(&self) -> super::builder::agents::ImportAgent {
367        super::builder::agents::ImportAgent::new(self.inner.clone())
368    }
369
370    /// Restores the specified agent from a ZIP file.
371    ///
372    /// Replaces the current agent version with a new one. All the intents and
373    /// entity types in the older version are deleted. After the restore, the
374    /// restored draft agent will be trained automatically (unless disabled in
375    /// agent settings). However, once the restore is done, training may not be
376    /// completed yet. Please call
377    /// [TrainAgent][google.cloud.dialogflow.v2.Agents.TrainAgent] and wait for the
378    /// operation it returns in order to train explicitly.
379    ///
380    /// This method is a [long-running
381    /// operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations).
382    /// The returned `Operation` type has the following method-specific fields:
383    ///
384    /// - `metadata`: An empty [Struct
385    ///   message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct)
386    /// - `response`: An [Empty
387    ///   message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
388    ///
389    /// The operation only tracks when restoring is complete, not when it is done
390    /// training.
391    ///
392    /// Note: You should always train an agent prior to sending it queries. See the
393    /// [training
394    /// documentation](https://cloud.google.com/dialogflow/es/docs/training).
395    ///
396    /// [google.cloud.dialogflow.v2.Agents.TrainAgent]: crate::client::Agents::train_agent
397    ///
398    /// # Long running operations
399    ///
400    /// This method is used to start, and/or poll a [long-running Operation].
401    /// The [Working with long-running operations] chapter in the [user guide]
402    /// covers these operations in detail.
403    ///
404    /// [long-running operation]: https://google.aip.dev/151
405    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
406    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
407    ///
408    /// # Example
409    /// ```
410    /// # use google_cloud_dialogflow_v2::client::Agents;
411    /// use google_cloud_lro::Poller;
412    /// use google_cloud_dialogflow_v2::Result;
413    /// async fn sample(
414    ///    client: &Agents
415    /// ) -> Result<()> {
416    ///     client.restore_agent()
417    ///         /* set fields */
418    ///         .poller().until_done().await?;
419    ///     Ok(())
420    /// }
421    /// ```
422    pub fn restore_agent(&self) -> super::builder::agents::RestoreAgent {
423        super::builder::agents::RestoreAgent::new(self.inner.clone())
424    }
425
426    /// Gets agent validation result. Agent validation is performed during
427    /// training time and is updated automatically when training is completed.
428    ///
429    /// # Example
430    /// ```
431    /// # use google_cloud_dialogflow_v2::client::Agents;
432    /// use google_cloud_dialogflow_v2::Result;
433    /// async fn sample(
434    ///    client: &Agents
435    /// ) -> Result<()> {
436    ///     let response = client.get_validation_result()
437    ///         /* set fields */
438    ///         .send().await?;
439    ///     println!("response {:?}", response);
440    ///     Ok(())
441    /// }
442    /// ```
443    pub fn get_validation_result(&self) -> super::builder::agents::GetValidationResult {
444        super::builder::agents::GetValidationResult::new(self.inner.clone())
445    }
446
447    /// Lists information about the supported locations for this service.
448    ///
449    /// This method lists locations based on the resource scope provided in
450    /// the [ListLocationsRequest.name][google.cloud.location.ListLocationsRequest.name] field: *
451    /// **Global locations**: If `name` is empty, the method lists the
452    /// public locations available to all projects. * **Project-specific
453    /// locations**: If `name` follows the format
454    /// `projects/{project}`, the method lists locations visible to that
455    /// specific project. This includes public, private, or other
456    /// project-specific locations enabled for the project.
457    ///
458    /// For gRPC and client library implementations, the resource name is
459    /// passed as the `name` field. For direct service calls, the resource
460    /// name is
461    /// incorporated into the request path based on the specific service
462    /// implementation and version.
463    ///
464    /// [google.cloud.location.ListLocationsRequest.name]: google_cloud_location::model::ListLocationsRequest::name
465    ///
466    /// # Example
467    /// ```
468    /// # use google_cloud_dialogflow_v2::client::Agents;
469    /// use google_cloud_gax::paginator::ItemPaginator as _;
470    /// use google_cloud_dialogflow_v2::Result;
471    /// async fn sample(
472    ///    client: &Agents
473    /// ) -> Result<()> {
474    ///     let mut list = client.list_locations()
475    ///         /* set fields */
476    ///         .by_item();
477    ///     while let Some(item) = list.next().await.transpose()? {
478    ///         println!("{:?}", item);
479    ///     }
480    ///     Ok(())
481    /// }
482    /// ```
483    pub fn list_locations(&self) -> super::builder::agents::ListLocations {
484        super::builder::agents::ListLocations::new(self.inner.clone())
485    }
486
487    /// Gets information about a location.
488    ///
489    /// # Example
490    /// ```
491    /// # use google_cloud_dialogflow_v2::client::Agents;
492    /// use google_cloud_dialogflow_v2::Result;
493    /// async fn sample(
494    ///    client: &Agents
495    /// ) -> Result<()> {
496    ///     let response = client.get_location()
497    ///         /* set fields */
498    ///         .send().await?;
499    ///     println!("response {:?}", response);
500    ///     Ok(())
501    /// }
502    /// ```
503    pub fn get_location(&self) -> super::builder::agents::GetLocation {
504        super::builder::agents::GetLocation::new(self.inner.clone())
505    }
506
507    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
508    ///
509    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
510    ///
511    /// # Example
512    /// ```
513    /// # use google_cloud_dialogflow_v2::client::Agents;
514    /// use google_cloud_gax::paginator::ItemPaginator as _;
515    /// use google_cloud_dialogflow_v2::Result;
516    /// async fn sample(
517    ///    client: &Agents
518    /// ) -> Result<()> {
519    ///     let mut list = client.list_operations()
520    ///         /* set fields */
521    ///         .by_item();
522    ///     while let Some(item) = list.next().await.transpose()? {
523    ///         println!("{:?}", item);
524    ///     }
525    ///     Ok(())
526    /// }
527    /// ```
528    pub fn list_operations(&self) -> super::builder::agents::ListOperations {
529        super::builder::agents::ListOperations::new(self.inner.clone())
530    }
531
532    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
533    ///
534    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
535    ///
536    /// # Example
537    /// ```
538    /// # use google_cloud_dialogflow_v2::client::Agents;
539    /// use google_cloud_dialogflow_v2::Result;
540    /// async fn sample(
541    ///    client: &Agents
542    /// ) -> Result<()> {
543    ///     let response = client.get_operation()
544    ///         /* set fields */
545    ///         .send().await?;
546    ///     println!("response {:?}", response);
547    ///     Ok(())
548    /// }
549    /// ```
550    pub fn get_operation(&self) -> super::builder::agents::GetOperation {
551        super::builder::agents::GetOperation::new(self.inner.clone())
552    }
553
554    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
555    ///
556    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
557    ///
558    /// # Example
559    /// ```
560    /// # use google_cloud_dialogflow_v2::client::Agents;
561    /// use google_cloud_dialogflow_v2::Result;
562    /// async fn sample(
563    ///    client: &Agents
564    /// ) -> Result<()> {
565    ///     client.cancel_operation()
566    ///         /* set fields */
567    ///         .send().await?;
568    ///     Ok(())
569    /// }
570    /// ```
571    pub fn cancel_operation(&self) -> super::builder::agents::CancelOperation {
572        super::builder::agents::CancelOperation::new(self.inner.clone())
573    }
574}
575
576/// Implements a client for the Dialogflow API.
577///
578/// # Example
579/// ```
580/// # use google_cloud_dialogflow_v2::client::AnswerRecords;
581/// use google_cloud_gax::paginator::ItemPaginator as _;
582/// async fn sample(
583///    project_id: &str,
584/// ) -> anyhow::Result<()> {
585///     let client = AnswerRecords::builder().build().await?;
586///     let mut list = client.list_answer_records()
587///         .set_parent(format!("projects/{project_id}"))
588///         .by_item();
589///     while let Some(item) = list.next().await.transpose()? {
590///         println!("{:?}", item);
591///     }
592///     Ok(())
593/// }
594/// ```
595///
596/// # Service Description
597///
598/// Service for managing
599/// [AnswerRecords][google.cloud.dialogflow.v2.AnswerRecord].
600///
601/// [google.cloud.dialogflow.v2.AnswerRecord]: crate::model::AnswerRecord
602///
603/// # Configuration
604///
605/// To configure `AnswerRecords` use the `with_*` methods in the type returned
606/// by [builder()][AnswerRecords::builder]. The default configuration should
607/// work for most applications. Common configuration changes include
608///
609/// * [with_endpoint()]: by default this client uses the global default endpoint
610///   (`https://dialogflow.googleapis.com`). Applications using regional
611///   endpoints or running in restricted networks (e.g. a network configured
612///   with [Private Google Access with VPC Service Controls]) may want to
613///   override this default.
614/// * [with_credentials()]: by default this client uses
615///   [Application Default Credentials]. Applications using custom
616///   authentication may need to override this default.
617///
618/// [with_endpoint()]: super::builder::answer_records::ClientBuilder::with_endpoint
619/// [with_credentials()]: super::builder::answer_records::ClientBuilder::with_credentials
620/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
621/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
622///
623/// # Pooling and Cloning
624///
625/// `AnswerRecords` holds a connection pool internally, it is advised to
626/// create one and reuse it. You do not need to wrap `AnswerRecords` in
627/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
628/// already uses an `Arc` internally.
629#[cfg(feature = "answer-records")]
630#[cfg_attr(docsrs, doc(cfg(feature = "answer-records")))]
631#[derive(Clone, Debug)]
632pub struct AnswerRecords {
633    inner: std::sync::Arc<dyn super::stub::dynamic::AnswerRecords>,
634}
635
636#[cfg(feature = "answer-records")]
637impl AnswerRecords {
638    /// Returns a builder for [AnswerRecords].
639    ///
640    /// ```
641    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
642    /// # use google_cloud_dialogflow_v2::client::AnswerRecords;
643    /// let client = AnswerRecords::builder().build().await?;
644    /// # Ok(()) }
645    /// ```
646    pub fn builder() -> super::builder::answer_records::ClientBuilder {
647        crate::new_client_builder(super::builder::answer_records::client::Factory)
648    }
649
650    /// Creates a new client from the provided stub.
651    ///
652    /// The most common case for calling this function is in tests mocking the
653    /// client's behavior.
654    pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
655    where
656        T: super::stub::AnswerRecords + 'static,
657    {
658        Self { inner: stub.into() }
659    }
660
661    pub(crate) async fn new(
662        config: gaxi::options::ClientConfig,
663    ) -> crate::ClientBuilderResult<Self> {
664        let inner = Self::build_inner(config).await?;
665        Ok(Self { inner })
666    }
667
668    async fn build_inner(
669        conf: gaxi::options::ClientConfig,
670    ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::AnswerRecords>> {
671        if gaxi::options::tracing_enabled(&conf) {
672            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
673        }
674        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
675    }
676
677    async fn build_transport(
678        conf: gaxi::options::ClientConfig,
679    ) -> crate::ClientBuilderResult<impl super::stub::AnswerRecords> {
680        super::transport::AnswerRecords::new(conf).await
681    }
682
683    async fn build_with_tracing(
684        conf: gaxi::options::ClientConfig,
685    ) -> crate::ClientBuilderResult<impl super::stub::AnswerRecords> {
686        Self::build_transport(conf)
687            .await
688            .map(super::tracing::AnswerRecords::new)
689    }
690
691    /// Returns the list of all answer records in the specified project in reverse
692    /// chronological order.
693    ///
694    /// # Example
695    /// ```
696    /// # use google_cloud_dialogflow_v2::client::AnswerRecords;
697    /// use google_cloud_gax::paginator::ItemPaginator as _;
698    /// use google_cloud_dialogflow_v2::Result;
699    /// async fn sample(
700    ///    client: &AnswerRecords, project_id: &str
701    /// ) -> Result<()> {
702    ///     let mut list = client.list_answer_records()
703    ///         .set_parent(format!("projects/{project_id}"))
704    ///         .by_item();
705    ///     while let Some(item) = list.next().await.transpose()? {
706    ///         println!("{:?}", item);
707    ///     }
708    ///     Ok(())
709    /// }
710    /// ```
711    pub fn list_answer_records(&self) -> super::builder::answer_records::ListAnswerRecords {
712        super::builder::answer_records::ListAnswerRecords::new(self.inner.clone())
713    }
714
715    /// Updates the specified answer record.
716    ///
717    /// # Example
718    /// ```
719    /// # use google_cloud_dialogflow_v2::client::AnswerRecords;
720    /// # extern crate wkt as google_cloud_wkt;
721    /// use google_cloud_wkt::FieldMask;
722    /// use google_cloud_dialogflow_v2::model::AnswerRecord;
723    /// use google_cloud_dialogflow_v2::Result;
724    /// async fn sample(
725    ///    client: &AnswerRecords, project_id: &str, answer_record_id: &str
726    /// ) -> Result<()> {
727    ///     let response = client.update_answer_record()
728    ///         .set_answer_record(
729    ///             AnswerRecord::new().set_name(format!("projects/{project_id}/answerRecords/{answer_record_id}"))/* set fields */
730    ///         )
731    ///         .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
732    ///         .send().await?;
733    ///     println!("response {:?}", response);
734    ///     Ok(())
735    /// }
736    /// ```
737    pub fn update_answer_record(&self) -> super::builder::answer_records::UpdateAnswerRecord {
738        super::builder::answer_records::UpdateAnswerRecord::new(self.inner.clone())
739    }
740
741    /// Lists information about the supported locations for this service.
742    ///
743    /// This method lists locations based on the resource scope provided in
744    /// the [ListLocationsRequest.name][google.cloud.location.ListLocationsRequest.name] field: *
745    /// **Global locations**: If `name` is empty, the method lists the
746    /// public locations available to all projects. * **Project-specific
747    /// locations**: If `name` follows the format
748    /// `projects/{project}`, the method lists locations visible to that
749    /// specific project. This includes public, private, or other
750    /// project-specific locations enabled for the project.
751    ///
752    /// For gRPC and client library implementations, the resource name is
753    /// passed as the `name` field. For direct service calls, the resource
754    /// name is
755    /// incorporated into the request path based on the specific service
756    /// implementation and version.
757    ///
758    /// [google.cloud.location.ListLocationsRequest.name]: google_cloud_location::model::ListLocationsRequest::name
759    ///
760    /// # Example
761    /// ```
762    /// # use google_cloud_dialogflow_v2::client::AnswerRecords;
763    /// use google_cloud_gax::paginator::ItemPaginator as _;
764    /// use google_cloud_dialogflow_v2::Result;
765    /// async fn sample(
766    ///    client: &AnswerRecords
767    /// ) -> Result<()> {
768    ///     let mut list = client.list_locations()
769    ///         /* set fields */
770    ///         .by_item();
771    ///     while let Some(item) = list.next().await.transpose()? {
772    ///         println!("{:?}", item);
773    ///     }
774    ///     Ok(())
775    /// }
776    /// ```
777    pub fn list_locations(&self) -> super::builder::answer_records::ListLocations {
778        super::builder::answer_records::ListLocations::new(self.inner.clone())
779    }
780
781    /// Gets information about a location.
782    ///
783    /// # Example
784    /// ```
785    /// # use google_cloud_dialogflow_v2::client::AnswerRecords;
786    /// use google_cloud_dialogflow_v2::Result;
787    /// async fn sample(
788    ///    client: &AnswerRecords
789    /// ) -> Result<()> {
790    ///     let response = client.get_location()
791    ///         /* set fields */
792    ///         .send().await?;
793    ///     println!("response {:?}", response);
794    ///     Ok(())
795    /// }
796    /// ```
797    pub fn get_location(&self) -> super::builder::answer_records::GetLocation {
798        super::builder::answer_records::GetLocation::new(self.inner.clone())
799    }
800
801    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
802    ///
803    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
804    ///
805    /// # Example
806    /// ```
807    /// # use google_cloud_dialogflow_v2::client::AnswerRecords;
808    /// use google_cloud_gax::paginator::ItemPaginator as _;
809    /// use google_cloud_dialogflow_v2::Result;
810    /// async fn sample(
811    ///    client: &AnswerRecords
812    /// ) -> Result<()> {
813    ///     let mut list = client.list_operations()
814    ///         /* set fields */
815    ///         .by_item();
816    ///     while let Some(item) = list.next().await.transpose()? {
817    ///         println!("{:?}", item);
818    ///     }
819    ///     Ok(())
820    /// }
821    /// ```
822    pub fn list_operations(&self) -> super::builder::answer_records::ListOperations {
823        super::builder::answer_records::ListOperations::new(self.inner.clone())
824    }
825
826    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
827    ///
828    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
829    ///
830    /// # Example
831    /// ```
832    /// # use google_cloud_dialogflow_v2::client::AnswerRecords;
833    /// use google_cloud_dialogflow_v2::Result;
834    /// async fn sample(
835    ///    client: &AnswerRecords
836    /// ) -> Result<()> {
837    ///     let response = client.get_operation()
838    ///         /* set fields */
839    ///         .send().await?;
840    ///     println!("response {:?}", response);
841    ///     Ok(())
842    /// }
843    /// ```
844    pub fn get_operation(&self) -> super::builder::answer_records::GetOperation {
845        super::builder::answer_records::GetOperation::new(self.inner.clone())
846    }
847
848    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
849    ///
850    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
851    ///
852    /// # Example
853    /// ```
854    /// # use google_cloud_dialogflow_v2::client::AnswerRecords;
855    /// use google_cloud_dialogflow_v2::Result;
856    /// async fn sample(
857    ///    client: &AnswerRecords
858    /// ) -> Result<()> {
859    ///     client.cancel_operation()
860    ///         /* set fields */
861    ///         .send().await?;
862    ///     Ok(())
863    /// }
864    /// ```
865    pub fn cancel_operation(&self) -> super::builder::answer_records::CancelOperation {
866        super::builder::answer_records::CancelOperation::new(self.inner.clone())
867    }
868}
869
870/// Implements a client for the Dialogflow API.
871///
872/// # Example
873/// ```
874/// # use google_cloud_dialogflow_v2::client::Contexts;
875/// use google_cloud_gax::paginator::ItemPaginator as _;
876/// async fn sample(
877///    project_id: &str,
878///    session_id: &str,
879/// ) -> anyhow::Result<()> {
880///     let client = Contexts::builder().build().await?;
881///     let mut list = client.list_contexts()
882///         .set_parent(format!("projects/{project_id}/agent/sessions/{session_id}"))
883///         .by_item();
884///     while let Some(item) = list.next().await.transpose()? {
885///         println!("{:?}", item);
886///     }
887///     Ok(())
888/// }
889/// ```
890///
891/// # Service Description
892///
893/// Service for managing [Contexts][google.cloud.dialogflow.v2.Context].
894///
895/// [google.cloud.dialogflow.v2.Context]: crate::model::Context
896///
897/// # Configuration
898///
899/// To configure `Contexts` use the `with_*` methods in the type returned
900/// by [builder()][Contexts::builder]. The default configuration should
901/// work for most applications. Common configuration changes include
902///
903/// * [with_endpoint()]: by default this client uses the global default endpoint
904///   (`https://dialogflow.googleapis.com`). Applications using regional
905///   endpoints or running in restricted networks (e.g. a network configured
906///   with [Private Google Access with VPC Service Controls]) may want to
907///   override this default.
908/// * [with_credentials()]: by default this client uses
909///   [Application Default Credentials]. Applications using custom
910///   authentication may need to override this default.
911///
912/// [with_endpoint()]: super::builder::contexts::ClientBuilder::with_endpoint
913/// [with_credentials()]: super::builder::contexts::ClientBuilder::with_credentials
914/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
915/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
916///
917/// # Pooling and Cloning
918///
919/// `Contexts` holds a connection pool internally, it is advised to
920/// create one and reuse it. You do not need to wrap `Contexts` in
921/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
922/// already uses an `Arc` internally.
923#[cfg(feature = "contexts")]
924#[cfg_attr(docsrs, doc(cfg(feature = "contexts")))]
925#[derive(Clone, Debug)]
926pub struct Contexts {
927    inner: std::sync::Arc<dyn super::stub::dynamic::Contexts>,
928}
929
930#[cfg(feature = "contexts")]
931impl Contexts {
932    /// Returns a builder for [Contexts].
933    ///
934    /// ```
935    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
936    /// # use google_cloud_dialogflow_v2::client::Contexts;
937    /// let client = Contexts::builder().build().await?;
938    /// # Ok(()) }
939    /// ```
940    pub fn builder() -> super::builder::contexts::ClientBuilder {
941        crate::new_client_builder(super::builder::contexts::client::Factory)
942    }
943
944    /// Creates a new client from the provided stub.
945    ///
946    /// The most common case for calling this function is in tests mocking the
947    /// client's behavior.
948    pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
949    where
950        T: super::stub::Contexts + 'static,
951    {
952        Self { inner: stub.into() }
953    }
954
955    pub(crate) async fn new(
956        config: gaxi::options::ClientConfig,
957    ) -> crate::ClientBuilderResult<Self> {
958        let inner = Self::build_inner(config).await?;
959        Ok(Self { inner })
960    }
961
962    async fn build_inner(
963        conf: gaxi::options::ClientConfig,
964    ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::Contexts>> {
965        if gaxi::options::tracing_enabled(&conf) {
966            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
967        }
968        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
969    }
970
971    async fn build_transport(
972        conf: gaxi::options::ClientConfig,
973    ) -> crate::ClientBuilderResult<impl super::stub::Contexts> {
974        super::transport::Contexts::new(conf).await
975    }
976
977    async fn build_with_tracing(
978        conf: gaxi::options::ClientConfig,
979    ) -> crate::ClientBuilderResult<impl super::stub::Contexts> {
980        Self::build_transport(conf)
981            .await
982            .map(super::tracing::Contexts::new)
983    }
984
985    /// Returns the list of all contexts in the specified session.
986    ///
987    /// # Example
988    /// ```
989    /// # use google_cloud_dialogflow_v2::client::Contexts;
990    /// use google_cloud_gax::paginator::ItemPaginator as _;
991    /// use google_cloud_dialogflow_v2::Result;
992    /// async fn sample(
993    ///    client: &Contexts, project_id: &str, session_id: &str
994    /// ) -> Result<()> {
995    ///     let mut list = client.list_contexts()
996    ///         .set_parent(format!("projects/{project_id}/agent/sessions/{session_id}"))
997    ///         .by_item();
998    ///     while let Some(item) = list.next().await.transpose()? {
999    ///         println!("{:?}", item);
1000    ///     }
1001    ///     Ok(())
1002    /// }
1003    /// ```
1004    pub fn list_contexts(&self) -> super::builder::contexts::ListContexts {
1005        super::builder::contexts::ListContexts::new(self.inner.clone())
1006    }
1007
1008    /// Retrieves the specified context.
1009    ///
1010    /// # Example
1011    /// ```
1012    /// # use google_cloud_dialogflow_v2::client::Contexts;
1013    /// use google_cloud_dialogflow_v2::Result;
1014    /// async fn sample(
1015    ///    client: &Contexts, project_id: &str, session_id: &str, context_id: &str
1016    /// ) -> Result<()> {
1017    ///     let response = client.get_context()
1018    ///         .set_name(format!("projects/{project_id}/agent/sessions/{session_id}/contexts/{context_id}"))
1019    ///         .send().await?;
1020    ///     println!("response {:?}", response);
1021    ///     Ok(())
1022    /// }
1023    /// ```
1024    pub fn get_context(&self) -> super::builder::contexts::GetContext {
1025        super::builder::contexts::GetContext::new(self.inner.clone())
1026    }
1027
1028    /// Creates a context.
1029    ///
1030    /// If the specified context already exists, overrides the context.
1031    ///
1032    /// # Example
1033    /// ```
1034    /// # use google_cloud_dialogflow_v2::client::Contexts;
1035    /// use google_cloud_dialogflow_v2::model::Context;
1036    /// use google_cloud_dialogflow_v2::Result;
1037    /// async fn sample(
1038    ///    client: &Contexts, project_id: &str, session_id: &str
1039    /// ) -> Result<()> {
1040    ///     let response = client.create_context()
1041    ///         .set_parent(format!("projects/{project_id}/agent/sessions/{session_id}"))
1042    ///         .set_context(
1043    ///             Context::new()/* set fields */
1044    ///         )
1045    ///         .send().await?;
1046    ///     println!("response {:?}", response);
1047    ///     Ok(())
1048    /// }
1049    /// ```
1050    pub fn create_context(&self) -> super::builder::contexts::CreateContext {
1051        super::builder::contexts::CreateContext::new(self.inner.clone())
1052    }
1053
1054    /// Updates the specified context.
1055    ///
1056    /// # Example
1057    /// ```
1058    /// # use google_cloud_dialogflow_v2::client::Contexts;
1059    /// # extern crate wkt as google_cloud_wkt;
1060    /// use google_cloud_wkt::FieldMask;
1061    /// use google_cloud_dialogflow_v2::model::Context;
1062    /// use google_cloud_dialogflow_v2::Result;
1063    /// async fn sample(
1064    ///    client: &Contexts, project_id: &str, session_id: &str, context_id: &str
1065    /// ) -> Result<()> {
1066    ///     let response = client.update_context()
1067    ///         .set_context(
1068    ///             Context::new().set_name(format!("projects/{project_id}/agent/sessions/{session_id}/contexts/{context_id}"))/* set fields */
1069    ///         )
1070    ///         .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
1071    ///         .send().await?;
1072    ///     println!("response {:?}", response);
1073    ///     Ok(())
1074    /// }
1075    /// ```
1076    pub fn update_context(&self) -> super::builder::contexts::UpdateContext {
1077        super::builder::contexts::UpdateContext::new(self.inner.clone())
1078    }
1079
1080    /// Deletes the specified context.
1081    ///
1082    /// # Example
1083    /// ```
1084    /// # use google_cloud_dialogflow_v2::client::Contexts;
1085    /// use google_cloud_dialogflow_v2::Result;
1086    /// async fn sample(
1087    ///    client: &Contexts, project_id: &str, session_id: &str, context_id: &str
1088    /// ) -> Result<()> {
1089    ///     client.delete_context()
1090    ///         .set_name(format!("projects/{project_id}/agent/sessions/{session_id}/contexts/{context_id}"))
1091    ///         .send().await?;
1092    ///     Ok(())
1093    /// }
1094    /// ```
1095    pub fn delete_context(&self) -> super::builder::contexts::DeleteContext {
1096        super::builder::contexts::DeleteContext::new(self.inner.clone())
1097    }
1098
1099    /// Deletes all active contexts in the specified session.
1100    ///
1101    /// # Example
1102    /// ```
1103    /// # use google_cloud_dialogflow_v2::client::Contexts;
1104    /// use google_cloud_dialogflow_v2::Result;
1105    /// async fn sample(
1106    ///    client: &Contexts
1107    /// ) -> Result<()> {
1108    ///     client.delete_all_contexts()
1109    ///         /* set fields */
1110    ///         .send().await?;
1111    ///     Ok(())
1112    /// }
1113    /// ```
1114    pub fn delete_all_contexts(&self) -> super::builder::contexts::DeleteAllContexts {
1115        super::builder::contexts::DeleteAllContexts::new(self.inner.clone())
1116    }
1117
1118    /// Lists information about the supported locations for this service.
1119    ///
1120    /// This method lists locations based on the resource scope provided in
1121    /// the [ListLocationsRequest.name][google.cloud.location.ListLocationsRequest.name] field: *
1122    /// **Global locations**: If `name` is empty, the method lists the
1123    /// public locations available to all projects. * **Project-specific
1124    /// locations**: If `name` follows the format
1125    /// `projects/{project}`, the method lists locations visible to that
1126    /// specific project. This includes public, private, or other
1127    /// project-specific locations enabled for the project.
1128    ///
1129    /// For gRPC and client library implementations, the resource name is
1130    /// passed as the `name` field. For direct service calls, the resource
1131    /// name is
1132    /// incorporated into the request path based on the specific service
1133    /// implementation and version.
1134    ///
1135    /// [google.cloud.location.ListLocationsRequest.name]: google_cloud_location::model::ListLocationsRequest::name
1136    ///
1137    /// # Example
1138    /// ```
1139    /// # use google_cloud_dialogflow_v2::client::Contexts;
1140    /// use google_cloud_gax::paginator::ItemPaginator as _;
1141    /// use google_cloud_dialogflow_v2::Result;
1142    /// async fn sample(
1143    ///    client: &Contexts
1144    /// ) -> Result<()> {
1145    ///     let mut list = client.list_locations()
1146    ///         /* set fields */
1147    ///         .by_item();
1148    ///     while let Some(item) = list.next().await.transpose()? {
1149    ///         println!("{:?}", item);
1150    ///     }
1151    ///     Ok(())
1152    /// }
1153    /// ```
1154    pub fn list_locations(&self) -> super::builder::contexts::ListLocations {
1155        super::builder::contexts::ListLocations::new(self.inner.clone())
1156    }
1157
1158    /// Gets information about a location.
1159    ///
1160    /// # Example
1161    /// ```
1162    /// # use google_cloud_dialogflow_v2::client::Contexts;
1163    /// use google_cloud_dialogflow_v2::Result;
1164    /// async fn sample(
1165    ///    client: &Contexts
1166    /// ) -> Result<()> {
1167    ///     let response = client.get_location()
1168    ///         /* set fields */
1169    ///         .send().await?;
1170    ///     println!("response {:?}", response);
1171    ///     Ok(())
1172    /// }
1173    /// ```
1174    pub fn get_location(&self) -> super::builder::contexts::GetLocation {
1175        super::builder::contexts::GetLocation::new(self.inner.clone())
1176    }
1177
1178    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1179    ///
1180    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1181    ///
1182    /// # Example
1183    /// ```
1184    /// # use google_cloud_dialogflow_v2::client::Contexts;
1185    /// use google_cloud_gax::paginator::ItemPaginator as _;
1186    /// use google_cloud_dialogflow_v2::Result;
1187    /// async fn sample(
1188    ///    client: &Contexts
1189    /// ) -> Result<()> {
1190    ///     let mut list = client.list_operations()
1191    ///         /* set fields */
1192    ///         .by_item();
1193    ///     while let Some(item) = list.next().await.transpose()? {
1194    ///         println!("{:?}", item);
1195    ///     }
1196    ///     Ok(())
1197    /// }
1198    /// ```
1199    pub fn list_operations(&self) -> super::builder::contexts::ListOperations {
1200        super::builder::contexts::ListOperations::new(self.inner.clone())
1201    }
1202
1203    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1204    ///
1205    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1206    ///
1207    /// # Example
1208    /// ```
1209    /// # use google_cloud_dialogflow_v2::client::Contexts;
1210    /// use google_cloud_dialogflow_v2::Result;
1211    /// async fn sample(
1212    ///    client: &Contexts
1213    /// ) -> Result<()> {
1214    ///     let response = client.get_operation()
1215    ///         /* set fields */
1216    ///         .send().await?;
1217    ///     println!("response {:?}", response);
1218    ///     Ok(())
1219    /// }
1220    /// ```
1221    pub fn get_operation(&self) -> super::builder::contexts::GetOperation {
1222        super::builder::contexts::GetOperation::new(self.inner.clone())
1223    }
1224
1225    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1226    ///
1227    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1228    ///
1229    /// # Example
1230    /// ```
1231    /// # use google_cloud_dialogflow_v2::client::Contexts;
1232    /// use google_cloud_dialogflow_v2::Result;
1233    /// async fn sample(
1234    ///    client: &Contexts
1235    /// ) -> Result<()> {
1236    ///     client.cancel_operation()
1237    ///         /* set fields */
1238    ///         .send().await?;
1239    ///     Ok(())
1240    /// }
1241    /// ```
1242    pub fn cancel_operation(&self) -> super::builder::contexts::CancelOperation {
1243        super::builder::contexts::CancelOperation::new(self.inner.clone())
1244    }
1245}
1246
1247/// Implements a client for the Dialogflow API.
1248///
1249/// # Example
1250/// ```
1251/// # use google_cloud_dialogflow_v2::client::Conversations;
1252/// use google_cloud_gax::paginator::ItemPaginator as _;
1253/// async fn sample(
1254///    project_id: &str,
1255/// ) -> anyhow::Result<()> {
1256///     let client = Conversations::builder().build().await?;
1257///     let mut list = client.list_conversations()
1258///         .set_parent(format!("projects/{project_id}"))
1259///         .by_item();
1260///     while let Some(item) = list.next().await.transpose()? {
1261///         println!("{:?}", item);
1262///     }
1263///     Ok(())
1264/// }
1265/// ```
1266///
1267/// # Service Description
1268///
1269/// Service for managing
1270/// [Conversations][google.cloud.dialogflow.v2.Conversation].
1271///
1272/// [google.cloud.dialogflow.v2.Conversation]: crate::model::Conversation
1273///
1274/// # Configuration
1275///
1276/// To configure `Conversations` use the `with_*` methods in the type returned
1277/// by [builder()][Conversations::builder]. The default configuration should
1278/// work for most applications. Common configuration changes include
1279///
1280/// * [with_endpoint()]: by default this client uses the global default endpoint
1281///   (`https://dialogflow.googleapis.com`). Applications using regional
1282///   endpoints or running in restricted networks (e.g. a network configured
1283///   with [Private Google Access with VPC Service Controls]) may want to
1284///   override this default.
1285/// * [with_credentials()]: by default this client uses
1286///   [Application Default Credentials]. Applications using custom
1287///   authentication may need to override this default.
1288///
1289/// [with_endpoint()]: super::builder::conversations::ClientBuilder::with_endpoint
1290/// [with_credentials()]: super::builder::conversations::ClientBuilder::with_credentials
1291/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
1292/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
1293///
1294/// # Pooling and Cloning
1295///
1296/// `Conversations` holds a connection pool internally, it is advised to
1297/// create one and reuse it. You do not need to wrap `Conversations` in
1298/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
1299/// already uses an `Arc` internally.
1300#[cfg(feature = "conversations")]
1301#[cfg_attr(docsrs, doc(cfg(feature = "conversations")))]
1302#[derive(Clone, Debug)]
1303pub struct Conversations {
1304    inner: std::sync::Arc<dyn super::stub::dynamic::Conversations>,
1305}
1306
1307#[cfg(feature = "conversations")]
1308impl Conversations {
1309    /// Returns a builder for [Conversations].
1310    ///
1311    /// ```
1312    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
1313    /// # use google_cloud_dialogflow_v2::client::Conversations;
1314    /// let client = Conversations::builder().build().await?;
1315    /// # Ok(()) }
1316    /// ```
1317    pub fn builder() -> super::builder::conversations::ClientBuilder {
1318        crate::new_client_builder(super::builder::conversations::client::Factory)
1319    }
1320
1321    /// Creates a new client from the provided stub.
1322    ///
1323    /// The most common case for calling this function is in tests mocking the
1324    /// client's behavior.
1325    pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
1326    where
1327        T: super::stub::Conversations + 'static,
1328    {
1329        Self { inner: stub.into() }
1330    }
1331
1332    pub(crate) async fn new(
1333        config: gaxi::options::ClientConfig,
1334    ) -> crate::ClientBuilderResult<Self> {
1335        let inner = Self::build_inner(config).await?;
1336        Ok(Self { inner })
1337    }
1338
1339    async fn build_inner(
1340        conf: gaxi::options::ClientConfig,
1341    ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::Conversations>> {
1342        if gaxi::options::tracing_enabled(&conf) {
1343            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
1344        }
1345        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
1346    }
1347
1348    async fn build_transport(
1349        conf: gaxi::options::ClientConfig,
1350    ) -> crate::ClientBuilderResult<impl super::stub::Conversations> {
1351        super::transport::Conversations::new(conf).await
1352    }
1353
1354    async fn build_with_tracing(
1355        conf: gaxi::options::ClientConfig,
1356    ) -> crate::ClientBuilderResult<impl super::stub::Conversations> {
1357        Self::build_transport(conf)
1358            .await
1359            .map(super::tracing::Conversations::new)
1360    }
1361
1362    /// Creates a new conversation. Conversations are auto-completed after 24
1363    /// hours.
1364    ///
1365    /// Conversation Lifecycle:
1366    /// There are two stages during a conversation: Automated Agent Stage and
1367    /// Assist Stage.
1368    ///
1369    /// For Automated Agent Stage, there will be a dialogflow agent responding to
1370    /// user queries.
1371    ///
1372    /// For Assist Stage, there's no dialogflow agent responding to user queries.
1373    /// But we will provide suggestions which are generated from conversation.
1374    ///
1375    /// If
1376    /// [Conversation.conversation_profile][google.cloud.dialogflow.v2.Conversation.conversation_profile]
1377    /// is configured for a dialogflow agent, conversation will start from
1378    /// `Automated Agent Stage`, otherwise, it will start from `Assist Stage`. And
1379    /// during `Automated Agent Stage`, once an
1380    /// [Intent][google.cloud.dialogflow.v2.Intent] with
1381    /// [Intent.live_agent_handoff][google.cloud.dialogflow.v2.Intent.live_agent_handoff]
1382    /// is triggered, conversation will transfer to Assist Stage.
1383    ///
1384    /// [google.cloud.dialogflow.v2.Conversation.conversation_profile]: crate::model::Conversation::conversation_profile
1385    /// [google.cloud.dialogflow.v2.Intent]: crate::model::Intent
1386    /// [google.cloud.dialogflow.v2.Intent.live_agent_handoff]: crate::model::Intent::live_agent_handoff
1387    ///
1388    /// # Example
1389    /// ```
1390    /// # use google_cloud_dialogflow_v2::client::Conversations;
1391    /// use google_cloud_dialogflow_v2::model::Conversation;
1392    /// use google_cloud_dialogflow_v2::Result;
1393    /// async fn sample(
1394    ///    client: &Conversations, project_id: &str
1395    /// ) -> Result<()> {
1396    ///     let response = client.create_conversation()
1397    ///         .set_parent(format!("projects/{project_id}"))
1398    ///         .set_conversation_id("conversation_id_value")
1399    ///         .set_conversation(
1400    ///             Conversation::new()/* set fields */
1401    ///         )
1402    ///         .send().await?;
1403    ///     println!("response {:?}", response);
1404    ///     Ok(())
1405    /// }
1406    /// ```
1407    pub fn create_conversation(&self) -> super::builder::conversations::CreateConversation {
1408        super::builder::conversations::CreateConversation::new(self.inner.clone())
1409    }
1410
1411    /// Returns the list of all conversations in the specified project.
1412    ///
1413    /// # Example
1414    /// ```
1415    /// # use google_cloud_dialogflow_v2::client::Conversations;
1416    /// use google_cloud_gax::paginator::ItemPaginator as _;
1417    /// use google_cloud_dialogflow_v2::Result;
1418    /// async fn sample(
1419    ///    client: &Conversations, project_id: &str
1420    /// ) -> Result<()> {
1421    ///     let mut list = client.list_conversations()
1422    ///         .set_parent(format!("projects/{project_id}"))
1423    ///         .by_item();
1424    ///     while let Some(item) = list.next().await.transpose()? {
1425    ///         println!("{:?}", item);
1426    ///     }
1427    ///     Ok(())
1428    /// }
1429    /// ```
1430    pub fn list_conversations(&self) -> super::builder::conversations::ListConversations {
1431        super::builder::conversations::ListConversations::new(self.inner.clone())
1432    }
1433
1434    /// Retrieves the specific conversation.
1435    ///
1436    /// # Example
1437    /// ```
1438    /// # use google_cloud_dialogflow_v2::client::Conversations;
1439    /// use google_cloud_dialogflow_v2::Result;
1440    /// async fn sample(
1441    ///    client: &Conversations, project_id: &str, conversation_id: &str
1442    /// ) -> Result<()> {
1443    ///     let response = client.get_conversation()
1444    ///         .set_name(format!("projects/{project_id}/conversations/{conversation_id}"))
1445    ///         .send().await?;
1446    ///     println!("response {:?}", response);
1447    ///     Ok(())
1448    /// }
1449    /// ```
1450    pub fn get_conversation(&self) -> super::builder::conversations::GetConversation {
1451        super::builder::conversations::GetConversation::new(self.inner.clone())
1452    }
1453
1454    /// Completes the specified conversation. Finished conversations are purged
1455    /// from the database after 30 days.
1456    ///
1457    /// # Example
1458    /// ```
1459    /// # use google_cloud_dialogflow_v2::client::Conversations;
1460    /// use google_cloud_dialogflow_v2::Result;
1461    /// async fn sample(
1462    ///    client: &Conversations
1463    /// ) -> Result<()> {
1464    ///     let response = client.complete_conversation()
1465    ///         /* set fields */
1466    ///         .send().await?;
1467    ///     println!("response {:?}", response);
1468    ///     Ok(())
1469    /// }
1470    /// ```
1471    pub fn complete_conversation(&self) -> super::builder::conversations::CompleteConversation {
1472        super::builder::conversations::CompleteConversation::new(self.inner.clone())
1473    }
1474
1475    /// Data ingestion API.
1476    /// Ingests context references for an existing conversation.
1477    ///
1478    /// # Example
1479    /// ```
1480    /// # use google_cloud_dialogflow_v2::client::Conversations;
1481    /// use google_cloud_dialogflow_v2::Result;
1482    /// async fn sample(
1483    ///    client: &Conversations
1484    /// ) -> Result<()> {
1485    ///     let response = client.ingest_context_references()
1486    ///         /* set fields */
1487    ///         .send().await?;
1488    ///     println!("response {:?}", response);
1489    ///     Ok(())
1490    /// }
1491    /// ```
1492    pub fn ingest_context_references(
1493        &self,
1494    ) -> super::builder::conversations::IngestContextReferences {
1495        super::builder::conversations::IngestContextReferences::new(self.inner.clone())
1496    }
1497
1498    /// Lists messages that belong to a given conversation.
1499    /// `messages` are ordered by `create_time` in descending order. To fetch
1500    /// updates without duplication, send request with filter
1501    /// `create_time_epoch_microseconds >
1502    /// [first item's create_time of previous request]` and empty page_token.
1503    ///
1504    /// # Example
1505    /// ```
1506    /// # use google_cloud_dialogflow_v2::client::Conversations;
1507    /// use google_cloud_gax::paginator::ItemPaginator as _;
1508    /// use google_cloud_dialogflow_v2::Result;
1509    /// async fn sample(
1510    ///    client: &Conversations, project_id: &str, conversation_id: &str
1511    /// ) -> Result<()> {
1512    ///     let mut list = client.list_messages()
1513    ///         .set_parent(format!("projects/{project_id}/conversations/{conversation_id}"))
1514    ///         .by_item();
1515    ///     while let Some(item) = list.next().await.transpose()? {
1516    ///         println!("{:?}", item);
1517    ///     }
1518    ///     Ok(())
1519    /// }
1520    /// ```
1521    pub fn list_messages(&self) -> super::builder::conversations::ListMessages {
1522        super::builder::conversations::ListMessages::new(self.inner.clone())
1523    }
1524
1525    /// Suggests summary for a conversation based on specific historical messages.
1526    /// The range of the messages to be used for summary can be specified in the
1527    /// request.
1528    ///
1529    /// # Example
1530    /// ```
1531    /// # use google_cloud_dialogflow_v2::client::Conversations;
1532    /// use google_cloud_dialogflow_v2::Result;
1533    /// async fn sample(
1534    ///    client: &Conversations
1535    /// ) -> Result<()> {
1536    ///     let response = client.suggest_conversation_summary()
1537    ///         /* set fields */
1538    ///         .send().await?;
1539    ///     println!("response {:?}", response);
1540    ///     Ok(())
1541    /// }
1542    /// ```
1543    pub fn suggest_conversation_summary(
1544        &self,
1545    ) -> super::builder::conversations::SuggestConversationSummary {
1546        super::builder::conversations::SuggestConversationSummary::new(self.inner.clone())
1547    }
1548
1549    /// Generates and returns a summary for a conversation that does not have a
1550    /// resource created for it.
1551    ///
1552    /// # Example
1553    /// ```
1554    /// # use google_cloud_dialogflow_v2::client::Conversations;
1555    /// use google_cloud_dialogflow_v2::Result;
1556    /// async fn sample(
1557    ///    client: &Conversations
1558    /// ) -> Result<()> {
1559    ///     let response = client.generate_stateless_summary()
1560    ///         /* set fields */
1561    ///         .send().await?;
1562    ///     println!("response {:?}", response);
1563    ///     Ok(())
1564    /// }
1565    /// ```
1566    pub fn generate_stateless_summary(
1567        &self,
1568    ) -> super::builder::conversations::GenerateStatelessSummary {
1569        super::builder::conversations::GenerateStatelessSummary::new(self.inner.clone())
1570    }
1571
1572    /// Generates and returns a suggestion for a conversation that does not have a
1573    /// resource created for it.
1574    ///
1575    /// # Example
1576    /// ```
1577    /// # use google_cloud_dialogflow_v2::client::Conversations;
1578    /// use google_cloud_dialogflow_v2::Result;
1579    /// async fn sample(
1580    ///    client: &Conversations
1581    /// ) -> Result<()> {
1582    ///     let response = client.generate_stateless_suggestion()
1583    ///         /* set fields */
1584    ///         .send().await?;
1585    ///     println!("response {:?}", response);
1586    ///     Ok(())
1587    /// }
1588    /// ```
1589    pub fn generate_stateless_suggestion(
1590        &self,
1591    ) -> super::builder::conversations::GenerateStatelessSuggestion {
1592        super::builder::conversations::GenerateStatelessSuggestion::new(self.inner.clone())
1593    }
1594
1595    /// Get answers for the given query based on knowledge documents.
1596    ///
1597    /// # Example
1598    /// ```
1599    /// # use google_cloud_dialogflow_v2::client::Conversations;
1600    /// use google_cloud_dialogflow_v2::Result;
1601    /// async fn sample(
1602    ///    client: &Conversations
1603    /// ) -> Result<()> {
1604    ///     let response = client.search_knowledge()
1605    ///         /* set fields */
1606    ///         .send().await?;
1607    ///     println!("response {:?}", response);
1608    ///     Ok(())
1609    /// }
1610    /// ```
1611    pub fn search_knowledge(&self) -> super::builder::conversations::SearchKnowledge {
1612        super::builder::conversations::SearchKnowledge::new(self.inner.clone())
1613    }
1614
1615    /// Generates all the suggestions using generators configured in the
1616    /// conversation profile. A generator is used only if its trigger event is
1617    /// matched.
1618    ///
1619    /// # Example
1620    /// ```
1621    /// # use google_cloud_dialogflow_v2::client::Conversations;
1622    /// use google_cloud_dialogflow_v2::Result;
1623    /// async fn sample(
1624    ///    client: &Conversations
1625    /// ) -> Result<()> {
1626    ///     let response = client.generate_suggestions()
1627    ///         /* set fields */
1628    ///         .send().await?;
1629    ///     println!("response {:?}", response);
1630    ///     Ok(())
1631    /// }
1632    /// ```
1633    pub fn generate_suggestions(&self) -> super::builder::conversations::GenerateSuggestions {
1634        super::builder::conversations::GenerateSuggestions::new(self.inner.clone())
1635    }
1636
1637    /// Lists information about the supported locations for this service.
1638    ///
1639    /// This method lists locations based on the resource scope provided in
1640    /// the [ListLocationsRequest.name][google.cloud.location.ListLocationsRequest.name] field: *
1641    /// **Global locations**: If `name` is empty, the method lists the
1642    /// public locations available to all projects. * **Project-specific
1643    /// locations**: If `name` follows the format
1644    /// `projects/{project}`, the method lists locations visible to that
1645    /// specific project. This includes public, private, or other
1646    /// project-specific locations enabled for the project.
1647    ///
1648    /// For gRPC and client library implementations, the resource name is
1649    /// passed as the `name` field. For direct service calls, the resource
1650    /// name is
1651    /// incorporated into the request path based on the specific service
1652    /// implementation and version.
1653    ///
1654    /// [google.cloud.location.ListLocationsRequest.name]: google_cloud_location::model::ListLocationsRequest::name
1655    ///
1656    /// # Example
1657    /// ```
1658    /// # use google_cloud_dialogflow_v2::client::Conversations;
1659    /// use google_cloud_gax::paginator::ItemPaginator as _;
1660    /// use google_cloud_dialogflow_v2::Result;
1661    /// async fn sample(
1662    ///    client: &Conversations
1663    /// ) -> Result<()> {
1664    ///     let mut list = client.list_locations()
1665    ///         /* set fields */
1666    ///         .by_item();
1667    ///     while let Some(item) = list.next().await.transpose()? {
1668    ///         println!("{:?}", item);
1669    ///     }
1670    ///     Ok(())
1671    /// }
1672    /// ```
1673    pub fn list_locations(&self) -> super::builder::conversations::ListLocations {
1674        super::builder::conversations::ListLocations::new(self.inner.clone())
1675    }
1676
1677    /// Gets information about a location.
1678    ///
1679    /// # Example
1680    /// ```
1681    /// # use google_cloud_dialogflow_v2::client::Conversations;
1682    /// use google_cloud_dialogflow_v2::Result;
1683    /// async fn sample(
1684    ///    client: &Conversations
1685    /// ) -> Result<()> {
1686    ///     let response = client.get_location()
1687    ///         /* set fields */
1688    ///         .send().await?;
1689    ///     println!("response {:?}", response);
1690    ///     Ok(())
1691    /// }
1692    /// ```
1693    pub fn get_location(&self) -> super::builder::conversations::GetLocation {
1694        super::builder::conversations::GetLocation::new(self.inner.clone())
1695    }
1696
1697    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1698    ///
1699    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1700    ///
1701    /// # Example
1702    /// ```
1703    /// # use google_cloud_dialogflow_v2::client::Conversations;
1704    /// use google_cloud_gax::paginator::ItemPaginator as _;
1705    /// use google_cloud_dialogflow_v2::Result;
1706    /// async fn sample(
1707    ///    client: &Conversations
1708    /// ) -> Result<()> {
1709    ///     let mut list = client.list_operations()
1710    ///         /* set fields */
1711    ///         .by_item();
1712    ///     while let Some(item) = list.next().await.transpose()? {
1713    ///         println!("{:?}", item);
1714    ///     }
1715    ///     Ok(())
1716    /// }
1717    /// ```
1718    pub fn list_operations(&self) -> super::builder::conversations::ListOperations {
1719        super::builder::conversations::ListOperations::new(self.inner.clone())
1720    }
1721
1722    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1723    ///
1724    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1725    ///
1726    /// # Example
1727    /// ```
1728    /// # use google_cloud_dialogflow_v2::client::Conversations;
1729    /// use google_cloud_dialogflow_v2::Result;
1730    /// async fn sample(
1731    ///    client: &Conversations
1732    /// ) -> Result<()> {
1733    ///     let response = client.get_operation()
1734    ///         /* set fields */
1735    ///         .send().await?;
1736    ///     println!("response {:?}", response);
1737    ///     Ok(())
1738    /// }
1739    /// ```
1740    pub fn get_operation(&self) -> super::builder::conversations::GetOperation {
1741        super::builder::conversations::GetOperation::new(self.inner.clone())
1742    }
1743
1744    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1745    ///
1746    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1747    ///
1748    /// # Example
1749    /// ```
1750    /// # use google_cloud_dialogflow_v2::client::Conversations;
1751    /// use google_cloud_dialogflow_v2::Result;
1752    /// async fn sample(
1753    ///    client: &Conversations
1754    /// ) -> Result<()> {
1755    ///     client.cancel_operation()
1756    ///         /* set fields */
1757    ///         .send().await?;
1758    ///     Ok(())
1759    /// }
1760    /// ```
1761    pub fn cancel_operation(&self) -> super::builder::conversations::CancelOperation {
1762        super::builder::conversations::CancelOperation::new(self.inner.clone())
1763    }
1764}
1765
1766/// Implements a client for the Dialogflow API.
1767///
1768/// # Example
1769/// ```
1770/// # use google_cloud_dialogflow_v2::client::ConversationDatasets;
1771/// use google_cloud_gax::paginator::ItemPaginator as _;
1772/// async fn sample(
1773///    project_id: &str,
1774///    location_id: &str,
1775/// ) -> anyhow::Result<()> {
1776///     let client = ConversationDatasets::builder().build().await?;
1777///     let mut list = client.list_conversation_datasets()
1778///         .set_parent(format!("projects/{project_id}/locations/{location_id}"))
1779///         .by_item();
1780///     while let Some(item) = list.next().await.transpose()? {
1781///         println!("{:?}", item);
1782///     }
1783///     Ok(())
1784/// }
1785/// ```
1786///
1787/// # Service Description
1788///
1789/// Conversation datasets.
1790///
1791/// Conversation datasets contain raw conversation files and their
1792/// customizable metadata that can be used for model training.
1793///
1794/// # Configuration
1795///
1796/// To configure `ConversationDatasets` use the `with_*` methods in the type returned
1797/// by [builder()][ConversationDatasets::builder]. The default configuration should
1798/// work for most applications. Common configuration changes include
1799///
1800/// * [with_endpoint()]: by default this client uses the global default endpoint
1801///   (`https://dialogflow.googleapis.com`). Applications using regional
1802///   endpoints or running in restricted networks (e.g. a network configured
1803///   with [Private Google Access with VPC Service Controls]) may want to
1804///   override this default.
1805/// * [with_credentials()]: by default this client uses
1806///   [Application Default Credentials]. Applications using custom
1807///   authentication may need to override this default.
1808///
1809/// [with_endpoint()]: super::builder::conversation_datasets::ClientBuilder::with_endpoint
1810/// [with_credentials()]: super::builder::conversation_datasets::ClientBuilder::with_credentials
1811/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
1812/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
1813///
1814/// # Pooling and Cloning
1815///
1816/// `ConversationDatasets` holds a connection pool internally, it is advised to
1817/// create one and reuse it. You do not need to wrap `ConversationDatasets` in
1818/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
1819/// already uses an `Arc` internally.
1820#[cfg(feature = "conversation-datasets")]
1821#[cfg_attr(docsrs, doc(cfg(feature = "conversation-datasets")))]
1822#[derive(Clone, Debug)]
1823pub struct ConversationDatasets {
1824    inner: std::sync::Arc<dyn super::stub::dynamic::ConversationDatasets>,
1825}
1826
1827#[cfg(feature = "conversation-datasets")]
1828impl ConversationDatasets {
1829    /// Returns a builder for [ConversationDatasets].
1830    ///
1831    /// ```
1832    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
1833    /// # use google_cloud_dialogflow_v2::client::ConversationDatasets;
1834    /// let client = ConversationDatasets::builder().build().await?;
1835    /// # Ok(()) }
1836    /// ```
1837    pub fn builder() -> super::builder::conversation_datasets::ClientBuilder {
1838        crate::new_client_builder(super::builder::conversation_datasets::client::Factory)
1839    }
1840
1841    /// Creates a new client from the provided stub.
1842    ///
1843    /// The most common case for calling this function is in tests mocking the
1844    /// client's behavior.
1845    pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
1846    where
1847        T: super::stub::ConversationDatasets + 'static,
1848    {
1849        Self { inner: stub.into() }
1850    }
1851
1852    pub(crate) async fn new(
1853        config: gaxi::options::ClientConfig,
1854    ) -> crate::ClientBuilderResult<Self> {
1855        let inner = Self::build_inner(config).await?;
1856        Ok(Self { inner })
1857    }
1858
1859    async fn build_inner(
1860        conf: gaxi::options::ClientConfig,
1861    ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::ConversationDatasets>>
1862    {
1863        if gaxi::options::tracing_enabled(&conf) {
1864            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
1865        }
1866        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
1867    }
1868
1869    async fn build_transport(
1870        conf: gaxi::options::ClientConfig,
1871    ) -> crate::ClientBuilderResult<impl super::stub::ConversationDatasets> {
1872        super::transport::ConversationDatasets::new(conf).await
1873    }
1874
1875    async fn build_with_tracing(
1876        conf: gaxi::options::ClientConfig,
1877    ) -> crate::ClientBuilderResult<impl super::stub::ConversationDatasets> {
1878        Self::build_transport(conf)
1879            .await
1880            .map(super::tracing::ConversationDatasets::new)
1881    }
1882
1883    /// Creates a new conversation dataset.
1884    ///
1885    /// This method is a [long-running
1886    /// operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations).
1887    /// The returned `Operation` type has the following method-specific fields:
1888    ///
1889    /// - `metadata`:
1890    ///   [CreateConversationDatasetOperationMetadata][google.cloud.dialogflow.v2.CreateConversationDatasetOperationMetadata]
1891    /// - `response`:
1892    ///   [ConversationDataset][google.cloud.dialogflow.v2.ConversationDataset]
1893    ///
1894    /// [google.cloud.dialogflow.v2.ConversationDataset]: crate::model::ConversationDataset
1895    /// [google.cloud.dialogflow.v2.CreateConversationDatasetOperationMetadata]: crate::model::CreateConversationDatasetOperationMetadata
1896    ///
1897    /// # Long running operations
1898    ///
1899    /// This method is used to start, and/or poll a [long-running Operation].
1900    /// The [Working with long-running operations] chapter in the [user guide]
1901    /// covers these operations in detail.
1902    ///
1903    /// [long-running operation]: https://google.aip.dev/151
1904    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1905    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1906    ///
1907    /// # Example
1908    /// ```
1909    /// # use google_cloud_dialogflow_v2::client::ConversationDatasets;
1910    /// use google_cloud_lro::Poller;
1911    /// use google_cloud_dialogflow_v2::model::ConversationDataset;
1912    /// use google_cloud_dialogflow_v2::Result;
1913    /// async fn sample(
1914    ///    client: &ConversationDatasets, parent: &str
1915    /// ) -> Result<()> {
1916    ///     let response = client.create_conversation_dataset()
1917    ///         .set_parent(parent)
1918    ///         .set_conversation_dataset(
1919    ///             ConversationDataset::new()/* set fields */
1920    ///         )
1921    ///         .poller().until_done().await?;
1922    ///     println!("response {:?}", response);
1923    ///     Ok(())
1924    /// }
1925    /// ```
1926    pub fn create_conversation_dataset(
1927        &self,
1928    ) -> super::builder::conversation_datasets::CreateConversationDataset {
1929        super::builder::conversation_datasets::CreateConversationDataset::new(self.inner.clone())
1930    }
1931
1932    /// Retrieves the specified conversation dataset.
1933    ///
1934    /// # Example
1935    /// ```
1936    /// # use google_cloud_dialogflow_v2::client::ConversationDatasets;
1937    /// use google_cloud_dialogflow_v2::Result;
1938    /// async fn sample(
1939    ///    client: &ConversationDatasets, project_id: &str, location_id: &str, conversation_dataset_id: &str
1940    /// ) -> Result<()> {
1941    ///     let response = client.get_conversation_dataset()
1942    ///         .set_name(format!("projects/{project_id}/locations/{location_id}/conversationDatasets/{conversation_dataset_id}"))
1943    ///         .send().await?;
1944    ///     println!("response {:?}", response);
1945    ///     Ok(())
1946    /// }
1947    /// ```
1948    pub fn get_conversation_dataset(
1949        &self,
1950    ) -> super::builder::conversation_datasets::GetConversationDataset {
1951        super::builder::conversation_datasets::GetConversationDataset::new(self.inner.clone())
1952    }
1953
1954    /// Returns the list of all conversation datasets in the specified
1955    /// project and location.
1956    ///
1957    /// # Example
1958    /// ```
1959    /// # use google_cloud_dialogflow_v2::client::ConversationDatasets;
1960    /// use google_cloud_gax::paginator::ItemPaginator as _;
1961    /// use google_cloud_dialogflow_v2::Result;
1962    /// async fn sample(
1963    ///    client: &ConversationDatasets, project_id: &str, location_id: &str
1964    /// ) -> Result<()> {
1965    ///     let mut list = client.list_conversation_datasets()
1966    ///         .set_parent(format!("projects/{project_id}/locations/{location_id}"))
1967    ///         .by_item();
1968    ///     while let Some(item) = list.next().await.transpose()? {
1969    ///         println!("{:?}", item);
1970    ///     }
1971    ///     Ok(())
1972    /// }
1973    /// ```
1974    pub fn list_conversation_datasets(
1975        &self,
1976    ) -> super::builder::conversation_datasets::ListConversationDatasets {
1977        super::builder::conversation_datasets::ListConversationDatasets::new(self.inner.clone())
1978    }
1979
1980    /// Deletes the specified conversation dataset.
1981    ///
1982    /// This method is a [long-running
1983    /// operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations).
1984    /// The returned `Operation` type has the following method-specific fields:
1985    ///
1986    /// - `metadata`:
1987    ///   [DeleteConversationDatasetOperationMetadata][google.cloud.dialogflow.v2.DeleteConversationDatasetOperationMetadata]
1988    /// - `response`: An [Empty
1989    ///   message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
1990    ///
1991    /// [google.cloud.dialogflow.v2.DeleteConversationDatasetOperationMetadata]: crate::model::DeleteConversationDatasetOperationMetadata
1992    ///
1993    /// # Long running operations
1994    ///
1995    /// This method is used to start, and/or poll a [long-running Operation].
1996    /// The [Working with long-running operations] chapter in the [user guide]
1997    /// covers these operations in detail.
1998    ///
1999    /// [long-running operation]: https://google.aip.dev/151
2000    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2001    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2002    ///
2003    /// # Example
2004    /// ```
2005    /// # use google_cloud_dialogflow_v2::client::ConversationDatasets;
2006    /// use google_cloud_lro::Poller;
2007    /// use google_cloud_dialogflow_v2::Result;
2008    /// async fn sample(
2009    ///    client: &ConversationDatasets, project_id: &str, location_id: &str, conversation_dataset_id: &str
2010    /// ) -> Result<()> {
2011    ///     client.delete_conversation_dataset()
2012    ///         .set_name(format!("projects/{project_id}/locations/{location_id}/conversationDatasets/{conversation_dataset_id}"))
2013    ///         .poller().until_done().await?;
2014    ///     Ok(())
2015    /// }
2016    /// ```
2017    pub fn delete_conversation_dataset(
2018        &self,
2019    ) -> super::builder::conversation_datasets::DeleteConversationDataset {
2020        super::builder::conversation_datasets::DeleteConversationDataset::new(self.inner.clone())
2021    }
2022
2023    /// Import data into the specified conversation dataset. Note that it
2024    /// is not allowed to import data to a conversation dataset that
2025    /// already has data in it.
2026    ///
2027    /// This method is a [long-running
2028    /// operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations).
2029    /// The returned `Operation` type has the following method-specific fields:
2030    ///
2031    /// - `metadata`:
2032    ///   [ImportConversationDataOperationMetadata][google.cloud.dialogflow.v2.ImportConversationDataOperationMetadata]
2033    /// - `response`:
2034    ///   [ImportConversationDataOperationResponse][google.cloud.dialogflow.v2.ImportConversationDataOperationResponse]
2035    ///
2036    /// [google.cloud.dialogflow.v2.ImportConversationDataOperationMetadata]: crate::model::ImportConversationDataOperationMetadata
2037    /// [google.cloud.dialogflow.v2.ImportConversationDataOperationResponse]: crate::model::ImportConversationDataOperationResponse
2038    ///
2039    /// # Long running operations
2040    ///
2041    /// This method is used to start, and/or poll a [long-running Operation].
2042    /// The [Working with long-running operations] chapter in the [user guide]
2043    /// covers these operations in detail.
2044    ///
2045    /// [long-running operation]: https://google.aip.dev/151
2046    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2047    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2048    ///
2049    /// # Example
2050    /// ```
2051    /// # use google_cloud_dialogflow_v2::client::ConversationDatasets;
2052    /// use google_cloud_lro::Poller;
2053    /// use google_cloud_dialogflow_v2::Result;
2054    /// async fn sample(
2055    ///    client: &ConversationDatasets
2056    /// ) -> Result<()> {
2057    ///     let response = client.import_conversation_data()
2058    ///         /* set fields */
2059    ///         .poller().until_done().await?;
2060    ///     println!("response {:?}", response);
2061    ///     Ok(())
2062    /// }
2063    /// ```
2064    pub fn import_conversation_data(
2065        &self,
2066    ) -> super::builder::conversation_datasets::ImportConversationData {
2067        super::builder::conversation_datasets::ImportConversationData::new(self.inner.clone())
2068    }
2069
2070    /// Lists information about the supported locations for this service.
2071    ///
2072    /// This method lists locations based on the resource scope provided in
2073    /// the [ListLocationsRequest.name][google.cloud.location.ListLocationsRequest.name] field: *
2074    /// **Global locations**: If `name` is empty, the method lists the
2075    /// public locations available to all projects. * **Project-specific
2076    /// locations**: If `name` follows the format
2077    /// `projects/{project}`, the method lists locations visible to that
2078    /// specific project. This includes public, private, or other
2079    /// project-specific locations enabled for the project.
2080    ///
2081    /// For gRPC and client library implementations, the resource name is
2082    /// passed as the `name` field. For direct service calls, the resource
2083    /// name is
2084    /// incorporated into the request path based on the specific service
2085    /// implementation and version.
2086    ///
2087    /// [google.cloud.location.ListLocationsRequest.name]: google_cloud_location::model::ListLocationsRequest::name
2088    ///
2089    /// # Example
2090    /// ```
2091    /// # use google_cloud_dialogflow_v2::client::ConversationDatasets;
2092    /// use google_cloud_gax::paginator::ItemPaginator as _;
2093    /// use google_cloud_dialogflow_v2::Result;
2094    /// async fn sample(
2095    ///    client: &ConversationDatasets
2096    /// ) -> Result<()> {
2097    ///     let mut list = client.list_locations()
2098    ///         /* set fields */
2099    ///         .by_item();
2100    ///     while let Some(item) = list.next().await.transpose()? {
2101    ///         println!("{:?}", item);
2102    ///     }
2103    ///     Ok(())
2104    /// }
2105    /// ```
2106    pub fn list_locations(&self) -> super::builder::conversation_datasets::ListLocations {
2107        super::builder::conversation_datasets::ListLocations::new(self.inner.clone())
2108    }
2109
2110    /// Gets information about a location.
2111    ///
2112    /// # Example
2113    /// ```
2114    /// # use google_cloud_dialogflow_v2::client::ConversationDatasets;
2115    /// use google_cloud_dialogflow_v2::Result;
2116    /// async fn sample(
2117    ///    client: &ConversationDatasets
2118    /// ) -> Result<()> {
2119    ///     let response = client.get_location()
2120    ///         /* set fields */
2121    ///         .send().await?;
2122    ///     println!("response {:?}", response);
2123    ///     Ok(())
2124    /// }
2125    /// ```
2126    pub fn get_location(&self) -> super::builder::conversation_datasets::GetLocation {
2127        super::builder::conversation_datasets::GetLocation::new(self.inner.clone())
2128    }
2129
2130    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2131    ///
2132    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
2133    ///
2134    /// # Example
2135    /// ```
2136    /// # use google_cloud_dialogflow_v2::client::ConversationDatasets;
2137    /// use google_cloud_gax::paginator::ItemPaginator as _;
2138    /// use google_cloud_dialogflow_v2::Result;
2139    /// async fn sample(
2140    ///    client: &ConversationDatasets
2141    /// ) -> Result<()> {
2142    ///     let mut list = client.list_operations()
2143    ///         /* set fields */
2144    ///         .by_item();
2145    ///     while let Some(item) = list.next().await.transpose()? {
2146    ///         println!("{:?}", item);
2147    ///     }
2148    ///     Ok(())
2149    /// }
2150    /// ```
2151    pub fn list_operations(&self) -> super::builder::conversation_datasets::ListOperations {
2152        super::builder::conversation_datasets::ListOperations::new(self.inner.clone())
2153    }
2154
2155    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2156    ///
2157    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
2158    ///
2159    /// # Example
2160    /// ```
2161    /// # use google_cloud_dialogflow_v2::client::ConversationDatasets;
2162    /// use google_cloud_dialogflow_v2::Result;
2163    /// async fn sample(
2164    ///    client: &ConversationDatasets
2165    /// ) -> Result<()> {
2166    ///     let response = client.get_operation()
2167    ///         /* set fields */
2168    ///         .send().await?;
2169    ///     println!("response {:?}", response);
2170    ///     Ok(())
2171    /// }
2172    /// ```
2173    pub fn get_operation(&self) -> super::builder::conversation_datasets::GetOperation {
2174        super::builder::conversation_datasets::GetOperation::new(self.inner.clone())
2175    }
2176
2177    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2178    ///
2179    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
2180    ///
2181    /// # Example
2182    /// ```
2183    /// # use google_cloud_dialogflow_v2::client::ConversationDatasets;
2184    /// use google_cloud_dialogflow_v2::Result;
2185    /// async fn sample(
2186    ///    client: &ConversationDatasets
2187    /// ) -> Result<()> {
2188    ///     client.cancel_operation()
2189    ///         /* set fields */
2190    ///         .send().await?;
2191    ///     Ok(())
2192    /// }
2193    /// ```
2194    pub fn cancel_operation(&self) -> super::builder::conversation_datasets::CancelOperation {
2195        super::builder::conversation_datasets::CancelOperation::new(self.inner.clone())
2196    }
2197}
2198
2199/// Implements a client for the Dialogflow API.
2200///
2201/// # Example
2202/// ```
2203/// # use google_cloud_dialogflow_v2::client::ConversationModels;
2204/// use google_cloud_gax::paginator::ItemPaginator as _;
2205/// async fn sample(
2206///    parent: &str,
2207/// ) -> anyhow::Result<()> {
2208///     let client = ConversationModels::builder().build().await?;
2209///     let mut list = client.list_conversation_models()
2210///         .set_parent(parent)
2211///         .by_item();
2212///     while let Some(item) = list.next().await.transpose()? {
2213///         println!("{:?}", item);
2214///     }
2215///     Ok(())
2216/// }
2217/// ```
2218///
2219/// # Service Description
2220///
2221/// Manages a collection of models for human agent assistant.
2222///
2223/// # Configuration
2224///
2225/// To configure `ConversationModels` use the `with_*` methods in the type returned
2226/// by [builder()][ConversationModels::builder]. The default configuration should
2227/// work for most applications. Common configuration changes include
2228///
2229/// * [with_endpoint()]: by default this client uses the global default endpoint
2230///   (`https://dialogflow.googleapis.com`). Applications using regional
2231///   endpoints or running in restricted networks (e.g. a network configured
2232///   with [Private Google Access with VPC Service Controls]) may want to
2233///   override this default.
2234/// * [with_credentials()]: by default this client uses
2235///   [Application Default Credentials]. Applications using custom
2236///   authentication may need to override this default.
2237///
2238/// [with_endpoint()]: super::builder::conversation_models::ClientBuilder::with_endpoint
2239/// [with_credentials()]: super::builder::conversation_models::ClientBuilder::with_credentials
2240/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
2241/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
2242///
2243/// # Pooling and Cloning
2244///
2245/// `ConversationModels` holds a connection pool internally, it is advised to
2246/// create one and reuse it. You do not need to wrap `ConversationModels` in
2247/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
2248/// already uses an `Arc` internally.
2249#[cfg(feature = "conversation-models")]
2250#[cfg_attr(docsrs, doc(cfg(feature = "conversation-models")))]
2251#[derive(Clone, Debug)]
2252pub struct ConversationModels {
2253    inner: std::sync::Arc<dyn super::stub::dynamic::ConversationModels>,
2254}
2255
2256#[cfg(feature = "conversation-models")]
2257impl ConversationModels {
2258    /// Returns a builder for [ConversationModels].
2259    ///
2260    /// ```
2261    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
2262    /// # use google_cloud_dialogflow_v2::client::ConversationModels;
2263    /// let client = ConversationModels::builder().build().await?;
2264    /// # Ok(()) }
2265    /// ```
2266    pub fn builder() -> super::builder::conversation_models::ClientBuilder {
2267        crate::new_client_builder(super::builder::conversation_models::client::Factory)
2268    }
2269
2270    /// Creates a new client from the provided stub.
2271    ///
2272    /// The most common case for calling this function is in tests mocking the
2273    /// client's behavior.
2274    pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
2275    where
2276        T: super::stub::ConversationModels + 'static,
2277    {
2278        Self { inner: stub.into() }
2279    }
2280
2281    pub(crate) async fn new(
2282        config: gaxi::options::ClientConfig,
2283    ) -> crate::ClientBuilderResult<Self> {
2284        let inner = Self::build_inner(config).await?;
2285        Ok(Self { inner })
2286    }
2287
2288    async fn build_inner(
2289        conf: gaxi::options::ClientConfig,
2290    ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::ConversationModels>>
2291    {
2292        if gaxi::options::tracing_enabled(&conf) {
2293            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
2294        }
2295        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
2296    }
2297
2298    async fn build_transport(
2299        conf: gaxi::options::ClientConfig,
2300    ) -> crate::ClientBuilderResult<impl super::stub::ConversationModels> {
2301        super::transport::ConversationModels::new(conf).await
2302    }
2303
2304    async fn build_with_tracing(
2305        conf: gaxi::options::ClientConfig,
2306    ) -> crate::ClientBuilderResult<impl super::stub::ConversationModels> {
2307        Self::build_transport(conf)
2308            .await
2309            .map(super::tracing::ConversationModels::new)
2310    }
2311
2312    /// Creates a model.
2313    ///
2314    /// This method is a [long-running
2315    /// operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations).
2316    /// The returned `Operation` type has the following method-specific fields:
2317    ///
2318    /// - `metadata`:
2319    ///   [CreateConversationModelOperationMetadata][google.cloud.dialogflow.v2.CreateConversationModelOperationMetadata]
2320    /// - `response`:
2321    ///   [ConversationModel][google.cloud.dialogflow.v2.ConversationModel]
2322    ///
2323    /// [google.cloud.dialogflow.v2.ConversationModel]: crate::model::ConversationModel
2324    /// [google.cloud.dialogflow.v2.CreateConversationModelOperationMetadata]: crate::model::CreateConversationModelOperationMetadata
2325    ///
2326    /// # Long running operations
2327    ///
2328    /// This method is used to start, and/or poll a [long-running Operation].
2329    /// The [Working with long-running operations] chapter in the [user guide]
2330    /// covers these operations in detail.
2331    ///
2332    /// [long-running operation]: https://google.aip.dev/151
2333    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2334    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2335    ///
2336    /// # Example
2337    /// ```
2338    /// # use google_cloud_dialogflow_v2::client::ConversationModels;
2339    /// use google_cloud_lro::Poller;
2340    /// use google_cloud_dialogflow_v2::model::ConversationModel;
2341    /// use google_cloud_dialogflow_v2::Result;
2342    /// async fn sample(
2343    ///    client: &ConversationModels, parent: &str
2344    /// ) -> Result<()> {
2345    ///     let response = client.create_conversation_model()
2346    ///         .set_parent(parent)
2347    ///         .set_conversation_model(
2348    ///             ConversationModel::new()/* set fields */
2349    ///         )
2350    ///         .poller().until_done().await?;
2351    ///     println!("response {:?}", response);
2352    ///     Ok(())
2353    /// }
2354    /// ```
2355    pub fn create_conversation_model(
2356        &self,
2357    ) -> super::builder::conversation_models::CreateConversationModel {
2358        super::builder::conversation_models::CreateConversationModel::new(self.inner.clone())
2359    }
2360
2361    /// Gets conversation model.
2362    ///
2363    /// # Example
2364    /// ```
2365    /// # use google_cloud_dialogflow_v2::client::ConversationModels;
2366    /// use google_cloud_dialogflow_v2::Result;
2367    /// async fn sample(
2368    ///    client: &ConversationModels
2369    /// ) -> Result<()> {
2370    ///     let response = client.get_conversation_model()
2371    ///         /* set fields */
2372    ///         .send().await?;
2373    ///     println!("response {:?}", response);
2374    ///     Ok(())
2375    /// }
2376    /// ```
2377    pub fn get_conversation_model(
2378        &self,
2379    ) -> super::builder::conversation_models::GetConversationModel {
2380        super::builder::conversation_models::GetConversationModel::new(self.inner.clone())
2381    }
2382
2383    /// Lists conversation models.
2384    ///
2385    /// # Example
2386    /// ```
2387    /// # use google_cloud_dialogflow_v2::client::ConversationModels;
2388    /// use google_cloud_gax::paginator::ItemPaginator as _;
2389    /// use google_cloud_dialogflow_v2::Result;
2390    /// async fn sample(
2391    ///    client: &ConversationModels, parent: &str
2392    /// ) -> Result<()> {
2393    ///     let mut list = client.list_conversation_models()
2394    ///         .set_parent(parent)
2395    ///         .by_item();
2396    ///     while let Some(item) = list.next().await.transpose()? {
2397    ///         println!("{:?}", item);
2398    ///     }
2399    ///     Ok(())
2400    /// }
2401    /// ```
2402    pub fn list_conversation_models(
2403        &self,
2404    ) -> super::builder::conversation_models::ListConversationModels {
2405        super::builder::conversation_models::ListConversationModels::new(self.inner.clone())
2406    }
2407
2408    /// Deletes a model.
2409    ///
2410    /// This method is a [long-running
2411    /// operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations).
2412    /// The returned `Operation` type has the following method-specific fields:
2413    ///
2414    /// - `metadata`:
2415    ///   [DeleteConversationModelOperationMetadata][google.cloud.dialogflow.v2.DeleteConversationModelOperationMetadata]
2416    /// - `response`: An [Empty
2417    ///   message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
2418    ///
2419    /// [google.cloud.dialogflow.v2.DeleteConversationModelOperationMetadata]: crate::model::DeleteConversationModelOperationMetadata
2420    ///
2421    /// # Long running operations
2422    ///
2423    /// This method is used to start, and/or poll a [long-running Operation].
2424    /// The [Working with long-running operations] chapter in the [user guide]
2425    /// covers these operations in detail.
2426    ///
2427    /// [long-running operation]: https://google.aip.dev/151
2428    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2429    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2430    ///
2431    /// # Example
2432    /// ```
2433    /// # use google_cloud_dialogflow_v2::client::ConversationModels;
2434    /// use google_cloud_lro::Poller;
2435    /// use google_cloud_dialogflow_v2::Result;
2436    /// async fn sample(
2437    ///    client: &ConversationModels
2438    /// ) -> Result<()> {
2439    ///     client.delete_conversation_model()
2440    ///         /* set fields */
2441    ///         .poller().until_done().await?;
2442    ///     Ok(())
2443    /// }
2444    /// ```
2445    pub fn delete_conversation_model(
2446        &self,
2447    ) -> super::builder::conversation_models::DeleteConversationModel {
2448        super::builder::conversation_models::DeleteConversationModel::new(self.inner.clone())
2449    }
2450
2451    /// Deploys a model. If a model is already deployed, deploying it
2452    /// has no effect. A model can only serve prediction requests after it gets
2453    /// deployed. For article suggestion, custom model will not be used unless
2454    /// it is deployed.
2455    ///
2456    /// This method is a [long-running
2457    /// operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations).
2458    /// The returned `Operation` type has the following method-specific fields:
2459    ///
2460    /// - `metadata`:
2461    ///   [DeployConversationModelOperationMetadata][google.cloud.dialogflow.v2.DeployConversationModelOperationMetadata]
2462    /// - `response`: An [Empty
2463    ///   message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
2464    ///
2465    /// [google.cloud.dialogflow.v2.DeployConversationModelOperationMetadata]: crate::model::DeployConversationModelOperationMetadata
2466    ///
2467    /// # Long running operations
2468    ///
2469    /// This method is used to start, and/or poll a [long-running Operation].
2470    /// The [Working with long-running operations] chapter in the [user guide]
2471    /// covers these operations in detail.
2472    ///
2473    /// [long-running operation]: https://google.aip.dev/151
2474    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2475    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2476    ///
2477    /// # Example
2478    /// ```
2479    /// # use google_cloud_dialogflow_v2::client::ConversationModels;
2480    /// use google_cloud_lro::Poller;
2481    /// use google_cloud_dialogflow_v2::Result;
2482    /// async fn sample(
2483    ///    client: &ConversationModels
2484    /// ) -> Result<()> {
2485    ///     client.deploy_conversation_model()
2486    ///         /* set fields */
2487    ///         .poller().until_done().await?;
2488    ///     Ok(())
2489    /// }
2490    /// ```
2491    pub fn deploy_conversation_model(
2492        &self,
2493    ) -> super::builder::conversation_models::DeployConversationModel {
2494        super::builder::conversation_models::DeployConversationModel::new(self.inner.clone())
2495    }
2496
2497    /// Undeploys a model. If the model is not deployed this method has no effect.
2498    /// If the model is currently being used:
2499    ///
2500    /// - For article suggestion, article suggestion will fallback to the default
2501    ///   model if model is undeployed.
2502    ///
2503    /// This method is a [long-running
2504    /// operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations).
2505    /// The returned `Operation` type has the following method-specific fields:
2506    ///
2507    /// - `metadata`:
2508    ///   [UndeployConversationModelOperationMetadata][google.cloud.dialogflow.v2.UndeployConversationModelOperationMetadata]
2509    /// - `response`: An [Empty
2510    ///   message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
2511    ///
2512    /// [google.cloud.dialogflow.v2.UndeployConversationModelOperationMetadata]: crate::model::UndeployConversationModelOperationMetadata
2513    ///
2514    /// # Long running operations
2515    ///
2516    /// This method is used to start, and/or poll a [long-running Operation].
2517    /// The [Working with long-running operations] chapter in the [user guide]
2518    /// covers these operations in detail.
2519    ///
2520    /// [long-running operation]: https://google.aip.dev/151
2521    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2522    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2523    ///
2524    /// # Example
2525    /// ```
2526    /// # use google_cloud_dialogflow_v2::client::ConversationModels;
2527    /// use google_cloud_lro::Poller;
2528    /// use google_cloud_dialogflow_v2::Result;
2529    /// async fn sample(
2530    ///    client: &ConversationModels
2531    /// ) -> Result<()> {
2532    ///     client.undeploy_conversation_model()
2533    ///         /* set fields */
2534    ///         .poller().until_done().await?;
2535    ///     Ok(())
2536    /// }
2537    /// ```
2538    pub fn undeploy_conversation_model(
2539        &self,
2540    ) -> super::builder::conversation_models::UndeployConversationModel {
2541        super::builder::conversation_models::UndeployConversationModel::new(self.inner.clone())
2542    }
2543
2544    /// Gets an evaluation of conversation model.
2545    ///
2546    /// # Example
2547    /// ```
2548    /// # use google_cloud_dialogflow_v2::client::ConversationModels;
2549    /// use google_cloud_dialogflow_v2::Result;
2550    /// async fn sample(
2551    ///    client: &ConversationModels
2552    /// ) -> Result<()> {
2553    ///     let response = client.get_conversation_model_evaluation()
2554    ///         /* set fields */
2555    ///         .send().await?;
2556    ///     println!("response {:?}", response);
2557    ///     Ok(())
2558    /// }
2559    /// ```
2560    pub fn get_conversation_model_evaluation(
2561        &self,
2562    ) -> super::builder::conversation_models::GetConversationModelEvaluation {
2563        super::builder::conversation_models::GetConversationModelEvaluation::new(self.inner.clone())
2564    }
2565
2566    /// Lists evaluations of a conversation model.
2567    ///
2568    /// # Example
2569    /// ```
2570    /// # use google_cloud_dialogflow_v2::client::ConversationModels;
2571    /// use google_cloud_gax::paginator::ItemPaginator as _;
2572    /// use google_cloud_dialogflow_v2::Result;
2573    /// async fn sample(
2574    ///    client: &ConversationModels, parent: &str
2575    /// ) -> Result<()> {
2576    ///     let mut list = client.list_conversation_model_evaluations()
2577    ///         .set_parent(parent)
2578    ///         .by_item();
2579    ///     while let Some(item) = list.next().await.transpose()? {
2580    ///         println!("{:?}", item);
2581    ///     }
2582    ///     Ok(())
2583    /// }
2584    /// ```
2585    pub fn list_conversation_model_evaluations(
2586        &self,
2587    ) -> super::builder::conversation_models::ListConversationModelEvaluations {
2588        super::builder::conversation_models::ListConversationModelEvaluations::new(
2589            self.inner.clone(),
2590        )
2591    }
2592
2593    /// Creates evaluation of a conversation model.
2594    ///
2595    /// # Long running operations
2596    ///
2597    /// This method is used to start, and/or poll a [long-running Operation].
2598    /// The [Working with long-running operations] chapter in the [user guide]
2599    /// covers these operations in detail.
2600    ///
2601    /// [long-running operation]: https://google.aip.dev/151
2602    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2603    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2604    ///
2605    /// # Example
2606    /// ```
2607    /// # use google_cloud_dialogflow_v2::client::ConversationModels;
2608    /// use google_cloud_lro::Poller;
2609    /// use google_cloud_dialogflow_v2::Result;
2610    /// async fn sample(
2611    ///    client: &ConversationModels
2612    /// ) -> Result<()> {
2613    ///     let response = client.create_conversation_model_evaluation()
2614    ///         /* set fields */
2615    ///         .poller().until_done().await?;
2616    ///     println!("response {:?}", response);
2617    ///     Ok(())
2618    /// }
2619    /// ```
2620    pub fn create_conversation_model_evaluation(
2621        &self,
2622    ) -> super::builder::conversation_models::CreateConversationModelEvaluation {
2623        super::builder::conversation_models::CreateConversationModelEvaluation::new(
2624            self.inner.clone(),
2625        )
2626    }
2627
2628    /// Lists information about the supported locations for this service.
2629    ///
2630    /// This method lists locations based on the resource scope provided in
2631    /// the [ListLocationsRequest.name][google.cloud.location.ListLocationsRequest.name] field: *
2632    /// **Global locations**: If `name` is empty, the method lists the
2633    /// public locations available to all projects. * **Project-specific
2634    /// locations**: If `name` follows the format
2635    /// `projects/{project}`, the method lists locations visible to that
2636    /// specific project. This includes public, private, or other
2637    /// project-specific locations enabled for the project.
2638    ///
2639    /// For gRPC and client library implementations, the resource name is
2640    /// passed as the `name` field. For direct service calls, the resource
2641    /// name is
2642    /// incorporated into the request path based on the specific service
2643    /// implementation and version.
2644    ///
2645    /// [google.cloud.location.ListLocationsRequest.name]: google_cloud_location::model::ListLocationsRequest::name
2646    ///
2647    /// # Example
2648    /// ```
2649    /// # use google_cloud_dialogflow_v2::client::ConversationModels;
2650    /// use google_cloud_gax::paginator::ItemPaginator as _;
2651    /// use google_cloud_dialogflow_v2::Result;
2652    /// async fn sample(
2653    ///    client: &ConversationModels
2654    /// ) -> Result<()> {
2655    ///     let mut list = client.list_locations()
2656    ///         /* set fields */
2657    ///         .by_item();
2658    ///     while let Some(item) = list.next().await.transpose()? {
2659    ///         println!("{:?}", item);
2660    ///     }
2661    ///     Ok(())
2662    /// }
2663    /// ```
2664    pub fn list_locations(&self) -> super::builder::conversation_models::ListLocations {
2665        super::builder::conversation_models::ListLocations::new(self.inner.clone())
2666    }
2667
2668    /// Gets information about a location.
2669    ///
2670    /// # Example
2671    /// ```
2672    /// # use google_cloud_dialogflow_v2::client::ConversationModels;
2673    /// use google_cloud_dialogflow_v2::Result;
2674    /// async fn sample(
2675    ///    client: &ConversationModels
2676    /// ) -> Result<()> {
2677    ///     let response = client.get_location()
2678    ///         /* set fields */
2679    ///         .send().await?;
2680    ///     println!("response {:?}", response);
2681    ///     Ok(())
2682    /// }
2683    /// ```
2684    pub fn get_location(&self) -> super::builder::conversation_models::GetLocation {
2685        super::builder::conversation_models::GetLocation::new(self.inner.clone())
2686    }
2687
2688    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2689    ///
2690    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
2691    ///
2692    /// # Example
2693    /// ```
2694    /// # use google_cloud_dialogflow_v2::client::ConversationModels;
2695    /// use google_cloud_gax::paginator::ItemPaginator as _;
2696    /// use google_cloud_dialogflow_v2::Result;
2697    /// async fn sample(
2698    ///    client: &ConversationModels
2699    /// ) -> Result<()> {
2700    ///     let mut list = client.list_operations()
2701    ///         /* set fields */
2702    ///         .by_item();
2703    ///     while let Some(item) = list.next().await.transpose()? {
2704    ///         println!("{:?}", item);
2705    ///     }
2706    ///     Ok(())
2707    /// }
2708    /// ```
2709    pub fn list_operations(&self) -> super::builder::conversation_models::ListOperations {
2710        super::builder::conversation_models::ListOperations::new(self.inner.clone())
2711    }
2712
2713    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2714    ///
2715    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
2716    ///
2717    /// # Example
2718    /// ```
2719    /// # use google_cloud_dialogflow_v2::client::ConversationModels;
2720    /// use google_cloud_dialogflow_v2::Result;
2721    /// async fn sample(
2722    ///    client: &ConversationModels
2723    /// ) -> Result<()> {
2724    ///     let response = client.get_operation()
2725    ///         /* set fields */
2726    ///         .send().await?;
2727    ///     println!("response {:?}", response);
2728    ///     Ok(())
2729    /// }
2730    /// ```
2731    pub fn get_operation(&self) -> super::builder::conversation_models::GetOperation {
2732        super::builder::conversation_models::GetOperation::new(self.inner.clone())
2733    }
2734
2735    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2736    ///
2737    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
2738    ///
2739    /// # Example
2740    /// ```
2741    /// # use google_cloud_dialogflow_v2::client::ConversationModels;
2742    /// use google_cloud_dialogflow_v2::Result;
2743    /// async fn sample(
2744    ///    client: &ConversationModels
2745    /// ) -> Result<()> {
2746    ///     client.cancel_operation()
2747    ///         /* set fields */
2748    ///         .send().await?;
2749    ///     Ok(())
2750    /// }
2751    /// ```
2752    pub fn cancel_operation(&self) -> super::builder::conversation_models::CancelOperation {
2753        super::builder::conversation_models::CancelOperation::new(self.inner.clone())
2754    }
2755}
2756
2757/// Implements a client for the Dialogflow API.
2758///
2759/// # Example
2760/// ```
2761/// # use google_cloud_dialogflow_v2::client::ConversationProfiles;
2762/// use google_cloud_gax::paginator::ItemPaginator as _;
2763/// async fn sample(
2764///    project_id: &str,
2765/// ) -> anyhow::Result<()> {
2766///     let client = ConversationProfiles::builder().build().await?;
2767///     let mut list = client.list_conversation_profiles()
2768///         .set_parent(format!("projects/{project_id}"))
2769///         .by_item();
2770///     while let Some(item) = list.next().await.transpose()? {
2771///         println!("{:?}", item);
2772///     }
2773///     Ok(())
2774/// }
2775/// ```
2776///
2777/// # Service Description
2778///
2779/// Service for managing
2780/// [ConversationProfiles][google.cloud.dialogflow.v2.ConversationProfile].
2781///
2782/// [google.cloud.dialogflow.v2.ConversationProfile]: crate::model::ConversationProfile
2783///
2784/// # Configuration
2785///
2786/// To configure `ConversationProfiles` use the `with_*` methods in the type returned
2787/// by [builder()][ConversationProfiles::builder]. The default configuration should
2788/// work for most applications. Common configuration changes include
2789///
2790/// * [with_endpoint()]: by default this client uses the global default endpoint
2791///   (`https://dialogflow.googleapis.com`). Applications using regional
2792///   endpoints or running in restricted networks (e.g. a network configured
2793///   with [Private Google Access with VPC Service Controls]) may want to
2794///   override this default.
2795/// * [with_credentials()]: by default this client uses
2796///   [Application Default Credentials]. Applications using custom
2797///   authentication may need to override this default.
2798///
2799/// [with_endpoint()]: super::builder::conversation_profiles::ClientBuilder::with_endpoint
2800/// [with_credentials()]: super::builder::conversation_profiles::ClientBuilder::with_credentials
2801/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
2802/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
2803///
2804/// # Pooling and Cloning
2805///
2806/// `ConversationProfiles` holds a connection pool internally, it is advised to
2807/// create one and reuse it. You do not need to wrap `ConversationProfiles` in
2808/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
2809/// already uses an `Arc` internally.
2810#[cfg(feature = "conversation-profiles")]
2811#[cfg_attr(docsrs, doc(cfg(feature = "conversation-profiles")))]
2812#[derive(Clone, Debug)]
2813pub struct ConversationProfiles {
2814    inner: std::sync::Arc<dyn super::stub::dynamic::ConversationProfiles>,
2815}
2816
2817#[cfg(feature = "conversation-profiles")]
2818impl ConversationProfiles {
2819    /// Returns a builder for [ConversationProfiles].
2820    ///
2821    /// ```
2822    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
2823    /// # use google_cloud_dialogflow_v2::client::ConversationProfiles;
2824    /// let client = ConversationProfiles::builder().build().await?;
2825    /// # Ok(()) }
2826    /// ```
2827    pub fn builder() -> super::builder::conversation_profiles::ClientBuilder {
2828        crate::new_client_builder(super::builder::conversation_profiles::client::Factory)
2829    }
2830
2831    /// Creates a new client from the provided stub.
2832    ///
2833    /// The most common case for calling this function is in tests mocking the
2834    /// client's behavior.
2835    pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
2836    where
2837        T: super::stub::ConversationProfiles + 'static,
2838    {
2839        Self { inner: stub.into() }
2840    }
2841
2842    pub(crate) async fn new(
2843        config: gaxi::options::ClientConfig,
2844    ) -> crate::ClientBuilderResult<Self> {
2845        let inner = Self::build_inner(config).await?;
2846        Ok(Self { inner })
2847    }
2848
2849    async fn build_inner(
2850        conf: gaxi::options::ClientConfig,
2851    ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::ConversationProfiles>>
2852    {
2853        if gaxi::options::tracing_enabled(&conf) {
2854            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
2855        }
2856        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
2857    }
2858
2859    async fn build_transport(
2860        conf: gaxi::options::ClientConfig,
2861    ) -> crate::ClientBuilderResult<impl super::stub::ConversationProfiles> {
2862        super::transport::ConversationProfiles::new(conf).await
2863    }
2864
2865    async fn build_with_tracing(
2866        conf: gaxi::options::ClientConfig,
2867    ) -> crate::ClientBuilderResult<impl super::stub::ConversationProfiles> {
2868        Self::build_transport(conf)
2869            .await
2870            .map(super::tracing::ConversationProfiles::new)
2871    }
2872
2873    /// Returns the list of all conversation profiles in the specified project.
2874    ///
2875    /// # Example
2876    /// ```
2877    /// # use google_cloud_dialogflow_v2::client::ConversationProfiles;
2878    /// use google_cloud_gax::paginator::ItemPaginator as _;
2879    /// use google_cloud_dialogflow_v2::Result;
2880    /// async fn sample(
2881    ///    client: &ConversationProfiles, project_id: &str
2882    /// ) -> Result<()> {
2883    ///     let mut list = client.list_conversation_profiles()
2884    ///         .set_parent(format!("projects/{project_id}"))
2885    ///         .by_item();
2886    ///     while let Some(item) = list.next().await.transpose()? {
2887    ///         println!("{:?}", item);
2888    ///     }
2889    ///     Ok(())
2890    /// }
2891    /// ```
2892    pub fn list_conversation_profiles(
2893        &self,
2894    ) -> super::builder::conversation_profiles::ListConversationProfiles {
2895        super::builder::conversation_profiles::ListConversationProfiles::new(self.inner.clone())
2896    }
2897
2898    /// Retrieves the specified conversation profile.
2899    ///
2900    /// # Example
2901    /// ```
2902    /// # use google_cloud_dialogflow_v2::client::ConversationProfiles;
2903    /// use google_cloud_dialogflow_v2::Result;
2904    /// async fn sample(
2905    ///    client: &ConversationProfiles, project_id: &str, conversation_profile_id: &str
2906    /// ) -> Result<()> {
2907    ///     let response = client.get_conversation_profile()
2908    ///         .set_name(format!("projects/{project_id}/conversationProfiles/{conversation_profile_id}"))
2909    ///         .send().await?;
2910    ///     println!("response {:?}", response);
2911    ///     Ok(())
2912    /// }
2913    /// ```
2914    pub fn get_conversation_profile(
2915        &self,
2916    ) -> super::builder::conversation_profiles::GetConversationProfile {
2917        super::builder::conversation_profiles::GetConversationProfile::new(self.inner.clone())
2918    }
2919
2920    /// Creates a conversation profile in the specified project.
2921    ///
2922    /// [ConversationProfile.create_time][google.cloud.dialogflow.v2.ConversationProfile.create_time]
2923    /// and
2924    /// [ConversationProfile.update_time][google.cloud.dialogflow.v2.ConversationProfile.update_time]
2925    /// aren't populated in the response. You can retrieve them via
2926    /// [GetConversationProfile][google.cloud.dialogflow.v2.ConversationProfiles.GetConversationProfile]
2927    /// API.
2928    ///
2929    /// [google.cloud.dialogflow.v2.ConversationProfile.create_time]: crate::model::ConversationProfile::create_time
2930    /// [google.cloud.dialogflow.v2.ConversationProfile.update_time]: crate::model::ConversationProfile::update_time
2931    /// [google.cloud.dialogflow.v2.ConversationProfiles.GetConversationProfile]: crate::client::ConversationProfiles::get_conversation_profile
2932    ///
2933    /// # Example
2934    /// ```
2935    /// # use google_cloud_dialogflow_v2::client::ConversationProfiles;
2936    /// use google_cloud_dialogflow_v2::model::ConversationProfile;
2937    /// use google_cloud_dialogflow_v2::Result;
2938    /// async fn sample(
2939    ///    client: &ConversationProfiles, project_id: &str
2940    /// ) -> Result<()> {
2941    ///     let response = client.create_conversation_profile()
2942    ///         .set_parent(format!("projects/{project_id}"))
2943    ///         .set_conversation_profile(
2944    ///             ConversationProfile::new()/* set fields */
2945    ///         )
2946    ///         .send().await?;
2947    ///     println!("response {:?}", response);
2948    ///     Ok(())
2949    /// }
2950    /// ```
2951    pub fn create_conversation_profile(
2952        &self,
2953    ) -> super::builder::conversation_profiles::CreateConversationProfile {
2954        super::builder::conversation_profiles::CreateConversationProfile::new(self.inner.clone())
2955    }
2956
2957    /// Updates the specified conversation profile.
2958    ///
2959    /// [ConversationProfile.create_time][google.cloud.dialogflow.v2.ConversationProfile.create_time]
2960    /// and
2961    /// [ConversationProfile.update_time][google.cloud.dialogflow.v2.ConversationProfile.update_time]
2962    /// aren't populated in the response. You can retrieve them via
2963    /// [GetConversationProfile][google.cloud.dialogflow.v2.ConversationProfiles.GetConversationProfile]
2964    /// API.
2965    ///
2966    /// [google.cloud.dialogflow.v2.ConversationProfile.create_time]: crate::model::ConversationProfile::create_time
2967    /// [google.cloud.dialogflow.v2.ConversationProfile.update_time]: crate::model::ConversationProfile::update_time
2968    /// [google.cloud.dialogflow.v2.ConversationProfiles.GetConversationProfile]: crate::client::ConversationProfiles::get_conversation_profile
2969    ///
2970    /// # Example
2971    /// ```
2972    /// # use google_cloud_dialogflow_v2::client::ConversationProfiles;
2973    /// # extern crate wkt as google_cloud_wkt;
2974    /// use google_cloud_wkt::FieldMask;
2975    /// use google_cloud_dialogflow_v2::model::ConversationProfile;
2976    /// use google_cloud_dialogflow_v2::Result;
2977    /// async fn sample(
2978    ///    client: &ConversationProfiles, project_id: &str, conversation_profile_id: &str
2979    /// ) -> Result<()> {
2980    ///     let response = client.update_conversation_profile()
2981    ///         .set_conversation_profile(
2982    ///             ConversationProfile::new().set_name(format!("projects/{project_id}/conversationProfiles/{conversation_profile_id}"))/* set fields */
2983    ///         )
2984    ///         .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
2985    ///         .send().await?;
2986    ///     println!("response {:?}", response);
2987    ///     Ok(())
2988    /// }
2989    /// ```
2990    pub fn update_conversation_profile(
2991        &self,
2992    ) -> super::builder::conversation_profiles::UpdateConversationProfile {
2993        super::builder::conversation_profiles::UpdateConversationProfile::new(self.inner.clone())
2994    }
2995
2996    /// Deletes the specified conversation profile.
2997    ///
2998    /// # Example
2999    /// ```
3000    /// # use google_cloud_dialogflow_v2::client::ConversationProfiles;
3001    /// use google_cloud_dialogflow_v2::Result;
3002    /// async fn sample(
3003    ///    client: &ConversationProfiles, project_id: &str, conversation_profile_id: &str
3004    /// ) -> Result<()> {
3005    ///     client.delete_conversation_profile()
3006    ///         .set_name(format!("projects/{project_id}/conversationProfiles/{conversation_profile_id}"))
3007    ///         .send().await?;
3008    ///     Ok(())
3009    /// }
3010    /// ```
3011    pub fn delete_conversation_profile(
3012        &self,
3013    ) -> super::builder::conversation_profiles::DeleteConversationProfile {
3014        super::builder::conversation_profiles::DeleteConversationProfile::new(self.inner.clone())
3015    }
3016
3017    /// Adds or updates a suggestion feature in a conversation profile.
3018    /// If the conversation profile contains the type of suggestion feature for
3019    /// the participant role, it will update it. Otherwise it will insert the
3020    /// suggestion feature.
3021    ///
3022    /// This method is a [long-running
3023    /// operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations).
3024    /// The returned `Operation` type has the following method-specific fields:
3025    ///
3026    /// - `metadata`:
3027    ///   [SetSuggestionFeatureConfigOperationMetadata][google.cloud.dialogflow.v2.SetSuggestionFeatureConfigOperationMetadata]
3028    /// - `response`:
3029    ///   [ConversationProfile][google.cloud.dialogflow.v2.ConversationProfile]
3030    ///
3031    /// If a long running operation to add or update suggestion feature
3032    /// config for the same conversation profile, participant role and suggestion
3033    /// feature type exists, please cancel the existing long running operation
3034    /// before sending such request, otherwise the request will be rejected.
3035    ///
3036    /// [google.cloud.dialogflow.v2.ConversationProfile]: crate::model::ConversationProfile
3037    /// [google.cloud.dialogflow.v2.SetSuggestionFeatureConfigOperationMetadata]: crate::model::SetSuggestionFeatureConfigOperationMetadata
3038    ///
3039    /// # Long running operations
3040    ///
3041    /// This method is used to start, and/or poll a [long-running Operation].
3042    /// The [Working with long-running operations] chapter in the [user guide]
3043    /// covers these operations in detail.
3044    ///
3045    /// [long-running operation]: https://google.aip.dev/151
3046    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
3047    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
3048    ///
3049    /// # Example
3050    /// ```
3051    /// # use google_cloud_dialogflow_v2::client::ConversationProfiles;
3052    /// use google_cloud_lro::Poller;
3053    /// use google_cloud_dialogflow_v2::Result;
3054    /// async fn sample(
3055    ///    client: &ConversationProfiles
3056    /// ) -> Result<()> {
3057    ///     let response = client.set_suggestion_feature_config()
3058    ///         /* set fields */
3059    ///         .poller().until_done().await?;
3060    ///     println!("response {:?}", response);
3061    ///     Ok(())
3062    /// }
3063    /// ```
3064    pub fn set_suggestion_feature_config(
3065        &self,
3066    ) -> super::builder::conversation_profiles::SetSuggestionFeatureConfig {
3067        super::builder::conversation_profiles::SetSuggestionFeatureConfig::new(self.inner.clone())
3068    }
3069
3070    /// Clears a suggestion feature from a conversation profile for the given
3071    /// participant role.
3072    ///
3073    /// This method is a [long-running
3074    /// operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations).
3075    /// The returned `Operation` type has the following method-specific fields:
3076    ///
3077    /// - `metadata`:
3078    ///   [ClearSuggestionFeatureConfigOperationMetadata][google.cloud.dialogflow.v2.ClearSuggestionFeatureConfigOperationMetadata]
3079    /// - `response`:
3080    ///   [ConversationProfile][google.cloud.dialogflow.v2.ConversationProfile]
3081    ///
3082    /// [google.cloud.dialogflow.v2.ClearSuggestionFeatureConfigOperationMetadata]: crate::model::ClearSuggestionFeatureConfigOperationMetadata
3083    /// [google.cloud.dialogflow.v2.ConversationProfile]: crate::model::ConversationProfile
3084    ///
3085    /// # Long running operations
3086    ///
3087    /// This method is used to start, and/or poll a [long-running Operation].
3088    /// The [Working with long-running operations] chapter in the [user guide]
3089    /// covers these operations in detail.
3090    ///
3091    /// [long-running operation]: https://google.aip.dev/151
3092    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
3093    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
3094    ///
3095    /// # Example
3096    /// ```
3097    /// # use google_cloud_dialogflow_v2::client::ConversationProfiles;
3098    /// use google_cloud_lro::Poller;
3099    /// use google_cloud_dialogflow_v2::Result;
3100    /// async fn sample(
3101    ///    client: &ConversationProfiles
3102    /// ) -> Result<()> {
3103    ///     let response = client.clear_suggestion_feature_config()
3104    ///         /* set fields */
3105    ///         .poller().until_done().await?;
3106    ///     println!("response {:?}", response);
3107    ///     Ok(())
3108    /// }
3109    /// ```
3110    pub fn clear_suggestion_feature_config(
3111        &self,
3112    ) -> super::builder::conversation_profiles::ClearSuggestionFeatureConfig {
3113        super::builder::conversation_profiles::ClearSuggestionFeatureConfig::new(self.inner.clone())
3114    }
3115
3116    /// Lists information about the supported locations for this service.
3117    ///
3118    /// This method lists locations based on the resource scope provided in
3119    /// the [ListLocationsRequest.name][google.cloud.location.ListLocationsRequest.name] field: *
3120    /// **Global locations**: If `name` is empty, the method lists the
3121    /// public locations available to all projects. * **Project-specific
3122    /// locations**: If `name` follows the format
3123    /// `projects/{project}`, the method lists locations visible to that
3124    /// specific project. This includes public, private, or other
3125    /// project-specific locations enabled for the project.
3126    ///
3127    /// For gRPC and client library implementations, the resource name is
3128    /// passed as the `name` field. For direct service calls, the resource
3129    /// name is
3130    /// incorporated into the request path based on the specific service
3131    /// implementation and version.
3132    ///
3133    /// [google.cloud.location.ListLocationsRequest.name]: google_cloud_location::model::ListLocationsRequest::name
3134    ///
3135    /// # Example
3136    /// ```
3137    /// # use google_cloud_dialogflow_v2::client::ConversationProfiles;
3138    /// use google_cloud_gax::paginator::ItemPaginator as _;
3139    /// use google_cloud_dialogflow_v2::Result;
3140    /// async fn sample(
3141    ///    client: &ConversationProfiles
3142    /// ) -> Result<()> {
3143    ///     let mut list = client.list_locations()
3144    ///         /* set fields */
3145    ///         .by_item();
3146    ///     while let Some(item) = list.next().await.transpose()? {
3147    ///         println!("{:?}", item);
3148    ///     }
3149    ///     Ok(())
3150    /// }
3151    /// ```
3152    pub fn list_locations(&self) -> super::builder::conversation_profiles::ListLocations {
3153        super::builder::conversation_profiles::ListLocations::new(self.inner.clone())
3154    }
3155
3156    /// Gets information about a location.
3157    ///
3158    /// # Example
3159    /// ```
3160    /// # use google_cloud_dialogflow_v2::client::ConversationProfiles;
3161    /// use google_cloud_dialogflow_v2::Result;
3162    /// async fn sample(
3163    ///    client: &ConversationProfiles
3164    /// ) -> Result<()> {
3165    ///     let response = client.get_location()
3166    ///         /* set fields */
3167    ///         .send().await?;
3168    ///     println!("response {:?}", response);
3169    ///     Ok(())
3170    /// }
3171    /// ```
3172    pub fn get_location(&self) -> super::builder::conversation_profiles::GetLocation {
3173        super::builder::conversation_profiles::GetLocation::new(self.inner.clone())
3174    }
3175
3176    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3177    ///
3178    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
3179    ///
3180    /// # Example
3181    /// ```
3182    /// # use google_cloud_dialogflow_v2::client::ConversationProfiles;
3183    /// use google_cloud_gax::paginator::ItemPaginator as _;
3184    /// use google_cloud_dialogflow_v2::Result;
3185    /// async fn sample(
3186    ///    client: &ConversationProfiles
3187    /// ) -> Result<()> {
3188    ///     let mut list = client.list_operations()
3189    ///         /* set fields */
3190    ///         .by_item();
3191    ///     while let Some(item) = list.next().await.transpose()? {
3192    ///         println!("{:?}", item);
3193    ///     }
3194    ///     Ok(())
3195    /// }
3196    /// ```
3197    pub fn list_operations(&self) -> super::builder::conversation_profiles::ListOperations {
3198        super::builder::conversation_profiles::ListOperations::new(self.inner.clone())
3199    }
3200
3201    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3202    ///
3203    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
3204    ///
3205    /// # Example
3206    /// ```
3207    /// # use google_cloud_dialogflow_v2::client::ConversationProfiles;
3208    /// use google_cloud_dialogflow_v2::Result;
3209    /// async fn sample(
3210    ///    client: &ConversationProfiles
3211    /// ) -> Result<()> {
3212    ///     let response = client.get_operation()
3213    ///         /* set fields */
3214    ///         .send().await?;
3215    ///     println!("response {:?}", response);
3216    ///     Ok(())
3217    /// }
3218    /// ```
3219    pub fn get_operation(&self) -> super::builder::conversation_profiles::GetOperation {
3220        super::builder::conversation_profiles::GetOperation::new(self.inner.clone())
3221    }
3222
3223    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3224    ///
3225    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
3226    ///
3227    /// # Example
3228    /// ```
3229    /// # use google_cloud_dialogflow_v2::client::ConversationProfiles;
3230    /// use google_cloud_dialogflow_v2::Result;
3231    /// async fn sample(
3232    ///    client: &ConversationProfiles
3233    /// ) -> Result<()> {
3234    ///     client.cancel_operation()
3235    ///         /* set fields */
3236    ///         .send().await?;
3237    ///     Ok(())
3238    /// }
3239    /// ```
3240    pub fn cancel_operation(&self) -> super::builder::conversation_profiles::CancelOperation {
3241        super::builder::conversation_profiles::CancelOperation::new(self.inner.clone())
3242    }
3243}
3244
3245/// Implements a client for the Dialogflow API.
3246///
3247/// # Example
3248/// ```
3249/// # use google_cloud_dialogflow_v2::client::Documents;
3250/// use google_cloud_gax::paginator::ItemPaginator as _;
3251/// async fn sample(
3252///    project_id: &str,
3253///    knowledge_base_id: &str,
3254/// ) -> anyhow::Result<()> {
3255///     let client = Documents::builder().build().await?;
3256///     let mut list = client.list_documents()
3257///         .set_parent(format!("projects/{project_id}/knowledgeBases/{knowledge_base_id}"))
3258///         .by_item();
3259///     while let Some(item) = list.next().await.transpose()? {
3260///         println!("{:?}", item);
3261///     }
3262///     Ok(())
3263/// }
3264/// ```
3265///
3266/// # Service Description
3267///
3268/// Service for managing knowledge
3269/// [Documents][google.cloud.dialogflow.v2.Document].
3270///
3271/// [google.cloud.dialogflow.v2.Document]: crate::model::Document
3272///
3273/// # Configuration
3274///
3275/// To configure `Documents` use the `with_*` methods in the type returned
3276/// by [builder()][Documents::builder]. The default configuration should
3277/// work for most applications. Common configuration changes include
3278///
3279/// * [with_endpoint()]: by default this client uses the global default endpoint
3280///   (`https://dialogflow.googleapis.com`). Applications using regional
3281///   endpoints or running in restricted networks (e.g. a network configured
3282///   with [Private Google Access with VPC Service Controls]) may want to
3283///   override this default.
3284/// * [with_credentials()]: by default this client uses
3285///   [Application Default Credentials]. Applications using custom
3286///   authentication may need to override this default.
3287///
3288/// [with_endpoint()]: super::builder::documents::ClientBuilder::with_endpoint
3289/// [with_credentials()]: super::builder::documents::ClientBuilder::with_credentials
3290/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
3291/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
3292///
3293/// # Pooling and Cloning
3294///
3295/// `Documents` holds a connection pool internally, it is advised to
3296/// create one and reuse it. You do not need to wrap `Documents` in
3297/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
3298/// already uses an `Arc` internally.
3299#[cfg(feature = "documents")]
3300#[cfg_attr(docsrs, doc(cfg(feature = "documents")))]
3301#[derive(Clone, Debug)]
3302pub struct Documents {
3303    inner: std::sync::Arc<dyn super::stub::dynamic::Documents>,
3304}
3305
3306#[cfg(feature = "documents")]
3307impl Documents {
3308    /// Returns a builder for [Documents].
3309    ///
3310    /// ```
3311    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
3312    /// # use google_cloud_dialogflow_v2::client::Documents;
3313    /// let client = Documents::builder().build().await?;
3314    /// # Ok(()) }
3315    /// ```
3316    pub fn builder() -> super::builder::documents::ClientBuilder {
3317        crate::new_client_builder(super::builder::documents::client::Factory)
3318    }
3319
3320    /// Creates a new client from the provided stub.
3321    ///
3322    /// The most common case for calling this function is in tests mocking the
3323    /// client's behavior.
3324    pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
3325    where
3326        T: super::stub::Documents + 'static,
3327    {
3328        Self { inner: stub.into() }
3329    }
3330
3331    pub(crate) async fn new(
3332        config: gaxi::options::ClientConfig,
3333    ) -> crate::ClientBuilderResult<Self> {
3334        let inner = Self::build_inner(config).await?;
3335        Ok(Self { inner })
3336    }
3337
3338    async fn build_inner(
3339        conf: gaxi::options::ClientConfig,
3340    ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::Documents>> {
3341        if gaxi::options::tracing_enabled(&conf) {
3342            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
3343        }
3344        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
3345    }
3346
3347    async fn build_transport(
3348        conf: gaxi::options::ClientConfig,
3349    ) -> crate::ClientBuilderResult<impl super::stub::Documents> {
3350        super::transport::Documents::new(conf).await
3351    }
3352
3353    async fn build_with_tracing(
3354        conf: gaxi::options::ClientConfig,
3355    ) -> crate::ClientBuilderResult<impl super::stub::Documents> {
3356        Self::build_transport(conf)
3357            .await
3358            .map(super::tracing::Documents::new)
3359    }
3360
3361    /// Returns the list of all documents of the knowledge base.
3362    ///
3363    /// # Example
3364    /// ```
3365    /// # use google_cloud_dialogflow_v2::client::Documents;
3366    /// use google_cloud_gax::paginator::ItemPaginator as _;
3367    /// use google_cloud_dialogflow_v2::Result;
3368    /// async fn sample(
3369    ///    client: &Documents, project_id: &str, knowledge_base_id: &str
3370    /// ) -> Result<()> {
3371    ///     let mut list = client.list_documents()
3372    ///         .set_parent(format!("projects/{project_id}/knowledgeBases/{knowledge_base_id}"))
3373    ///         .by_item();
3374    ///     while let Some(item) = list.next().await.transpose()? {
3375    ///         println!("{:?}", item);
3376    ///     }
3377    ///     Ok(())
3378    /// }
3379    /// ```
3380    pub fn list_documents(&self) -> super::builder::documents::ListDocuments {
3381        super::builder::documents::ListDocuments::new(self.inner.clone())
3382    }
3383
3384    /// Retrieves the specified document.
3385    ///
3386    /// # Example
3387    /// ```
3388    /// # use google_cloud_dialogflow_v2::client::Documents;
3389    /// use google_cloud_dialogflow_v2::Result;
3390    /// async fn sample(
3391    ///    client: &Documents, project_id: &str, knowledge_base_id: &str, document_id: &str
3392    /// ) -> Result<()> {
3393    ///     let response = client.get_document()
3394    ///         .set_name(format!("projects/{project_id}/knowledgeBases/{knowledge_base_id}/documents/{document_id}"))
3395    ///         .send().await?;
3396    ///     println!("response {:?}", response);
3397    ///     Ok(())
3398    /// }
3399    /// ```
3400    pub fn get_document(&self) -> super::builder::documents::GetDocument {
3401        super::builder::documents::GetDocument::new(self.inner.clone())
3402    }
3403
3404    /// Creates a new document.
3405    ///
3406    /// This method is a [long-running
3407    /// operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation).
3408    /// The returned `Operation` type has the following method-specific fields:
3409    ///
3410    /// - `metadata`:
3411    ///   [KnowledgeOperationMetadata][google.cloud.dialogflow.v2.KnowledgeOperationMetadata]
3412    /// - `response`: [Document][google.cloud.dialogflow.v2.Document]
3413    ///
3414    /// [google.cloud.dialogflow.v2.Document]: crate::model::Document
3415    /// [google.cloud.dialogflow.v2.KnowledgeOperationMetadata]: crate::model::KnowledgeOperationMetadata
3416    ///
3417    /// # Long running operations
3418    ///
3419    /// This method is used to start, and/or poll a [long-running Operation].
3420    /// The [Working with long-running operations] chapter in the [user guide]
3421    /// covers these operations in detail.
3422    ///
3423    /// [long-running operation]: https://google.aip.dev/151
3424    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
3425    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
3426    ///
3427    /// # Example
3428    /// ```
3429    /// # use google_cloud_dialogflow_v2::client::Documents;
3430    /// use google_cloud_lro::Poller;
3431    /// use google_cloud_dialogflow_v2::model::Document;
3432    /// use google_cloud_dialogflow_v2::Result;
3433    /// async fn sample(
3434    ///    client: &Documents, project_id: &str, knowledge_base_id: &str
3435    /// ) -> Result<()> {
3436    ///     let response = client.create_document()
3437    ///         .set_parent(format!("projects/{project_id}/knowledgeBases/{knowledge_base_id}"))
3438    ///         .set_document(
3439    ///             Document::new()/* set fields */
3440    ///         )
3441    ///         .poller().until_done().await?;
3442    ///     println!("response {:?}", response);
3443    ///     Ok(())
3444    /// }
3445    /// ```
3446    pub fn create_document(&self) -> super::builder::documents::CreateDocument {
3447        super::builder::documents::CreateDocument::new(self.inner.clone())
3448    }
3449
3450    /// Creates documents by importing data from external sources.
3451    /// Dialogflow supports up to 350 documents in each request. If you try to
3452    /// import more, Dialogflow will return an error.
3453    ///
3454    /// This method is a [long-running
3455    /// operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation).
3456    /// The returned `Operation` type has the following method-specific fields:
3457    ///
3458    /// - `metadata`:
3459    ///   [KnowledgeOperationMetadata][google.cloud.dialogflow.v2.KnowledgeOperationMetadata]
3460    /// - `response`:
3461    ///   [ImportDocumentsResponse][google.cloud.dialogflow.v2.ImportDocumentsResponse]
3462    ///
3463    /// [google.cloud.dialogflow.v2.ImportDocumentsResponse]: crate::model::ImportDocumentsResponse
3464    /// [google.cloud.dialogflow.v2.KnowledgeOperationMetadata]: crate::model::KnowledgeOperationMetadata
3465    ///
3466    /// # Long running operations
3467    ///
3468    /// This method is used to start, and/or poll a [long-running Operation].
3469    /// The [Working with long-running operations] chapter in the [user guide]
3470    /// covers these operations in detail.
3471    ///
3472    /// [long-running operation]: https://google.aip.dev/151
3473    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
3474    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
3475    ///
3476    /// # Example
3477    /// ```
3478    /// # use google_cloud_dialogflow_v2::client::Documents;
3479    /// use google_cloud_lro::Poller;
3480    /// use google_cloud_dialogflow_v2::Result;
3481    /// async fn sample(
3482    ///    client: &Documents
3483    /// ) -> Result<()> {
3484    ///     let response = client.import_documents()
3485    ///         /* set fields */
3486    ///         .poller().until_done().await?;
3487    ///     println!("response {:?}", response);
3488    ///     Ok(())
3489    /// }
3490    /// ```
3491    pub fn import_documents(&self) -> super::builder::documents::ImportDocuments {
3492        super::builder::documents::ImportDocuments::new(self.inner.clone())
3493    }
3494
3495    /// Deletes the specified document.
3496    ///
3497    /// This method is a [long-running
3498    /// operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation).
3499    /// The returned `Operation` type has the following method-specific fields:
3500    ///
3501    /// - `metadata`:
3502    ///   [KnowledgeOperationMetadata][google.cloud.dialogflow.v2.KnowledgeOperationMetadata]
3503    /// - `response`: An [Empty
3504    ///   message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
3505    ///
3506    /// [google.cloud.dialogflow.v2.KnowledgeOperationMetadata]: crate::model::KnowledgeOperationMetadata
3507    ///
3508    /// # Long running operations
3509    ///
3510    /// This method is used to start, and/or poll a [long-running Operation].
3511    /// The [Working with long-running operations] chapter in the [user guide]
3512    /// covers these operations in detail.
3513    ///
3514    /// [long-running operation]: https://google.aip.dev/151
3515    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
3516    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
3517    ///
3518    /// # Example
3519    /// ```
3520    /// # use google_cloud_dialogflow_v2::client::Documents;
3521    /// use google_cloud_lro::Poller;
3522    /// use google_cloud_dialogflow_v2::Result;
3523    /// async fn sample(
3524    ///    client: &Documents, project_id: &str, knowledge_base_id: &str, document_id: &str
3525    /// ) -> Result<()> {
3526    ///     client.delete_document()
3527    ///         .set_name(format!("projects/{project_id}/knowledgeBases/{knowledge_base_id}/documents/{document_id}"))
3528    ///         .poller().until_done().await?;
3529    ///     Ok(())
3530    /// }
3531    /// ```
3532    pub fn delete_document(&self) -> super::builder::documents::DeleteDocument {
3533        super::builder::documents::DeleteDocument::new(self.inner.clone())
3534    }
3535
3536    /// Updates the specified document.
3537    ///
3538    /// This method is a [long-running
3539    /// operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation).
3540    /// The returned `Operation` type has the following method-specific fields:
3541    ///
3542    /// - `metadata`:
3543    ///   [KnowledgeOperationMetadata][google.cloud.dialogflow.v2.KnowledgeOperationMetadata]
3544    /// - `response`: [Document][google.cloud.dialogflow.v2.Document]
3545    ///
3546    /// [google.cloud.dialogflow.v2.Document]: crate::model::Document
3547    /// [google.cloud.dialogflow.v2.KnowledgeOperationMetadata]: crate::model::KnowledgeOperationMetadata
3548    ///
3549    /// # Long running operations
3550    ///
3551    /// This method is used to start, and/or poll a [long-running Operation].
3552    /// The [Working with long-running operations] chapter in the [user guide]
3553    /// covers these operations in detail.
3554    ///
3555    /// [long-running operation]: https://google.aip.dev/151
3556    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
3557    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
3558    ///
3559    /// # Example
3560    /// ```
3561    /// # use google_cloud_dialogflow_v2::client::Documents;
3562    /// use google_cloud_lro::Poller;
3563    /// # extern crate wkt as google_cloud_wkt;
3564    /// use google_cloud_wkt::FieldMask;
3565    /// use google_cloud_dialogflow_v2::model::Document;
3566    /// use google_cloud_dialogflow_v2::Result;
3567    /// async fn sample(
3568    ///    client: &Documents, project_id: &str, knowledge_base_id: &str, document_id: &str
3569    /// ) -> Result<()> {
3570    ///     let response = client.update_document()
3571    ///         .set_document(
3572    ///             Document::new().set_name(format!("projects/{project_id}/knowledgeBases/{knowledge_base_id}/documents/{document_id}"))/* set fields */
3573    ///         )
3574    ///         .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
3575    ///         .poller().until_done().await?;
3576    ///     println!("response {:?}", response);
3577    ///     Ok(())
3578    /// }
3579    /// ```
3580    pub fn update_document(&self) -> super::builder::documents::UpdateDocument {
3581        super::builder::documents::UpdateDocument::new(self.inner.clone())
3582    }
3583
3584    /// Reloads the specified document from its specified source, content_uri or
3585    /// content. The previously loaded content of the document will be deleted.
3586    /// Note: Even when the content of the document has not changed, there still
3587    /// may be side effects because of internal implementation changes.
3588    ///
3589    /// This method is a [long-running
3590    /// operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation).
3591    /// The returned `Operation` type has the following method-specific fields:
3592    ///
3593    /// - `metadata`:
3594    ///   [KnowledgeOperationMetadata][google.cloud.dialogflow.v2.KnowledgeOperationMetadata]
3595    /// - `response`: [Document][google.cloud.dialogflow.v2.Document]
3596    ///
3597    /// Note: The `projects.agent.knowledgeBases.documents` resource is deprecated;
3598    /// only use `projects.knowledgeBases.documents`.
3599    ///
3600    /// [google.cloud.dialogflow.v2.Document]: crate::model::Document
3601    /// [google.cloud.dialogflow.v2.KnowledgeOperationMetadata]: crate::model::KnowledgeOperationMetadata
3602    ///
3603    /// # Long running operations
3604    ///
3605    /// This method is used to start, and/or poll a [long-running Operation].
3606    /// The [Working with long-running operations] chapter in the [user guide]
3607    /// covers these operations in detail.
3608    ///
3609    /// [long-running operation]: https://google.aip.dev/151
3610    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
3611    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
3612    ///
3613    /// # Example
3614    /// ```
3615    /// # use google_cloud_dialogflow_v2::client::Documents;
3616    /// use google_cloud_lro::Poller;
3617    /// use google_cloud_dialogflow_v2::Result;
3618    /// async fn sample(
3619    ///    client: &Documents
3620    /// ) -> Result<()> {
3621    ///     let response = client.reload_document()
3622    ///         /* set fields */
3623    ///         .poller().until_done().await?;
3624    ///     println!("response {:?}", response);
3625    ///     Ok(())
3626    /// }
3627    /// ```
3628    pub fn reload_document(&self) -> super::builder::documents::ReloadDocument {
3629        super::builder::documents::ReloadDocument::new(self.inner.clone())
3630    }
3631
3632    /// Exports a smart messaging candidate document into the specified
3633    /// destination.
3634    ///
3635    /// This method is a [long-running
3636    /// operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation).
3637    /// The returned `Operation` type has the following method-specific fields:
3638    ///
3639    /// - `metadata`:
3640    ///   [KnowledgeOperationMetadata][google.cloud.dialogflow.v2.KnowledgeOperationMetadata]
3641    /// - `response`: [Document][google.cloud.dialogflow.v2.Document]
3642    ///
3643    /// [google.cloud.dialogflow.v2.Document]: crate::model::Document
3644    /// [google.cloud.dialogflow.v2.KnowledgeOperationMetadata]: crate::model::KnowledgeOperationMetadata
3645    ///
3646    /// # Long running operations
3647    ///
3648    /// This method is used to start, and/or poll a [long-running Operation].
3649    /// The [Working with long-running operations] chapter in the [user guide]
3650    /// covers these operations in detail.
3651    ///
3652    /// [long-running operation]: https://google.aip.dev/151
3653    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
3654    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
3655    ///
3656    /// # Example
3657    /// ```
3658    /// # use google_cloud_dialogflow_v2::client::Documents;
3659    /// use google_cloud_lro::Poller;
3660    /// use google_cloud_dialogflow_v2::Result;
3661    /// async fn sample(
3662    ///    client: &Documents
3663    /// ) -> Result<()> {
3664    ///     let response = client.export_document()
3665    ///         /* set fields */
3666    ///         .poller().until_done().await?;
3667    ///     println!("response {:?}", response);
3668    ///     Ok(())
3669    /// }
3670    /// ```
3671    pub fn export_document(&self) -> super::builder::documents::ExportDocument {
3672        super::builder::documents::ExportDocument::new(self.inner.clone())
3673    }
3674
3675    /// Lists information about the supported locations for this service.
3676    ///
3677    /// This method lists locations based on the resource scope provided in
3678    /// the [ListLocationsRequest.name][google.cloud.location.ListLocationsRequest.name] field: *
3679    /// **Global locations**: If `name` is empty, the method lists the
3680    /// public locations available to all projects. * **Project-specific
3681    /// locations**: If `name` follows the format
3682    /// `projects/{project}`, the method lists locations visible to that
3683    /// specific project. This includes public, private, or other
3684    /// project-specific locations enabled for the project.
3685    ///
3686    /// For gRPC and client library implementations, the resource name is
3687    /// passed as the `name` field. For direct service calls, the resource
3688    /// name is
3689    /// incorporated into the request path based on the specific service
3690    /// implementation and version.
3691    ///
3692    /// [google.cloud.location.ListLocationsRequest.name]: google_cloud_location::model::ListLocationsRequest::name
3693    ///
3694    /// # Example
3695    /// ```
3696    /// # use google_cloud_dialogflow_v2::client::Documents;
3697    /// use google_cloud_gax::paginator::ItemPaginator as _;
3698    /// use google_cloud_dialogflow_v2::Result;
3699    /// async fn sample(
3700    ///    client: &Documents
3701    /// ) -> Result<()> {
3702    ///     let mut list = client.list_locations()
3703    ///         /* set fields */
3704    ///         .by_item();
3705    ///     while let Some(item) = list.next().await.transpose()? {
3706    ///         println!("{:?}", item);
3707    ///     }
3708    ///     Ok(())
3709    /// }
3710    /// ```
3711    pub fn list_locations(&self) -> super::builder::documents::ListLocations {
3712        super::builder::documents::ListLocations::new(self.inner.clone())
3713    }
3714
3715    /// Gets information about a location.
3716    ///
3717    /// # Example
3718    /// ```
3719    /// # use google_cloud_dialogflow_v2::client::Documents;
3720    /// use google_cloud_dialogflow_v2::Result;
3721    /// async fn sample(
3722    ///    client: &Documents
3723    /// ) -> Result<()> {
3724    ///     let response = client.get_location()
3725    ///         /* set fields */
3726    ///         .send().await?;
3727    ///     println!("response {:?}", response);
3728    ///     Ok(())
3729    /// }
3730    /// ```
3731    pub fn get_location(&self) -> super::builder::documents::GetLocation {
3732        super::builder::documents::GetLocation::new(self.inner.clone())
3733    }
3734
3735    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3736    ///
3737    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
3738    ///
3739    /// # Example
3740    /// ```
3741    /// # use google_cloud_dialogflow_v2::client::Documents;
3742    /// use google_cloud_gax::paginator::ItemPaginator as _;
3743    /// use google_cloud_dialogflow_v2::Result;
3744    /// async fn sample(
3745    ///    client: &Documents
3746    /// ) -> Result<()> {
3747    ///     let mut list = client.list_operations()
3748    ///         /* set fields */
3749    ///         .by_item();
3750    ///     while let Some(item) = list.next().await.transpose()? {
3751    ///         println!("{:?}", item);
3752    ///     }
3753    ///     Ok(())
3754    /// }
3755    /// ```
3756    pub fn list_operations(&self) -> super::builder::documents::ListOperations {
3757        super::builder::documents::ListOperations::new(self.inner.clone())
3758    }
3759
3760    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3761    ///
3762    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
3763    ///
3764    /// # Example
3765    /// ```
3766    /// # use google_cloud_dialogflow_v2::client::Documents;
3767    /// use google_cloud_dialogflow_v2::Result;
3768    /// async fn sample(
3769    ///    client: &Documents
3770    /// ) -> Result<()> {
3771    ///     let response = client.get_operation()
3772    ///         /* set fields */
3773    ///         .send().await?;
3774    ///     println!("response {:?}", response);
3775    ///     Ok(())
3776    /// }
3777    /// ```
3778    pub fn get_operation(&self) -> super::builder::documents::GetOperation {
3779        super::builder::documents::GetOperation::new(self.inner.clone())
3780    }
3781
3782    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3783    ///
3784    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
3785    ///
3786    /// # Example
3787    /// ```
3788    /// # use google_cloud_dialogflow_v2::client::Documents;
3789    /// use google_cloud_dialogflow_v2::Result;
3790    /// async fn sample(
3791    ///    client: &Documents
3792    /// ) -> Result<()> {
3793    ///     client.cancel_operation()
3794    ///         /* set fields */
3795    ///         .send().await?;
3796    ///     Ok(())
3797    /// }
3798    /// ```
3799    pub fn cancel_operation(&self) -> super::builder::documents::CancelOperation {
3800        super::builder::documents::CancelOperation::new(self.inner.clone())
3801    }
3802}
3803
3804/// Implements a client for the Dialogflow API.
3805///
3806/// # Example
3807/// ```
3808/// # use google_cloud_dialogflow_v2::client::EncryptionSpecService;
3809/// async fn sample(
3810///    project_id: &str,
3811///    location_id: &str,
3812/// ) -> anyhow::Result<()> {
3813///     let client = EncryptionSpecService::builder().build().await?;
3814///     let response = client.get_encryption_spec()
3815///         .set_name(format!("projects/{project_id}/locations/{location_id}/encryptionSpec"))
3816///         .send().await?;
3817///     println!("response {:?}", response);
3818///     Ok(())
3819/// }
3820/// ```
3821///
3822/// # Service Description
3823///
3824/// Manages encryption spec settings for Dialogflow and Agent Assist.
3825///
3826/// # Configuration
3827///
3828/// To configure `EncryptionSpecService` use the `with_*` methods in the type returned
3829/// by [builder()][EncryptionSpecService::builder]. The default configuration should
3830/// work for most applications. Common configuration changes include
3831///
3832/// * [with_endpoint()]: by default this client uses the global default endpoint
3833///   (`https://dialogflow.googleapis.com`). Applications using regional
3834///   endpoints or running in restricted networks (e.g. a network configured
3835///   with [Private Google Access with VPC Service Controls]) may want to
3836///   override this default.
3837/// * [with_credentials()]: by default this client uses
3838///   [Application Default Credentials]. Applications using custom
3839///   authentication may need to override this default.
3840///
3841/// [with_endpoint()]: super::builder::encryption_spec_service::ClientBuilder::with_endpoint
3842/// [with_credentials()]: super::builder::encryption_spec_service::ClientBuilder::with_credentials
3843/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
3844/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
3845///
3846/// # Pooling and Cloning
3847///
3848/// `EncryptionSpecService` holds a connection pool internally, it is advised to
3849/// create one and reuse it. You do not need to wrap `EncryptionSpecService` in
3850/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
3851/// already uses an `Arc` internally.
3852#[cfg(feature = "encryption-spec-service")]
3853#[cfg_attr(docsrs, doc(cfg(feature = "encryption-spec-service")))]
3854#[derive(Clone, Debug)]
3855pub struct EncryptionSpecService {
3856    inner: std::sync::Arc<dyn super::stub::dynamic::EncryptionSpecService>,
3857}
3858
3859#[cfg(feature = "encryption-spec-service")]
3860impl EncryptionSpecService {
3861    /// Returns a builder for [EncryptionSpecService].
3862    ///
3863    /// ```
3864    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
3865    /// # use google_cloud_dialogflow_v2::client::EncryptionSpecService;
3866    /// let client = EncryptionSpecService::builder().build().await?;
3867    /// # Ok(()) }
3868    /// ```
3869    pub fn builder() -> super::builder::encryption_spec_service::ClientBuilder {
3870        crate::new_client_builder(super::builder::encryption_spec_service::client::Factory)
3871    }
3872
3873    /// Creates a new client from the provided stub.
3874    ///
3875    /// The most common case for calling this function is in tests mocking the
3876    /// client's behavior.
3877    pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
3878    where
3879        T: super::stub::EncryptionSpecService + 'static,
3880    {
3881        Self { inner: stub.into() }
3882    }
3883
3884    pub(crate) async fn new(
3885        config: gaxi::options::ClientConfig,
3886    ) -> crate::ClientBuilderResult<Self> {
3887        let inner = Self::build_inner(config).await?;
3888        Ok(Self { inner })
3889    }
3890
3891    async fn build_inner(
3892        conf: gaxi::options::ClientConfig,
3893    ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::EncryptionSpecService>>
3894    {
3895        if gaxi::options::tracing_enabled(&conf) {
3896            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
3897        }
3898        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
3899    }
3900
3901    async fn build_transport(
3902        conf: gaxi::options::ClientConfig,
3903    ) -> crate::ClientBuilderResult<impl super::stub::EncryptionSpecService> {
3904        super::transport::EncryptionSpecService::new(conf).await
3905    }
3906
3907    async fn build_with_tracing(
3908        conf: gaxi::options::ClientConfig,
3909    ) -> crate::ClientBuilderResult<impl super::stub::EncryptionSpecService> {
3910        Self::build_transport(conf)
3911            .await
3912            .map(super::tracing::EncryptionSpecService::new)
3913    }
3914
3915    /// Gets location-level encryption key specification.
3916    ///
3917    /// # Example
3918    /// ```
3919    /// # use google_cloud_dialogflow_v2::client::EncryptionSpecService;
3920    /// use google_cloud_dialogflow_v2::Result;
3921    /// async fn sample(
3922    ///    client: &EncryptionSpecService, project_id: &str, location_id: &str
3923    /// ) -> Result<()> {
3924    ///     let response = client.get_encryption_spec()
3925    ///         .set_name(format!("projects/{project_id}/locations/{location_id}/encryptionSpec"))
3926    ///         .send().await?;
3927    ///     println!("response {:?}", response);
3928    ///     Ok(())
3929    /// }
3930    /// ```
3931    pub fn get_encryption_spec(
3932        &self,
3933    ) -> super::builder::encryption_spec_service::GetEncryptionSpec {
3934        super::builder::encryption_spec_service::GetEncryptionSpec::new(self.inner.clone())
3935    }
3936
3937    /// Initializes a location-level encryption key specification.  An error will
3938    /// be thrown if the location has resources already created before the
3939    /// initialization. Once the encryption specification is initialized at a
3940    /// location, it is immutable and all newly created resources under the
3941    /// location will be encrypted with the existing specification.
3942    ///
3943    /// # Long running operations
3944    ///
3945    /// This method is used to start, and/or poll a [long-running Operation].
3946    /// The [Working with long-running operations] chapter in the [user guide]
3947    /// covers these operations in detail.
3948    ///
3949    /// [long-running operation]: https://google.aip.dev/151
3950    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
3951    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
3952    ///
3953    /// # Example
3954    /// ```
3955    /// # use google_cloud_dialogflow_v2::client::EncryptionSpecService;
3956    /// use google_cloud_lro::Poller;
3957    /// use google_cloud_dialogflow_v2::Result;
3958    /// async fn sample(
3959    ///    client: &EncryptionSpecService
3960    /// ) -> Result<()> {
3961    ///     let response = client.initialize_encryption_spec()
3962    ///         /* set fields */
3963    ///         .poller().until_done().await?;
3964    ///     println!("response {:?}", response);
3965    ///     Ok(())
3966    /// }
3967    /// ```
3968    pub fn initialize_encryption_spec(
3969        &self,
3970    ) -> super::builder::encryption_spec_service::InitializeEncryptionSpec {
3971        super::builder::encryption_spec_service::InitializeEncryptionSpec::new(self.inner.clone())
3972    }
3973
3974    /// Lists information about the supported locations for this service.
3975    ///
3976    /// This method lists locations based on the resource scope provided in
3977    /// the [ListLocationsRequest.name][google.cloud.location.ListLocationsRequest.name] field: *
3978    /// **Global locations**: If `name` is empty, the method lists the
3979    /// public locations available to all projects. * **Project-specific
3980    /// locations**: If `name` follows the format
3981    /// `projects/{project}`, the method lists locations visible to that
3982    /// specific project. This includes public, private, or other
3983    /// project-specific locations enabled for the project.
3984    ///
3985    /// For gRPC and client library implementations, the resource name is
3986    /// passed as the `name` field. For direct service calls, the resource
3987    /// name is
3988    /// incorporated into the request path based on the specific service
3989    /// implementation and version.
3990    ///
3991    /// [google.cloud.location.ListLocationsRequest.name]: google_cloud_location::model::ListLocationsRequest::name
3992    ///
3993    /// # Example
3994    /// ```
3995    /// # use google_cloud_dialogflow_v2::client::EncryptionSpecService;
3996    /// use google_cloud_gax::paginator::ItemPaginator as _;
3997    /// use google_cloud_dialogflow_v2::Result;
3998    /// async fn sample(
3999    ///    client: &EncryptionSpecService
4000    /// ) -> Result<()> {
4001    ///     let mut list = client.list_locations()
4002    ///         /* set fields */
4003    ///         .by_item();
4004    ///     while let Some(item) = list.next().await.transpose()? {
4005    ///         println!("{:?}", item);
4006    ///     }
4007    ///     Ok(())
4008    /// }
4009    /// ```
4010    pub fn list_locations(&self) -> super::builder::encryption_spec_service::ListLocations {
4011        super::builder::encryption_spec_service::ListLocations::new(self.inner.clone())
4012    }
4013
4014    /// Gets information about a location.
4015    ///
4016    /// # Example
4017    /// ```
4018    /// # use google_cloud_dialogflow_v2::client::EncryptionSpecService;
4019    /// use google_cloud_dialogflow_v2::Result;
4020    /// async fn sample(
4021    ///    client: &EncryptionSpecService
4022    /// ) -> Result<()> {
4023    ///     let response = client.get_location()
4024    ///         /* set fields */
4025    ///         .send().await?;
4026    ///     println!("response {:?}", response);
4027    ///     Ok(())
4028    /// }
4029    /// ```
4030    pub fn get_location(&self) -> super::builder::encryption_spec_service::GetLocation {
4031        super::builder::encryption_spec_service::GetLocation::new(self.inner.clone())
4032    }
4033
4034    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
4035    ///
4036    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
4037    ///
4038    /// # Example
4039    /// ```
4040    /// # use google_cloud_dialogflow_v2::client::EncryptionSpecService;
4041    /// use google_cloud_gax::paginator::ItemPaginator as _;
4042    /// use google_cloud_dialogflow_v2::Result;
4043    /// async fn sample(
4044    ///    client: &EncryptionSpecService
4045    /// ) -> Result<()> {
4046    ///     let mut list = client.list_operations()
4047    ///         /* set fields */
4048    ///         .by_item();
4049    ///     while let Some(item) = list.next().await.transpose()? {
4050    ///         println!("{:?}", item);
4051    ///     }
4052    ///     Ok(())
4053    /// }
4054    /// ```
4055    pub fn list_operations(&self) -> super::builder::encryption_spec_service::ListOperations {
4056        super::builder::encryption_spec_service::ListOperations::new(self.inner.clone())
4057    }
4058
4059    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
4060    ///
4061    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
4062    ///
4063    /// # Example
4064    /// ```
4065    /// # use google_cloud_dialogflow_v2::client::EncryptionSpecService;
4066    /// use google_cloud_dialogflow_v2::Result;
4067    /// async fn sample(
4068    ///    client: &EncryptionSpecService
4069    /// ) -> Result<()> {
4070    ///     let response = client.get_operation()
4071    ///         /* set fields */
4072    ///         .send().await?;
4073    ///     println!("response {:?}", response);
4074    ///     Ok(())
4075    /// }
4076    /// ```
4077    pub fn get_operation(&self) -> super::builder::encryption_spec_service::GetOperation {
4078        super::builder::encryption_spec_service::GetOperation::new(self.inner.clone())
4079    }
4080
4081    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
4082    ///
4083    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
4084    ///
4085    /// # Example
4086    /// ```
4087    /// # use google_cloud_dialogflow_v2::client::EncryptionSpecService;
4088    /// use google_cloud_dialogflow_v2::Result;
4089    /// async fn sample(
4090    ///    client: &EncryptionSpecService
4091    /// ) -> Result<()> {
4092    ///     client.cancel_operation()
4093    ///         /* set fields */
4094    ///         .send().await?;
4095    ///     Ok(())
4096    /// }
4097    /// ```
4098    pub fn cancel_operation(&self) -> super::builder::encryption_spec_service::CancelOperation {
4099        super::builder::encryption_spec_service::CancelOperation::new(self.inner.clone())
4100    }
4101}
4102
4103/// Implements a client for the Dialogflow API.
4104///
4105/// # Example
4106/// ```
4107/// # use google_cloud_dialogflow_v2::client::EntityTypes;
4108/// use google_cloud_gax::paginator::ItemPaginator as _;
4109/// async fn sample(
4110///    project_id: &str,
4111/// ) -> anyhow::Result<()> {
4112///     let client = EntityTypes::builder().build().await?;
4113///     let mut list = client.list_entity_types()
4114///         .set_parent(format!("projects/{project_id}/agent"))
4115///         .by_item();
4116///     while let Some(item) = list.next().await.transpose()? {
4117///         println!("{:?}", item);
4118///     }
4119///     Ok(())
4120/// }
4121/// ```
4122///
4123/// # Service Description
4124///
4125/// Service for managing [EntityTypes][google.cloud.dialogflow.v2.EntityType].
4126///
4127/// [google.cloud.dialogflow.v2.EntityType]: crate::model::EntityType
4128///
4129/// # Configuration
4130///
4131/// To configure `EntityTypes` use the `with_*` methods in the type returned
4132/// by [builder()][EntityTypes::builder]. The default configuration should
4133/// work for most applications. Common configuration changes include
4134///
4135/// * [with_endpoint()]: by default this client uses the global default endpoint
4136///   (`https://dialogflow.googleapis.com`). Applications using regional
4137///   endpoints or running in restricted networks (e.g. a network configured
4138///   with [Private Google Access with VPC Service Controls]) may want to
4139///   override this default.
4140/// * [with_credentials()]: by default this client uses
4141///   [Application Default Credentials]. Applications using custom
4142///   authentication may need to override this default.
4143///
4144/// [with_endpoint()]: super::builder::entity_types::ClientBuilder::with_endpoint
4145/// [with_credentials()]: super::builder::entity_types::ClientBuilder::with_credentials
4146/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
4147/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
4148///
4149/// # Pooling and Cloning
4150///
4151/// `EntityTypes` holds a connection pool internally, it is advised to
4152/// create one and reuse it. You do not need to wrap `EntityTypes` in
4153/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
4154/// already uses an `Arc` internally.
4155#[cfg(feature = "entity-types")]
4156#[cfg_attr(docsrs, doc(cfg(feature = "entity-types")))]
4157#[derive(Clone, Debug)]
4158pub struct EntityTypes {
4159    inner: std::sync::Arc<dyn super::stub::dynamic::EntityTypes>,
4160}
4161
4162#[cfg(feature = "entity-types")]
4163impl EntityTypes {
4164    /// Returns a builder for [EntityTypes].
4165    ///
4166    /// ```
4167    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
4168    /// # use google_cloud_dialogflow_v2::client::EntityTypes;
4169    /// let client = EntityTypes::builder().build().await?;
4170    /// # Ok(()) }
4171    /// ```
4172    pub fn builder() -> super::builder::entity_types::ClientBuilder {
4173        crate::new_client_builder(super::builder::entity_types::client::Factory)
4174    }
4175
4176    /// Creates a new client from the provided stub.
4177    ///
4178    /// The most common case for calling this function is in tests mocking the
4179    /// client's behavior.
4180    pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
4181    where
4182        T: super::stub::EntityTypes + 'static,
4183    {
4184        Self { inner: stub.into() }
4185    }
4186
4187    pub(crate) async fn new(
4188        config: gaxi::options::ClientConfig,
4189    ) -> crate::ClientBuilderResult<Self> {
4190        let inner = Self::build_inner(config).await?;
4191        Ok(Self { inner })
4192    }
4193
4194    async fn build_inner(
4195        conf: gaxi::options::ClientConfig,
4196    ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::EntityTypes>> {
4197        if gaxi::options::tracing_enabled(&conf) {
4198            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
4199        }
4200        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
4201    }
4202
4203    async fn build_transport(
4204        conf: gaxi::options::ClientConfig,
4205    ) -> crate::ClientBuilderResult<impl super::stub::EntityTypes> {
4206        super::transport::EntityTypes::new(conf).await
4207    }
4208
4209    async fn build_with_tracing(
4210        conf: gaxi::options::ClientConfig,
4211    ) -> crate::ClientBuilderResult<impl super::stub::EntityTypes> {
4212        Self::build_transport(conf)
4213            .await
4214            .map(super::tracing::EntityTypes::new)
4215    }
4216
4217    /// Returns the list of all entity types in the specified agent.
4218    ///
4219    /// # Example
4220    /// ```
4221    /// # use google_cloud_dialogflow_v2::client::EntityTypes;
4222    /// use google_cloud_gax::paginator::ItemPaginator as _;
4223    /// use google_cloud_dialogflow_v2::Result;
4224    /// async fn sample(
4225    ///    client: &EntityTypes, project_id: &str
4226    /// ) -> Result<()> {
4227    ///     let mut list = client.list_entity_types()
4228    ///         .set_parent(format!("projects/{project_id}/agent"))
4229    ///         .by_item();
4230    ///     while let Some(item) = list.next().await.transpose()? {
4231    ///         println!("{:?}", item);
4232    ///     }
4233    ///     Ok(())
4234    /// }
4235    /// ```
4236    pub fn list_entity_types(&self) -> super::builder::entity_types::ListEntityTypes {
4237        super::builder::entity_types::ListEntityTypes::new(self.inner.clone())
4238    }
4239
4240    /// Retrieves the specified entity type.
4241    ///
4242    /// # Example
4243    /// ```
4244    /// # use google_cloud_dialogflow_v2::client::EntityTypes;
4245    /// use google_cloud_dialogflow_v2::Result;
4246    /// async fn sample(
4247    ///    client: &EntityTypes, project_id: &str, entity_type_id: &str
4248    /// ) -> Result<()> {
4249    ///     let response = client.get_entity_type()
4250    ///         .set_name(format!("projects/{project_id}/agent/entityTypes/{entity_type_id}"))
4251    ///         .send().await?;
4252    ///     println!("response {:?}", response);
4253    ///     Ok(())
4254    /// }
4255    /// ```
4256    pub fn get_entity_type(&self) -> super::builder::entity_types::GetEntityType {
4257        super::builder::entity_types::GetEntityType::new(self.inner.clone())
4258    }
4259
4260    /// Creates an entity type in the specified agent.
4261    ///
4262    /// Note: You should always train an agent prior to sending it queries. See the
4263    /// [training
4264    /// documentation](https://cloud.google.com/dialogflow/es/docs/training).
4265    ///
4266    /// # Example
4267    /// ```
4268    /// # use google_cloud_dialogflow_v2::client::EntityTypes;
4269    /// use google_cloud_dialogflow_v2::model::EntityType;
4270    /// use google_cloud_dialogflow_v2::Result;
4271    /// async fn sample(
4272    ///    client: &EntityTypes, project_id: &str
4273    /// ) -> Result<()> {
4274    ///     let response = client.create_entity_type()
4275    ///         .set_parent(format!("projects/{project_id}/agent"))
4276    ///         .set_entity_type(
4277    ///             EntityType::new()/* set fields */
4278    ///         )
4279    ///         .send().await?;
4280    ///     println!("response {:?}", response);
4281    ///     Ok(())
4282    /// }
4283    /// ```
4284    pub fn create_entity_type(&self) -> super::builder::entity_types::CreateEntityType {
4285        super::builder::entity_types::CreateEntityType::new(self.inner.clone())
4286    }
4287
4288    /// Updates the specified entity type.
4289    ///
4290    /// Note: You should always train an agent prior to sending it queries. See the
4291    /// [training
4292    /// documentation](https://cloud.google.com/dialogflow/es/docs/training).
4293    ///
4294    /// # Example
4295    /// ```
4296    /// # use google_cloud_dialogflow_v2::client::EntityTypes;
4297    /// # extern crate wkt as google_cloud_wkt;
4298    /// use google_cloud_wkt::FieldMask;
4299    /// use google_cloud_dialogflow_v2::model::EntityType;
4300    /// use google_cloud_dialogflow_v2::Result;
4301    /// async fn sample(
4302    ///    client: &EntityTypes, project_id: &str, entity_type_id: &str
4303    /// ) -> Result<()> {
4304    ///     let response = client.update_entity_type()
4305    ///         .set_entity_type(
4306    ///             EntityType::new().set_name(format!("projects/{project_id}/agent/entityTypes/{entity_type_id}"))/* set fields */
4307    ///         )
4308    ///         .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
4309    ///         .send().await?;
4310    ///     println!("response {:?}", response);
4311    ///     Ok(())
4312    /// }
4313    /// ```
4314    pub fn update_entity_type(&self) -> super::builder::entity_types::UpdateEntityType {
4315        super::builder::entity_types::UpdateEntityType::new(self.inner.clone())
4316    }
4317
4318    /// Deletes the specified entity type.
4319    ///
4320    /// Note: You should always train an agent prior to sending it queries. See the
4321    /// [training
4322    /// documentation](https://cloud.google.com/dialogflow/es/docs/training).
4323    ///
4324    /// # Example
4325    /// ```
4326    /// # use google_cloud_dialogflow_v2::client::EntityTypes;
4327    /// use google_cloud_dialogflow_v2::Result;
4328    /// async fn sample(
4329    ///    client: &EntityTypes, project_id: &str, entity_type_id: &str
4330    /// ) -> Result<()> {
4331    ///     client.delete_entity_type()
4332    ///         .set_name(format!("projects/{project_id}/agent/entityTypes/{entity_type_id}"))
4333    ///         .send().await?;
4334    ///     Ok(())
4335    /// }
4336    /// ```
4337    pub fn delete_entity_type(&self) -> super::builder::entity_types::DeleteEntityType {
4338        super::builder::entity_types::DeleteEntityType::new(self.inner.clone())
4339    }
4340
4341    /// Updates/Creates multiple entity types in the specified agent.
4342    ///
4343    /// This method is a [long-running
4344    /// operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations).
4345    /// The returned `Operation` type has the following method-specific fields:
4346    ///
4347    /// - `metadata`: An empty [Struct
4348    ///   message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct)
4349    /// - `response`:
4350    ///   [BatchUpdateEntityTypesResponse][google.cloud.dialogflow.v2.BatchUpdateEntityTypesResponse]
4351    ///
4352    /// Note: You should always train an agent prior to sending it queries. See the
4353    /// [training
4354    /// documentation](https://cloud.google.com/dialogflow/es/docs/training).
4355    ///
4356    /// [google.cloud.dialogflow.v2.BatchUpdateEntityTypesResponse]: crate::model::BatchUpdateEntityTypesResponse
4357    ///
4358    /// # Long running operations
4359    ///
4360    /// This method is used to start, and/or poll a [long-running Operation].
4361    /// The [Working with long-running operations] chapter in the [user guide]
4362    /// covers these operations in detail.
4363    ///
4364    /// [long-running operation]: https://google.aip.dev/151
4365    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
4366    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
4367    ///
4368    /// # Example
4369    /// ```
4370    /// # use google_cloud_dialogflow_v2::client::EntityTypes;
4371    /// use google_cloud_lro::Poller;
4372    /// use google_cloud_dialogflow_v2::Result;
4373    /// async fn sample(
4374    ///    client: &EntityTypes
4375    /// ) -> Result<()> {
4376    ///     let response = client.batch_update_entity_types()
4377    ///         /* set fields */
4378    ///         .poller().until_done().await?;
4379    ///     println!("response {:?}", response);
4380    ///     Ok(())
4381    /// }
4382    /// ```
4383    pub fn batch_update_entity_types(
4384        &self,
4385    ) -> super::builder::entity_types::BatchUpdateEntityTypes {
4386        super::builder::entity_types::BatchUpdateEntityTypes::new(self.inner.clone())
4387    }
4388
4389    /// Deletes entity types in the specified agent.
4390    ///
4391    /// This method is a [long-running
4392    /// operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations).
4393    /// The returned `Operation` type has the following method-specific fields:
4394    ///
4395    /// - `metadata`: An empty [Struct
4396    ///   message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct)
4397    /// - `response`: An [Empty
4398    ///   message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
4399    ///
4400    /// Note: You should always train an agent prior to sending it queries. See the
4401    /// [training
4402    /// documentation](https://cloud.google.com/dialogflow/es/docs/training).
4403    ///
4404    /// # Long running operations
4405    ///
4406    /// This method is used to start, and/or poll a [long-running Operation].
4407    /// The [Working with long-running operations] chapter in the [user guide]
4408    /// covers these operations in detail.
4409    ///
4410    /// [long-running operation]: https://google.aip.dev/151
4411    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
4412    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
4413    ///
4414    /// # Example
4415    /// ```
4416    /// # use google_cloud_dialogflow_v2::client::EntityTypes;
4417    /// use google_cloud_lro::Poller;
4418    /// use google_cloud_dialogflow_v2::Result;
4419    /// async fn sample(
4420    ///    client: &EntityTypes
4421    /// ) -> Result<()> {
4422    ///     client.batch_delete_entity_types()
4423    ///         /* set fields */
4424    ///         .poller().until_done().await?;
4425    ///     Ok(())
4426    /// }
4427    /// ```
4428    pub fn batch_delete_entity_types(
4429        &self,
4430    ) -> super::builder::entity_types::BatchDeleteEntityTypes {
4431        super::builder::entity_types::BatchDeleteEntityTypes::new(self.inner.clone())
4432    }
4433
4434    /// Creates multiple new entities in the specified entity type.
4435    ///
4436    /// This method is a [long-running
4437    /// operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations).
4438    /// The returned `Operation` type has the following method-specific fields:
4439    ///
4440    /// - `metadata`: An empty [Struct
4441    ///   message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct)
4442    /// - `response`: An [Empty
4443    ///   message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
4444    ///
4445    /// Note: You should always train an agent prior to sending it queries. See the
4446    /// [training
4447    /// documentation](https://cloud.google.com/dialogflow/es/docs/training).
4448    ///
4449    /// # Long running operations
4450    ///
4451    /// This method is used to start, and/or poll a [long-running Operation].
4452    /// The [Working with long-running operations] chapter in the [user guide]
4453    /// covers these operations in detail.
4454    ///
4455    /// [long-running operation]: https://google.aip.dev/151
4456    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
4457    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
4458    ///
4459    /// # Example
4460    /// ```
4461    /// # use google_cloud_dialogflow_v2::client::EntityTypes;
4462    /// use google_cloud_lro::Poller;
4463    /// use google_cloud_dialogflow_v2::Result;
4464    /// async fn sample(
4465    ///    client: &EntityTypes
4466    /// ) -> Result<()> {
4467    ///     client.batch_create_entities()
4468    ///         /* set fields */
4469    ///         .poller().until_done().await?;
4470    ///     Ok(())
4471    /// }
4472    /// ```
4473    pub fn batch_create_entities(&self) -> super::builder::entity_types::BatchCreateEntities {
4474        super::builder::entity_types::BatchCreateEntities::new(self.inner.clone())
4475    }
4476
4477    /// Updates or creates multiple entities in the specified entity type. This
4478    /// method does not affect entities in the entity type that aren't explicitly
4479    /// specified in the request.
4480    ///
4481    /// This method is a [long-running
4482    /// operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations).
4483    /// The returned `Operation` type has the following method-specific fields:
4484    ///
4485    /// - `metadata`: An empty [Struct
4486    ///   message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct)
4487    /// - `response`: An [Empty
4488    ///   message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
4489    ///
4490    /// Note: You should always train an agent prior to sending it queries. See the
4491    /// [training
4492    /// documentation](https://cloud.google.com/dialogflow/es/docs/training).
4493    ///
4494    /// # Long running operations
4495    ///
4496    /// This method is used to start, and/or poll a [long-running Operation].
4497    /// The [Working with long-running operations] chapter in the [user guide]
4498    /// covers these operations in detail.
4499    ///
4500    /// [long-running operation]: https://google.aip.dev/151
4501    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
4502    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
4503    ///
4504    /// # Example
4505    /// ```
4506    /// # use google_cloud_dialogflow_v2::client::EntityTypes;
4507    /// use google_cloud_lro::Poller;
4508    /// use google_cloud_dialogflow_v2::Result;
4509    /// async fn sample(
4510    ///    client: &EntityTypes
4511    /// ) -> Result<()> {
4512    ///     client.batch_update_entities()
4513    ///         /* set fields */
4514    ///         .poller().until_done().await?;
4515    ///     Ok(())
4516    /// }
4517    /// ```
4518    pub fn batch_update_entities(&self) -> super::builder::entity_types::BatchUpdateEntities {
4519        super::builder::entity_types::BatchUpdateEntities::new(self.inner.clone())
4520    }
4521
4522    /// Deletes entities in the specified entity type.
4523    ///
4524    /// This method is a [long-running
4525    /// operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations).
4526    /// The returned `Operation` type has the following method-specific fields:
4527    ///
4528    /// - `metadata`: An empty [Struct
4529    ///   message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct)
4530    /// - `response`: An [Empty
4531    ///   message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
4532    ///
4533    /// Note: You should always train an agent prior to sending it queries. See the
4534    /// [training
4535    /// documentation](https://cloud.google.com/dialogflow/es/docs/training).
4536    ///
4537    /// # Long running operations
4538    ///
4539    /// This method is used to start, and/or poll a [long-running Operation].
4540    /// The [Working with long-running operations] chapter in the [user guide]
4541    /// covers these operations in detail.
4542    ///
4543    /// [long-running operation]: https://google.aip.dev/151
4544    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
4545    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
4546    ///
4547    /// # Example
4548    /// ```
4549    /// # use google_cloud_dialogflow_v2::client::EntityTypes;
4550    /// use google_cloud_lro::Poller;
4551    /// use google_cloud_dialogflow_v2::Result;
4552    /// async fn sample(
4553    ///    client: &EntityTypes
4554    /// ) -> Result<()> {
4555    ///     client.batch_delete_entities()
4556    ///         /* set fields */
4557    ///         .poller().until_done().await?;
4558    ///     Ok(())
4559    /// }
4560    /// ```
4561    pub fn batch_delete_entities(&self) -> super::builder::entity_types::BatchDeleteEntities {
4562        super::builder::entity_types::BatchDeleteEntities::new(self.inner.clone())
4563    }
4564
4565    /// Lists information about the supported locations for this service.
4566    ///
4567    /// This method lists locations based on the resource scope provided in
4568    /// the [ListLocationsRequest.name][google.cloud.location.ListLocationsRequest.name] field: *
4569    /// **Global locations**: If `name` is empty, the method lists the
4570    /// public locations available to all projects. * **Project-specific
4571    /// locations**: If `name` follows the format
4572    /// `projects/{project}`, the method lists locations visible to that
4573    /// specific project. This includes public, private, or other
4574    /// project-specific locations enabled for the project.
4575    ///
4576    /// For gRPC and client library implementations, the resource name is
4577    /// passed as the `name` field. For direct service calls, the resource
4578    /// name is
4579    /// incorporated into the request path based on the specific service
4580    /// implementation and version.
4581    ///
4582    /// [google.cloud.location.ListLocationsRequest.name]: google_cloud_location::model::ListLocationsRequest::name
4583    ///
4584    /// # Example
4585    /// ```
4586    /// # use google_cloud_dialogflow_v2::client::EntityTypes;
4587    /// use google_cloud_gax::paginator::ItemPaginator as _;
4588    /// use google_cloud_dialogflow_v2::Result;
4589    /// async fn sample(
4590    ///    client: &EntityTypes
4591    /// ) -> Result<()> {
4592    ///     let mut list = client.list_locations()
4593    ///         /* set fields */
4594    ///         .by_item();
4595    ///     while let Some(item) = list.next().await.transpose()? {
4596    ///         println!("{:?}", item);
4597    ///     }
4598    ///     Ok(())
4599    /// }
4600    /// ```
4601    pub fn list_locations(&self) -> super::builder::entity_types::ListLocations {
4602        super::builder::entity_types::ListLocations::new(self.inner.clone())
4603    }
4604
4605    /// Gets information about a location.
4606    ///
4607    /// # Example
4608    /// ```
4609    /// # use google_cloud_dialogflow_v2::client::EntityTypes;
4610    /// use google_cloud_dialogflow_v2::Result;
4611    /// async fn sample(
4612    ///    client: &EntityTypes
4613    /// ) -> Result<()> {
4614    ///     let response = client.get_location()
4615    ///         /* set fields */
4616    ///         .send().await?;
4617    ///     println!("response {:?}", response);
4618    ///     Ok(())
4619    /// }
4620    /// ```
4621    pub fn get_location(&self) -> super::builder::entity_types::GetLocation {
4622        super::builder::entity_types::GetLocation::new(self.inner.clone())
4623    }
4624
4625    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
4626    ///
4627    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
4628    ///
4629    /// # Example
4630    /// ```
4631    /// # use google_cloud_dialogflow_v2::client::EntityTypes;
4632    /// use google_cloud_gax::paginator::ItemPaginator as _;
4633    /// use google_cloud_dialogflow_v2::Result;
4634    /// async fn sample(
4635    ///    client: &EntityTypes
4636    /// ) -> Result<()> {
4637    ///     let mut list = client.list_operations()
4638    ///         /* set fields */
4639    ///         .by_item();
4640    ///     while let Some(item) = list.next().await.transpose()? {
4641    ///         println!("{:?}", item);
4642    ///     }
4643    ///     Ok(())
4644    /// }
4645    /// ```
4646    pub fn list_operations(&self) -> super::builder::entity_types::ListOperations {
4647        super::builder::entity_types::ListOperations::new(self.inner.clone())
4648    }
4649
4650    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
4651    ///
4652    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
4653    ///
4654    /// # Example
4655    /// ```
4656    /// # use google_cloud_dialogflow_v2::client::EntityTypes;
4657    /// use google_cloud_dialogflow_v2::Result;
4658    /// async fn sample(
4659    ///    client: &EntityTypes
4660    /// ) -> Result<()> {
4661    ///     let response = client.get_operation()
4662    ///         /* set fields */
4663    ///         .send().await?;
4664    ///     println!("response {:?}", response);
4665    ///     Ok(())
4666    /// }
4667    /// ```
4668    pub fn get_operation(&self) -> super::builder::entity_types::GetOperation {
4669        super::builder::entity_types::GetOperation::new(self.inner.clone())
4670    }
4671
4672    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
4673    ///
4674    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
4675    ///
4676    /// # Example
4677    /// ```
4678    /// # use google_cloud_dialogflow_v2::client::EntityTypes;
4679    /// use google_cloud_dialogflow_v2::Result;
4680    /// async fn sample(
4681    ///    client: &EntityTypes
4682    /// ) -> Result<()> {
4683    ///     client.cancel_operation()
4684    ///         /* set fields */
4685    ///         .send().await?;
4686    ///     Ok(())
4687    /// }
4688    /// ```
4689    pub fn cancel_operation(&self) -> super::builder::entity_types::CancelOperation {
4690        super::builder::entity_types::CancelOperation::new(self.inner.clone())
4691    }
4692}
4693
4694/// Implements a client for the Dialogflow API.
4695///
4696/// # Example
4697/// ```
4698/// # use google_cloud_dialogflow_v2::client::Environments;
4699/// use google_cloud_gax::paginator::ItemPaginator as _;
4700/// async fn sample(
4701///    project_id: &str,
4702/// ) -> anyhow::Result<()> {
4703///     let client = Environments::builder().build().await?;
4704///     let mut list = client.list_environments()
4705///         .set_parent(format!("projects/{project_id}/agent"))
4706///         .by_item();
4707///     while let Some(item) = list.next().await.transpose()? {
4708///         println!("{:?}", item);
4709///     }
4710///     Ok(())
4711/// }
4712/// ```
4713///
4714/// # Service Description
4715///
4716/// Service for managing [Environments][google.cloud.dialogflow.v2.Environment].
4717///
4718/// [google.cloud.dialogflow.v2.Environment]: crate::model::Environment
4719///
4720/// # Configuration
4721///
4722/// To configure `Environments` use the `with_*` methods in the type returned
4723/// by [builder()][Environments::builder]. The default configuration should
4724/// work for most applications. Common configuration changes include
4725///
4726/// * [with_endpoint()]: by default this client uses the global default endpoint
4727///   (`https://dialogflow.googleapis.com`). Applications using regional
4728///   endpoints or running in restricted networks (e.g. a network configured
4729///   with [Private Google Access with VPC Service Controls]) may want to
4730///   override this default.
4731/// * [with_credentials()]: by default this client uses
4732///   [Application Default Credentials]. Applications using custom
4733///   authentication may need to override this default.
4734///
4735/// [with_endpoint()]: super::builder::environments::ClientBuilder::with_endpoint
4736/// [with_credentials()]: super::builder::environments::ClientBuilder::with_credentials
4737/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
4738/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
4739///
4740/// # Pooling and Cloning
4741///
4742/// `Environments` holds a connection pool internally, it is advised to
4743/// create one and reuse it. You do not need to wrap `Environments` in
4744/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
4745/// already uses an `Arc` internally.
4746#[cfg(feature = "environments")]
4747#[cfg_attr(docsrs, doc(cfg(feature = "environments")))]
4748#[derive(Clone, Debug)]
4749pub struct Environments {
4750    inner: std::sync::Arc<dyn super::stub::dynamic::Environments>,
4751}
4752
4753#[cfg(feature = "environments")]
4754impl Environments {
4755    /// Returns a builder for [Environments].
4756    ///
4757    /// ```
4758    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
4759    /// # use google_cloud_dialogflow_v2::client::Environments;
4760    /// let client = Environments::builder().build().await?;
4761    /// # Ok(()) }
4762    /// ```
4763    pub fn builder() -> super::builder::environments::ClientBuilder {
4764        crate::new_client_builder(super::builder::environments::client::Factory)
4765    }
4766
4767    /// Creates a new client from the provided stub.
4768    ///
4769    /// The most common case for calling this function is in tests mocking the
4770    /// client's behavior.
4771    pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
4772    where
4773        T: super::stub::Environments + 'static,
4774    {
4775        Self { inner: stub.into() }
4776    }
4777
4778    pub(crate) async fn new(
4779        config: gaxi::options::ClientConfig,
4780    ) -> crate::ClientBuilderResult<Self> {
4781        let inner = Self::build_inner(config).await?;
4782        Ok(Self { inner })
4783    }
4784
4785    async fn build_inner(
4786        conf: gaxi::options::ClientConfig,
4787    ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::Environments>> {
4788        if gaxi::options::tracing_enabled(&conf) {
4789            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
4790        }
4791        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
4792    }
4793
4794    async fn build_transport(
4795        conf: gaxi::options::ClientConfig,
4796    ) -> crate::ClientBuilderResult<impl super::stub::Environments> {
4797        super::transport::Environments::new(conf).await
4798    }
4799
4800    async fn build_with_tracing(
4801        conf: gaxi::options::ClientConfig,
4802    ) -> crate::ClientBuilderResult<impl super::stub::Environments> {
4803        Self::build_transport(conf)
4804            .await
4805            .map(super::tracing::Environments::new)
4806    }
4807
4808    /// Returns the list of all non-default environments of the specified agent.
4809    ///
4810    /// # Example
4811    /// ```
4812    /// # use google_cloud_dialogflow_v2::client::Environments;
4813    /// use google_cloud_gax::paginator::ItemPaginator as _;
4814    /// use google_cloud_dialogflow_v2::Result;
4815    /// async fn sample(
4816    ///    client: &Environments, project_id: &str
4817    /// ) -> Result<()> {
4818    ///     let mut list = client.list_environments()
4819    ///         .set_parent(format!("projects/{project_id}/agent"))
4820    ///         .by_item();
4821    ///     while let Some(item) = list.next().await.transpose()? {
4822    ///         println!("{:?}", item);
4823    ///     }
4824    ///     Ok(())
4825    /// }
4826    /// ```
4827    pub fn list_environments(&self) -> super::builder::environments::ListEnvironments {
4828        super::builder::environments::ListEnvironments::new(self.inner.clone())
4829    }
4830
4831    /// Retrieves the specified agent environment.
4832    ///
4833    /// # Example
4834    /// ```
4835    /// # use google_cloud_dialogflow_v2::client::Environments;
4836    /// use google_cloud_dialogflow_v2::Result;
4837    /// async fn sample(
4838    ///    client: &Environments, project_id: &str, environment_id: &str
4839    /// ) -> Result<()> {
4840    ///     let response = client.get_environment()
4841    ///         .set_name(format!("projects/{project_id}/agent/environments/{environment_id}"))
4842    ///         .send().await?;
4843    ///     println!("response {:?}", response);
4844    ///     Ok(())
4845    /// }
4846    /// ```
4847    pub fn get_environment(&self) -> super::builder::environments::GetEnvironment {
4848        super::builder::environments::GetEnvironment::new(self.inner.clone())
4849    }
4850
4851    /// Creates an agent environment.
4852    ///
4853    /// # Example
4854    /// ```
4855    /// # use google_cloud_dialogflow_v2::client::Environments;
4856    /// use google_cloud_dialogflow_v2::model::Environment;
4857    /// use google_cloud_dialogflow_v2::Result;
4858    /// async fn sample(
4859    ///    client: &Environments, project_id: &str
4860    /// ) -> Result<()> {
4861    ///     let response = client.create_environment()
4862    ///         .set_parent(format!("projects/{project_id}/agent"))
4863    ///         .set_environment_id("environment_id_value")
4864    ///         .set_environment(
4865    ///             Environment::new()/* set fields */
4866    ///         )
4867    ///         .send().await?;
4868    ///     println!("response {:?}", response);
4869    ///     Ok(())
4870    /// }
4871    /// ```
4872    pub fn create_environment(&self) -> super::builder::environments::CreateEnvironment {
4873        super::builder::environments::CreateEnvironment::new(self.inner.clone())
4874    }
4875
4876    /// Updates the specified agent environment.
4877    ///
4878    /// This method allows you to deploy new agent versions into the environment.
4879    /// When an environment is pointed to a new agent version by setting
4880    /// `environment.agent_version`, the environment is temporarily set to the
4881    /// `LOADING` state. During that time, the environment continues serving the
4882    /// previous version of the agent. After the new agent version is done loading,
4883    /// the environment is set back to the `RUNNING` state.
4884    /// You can use "-" as Environment ID in environment name to update an agent
4885    /// version in the default environment. WARNING: this will negate all recent
4886    /// changes to the draft agent and can't be undone. You may want to save the
4887    /// draft agent to a version before calling this method.
4888    ///
4889    /// # Example
4890    /// ```
4891    /// # use google_cloud_dialogflow_v2::client::Environments;
4892    /// # extern crate wkt as google_cloud_wkt;
4893    /// use google_cloud_wkt::FieldMask;
4894    /// use google_cloud_dialogflow_v2::model::Environment;
4895    /// use google_cloud_dialogflow_v2::Result;
4896    /// async fn sample(
4897    ///    client: &Environments, project_id: &str, environment_id: &str
4898    /// ) -> Result<()> {
4899    ///     let response = client.update_environment()
4900    ///         .set_environment(
4901    ///             Environment::new().set_name(format!("projects/{project_id}/agent/environments/{environment_id}"))/* set fields */
4902    ///         )
4903    ///         .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
4904    ///         .send().await?;
4905    ///     println!("response {:?}", response);
4906    ///     Ok(())
4907    /// }
4908    /// ```
4909    pub fn update_environment(&self) -> super::builder::environments::UpdateEnvironment {
4910        super::builder::environments::UpdateEnvironment::new(self.inner.clone())
4911    }
4912
4913    /// Deletes the specified agent environment.
4914    ///
4915    /// # Example
4916    /// ```
4917    /// # use google_cloud_dialogflow_v2::client::Environments;
4918    /// use google_cloud_dialogflow_v2::Result;
4919    /// async fn sample(
4920    ///    client: &Environments, project_id: &str, environment_id: &str
4921    /// ) -> Result<()> {
4922    ///     client.delete_environment()
4923    ///         .set_name(format!("projects/{project_id}/agent/environments/{environment_id}"))
4924    ///         .send().await?;
4925    ///     Ok(())
4926    /// }
4927    /// ```
4928    pub fn delete_environment(&self) -> super::builder::environments::DeleteEnvironment {
4929        super::builder::environments::DeleteEnvironment::new(self.inner.clone())
4930    }
4931
4932    /// Gets the history of the specified environment.
4933    ///
4934    /// # Example
4935    /// ```
4936    /// # use google_cloud_dialogflow_v2::client::Environments;
4937    /// use google_cloud_gax::paginator::ItemPaginator as _;
4938    /// use google_cloud_dialogflow_v2::Result;
4939    /// async fn sample(
4940    ///    client: &Environments
4941    /// ) -> Result<()> {
4942    ///     let mut list = client.get_environment_history()
4943    ///         /* set fields */
4944    ///         .by_item();
4945    ///     while let Some(item) = list.next().await.transpose()? {
4946    ///         println!("{:?}", item);
4947    ///     }
4948    ///     Ok(())
4949    /// }
4950    /// ```
4951    pub fn get_environment_history(&self) -> super::builder::environments::GetEnvironmentHistory {
4952        super::builder::environments::GetEnvironmentHistory::new(self.inner.clone())
4953    }
4954
4955    /// Lists information about the supported locations for this service.
4956    ///
4957    /// This method lists locations based on the resource scope provided in
4958    /// the [ListLocationsRequest.name][google.cloud.location.ListLocationsRequest.name] field: *
4959    /// **Global locations**: If `name` is empty, the method lists the
4960    /// public locations available to all projects. * **Project-specific
4961    /// locations**: If `name` follows the format
4962    /// `projects/{project}`, the method lists locations visible to that
4963    /// specific project. This includes public, private, or other
4964    /// project-specific locations enabled for the project.
4965    ///
4966    /// For gRPC and client library implementations, the resource name is
4967    /// passed as the `name` field. For direct service calls, the resource
4968    /// name is
4969    /// incorporated into the request path based on the specific service
4970    /// implementation and version.
4971    ///
4972    /// [google.cloud.location.ListLocationsRequest.name]: google_cloud_location::model::ListLocationsRequest::name
4973    ///
4974    /// # Example
4975    /// ```
4976    /// # use google_cloud_dialogflow_v2::client::Environments;
4977    /// use google_cloud_gax::paginator::ItemPaginator as _;
4978    /// use google_cloud_dialogflow_v2::Result;
4979    /// async fn sample(
4980    ///    client: &Environments
4981    /// ) -> Result<()> {
4982    ///     let mut list = client.list_locations()
4983    ///         /* set fields */
4984    ///         .by_item();
4985    ///     while let Some(item) = list.next().await.transpose()? {
4986    ///         println!("{:?}", item);
4987    ///     }
4988    ///     Ok(())
4989    /// }
4990    /// ```
4991    pub fn list_locations(&self) -> super::builder::environments::ListLocations {
4992        super::builder::environments::ListLocations::new(self.inner.clone())
4993    }
4994
4995    /// Gets information about a location.
4996    ///
4997    /// # Example
4998    /// ```
4999    /// # use google_cloud_dialogflow_v2::client::Environments;
5000    /// use google_cloud_dialogflow_v2::Result;
5001    /// async fn sample(
5002    ///    client: &Environments
5003    /// ) -> Result<()> {
5004    ///     let response = client.get_location()
5005    ///         /* set fields */
5006    ///         .send().await?;
5007    ///     println!("response {:?}", response);
5008    ///     Ok(())
5009    /// }
5010    /// ```
5011    pub fn get_location(&self) -> super::builder::environments::GetLocation {
5012        super::builder::environments::GetLocation::new(self.inner.clone())
5013    }
5014
5015    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
5016    ///
5017    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
5018    ///
5019    /// # Example
5020    /// ```
5021    /// # use google_cloud_dialogflow_v2::client::Environments;
5022    /// use google_cloud_gax::paginator::ItemPaginator as _;
5023    /// use google_cloud_dialogflow_v2::Result;
5024    /// async fn sample(
5025    ///    client: &Environments
5026    /// ) -> Result<()> {
5027    ///     let mut list = client.list_operations()
5028    ///         /* set fields */
5029    ///         .by_item();
5030    ///     while let Some(item) = list.next().await.transpose()? {
5031    ///         println!("{:?}", item);
5032    ///     }
5033    ///     Ok(())
5034    /// }
5035    /// ```
5036    pub fn list_operations(&self) -> super::builder::environments::ListOperations {
5037        super::builder::environments::ListOperations::new(self.inner.clone())
5038    }
5039
5040    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
5041    ///
5042    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
5043    ///
5044    /// # Example
5045    /// ```
5046    /// # use google_cloud_dialogflow_v2::client::Environments;
5047    /// use google_cloud_dialogflow_v2::Result;
5048    /// async fn sample(
5049    ///    client: &Environments
5050    /// ) -> Result<()> {
5051    ///     let response = client.get_operation()
5052    ///         /* set fields */
5053    ///         .send().await?;
5054    ///     println!("response {:?}", response);
5055    ///     Ok(())
5056    /// }
5057    /// ```
5058    pub fn get_operation(&self) -> super::builder::environments::GetOperation {
5059        super::builder::environments::GetOperation::new(self.inner.clone())
5060    }
5061
5062    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
5063    ///
5064    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
5065    ///
5066    /// # Example
5067    /// ```
5068    /// # use google_cloud_dialogflow_v2::client::Environments;
5069    /// use google_cloud_dialogflow_v2::Result;
5070    /// async fn sample(
5071    ///    client: &Environments
5072    /// ) -> Result<()> {
5073    ///     client.cancel_operation()
5074    ///         /* set fields */
5075    ///         .send().await?;
5076    ///     Ok(())
5077    /// }
5078    /// ```
5079    pub fn cancel_operation(&self) -> super::builder::environments::CancelOperation {
5080        super::builder::environments::CancelOperation::new(self.inner.clone())
5081    }
5082}
5083
5084/// Implements a client for the Dialogflow API.
5085///
5086/// # Example
5087/// ```
5088/// # use google_cloud_dialogflow_v2::client::Fulfillments;
5089/// async fn sample(
5090///    project_id: &str,
5091/// ) -> anyhow::Result<()> {
5092///     let client = Fulfillments::builder().build().await?;
5093///     let response = client.get_fulfillment()
5094///         .set_name(format!("projects/{project_id}/agent/fulfillment"))
5095///         .send().await?;
5096///     println!("response {:?}", response);
5097///     Ok(())
5098/// }
5099/// ```
5100///
5101/// # Service Description
5102///
5103/// Service for managing [Fulfillments][google.cloud.dialogflow.v2.Fulfillment].
5104///
5105/// [google.cloud.dialogflow.v2.Fulfillment]: crate::model::Fulfillment
5106///
5107/// # Configuration
5108///
5109/// To configure `Fulfillments` use the `with_*` methods in the type returned
5110/// by [builder()][Fulfillments::builder]. The default configuration should
5111/// work for most applications. Common configuration changes include
5112///
5113/// * [with_endpoint()]: by default this client uses the global default endpoint
5114///   (`https://dialogflow.googleapis.com`). Applications using regional
5115///   endpoints or running in restricted networks (e.g. a network configured
5116///   with [Private Google Access with VPC Service Controls]) may want to
5117///   override this default.
5118/// * [with_credentials()]: by default this client uses
5119///   [Application Default Credentials]. Applications using custom
5120///   authentication may need to override this default.
5121///
5122/// [with_endpoint()]: super::builder::fulfillments::ClientBuilder::with_endpoint
5123/// [with_credentials()]: super::builder::fulfillments::ClientBuilder::with_credentials
5124/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
5125/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
5126///
5127/// # Pooling and Cloning
5128///
5129/// `Fulfillments` holds a connection pool internally, it is advised to
5130/// create one and reuse it. You do not need to wrap `Fulfillments` in
5131/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
5132/// already uses an `Arc` internally.
5133#[cfg(feature = "fulfillments")]
5134#[cfg_attr(docsrs, doc(cfg(feature = "fulfillments")))]
5135#[derive(Clone, Debug)]
5136pub struct Fulfillments {
5137    inner: std::sync::Arc<dyn super::stub::dynamic::Fulfillments>,
5138}
5139
5140#[cfg(feature = "fulfillments")]
5141impl Fulfillments {
5142    /// Returns a builder for [Fulfillments].
5143    ///
5144    /// ```
5145    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
5146    /// # use google_cloud_dialogflow_v2::client::Fulfillments;
5147    /// let client = Fulfillments::builder().build().await?;
5148    /// # Ok(()) }
5149    /// ```
5150    pub fn builder() -> super::builder::fulfillments::ClientBuilder {
5151        crate::new_client_builder(super::builder::fulfillments::client::Factory)
5152    }
5153
5154    /// Creates a new client from the provided stub.
5155    ///
5156    /// The most common case for calling this function is in tests mocking the
5157    /// client's behavior.
5158    pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
5159    where
5160        T: super::stub::Fulfillments + 'static,
5161    {
5162        Self { inner: stub.into() }
5163    }
5164
5165    pub(crate) async fn new(
5166        config: gaxi::options::ClientConfig,
5167    ) -> crate::ClientBuilderResult<Self> {
5168        let inner = Self::build_inner(config).await?;
5169        Ok(Self { inner })
5170    }
5171
5172    async fn build_inner(
5173        conf: gaxi::options::ClientConfig,
5174    ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::Fulfillments>> {
5175        if gaxi::options::tracing_enabled(&conf) {
5176            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
5177        }
5178        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
5179    }
5180
5181    async fn build_transport(
5182        conf: gaxi::options::ClientConfig,
5183    ) -> crate::ClientBuilderResult<impl super::stub::Fulfillments> {
5184        super::transport::Fulfillments::new(conf).await
5185    }
5186
5187    async fn build_with_tracing(
5188        conf: gaxi::options::ClientConfig,
5189    ) -> crate::ClientBuilderResult<impl super::stub::Fulfillments> {
5190        Self::build_transport(conf)
5191            .await
5192            .map(super::tracing::Fulfillments::new)
5193    }
5194
5195    /// Retrieves the fulfillment.
5196    ///
5197    /// # Example
5198    /// ```
5199    /// # use google_cloud_dialogflow_v2::client::Fulfillments;
5200    /// use google_cloud_dialogflow_v2::Result;
5201    /// async fn sample(
5202    ///    client: &Fulfillments, project_id: &str
5203    /// ) -> Result<()> {
5204    ///     let response = client.get_fulfillment()
5205    ///         .set_name(format!("projects/{project_id}/agent/fulfillment"))
5206    ///         .send().await?;
5207    ///     println!("response {:?}", response);
5208    ///     Ok(())
5209    /// }
5210    /// ```
5211    pub fn get_fulfillment(&self) -> super::builder::fulfillments::GetFulfillment {
5212        super::builder::fulfillments::GetFulfillment::new(self.inner.clone())
5213    }
5214
5215    /// Updates the fulfillment.
5216    ///
5217    /// # Example
5218    /// ```
5219    /// # use google_cloud_dialogflow_v2::client::Fulfillments;
5220    /// # extern crate wkt as google_cloud_wkt;
5221    /// use google_cloud_wkt::FieldMask;
5222    /// use google_cloud_dialogflow_v2::model::Fulfillment;
5223    /// use google_cloud_dialogflow_v2::Result;
5224    /// async fn sample(
5225    ///    client: &Fulfillments, project_id: &str
5226    /// ) -> Result<()> {
5227    ///     let response = client.update_fulfillment()
5228    ///         .set_fulfillment(
5229    ///             Fulfillment::new().set_name(format!("projects/{project_id}/agent/fulfillment"))/* set fields */
5230    ///         )
5231    ///         .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
5232    ///         .send().await?;
5233    ///     println!("response {:?}", response);
5234    ///     Ok(())
5235    /// }
5236    /// ```
5237    pub fn update_fulfillment(&self) -> super::builder::fulfillments::UpdateFulfillment {
5238        super::builder::fulfillments::UpdateFulfillment::new(self.inner.clone())
5239    }
5240
5241    /// Lists information about the supported locations for this service.
5242    ///
5243    /// This method lists locations based on the resource scope provided in
5244    /// the [ListLocationsRequest.name][google.cloud.location.ListLocationsRequest.name] field: *
5245    /// **Global locations**: If `name` is empty, the method lists the
5246    /// public locations available to all projects. * **Project-specific
5247    /// locations**: If `name` follows the format
5248    /// `projects/{project}`, the method lists locations visible to that
5249    /// specific project. This includes public, private, or other
5250    /// project-specific locations enabled for the project.
5251    ///
5252    /// For gRPC and client library implementations, the resource name is
5253    /// passed as the `name` field. For direct service calls, the resource
5254    /// name is
5255    /// incorporated into the request path based on the specific service
5256    /// implementation and version.
5257    ///
5258    /// [google.cloud.location.ListLocationsRequest.name]: google_cloud_location::model::ListLocationsRequest::name
5259    ///
5260    /// # Example
5261    /// ```
5262    /// # use google_cloud_dialogflow_v2::client::Fulfillments;
5263    /// use google_cloud_gax::paginator::ItemPaginator as _;
5264    /// use google_cloud_dialogflow_v2::Result;
5265    /// async fn sample(
5266    ///    client: &Fulfillments
5267    /// ) -> Result<()> {
5268    ///     let mut list = client.list_locations()
5269    ///         /* set fields */
5270    ///         .by_item();
5271    ///     while let Some(item) = list.next().await.transpose()? {
5272    ///         println!("{:?}", item);
5273    ///     }
5274    ///     Ok(())
5275    /// }
5276    /// ```
5277    pub fn list_locations(&self) -> super::builder::fulfillments::ListLocations {
5278        super::builder::fulfillments::ListLocations::new(self.inner.clone())
5279    }
5280
5281    /// Gets information about a location.
5282    ///
5283    /// # Example
5284    /// ```
5285    /// # use google_cloud_dialogflow_v2::client::Fulfillments;
5286    /// use google_cloud_dialogflow_v2::Result;
5287    /// async fn sample(
5288    ///    client: &Fulfillments
5289    /// ) -> Result<()> {
5290    ///     let response = client.get_location()
5291    ///         /* set fields */
5292    ///         .send().await?;
5293    ///     println!("response {:?}", response);
5294    ///     Ok(())
5295    /// }
5296    /// ```
5297    pub fn get_location(&self) -> super::builder::fulfillments::GetLocation {
5298        super::builder::fulfillments::GetLocation::new(self.inner.clone())
5299    }
5300
5301    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
5302    ///
5303    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
5304    ///
5305    /// # Example
5306    /// ```
5307    /// # use google_cloud_dialogflow_v2::client::Fulfillments;
5308    /// use google_cloud_gax::paginator::ItemPaginator as _;
5309    /// use google_cloud_dialogflow_v2::Result;
5310    /// async fn sample(
5311    ///    client: &Fulfillments
5312    /// ) -> Result<()> {
5313    ///     let mut list = client.list_operations()
5314    ///         /* set fields */
5315    ///         .by_item();
5316    ///     while let Some(item) = list.next().await.transpose()? {
5317    ///         println!("{:?}", item);
5318    ///     }
5319    ///     Ok(())
5320    /// }
5321    /// ```
5322    pub fn list_operations(&self) -> super::builder::fulfillments::ListOperations {
5323        super::builder::fulfillments::ListOperations::new(self.inner.clone())
5324    }
5325
5326    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
5327    ///
5328    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
5329    ///
5330    /// # Example
5331    /// ```
5332    /// # use google_cloud_dialogflow_v2::client::Fulfillments;
5333    /// use google_cloud_dialogflow_v2::Result;
5334    /// async fn sample(
5335    ///    client: &Fulfillments
5336    /// ) -> Result<()> {
5337    ///     let response = client.get_operation()
5338    ///         /* set fields */
5339    ///         .send().await?;
5340    ///     println!("response {:?}", response);
5341    ///     Ok(())
5342    /// }
5343    /// ```
5344    pub fn get_operation(&self) -> super::builder::fulfillments::GetOperation {
5345        super::builder::fulfillments::GetOperation::new(self.inner.clone())
5346    }
5347
5348    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
5349    ///
5350    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
5351    ///
5352    /// # Example
5353    /// ```
5354    /// # use google_cloud_dialogflow_v2::client::Fulfillments;
5355    /// use google_cloud_dialogflow_v2::Result;
5356    /// async fn sample(
5357    ///    client: &Fulfillments
5358    /// ) -> Result<()> {
5359    ///     client.cancel_operation()
5360    ///         /* set fields */
5361    ///         .send().await?;
5362    ///     Ok(())
5363    /// }
5364    /// ```
5365    pub fn cancel_operation(&self) -> super::builder::fulfillments::CancelOperation {
5366        super::builder::fulfillments::CancelOperation::new(self.inner.clone())
5367    }
5368}
5369
5370/// Implements a client for the Dialogflow API.
5371///
5372/// # Example
5373/// ```
5374/// # use google_cloud_dialogflow_v2::client::Generators;
5375/// use google_cloud_gax::paginator::ItemPaginator as _;
5376/// async fn sample(
5377///    parent: &str,
5378/// ) -> anyhow::Result<()> {
5379///     let client = Generators::builder().build().await?;
5380///     let mut list = client.list_generators()
5381///         .set_parent(parent)
5382///         .by_item();
5383///     while let Some(item) = list.next().await.transpose()? {
5384///         println!("{:?}", item);
5385///     }
5386///     Ok(())
5387/// }
5388/// ```
5389///
5390/// # Service Description
5391///
5392/// Generator Service for LLM powered Agent Assist. This service manages the
5393/// configurations of user owned Generators, such as description, context and
5394/// instruction, input/output format, etc. The generator resources will be used
5395/// inside a conversation and will be triggered by TriggerEvent to query LLM for
5396/// answers.
5397///
5398/// # Configuration
5399///
5400/// To configure `Generators` use the `with_*` methods in the type returned
5401/// by [builder()][Generators::builder]. The default configuration should
5402/// work for most applications. Common configuration changes include
5403///
5404/// * [with_endpoint()]: by default this client uses the global default endpoint
5405///   (`https://dialogflow.googleapis.com`). Applications using regional
5406///   endpoints or running in restricted networks (e.g. a network configured
5407///   with [Private Google Access with VPC Service Controls]) may want to
5408///   override this default.
5409/// * [with_credentials()]: by default this client uses
5410///   [Application Default Credentials]. Applications using custom
5411///   authentication may need to override this default.
5412///
5413/// [with_endpoint()]: super::builder::generators::ClientBuilder::with_endpoint
5414/// [with_credentials()]: super::builder::generators::ClientBuilder::with_credentials
5415/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
5416/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
5417///
5418/// # Pooling and Cloning
5419///
5420/// `Generators` holds a connection pool internally, it is advised to
5421/// create one and reuse it. You do not need to wrap `Generators` in
5422/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
5423/// already uses an `Arc` internally.
5424#[cfg(feature = "generators")]
5425#[cfg_attr(docsrs, doc(cfg(feature = "generators")))]
5426#[derive(Clone, Debug)]
5427pub struct Generators {
5428    inner: std::sync::Arc<dyn super::stub::dynamic::Generators>,
5429}
5430
5431#[cfg(feature = "generators")]
5432impl Generators {
5433    /// Returns a builder for [Generators].
5434    ///
5435    /// ```
5436    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
5437    /// # use google_cloud_dialogflow_v2::client::Generators;
5438    /// let client = Generators::builder().build().await?;
5439    /// # Ok(()) }
5440    /// ```
5441    pub fn builder() -> super::builder::generators::ClientBuilder {
5442        crate::new_client_builder(super::builder::generators::client::Factory)
5443    }
5444
5445    /// Creates a new client from the provided stub.
5446    ///
5447    /// The most common case for calling this function is in tests mocking the
5448    /// client's behavior.
5449    pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
5450    where
5451        T: super::stub::Generators + 'static,
5452    {
5453        Self { inner: stub.into() }
5454    }
5455
5456    pub(crate) async fn new(
5457        config: gaxi::options::ClientConfig,
5458    ) -> crate::ClientBuilderResult<Self> {
5459        let inner = Self::build_inner(config).await?;
5460        Ok(Self { inner })
5461    }
5462
5463    async fn build_inner(
5464        conf: gaxi::options::ClientConfig,
5465    ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::Generators>> {
5466        if gaxi::options::tracing_enabled(&conf) {
5467            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
5468        }
5469        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
5470    }
5471
5472    async fn build_transport(
5473        conf: gaxi::options::ClientConfig,
5474    ) -> crate::ClientBuilderResult<impl super::stub::Generators> {
5475        super::transport::Generators::new(conf).await
5476    }
5477
5478    async fn build_with_tracing(
5479        conf: gaxi::options::ClientConfig,
5480    ) -> crate::ClientBuilderResult<impl super::stub::Generators> {
5481        Self::build_transport(conf)
5482            .await
5483            .map(super::tracing::Generators::new)
5484    }
5485
5486    /// Creates a generator.
5487    ///
5488    /// # Example
5489    /// ```
5490    /// # use google_cloud_dialogflow_v2::client::Generators;
5491    /// use google_cloud_dialogflow_v2::model::Generator;
5492    /// use google_cloud_dialogflow_v2::Result;
5493    /// async fn sample(
5494    ///    client: &Generators, parent: &str
5495    /// ) -> Result<()> {
5496    ///     let response = client.create_generator()
5497    ///         .set_parent(parent)
5498    ///         .set_generator_id("generator_id_value")
5499    ///         .set_generator(
5500    ///             Generator::new()/* set fields */
5501    ///         )
5502    ///         .send().await?;
5503    ///     println!("response {:?}", response);
5504    ///     Ok(())
5505    /// }
5506    /// ```
5507    pub fn create_generator(&self) -> super::builder::generators::CreateGenerator {
5508        super::builder::generators::CreateGenerator::new(self.inner.clone())
5509    }
5510
5511    /// Retrieves a generator.
5512    ///
5513    /// # Example
5514    /// ```
5515    /// # use google_cloud_dialogflow_v2::client::Generators;
5516    /// use google_cloud_dialogflow_v2::Result;
5517    /// async fn sample(
5518    ///    client: &Generators, project_id: &str, location_id: &str, generator_id: &str
5519    /// ) -> Result<()> {
5520    ///     let response = client.get_generator()
5521    ///         .set_name(format!("projects/{project_id}/locations/{location_id}/generators/{generator_id}"))
5522    ///         .send().await?;
5523    ///     println!("response {:?}", response);
5524    ///     Ok(())
5525    /// }
5526    /// ```
5527    pub fn get_generator(&self) -> super::builder::generators::GetGenerator {
5528        super::builder::generators::GetGenerator::new(self.inner.clone())
5529    }
5530
5531    /// Lists generators.
5532    ///
5533    /// # Example
5534    /// ```
5535    /// # use google_cloud_dialogflow_v2::client::Generators;
5536    /// use google_cloud_gax::paginator::ItemPaginator as _;
5537    /// use google_cloud_dialogflow_v2::Result;
5538    /// async fn sample(
5539    ///    client: &Generators, parent: &str
5540    /// ) -> Result<()> {
5541    ///     let mut list = client.list_generators()
5542    ///         .set_parent(parent)
5543    ///         .by_item();
5544    ///     while let Some(item) = list.next().await.transpose()? {
5545    ///         println!("{:?}", item);
5546    ///     }
5547    ///     Ok(())
5548    /// }
5549    /// ```
5550    pub fn list_generators(&self) -> super::builder::generators::ListGenerators {
5551        super::builder::generators::ListGenerators::new(self.inner.clone())
5552    }
5553
5554    /// Deletes a generator.
5555    ///
5556    /// # Example
5557    /// ```
5558    /// # use google_cloud_dialogflow_v2::client::Generators;
5559    /// use google_cloud_dialogflow_v2::Result;
5560    /// async fn sample(
5561    ///    client: &Generators, project_id: &str, location_id: &str, generator_id: &str
5562    /// ) -> Result<()> {
5563    ///     client.delete_generator()
5564    ///         .set_name(format!("projects/{project_id}/locations/{location_id}/generators/{generator_id}"))
5565    ///         .send().await?;
5566    ///     Ok(())
5567    /// }
5568    /// ```
5569    pub fn delete_generator(&self) -> super::builder::generators::DeleteGenerator {
5570        super::builder::generators::DeleteGenerator::new(self.inner.clone())
5571    }
5572
5573    /// Updates a generator.
5574    ///
5575    /// # Example
5576    /// ```
5577    /// # use google_cloud_dialogflow_v2::client::Generators;
5578    /// # extern crate wkt as google_cloud_wkt;
5579    /// use google_cloud_wkt::FieldMask;
5580    /// use google_cloud_dialogflow_v2::model::Generator;
5581    /// use google_cloud_dialogflow_v2::Result;
5582    /// async fn sample(
5583    ///    client: &Generators, project_id: &str, location_id: &str, generator_id: &str
5584    /// ) -> Result<()> {
5585    ///     let response = client.update_generator()
5586    ///         .set_generator(
5587    ///             Generator::new().set_name(format!("projects/{project_id}/locations/{location_id}/generators/{generator_id}"))/* set fields */
5588    ///         )
5589    ///         .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
5590    ///         .send().await?;
5591    ///     println!("response {:?}", response);
5592    ///     Ok(())
5593    /// }
5594    /// ```
5595    pub fn update_generator(&self) -> super::builder::generators::UpdateGenerator {
5596        super::builder::generators::UpdateGenerator::new(self.inner.clone())
5597    }
5598
5599    /// Lists information about the supported locations for this service.
5600    ///
5601    /// This method lists locations based on the resource scope provided in
5602    /// the [ListLocationsRequest.name][google.cloud.location.ListLocationsRequest.name] field: *
5603    /// **Global locations**: If `name` is empty, the method lists the
5604    /// public locations available to all projects. * **Project-specific
5605    /// locations**: If `name` follows the format
5606    /// `projects/{project}`, the method lists locations visible to that
5607    /// specific project. This includes public, private, or other
5608    /// project-specific locations enabled for the project.
5609    ///
5610    /// For gRPC and client library implementations, the resource name is
5611    /// passed as the `name` field. For direct service calls, the resource
5612    /// name is
5613    /// incorporated into the request path based on the specific service
5614    /// implementation and version.
5615    ///
5616    /// [google.cloud.location.ListLocationsRequest.name]: google_cloud_location::model::ListLocationsRequest::name
5617    ///
5618    /// # Example
5619    /// ```
5620    /// # use google_cloud_dialogflow_v2::client::Generators;
5621    /// use google_cloud_gax::paginator::ItemPaginator as _;
5622    /// use google_cloud_dialogflow_v2::Result;
5623    /// async fn sample(
5624    ///    client: &Generators
5625    /// ) -> Result<()> {
5626    ///     let mut list = client.list_locations()
5627    ///         /* set fields */
5628    ///         .by_item();
5629    ///     while let Some(item) = list.next().await.transpose()? {
5630    ///         println!("{:?}", item);
5631    ///     }
5632    ///     Ok(())
5633    /// }
5634    /// ```
5635    pub fn list_locations(&self) -> super::builder::generators::ListLocations {
5636        super::builder::generators::ListLocations::new(self.inner.clone())
5637    }
5638
5639    /// Gets information about a location.
5640    ///
5641    /// # Example
5642    /// ```
5643    /// # use google_cloud_dialogflow_v2::client::Generators;
5644    /// use google_cloud_dialogflow_v2::Result;
5645    /// async fn sample(
5646    ///    client: &Generators
5647    /// ) -> Result<()> {
5648    ///     let response = client.get_location()
5649    ///         /* set fields */
5650    ///         .send().await?;
5651    ///     println!("response {:?}", response);
5652    ///     Ok(())
5653    /// }
5654    /// ```
5655    pub fn get_location(&self) -> super::builder::generators::GetLocation {
5656        super::builder::generators::GetLocation::new(self.inner.clone())
5657    }
5658
5659    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
5660    ///
5661    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
5662    ///
5663    /// # Example
5664    /// ```
5665    /// # use google_cloud_dialogflow_v2::client::Generators;
5666    /// use google_cloud_gax::paginator::ItemPaginator as _;
5667    /// use google_cloud_dialogflow_v2::Result;
5668    /// async fn sample(
5669    ///    client: &Generators
5670    /// ) -> Result<()> {
5671    ///     let mut list = client.list_operations()
5672    ///         /* set fields */
5673    ///         .by_item();
5674    ///     while let Some(item) = list.next().await.transpose()? {
5675    ///         println!("{:?}", item);
5676    ///     }
5677    ///     Ok(())
5678    /// }
5679    /// ```
5680    pub fn list_operations(&self) -> super::builder::generators::ListOperations {
5681        super::builder::generators::ListOperations::new(self.inner.clone())
5682    }
5683
5684    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
5685    ///
5686    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
5687    ///
5688    /// # Example
5689    /// ```
5690    /// # use google_cloud_dialogflow_v2::client::Generators;
5691    /// use google_cloud_dialogflow_v2::Result;
5692    /// async fn sample(
5693    ///    client: &Generators
5694    /// ) -> Result<()> {
5695    ///     let response = client.get_operation()
5696    ///         /* set fields */
5697    ///         .send().await?;
5698    ///     println!("response {:?}", response);
5699    ///     Ok(())
5700    /// }
5701    /// ```
5702    pub fn get_operation(&self) -> super::builder::generators::GetOperation {
5703        super::builder::generators::GetOperation::new(self.inner.clone())
5704    }
5705
5706    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
5707    ///
5708    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
5709    ///
5710    /// # Example
5711    /// ```
5712    /// # use google_cloud_dialogflow_v2::client::Generators;
5713    /// use google_cloud_dialogflow_v2::Result;
5714    /// async fn sample(
5715    ///    client: &Generators
5716    /// ) -> Result<()> {
5717    ///     client.cancel_operation()
5718    ///         /* set fields */
5719    ///         .send().await?;
5720    ///     Ok(())
5721    /// }
5722    /// ```
5723    pub fn cancel_operation(&self) -> super::builder::generators::CancelOperation {
5724        super::builder::generators::CancelOperation::new(self.inner.clone())
5725    }
5726}
5727
5728/// Implements a client for the Dialogflow API.
5729///
5730/// # Example
5731/// ```
5732/// # use google_cloud_dialogflow_v2::client::GeneratorEvaluations;
5733/// use google_cloud_gax::paginator::ItemPaginator as _;
5734/// async fn sample(
5735///    project_id: &str,
5736///    location_id: &str,
5737///    generator_id: &str,
5738/// ) -> anyhow::Result<()> {
5739///     let client = GeneratorEvaluations::builder().build().await?;
5740///     let mut list = client.list_generator_evaluations()
5741///         .set_parent(format!("projects/{project_id}/locations/{location_id}/generators/{generator_id}"))
5742///         .by_item();
5743///     while let Some(item) = list.next().await.transpose()? {
5744///         println!("{:?}", item);
5745///     }
5746///     Ok(())
5747/// }
5748/// ```
5749///
5750/// # Service Description
5751///
5752/// Service for managing generator evaluations.
5753///
5754/// # Configuration
5755///
5756/// To configure `GeneratorEvaluations` use the `with_*` methods in the type returned
5757/// by [builder()][GeneratorEvaluations::builder]. The default configuration should
5758/// work for most applications. Common configuration changes include
5759///
5760/// * [with_endpoint()]: by default this client uses the global default endpoint
5761///   (`https://dialogflow.googleapis.com`). Applications using regional
5762///   endpoints or running in restricted networks (e.g. a network configured
5763///   with [Private Google Access with VPC Service Controls]) may want to
5764///   override this default.
5765/// * [with_credentials()]: by default this client uses
5766///   [Application Default Credentials]. Applications using custom
5767///   authentication may need to override this default.
5768///
5769/// [with_endpoint()]: super::builder::generator_evaluations::ClientBuilder::with_endpoint
5770/// [with_credentials()]: super::builder::generator_evaluations::ClientBuilder::with_credentials
5771/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
5772/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
5773///
5774/// # Pooling and Cloning
5775///
5776/// `GeneratorEvaluations` holds a connection pool internally, it is advised to
5777/// create one and reuse it. You do not need to wrap `GeneratorEvaluations` in
5778/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
5779/// already uses an `Arc` internally.
5780#[cfg(feature = "generator-evaluations")]
5781#[cfg_attr(docsrs, doc(cfg(feature = "generator-evaluations")))]
5782#[derive(Clone, Debug)]
5783pub struct GeneratorEvaluations {
5784    inner: std::sync::Arc<dyn super::stub::dynamic::GeneratorEvaluations>,
5785}
5786
5787#[cfg(feature = "generator-evaluations")]
5788impl GeneratorEvaluations {
5789    /// Returns a builder for [GeneratorEvaluations].
5790    ///
5791    /// ```
5792    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
5793    /// # use google_cloud_dialogflow_v2::client::GeneratorEvaluations;
5794    /// let client = GeneratorEvaluations::builder().build().await?;
5795    /// # Ok(()) }
5796    /// ```
5797    pub fn builder() -> super::builder::generator_evaluations::ClientBuilder {
5798        crate::new_client_builder(super::builder::generator_evaluations::client::Factory)
5799    }
5800
5801    /// Creates a new client from the provided stub.
5802    ///
5803    /// The most common case for calling this function is in tests mocking the
5804    /// client's behavior.
5805    pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
5806    where
5807        T: super::stub::GeneratorEvaluations + 'static,
5808    {
5809        Self { inner: stub.into() }
5810    }
5811
5812    pub(crate) async fn new(
5813        config: gaxi::options::ClientConfig,
5814    ) -> crate::ClientBuilderResult<Self> {
5815        let inner = Self::build_inner(config).await?;
5816        Ok(Self { inner })
5817    }
5818
5819    async fn build_inner(
5820        conf: gaxi::options::ClientConfig,
5821    ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::GeneratorEvaluations>>
5822    {
5823        if gaxi::options::tracing_enabled(&conf) {
5824            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
5825        }
5826        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
5827    }
5828
5829    async fn build_transport(
5830        conf: gaxi::options::ClientConfig,
5831    ) -> crate::ClientBuilderResult<impl super::stub::GeneratorEvaluations> {
5832        super::transport::GeneratorEvaluations::new(conf).await
5833    }
5834
5835    async fn build_with_tracing(
5836        conf: gaxi::options::ClientConfig,
5837    ) -> crate::ClientBuilderResult<impl super::stub::GeneratorEvaluations> {
5838        Self::build_transport(conf)
5839            .await
5840            .map(super::tracing::GeneratorEvaluations::new)
5841    }
5842
5843    /// Creates evaluation of a generator.
5844    ///
5845    /// # Long running operations
5846    ///
5847    /// This method is used to start, and/or poll a [long-running Operation].
5848    /// The [Working with long-running operations] chapter in the [user guide]
5849    /// covers these operations in detail.
5850    ///
5851    /// [long-running operation]: https://google.aip.dev/151
5852    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
5853    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
5854    ///
5855    /// # Example
5856    /// ```
5857    /// # use google_cloud_dialogflow_v2::client::GeneratorEvaluations;
5858    /// use google_cloud_lro::Poller;
5859    /// use google_cloud_dialogflow_v2::model::GeneratorEvaluation;
5860    /// use google_cloud_dialogflow_v2::Result;
5861    /// async fn sample(
5862    ///    client: &GeneratorEvaluations, project_id: &str, location_id: &str, generator_id: &str
5863    /// ) -> Result<()> {
5864    ///     let response = client.create_generator_evaluation()
5865    ///         .set_parent(format!("projects/{project_id}/locations/{location_id}/generators/{generator_id}"))
5866    ///         .set_generator_evaluation(
5867    ///             GeneratorEvaluation::new()/* set fields */
5868    ///         )
5869    ///         .poller().until_done().await?;
5870    ///     println!("response {:?}", response);
5871    ///     Ok(())
5872    /// }
5873    /// ```
5874    pub fn create_generator_evaluation(
5875        &self,
5876    ) -> super::builder::generator_evaluations::CreateGeneratorEvaluation {
5877        super::builder::generator_evaluations::CreateGeneratorEvaluation::new(self.inner.clone())
5878    }
5879
5880    /// Gets an evaluation of generator.
5881    ///
5882    /// # Example
5883    /// ```
5884    /// # use google_cloud_dialogflow_v2::client::GeneratorEvaluations;
5885    /// use google_cloud_dialogflow_v2::Result;
5886    /// async fn sample(
5887    ///    client: &GeneratorEvaluations, project_id: &str, location_id: &str, generator_id: &str, evaluation_id: &str
5888    /// ) -> Result<()> {
5889    ///     let response = client.get_generator_evaluation()
5890    ///         .set_name(format!("projects/{project_id}/locations/{location_id}/generators/{generator_id}/evaluations/{evaluation_id}"))
5891    ///         .send().await?;
5892    ///     println!("response {:?}", response);
5893    ///     Ok(())
5894    /// }
5895    /// ```
5896    pub fn get_generator_evaluation(
5897        &self,
5898    ) -> super::builder::generator_evaluations::GetGeneratorEvaluation {
5899        super::builder::generator_evaluations::GetGeneratorEvaluation::new(self.inner.clone())
5900    }
5901
5902    /// Lists evaluations of generator.
5903    ///
5904    /// # Example
5905    /// ```
5906    /// # use google_cloud_dialogflow_v2::client::GeneratorEvaluations;
5907    /// use google_cloud_gax::paginator::ItemPaginator as _;
5908    /// use google_cloud_dialogflow_v2::Result;
5909    /// async fn sample(
5910    ///    client: &GeneratorEvaluations, project_id: &str, location_id: &str, generator_id: &str
5911    /// ) -> Result<()> {
5912    ///     let mut list = client.list_generator_evaluations()
5913    ///         .set_parent(format!("projects/{project_id}/locations/{location_id}/generators/{generator_id}"))
5914    ///         .by_item();
5915    ///     while let Some(item) = list.next().await.transpose()? {
5916    ///         println!("{:?}", item);
5917    ///     }
5918    ///     Ok(())
5919    /// }
5920    /// ```
5921    pub fn list_generator_evaluations(
5922        &self,
5923    ) -> super::builder::generator_evaluations::ListGeneratorEvaluations {
5924        super::builder::generator_evaluations::ListGeneratorEvaluations::new(self.inner.clone())
5925    }
5926
5927    /// Deletes an evaluation of generator.
5928    ///
5929    /// # Example
5930    /// ```
5931    /// # use google_cloud_dialogflow_v2::client::GeneratorEvaluations;
5932    /// use google_cloud_dialogflow_v2::Result;
5933    /// async fn sample(
5934    ///    client: &GeneratorEvaluations, project_id: &str, location_id: &str, generator_id: &str, evaluation_id: &str
5935    /// ) -> Result<()> {
5936    ///     client.delete_generator_evaluation()
5937    ///         .set_name(format!("projects/{project_id}/locations/{location_id}/generators/{generator_id}/evaluations/{evaluation_id}"))
5938    ///         .send().await?;
5939    ///     Ok(())
5940    /// }
5941    /// ```
5942    pub fn delete_generator_evaluation(
5943        &self,
5944    ) -> super::builder::generator_evaluations::DeleteGeneratorEvaluation {
5945        super::builder::generator_evaluations::DeleteGeneratorEvaluation::new(self.inner.clone())
5946    }
5947
5948    /// Lists information about the supported locations for this service.
5949    ///
5950    /// This method lists locations based on the resource scope provided in
5951    /// the [ListLocationsRequest.name][google.cloud.location.ListLocationsRequest.name] field: *
5952    /// **Global locations**: If `name` is empty, the method lists the
5953    /// public locations available to all projects. * **Project-specific
5954    /// locations**: If `name` follows the format
5955    /// `projects/{project}`, the method lists locations visible to that
5956    /// specific project. This includes public, private, or other
5957    /// project-specific locations enabled for the project.
5958    ///
5959    /// For gRPC and client library implementations, the resource name is
5960    /// passed as the `name` field. For direct service calls, the resource
5961    /// name is
5962    /// incorporated into the request path based on the specific service
5963    /// implementation and version.
5964    ///
5965    /// [google.cloud.location.ListLocationsRequest.name]: google_cloud_location::model::ListLocationsRequest::name
5966    ///
5967    /// # Example
5968    /// ```
5969    /// # use google_cloud_dialogflow_v2::client::GeneratorEvaluations;
5970    /// use google_cloud_gax::paginator::ItemPaginator as _;
5971    /// use google_cloud_dialogflow_v2::Result;
5972    /// async fn sample(
5973    ///    client: &GeneratorEvaluations
5974    /// ) -> Result<()> {
5975    ///     let mut list = client.list_locations()
5976    ///         /* set fields */
5977    ///         .by_item();
5978    ///     while let Some(item) = list.next().await.transpose()? {
5979    ///         println!("{:?}", item);
5980    ///     }
5981    ///     Ok(())
5982    /// }
5983    /// ```
5984    pub fn list_locations(&self) -> super::builder::generator_evaluations::ListLocations {
5985        super::builder::generator_evaluations::ListLocations::new(self.inner.clone())
5986    }
5987
5988    /// Gets information about a location.
5989    ///
5990    /// # Example
5991    /// ```
5992    /// # use google_cloud_dialogflow_v2::client::GeneratorEvaluations;
5993    /// use google_cloud_dialogflow_v2::Result;
5994    /// async fn sample(
5995    ///    client: &GeneratorEvaluations
5996    /// ) -> Result<()> {
5997    ///     let response = client.get_location()
5998    ///         /* set fields */
5999    ///         .send().await?;
6000    ///     println!("response {:?}", response);
6001    ///     Ok(())
6002    /// }
6003    /// ```
6004    pub fn get_location(&self) -> super::builder::generator_evaluations::GetLocation {
6005        super::builder::generator_evaluations::GetLocation::new(self.inner.clone())
6006    }
6007
6008    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
6009    ///
6010    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
6011    ///
6012    /// # Example
6013    /// ```
6014    /// # use google_cloud_dialogflow_v2::client::GeneratorEvaluations;
6015    /// use google_cloud_gax::paginator::ItemPaginator as _;
6016    /// use google_cloud_dialogflow_v2::Result;
6017    /// async fn sample(
6018    ///    client: &GeneratorEvaluations
6019    /// ) -> Result<()> {
6020    ///     let mut list = client.list_operations()
6021    ///         /* set fields */
6022    ///         .by_item();
6023    ///     while let Some(item) = list.next().await.transpose()? {
6024    ///         println!("{:?}", item);
6025    ///     }
6026    ///     Ok(())
6027    /// }
6028    /// ```
6029    pub fn list_operations(&self) -> super::builder::generator_evaluations::ListOperations {
6030        super::builder::generator_evaluations::ListOperations::new(self.inner.clone())
6031    }
6032
6033    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
6034    ///
6035    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
6036    ///
6037    /// # Example
6038    /// ```
6039    /// # use google_cloud_dialogflow_v2::client::GeneratorEvaluations;
6040    /// use google_cloud_dialogflow_v2::Result;
6041    /// async fn sample(
6042    ///    client: &GeneratorEvaluations
6043    /// ) -> Result<()> {
6044    ///     let response = client.get_operation()
6045    ///         /* set fields */
6046    ///         .send().await?;
6047    ///     println!("response {:?}", response);
6048    ///     Ok(())
6049    /// }
6050    /// ```
6051    pub fn get_operation(&self) -> super::builder::generator_evaluations::GetOperation {
6052        super::builder::generator_evaluations::GetOperation::new(self.inner.clone())
6053    }
6054
6055    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
6056    ///
6057    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
6058    ///
6059    /// # Example
6060    /// ```
6061    /// # use google_cloud_dialogflow_v2::client::GeneratorEvaluations;
6062    /// use google_cloud_dialogflow_v2::Result;
6063    /// async fn sample(
6064    ///    client: &GeneratorEvaluations
6065    /// ) -> Result<()> {
6066    ///     client.cancel_operation()
6067    ///         /* set fields */
6068    ///         .send().await?;
6069    ///     Ok(())
6070    /// }
6071    /// ```
6072    pub fn cancel_operation(&self) -> super::builder::generator_evaluations::CancelOperation {
6073        super::builder::generator_evaluations::CancelOperation::new(self.inner.clone())
6074    }
6075}
6076
6077/// Implements a client for the Dialogflow API.
6078///
6079/// # Example
6080/// ```
6081/// # use google_cloud_dialogflow_v2::client::Intents;
6082/// use google_cloud_gax::paginator::ItemPaginator as _;
6083/// async fn sample(
6084///    project_id: &str,
6085/// ) -> anyhow::Result<()> {
6086///     let client = Intents::builder().build().await?;
6087///     let mut list = client.list_intents()
6088///         .set_parent(format!("projects/{project_id}/agent"))
6089///         .by_item();
6090///     while let Some(item) = list.next().await.transpose()? {
6091///         println!("{:?}", item);
6092///     }
6093///     Ok(())
6094/// }
6095/// ```
6096///
6097/// # Service Description
6098///
6099/// Service for managing [Intents][google.cloud.dialogflow.v2.Intent].
6100///
6101/// [google.cloud.dialogflow.v2.Intent]: crate::model::Intent
6102///
6103/// # Configuration
6104///
6105/// To configure `Intents` use the `with_*` methods in the type returned
6106/// by [builder()][Intents::builder]. The default configuration should
6107/// work for most applications. Common configuration changes include
6108///
6109/// * [with_endpoint()]: by default this client uses the global default endpoint
6110///   (`https://dialogflow.googleapis.com`). Applications using regional
6111///   endpoints or running in restricted networks (e.g. a network configured
6112///   with [Private Google Access with VPC Service Controls]) may want to
6113///   override this default.
6114/// * [with_credentials()]: by default this client uses
6115///   [Application Default Credentials]. Applications using custom
6116///   authentication may need to override this default.
6117///
6118/// [with_endpoint()]: super::builder::intents::ClientBuilder::with_endpoint
6119/// [with_credentials()]: super::builder::intents::ClientBuilder::with_credentials
6120/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
6121/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
6122///
6123/// # Pooling and Cloning
6124///
6125/// `Intents` holds a connection pool internally, it is advised to
6126/// create one and reuse it. You do not need to wrap `Intents` in
6127/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
6128/// already uses an `Arc` internally.
6129#[cfg(feature = "intents")]
6130#[cfg_attr(docsrs, doc(cfg(feature = "intents")))]
6131#[derive(Clone, Debug)]
6132pub struct Intents {
6133    inner: std::sync::Arc<dyn super::stub::dynamic::Intents>,
6134}
6135
6136#[cfg(feature = "intents")]
6137impl Intents {
6138    /// Returns a builder for [Intents].
6139    ///
6140    /// ```
6141    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
6142    /// # use google_cloud_dialogflow_v2::client::Intents;
6143    /// let client = Intents::builder().build().await?;
6144    /// # Ok(()) }
6145    /// ```
6146    pub fn builder() -> super::builder::intents::ClientBuilder {
6147        crate::new_client_builder(super::builder::intents::client::Factory)
6148    }
6149
6150    /// Creates a new client from the provided stub.
6151    ///
6152    /// The most common case for calling this function is in tests mocking the
6153    /// client's behavior.
6154    pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
6155    where
6156        T: super::stub::Intents + 'static,
6157    {
6158        Self { inner: stub.into() }
6159    }
6160
6161    pub(crate) async fn new(
6162        config: gaxi::options::ClientConfig,
6163    ) -> crate::ClientBuilderResult<Self> {
6164        let inner = Self::build_inner(config).await?;
6165        Ok(Self { inner })
6166    }
6167
6168    async fn build_inner(
6169        conf: gaxi::options::ClientConfig,
6170    ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::Intents>> {
6171        if gaxi::options::tracing_enabled(&conf) {
6172            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
6173        }
6174        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
6175    }
6176
6177    async fn build_transport(
6178        conf: gaxi::options::ClientConfig,
6179    ) -> crate::ClientBuilderResult<impl super::stub::Intents> {
6180        super::transport::Intents::new(conf).await
6181    }
6182
6183    async fn build_with_tracing(
6184        conf: gaxi::options::ClientConfig,
6185    ) -> crate::ClientBuilderResult<impl super::stub::Intents> {
6186        Self::build_transport(conf)
6187            .await
6188            .map(super::tracing::Intents::new)
6189    }
6190
6191    /// Returns the list of all intents in the specified agent.
6192    ///
6193    /// # Example
6194    /// ```
6195    /// # use google_cloud_dialogflow_v2::client::Intents;
6196    /// use google_cloud_gax::paginator::ItemPaginator as _;
6197    /// use google_cloud_dialogflow_v2::Result;
6198    /// async fn sample(
6199    ///    client: &Intents, project_id: &str
6200    /// ) -> Result<()> {
6201    ///     let mut list = client.list_intents()
6202    ///         .set_parent(format!("projects/{project_id}/agent"))
6203    ///         .by_item();
6204    ///     while let Some(item) = list.next().await.transpose()? {
6205    ///         println!("{:?}", item);
6206    ///     }
6207    ///     Ok(())
6208    /// }
6209    /// ```
6210    pub fn list_intents(&self) -> super::builder::intents::ListIntents {
6211        super::builder::intents::ListIntents::new(self.inner.clone())
6212    }
6213
6214    /// Retrieves the specified intent.
6215    ///
6216    /// # Example
6217    /// ```
6218    /// # use google_cloud_dialogflow_v2::client::Intents;
6219    /// use google_cloud_dialogflow_v2::Result;
6220    /// async fn sample(
6221    ///    client: &Intents, project_id: &str, intent_id: &str
6222    /// ) -> Result<()> {
6223    ///     let response = client.get_intent()
6224    ///         .set_name(format!("projects/{project_id}/agent/intents/{intent_id}"))
6225    ///         .send().await?;
6226    ///     println!("response {:?}", response);
6227    ///     Ok(())
6228    /// }
6229    /// ```
6230    pub fn get_intent(&self) -> super::builder::intents::GetIntent {
6231        super::builder::intents::GetIntent::new(self.inner.clone())
6232    }
6233
6234    /// Creates an intent in the specified agent.
6235    ///
6236    /// Note: You should always train an agent prior to sending it queries. See the
6237    /// [training
6238    /// documentation](https://cloud.google.com/dialogflow/es/docs/training).
6239    ///
6240    /// # Example
6241    /// ```
6242    /// # use google_cloud_dialogflow_v2::client::Intents;
6243    /// use google_cloud_dialogflow_v2::model::Intent;
6244    /// use google_cloud_dialogflow_v2::Result;
6245    /// async fn sample(
6246    ///    client: &Intents, project_id: &str
6247    /// ) -> Result<()> {
6248    ///     let response = client.create_intent()
6249    ///         .set_parent(format!("projects/{project_id}/agent"))
6250    ///         .set_intent(
6251    ///             Intent::new()/* set fields */
6252    ///         )
6253    ///         .send().await?;
6254    ///     println!("response {:?}", response);
6255    ///     Ok(())
6256    /// }
6257    /// ```
6258    pub fn create_intent(&self) -> super::builder::intents::CreateIntent {
6259        super::builder::intents::CreateIntent::new(self.inner.clone())
6260    }
6261
6262    /// Updates the specified intent.
6263    ///
6264    /// Note: You should always train an agent prior to sending it queries. See the
6265    /// [training
6266    /// documentation](https://cloud.google.com/dialogflow/es/docs/training).
6267    ///
6268    /// # Example
6269    /// ```
6270    /// # use google_cloud_dialogflow_v2::client::Intents;
6271    /// # extern crate wkt as google_cloud_wkt;
6272    /// use google_cloud_wkt::FieldMask;
6273    /// use google_cloud_dialogflow_v2::model::Intent;
6274    /// use google_cloud_dialogflow_v2::Result;
6275    /// async fn sample(
6276    ///    client: &Intents, project_id: &str, intent_id: &str
6277    /// ) -> Result<()> {
6278    ///     let response = client.update_intent()
6279    ///         .set_intent(
6280    ///             Intent::new().set_name(format!("projects/{project_id}/agent/intents/{intent_id}"))/* set fields */
6281    ///         )
6282    ///         .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
6283    ///         .send().await?;
6284    ///     println!("response {:?}", response);
6285    ///     Ok(())
6286    /// }
6287    /// ```
6288    pub fn update_intent(&self) -> super::builder::intents::UpdateIntent {
6289        super::builder::intents::UpdateIntent::new(self.inner.clone())
6290    }
6291
6292    /// Deletes the specified intent and its direct or indirect followup intents.
6293    ///
6294    /// Note: You should always train an agent prior to sending it queries. See the
6295    /// [training
6296    /// documentation](https://cloud.google.com/dialogflow/es/docs/training).
6297    ///
6298    /// # Example
6299    /// ```
6300    /// # use google_cloud_dialogflow_v2::client::Intents;
6301    /// use google_cloud_dialogflow_v2::Result;
6302    /// async fn sample(
6303    ///    client: &Intents, project_id: &str, intent_id: &str
6304    /// ) -> Result<()> {
6305    ///     client.delete_intent()
6306    ///         .set_name(format!("projects/{project_id}/agent/intents/{intent_id}"))
6307    ///         .send().await?;
6308    ///     Ok(())
6309    /// }
6310    /// ```
6311    pub fn delete_intent(&self) -> super::builder::intents::DeleteIntent {
6312        super::builder::intents::DeleteIntent::new(self.inner.clone())
6313    }
6314
6315    /// Updates/Creates multiple intents in the specified agent.
6316    ///
6317    /// This method is a [long-running
6318    /// operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations).
6319    /// The returned `Operation` type has the following method-specific fields:
6320    ///
6321    /// - `metadata`: An empty [Struct
6322    ///   message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct)
6323    /// - `response`:
6324    ///   [BatchUpdateIntentsResponse][google.cloud.dialogflow.v2.BatchUpdateIntentsResponse]
6325    ///
6326    /// Note: You should always train an agent prior to sending it queries. See the
6327    /// [training
6328    /// documentation](https://cloud.google.com/dialogflow/es/docs/training).
6329    ///
6330    /// [google.cloud.dialogflow.v2.BatchUpdateIntentsResponse]: crate::model::BatchUpdateIntentsResponse
6331    ///
6332    /// # Long running operations
6333    ///
6334    /// This method is used to start, and/or poll a [long-running Operation].
6335    /// The [Working with long-running operations] chapter in the [user guide]
6336    /// covers these operations in detail.
6337    ///
6338    /// [long-running operation]: https://google.aip.dev/151
6339    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
6340    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
6341    ///
6342    /// # Example
6343    /// ```
6344    /// # use google_cloud_dialogflow_v2::client::Intents;
6345    /// use google_cloud_lro::Poller;
6346    /// use google_cloud_dialogflow_v2::Result;
6347    /// async fn sample(
6348    ///    client: &Intents
6349    /// ) -> Result<()> {
6350    ///     let response = client.batch_update_intents()
6351    ///         /* set fields */
6352    ///         .poller().until_done().await?;
6353    ///     println!("response {:?}", response);
6354    ///     Ok(())
6355    /// }
6356    /// ```
6357    pub fn batch_update_intents(&self) -> super::builder::intents::BatchUpdateIntents {
6358        super::builder::intents::BatchUpdateIntents::new(self.inner.clone())
6359    }
6360
6361    /// Deletes intents in the specified agent.
6362    ///
6363    /// This method is a [long-running
6364    /// operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations).
6365    /// The returned `Operation` type has the following method-specific fields:
6366    ///
6367    /// - `metadata`: An empty [Struct
6368    ///   message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct)
6369    /// - `response`: An [Empty
6370    ///   message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
6371    ///
6372    /// Note: You should always train an agent prior to sending it queries. See the
6373    /// [training
6374    /// documentation](https://cloud.google.com/dialogflow/es/docs/training).
6375    ///
6376    /// # Long running operations
6377    ///
6378    /// This method is used to start, and/or poll a [long-running Operation].
6379    /// The [Working with long-running operations] chapter in the [user guide]
6380    /// covers these operations in detail.
6381    ///
6382    /// [long-running operation]: https://google.aip.dev/151
6383    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
6384    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
6385    ///
6386    /// # Example
6387    /// ```
6388    /// # use google_cloud_dialogflow_v2::client::Intents;
6389    /// use google_cloud_lro::Poller;
6390    /// use google_cloud_dialogflow_v2::Result;
6391    /// async fn sample(
6392    ///    client: &Intents
6393    /// ) -> Result<()> {
6394    ///     client.batch_delete_intents()
6395    ///         /* set fields */
6396    ///         .poller().until_done().await?;
6397    ///     Ok(())
6398    /// }
6399    /// ```
6400    pub fn batch_delete_intents(&self) -> super::builder::intents::BatchDeleteIntents {
6401        super::builder::intents::BatchDeleteIntents::new(self.inner.clone())
6402    }
6403
6404    /// Lists information about the supported locations for this service.
6405    ///
6406    /// This method lists locations based on the resource scope provided in
6407    /// the [ListLocationsRequest.name][google.cloud.location.ListLocationsRequest.name] field: *
6408    /// **Global locations**: If `name` is empty, the method lists the
6409    /// public locations available to all projects. * **Project-specific
6410    /// locations**: If `name` follows the format
6411    /// `projects/{project}`, the method lists locations visible to that
6412    /// specific project. This includes public, private, or other
6413    /// project-specific locations enabled for the project.
6414    ///
6415    /// For gRPC and client library implementations, the resource name is
6416    /// passed as the `name` field. For direct service calls, the resource
6417    /// name is
6418    /// incorporated into the request path based on the specific service
6419    /// implementation and version.
6420    ///
6421    /// [google.cloud.location.ListLocationsRequest.name]: google_cloud_location::model::ListLocationsRequest::name
6422    ///
6423    /// # Example
6424    /// ```
6425    /// # use google_cloud_dialogflow_v2::client::Intents;
6426    /// use google_cloud_gax::paginator::ItemPaginator as _;
6427    /// use google_cloud_dialogflow_v2::Result;
6428    /// async fn sample(
6429    ///    client: &Intents
6430    /// ) -> Result<()> {
6431    ///     let mut list = client.list_locations()
6432    ///         /* set fields */
6433    ///         .by_item();
6434    ///     while let Some(item) = list.next().await.transpose()? {
6435    ///         println!("{:?}", item);
6436    ///     }
6437    ///     Ok(())
6438    /// }
6439    /// ```
6440    pub fn list_locations(&self) -> super::builder::intents::ListLocations {
6441        super::builder::intents::ListLocations::new(self.inner.clone())
6442    }
6443
6444    /// Gets information about a location.
6445    ///
6446    /// # Example
6447    /// ```
6448    /// # use google_cloud_dialogflow_v2::client::Intents;
6449    /// use google_cloud_dialogflow_v2::Result;
6450    /// async fn sample(
6451    ///    client: &Intents
6452    /// ) -> Result<()> {
6453    ///     let response = client.get_location()
6454    ///         /* set fields */
6455    ///         .send().await?;
6456    ///     println!("response {:?}", response);
6457    ///     Ok(())
6458    /// }
6459    /// ```
6460    pub fn get_location(&self) -> super::builder::intents::GetLocation {
6461        super::builder::intents::GetLocation::new(self.inner.clone())
6462    }
6463
6464    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
6465    ///
6466    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
6467    ///
6468    /// # Example
6469    /// ```
6470    /// # use google_cloud_dialogflow_v2::client::Intents;
6471    /// use google_cloud_gax::paginator::ItemPaginator as _;
6472    /// use google_cloud_dialogflow_v2::Result;
6473    /// async fn sample(
6474    ///    client: &Intents
6475    /// ) -> Result<()> {
6476    ///     let mut list = client.list_operations()
6477    ///         /* set fields */
6478    ///         .by_item();
6479    ///     while let Some(item) = list.next().await.transpose()? {
6480    ///         println!("{:?}", item);
6481    ///     }
6482    ///     Ok(())
6483    /// }
6484    /// ```
6485    pub fn list_operations(&self) -> super::builder::intents::ListOperations {
6486        super::builder::intents::ListOperations::new(self.inner.clone())
6487    }
6488
6489    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
6490    ///
6491    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
6492    ///
6493    /// # Example
6494    /// ```
6495    /// # use google_cloud_dialogflow_v2::client::Intents;
6496    /// use google_cloud_dialogflow_v2::Result;
6497    /// async fn sample(
6498    ///    client: &Intents
6499    /// ) -> Result<()> {
6500    ///     let response = client.get_operation()
6501    ///         /* set fields */
6502    ///         .send().await?;
6503    ///     println!("response {:?}", response);
6504    ///     Ok(())
6505    /// }
6506    /// ```
6507    pub fn get_operation(&self) -> super::builder::intents::GetOperation {
6508        super::builder::intents::GetOperation::new(self.inner.clone())
6509    }
6510
6511    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
6512    ///
6513    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
6514    ///
6515    /// # Example
6516    /// ```
6517    /// # use google_cloud_dialogflow_v2::client::Intents;
6518    /// use google_cloud_dialogflow_v2::Result;
6519    /// async fn sample(
6520    ///    client: &Intents
6521    /// ) -> Result<()> {
6522    ///     client.cancel_operation()
6523    ///         /* set fields */
6524    ///         .send().await?;
6525    ///     Ok(())
6526    /// }
6527    /// ```
6528    pub fn cancel_operation(&self) -> super::builder::intents::CancelOperation {
6529        super::builder::intents::CancelOperation::new(self.inner.clone())
6530    }
6531}
6532
6533/// Implements a client for the Dialogflow API.
6534///
6535/// # Example
6536/// ```
6537/// # use google_cloud_dialogflow_v2::client::KnowledgeBases;
6538/// use google_cloud_gax::paginator::ItemPaginator as _;
6539/// async fn sample(
6540///    project_id: &str,
6541/// ) -> anyhow::Result<()> {
6542///     let client = KnowledgeBases::builder().build().await?;
6543///     let mut list = client.list_knowledge_bases()
6544///         .set_parent(format!("projects/{project_id}"))
6545///         .by_item();
6546///     while let Some(item) = list.next().await.transpose()? {
6547///         println!("{:?}", item);
6548///     }
6549///     Ok(())
6550/// }
6551/// ```
6552///
6553/// # Service Description
6554///
6555/// Service for managing
6556/// [KnowledgeBases][google.cloud.dialogflow.v2.KnowledgeBase].
6557///
6558/// [google.cloud.dialogflow.v2.KnowledgeBase]: crate::model::KnowledgeBase
6559///
6560/// # Configuration
6561///
6562/// To configure `KnowledgeBases` use the `with_*` methods in the type returned
6563/// by [builder()][KnowledgeBases::builder]. The default configuration should
6564/// work for most applications. Common configuration changes include
6565///
6566/// * [with_endpoint()]: by default this client uses the global default endpoint
6567///   (`https://dialogflow.googleapis.com`). Applications using regional
6568///   endpoints or running in restricted networks (e.g. a network configured
6569///   with [Private Google Access with VPC Service Controls]) may want to
6570///   override this default.
6571/// * [with_credentials()]: by default this client uses
6572///   [Application Default Credentials]. Applications using custom
6573///   authentication may need to override this default.
6574///
6575/// [with_endpoint()]: super::builder::knowledge_bases::ClientBuilder::with_endpoint
6576/// [with_credentials()]: super::builder::knowledge_bases::ClientBuilder::with_credentials
6577/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
6578/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
6579///
6580/// # Pooling and Cloning
6581///
6582/// `KnowledgeBases` holds a connection pool internally, it is advised to
6583/// create one and reuse it. You do not need to wrap `KnowledgeBases` in
6584/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
6585/// already uses an `Arc` internally.
6586#[cfg(feature = "knowledge-bases")]
6587#[cfg_attr(docsrs, doc(cfg(feature = "knowledge-bases")))]
6588#[derive(Clone, Debug)]
6589pub struct KnowledgeBases {
6590    inner: std::sync::Arc<dyn super::stub::dynamic::KnowledgeBases>,
6591}
6592
6593#[cfg(feature = "knowledge-bases")]
6594impl KnowledgeBases {
6595    /// Returns a builder for [KnowledgeBases].
6596    ///
6597    /// ```
6598    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
6599    /// # use google_cloud_dialogflow_v2::client::KnowledgeBases;
6600    /// let client = KnowledgeBases::builder().build().await?;
6601    /// # Ok(()) }
6602    /// ```
6603    pub fn builder() -> super::builder::knowledge_bases::ClientBuilder {
6604        crate::new_client_builder(super::builder::knowledge_bases::client::Factory)
6605    }
6606
6607    /// Creates a new client from the provided stub.
6608    ///
6609    /// The most common case for calling this function is in tests mocking the
6610    /// client's behavior.
6611    pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
6612    where
6613        T: super::stub::KnowledgeBases + 'static,
6614    {
6615        Self { inner: stub.into() }
6616    }
6617
6618    pub(crate) async fn new(
6619        config: gaxi::options::ClientConfig,
6620    ) -> crate::ClientBuilderResult<Self> {
6621        let inner = Self::build_inner(config).await?;
6622        Ok(Self { inner })
6623    }
6624
6625    async fn build_inner(
6626        conf: gaxi::options::ClientConfig,
6627    ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::KnowledgeBases>> {
6628        if gaxi::options::tracing_enabled(&conf) {
6629            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
6630        }
6631        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
6632    }
6633
6634    async fn build_transport(
6635        conf: gaxi::options::ClientConfig,
6636    ) -> crate::ClientBuilderResult<impl super::stub::KnowledgeBases> {
6637        super::transport::KnowledgeBases::new(conf).await
6638    }
6639
6640    async fn build_with_tracing(
6641        conf: gaxi::options::ClientConfig,
6642    ) -> crate::ClientBuilderResult<impl super::stub::KnowledgeBases> {
6643        Self::build_transport(conf)
6644            .await
6645            .map(super::tracing::KnowledgeBases::new)
6646    }
6647
6648    /// Returns the list of all knowledge bases of the specified agent.
6649    ///
6650    /// # Example
6651    /// ```
6652    /// # use google_cloud_dialogflow_v2::client::KnowledgeBases;
6653    /// use google_cloud_gax::paginator::ItemPaginator as _;
6654    /// use google_cloud_dialogflow_v2::Result;
6655    /// async fn sample(
6656    ///    client: &KnowledgeBases, project_id: &str
6657    /// ) -> Result<()> {
6658    ///     let mut list = client.list_knowledge_bases()
6659    ///         .set_parent(format!("projects/{project_id}"))
6660    ///         .by_item();
6661    ///     while let Some(item) = list.next().await.transpose()? {
6662    ///         println!("{:?}", item);
6663    ///     }
6664    ///     Ok(())
6665    /// }
6666    /// ```
6667    pub fn list_knowledge_bases(&self) -> super::builder::knowledge_bases::ListKnowledgeBases {
6668        super::builder::knowledge_bases::ListKnowledgeBases::new(self.inner.clone())
6669    }
6670
6671    /// Retrieves the specified knowledge base.
6672    ///
6673    /// # Example
6674    /// ```
6675    /// # use google_cloud_dialogflow_v2::client::KnowledgeBases;
6676    /// use google_cloud_dialogflow_v2::Result;
6677    /// async fn sample(
6678    ///    client: &KnowledgeBases, project_id: &str, knowledge_base_id: &str
6679    /// ) -> Result<()> {
6680    ///     let response = client.get_knowledge_base()
6681    ///         .set_name(format!("projects/{project_id}/knowledgeBases/{knowledge_base_id}"))
6682    ///         .send().await?;
6683    ///     println!("response {:?}", response);
6684    ///     Ok(())
6685    /// }
6686    /// ```
6687    pub fn get_knowledge_base(&self) -> super::builder::knowledge_bases::GetKnowledgeBase {
6688        super::builder::knowledge_bases::GetKnowledgeBase::new(self.inner.clone())
6689    }
6690
6691    /// Creates a knowledge base.
6692    ///
6693    /// # Example
6694    /// ```
6695    /// # use google_cloud_dialogflow_v2::client::KnowledgeBases;
6696    /// use google_cloud_dialogflow_v2::model::KnowledgeBase;
6697    /// use google_cloud_dialogflow_v2::Result;
6698    /// async fn sample(
6699    ///    client: &KnowledgeBases, project_id: &str
6700    /// ) -> Result<()> {
6701    ///     let response = client.create_knowledge_base()
6702    ///         .set_parent(format!("projects/{project_id}"))
6703    ///         .set_knowledge_base(
6704    ///             KnowledgeBase::new()/* set fields */
6705    ///         )
6706    ///         .send().await?;
6707    ///     println!("response {:?}", response);
6708    ///     Ok(())
6709    /// }
6710    /// ```
6711    pub fn create_knowledge_base(&self) -> super::builder::knowledge_bases::CreateKnowledgeBase {
6712        super::builder::knowledge_bases::CreateKnowledgeBase::new(self.inner.clone())
6713    }
6714
6715    /// Deletes the specified knowledge base.
6716    ///
6717    /// # Example
6718    /// ```
6719    /// # use google_cloud_dialogflow_v2::client::KnowledgeBases;
6720    /// use google_cloud_dialogflow_v2::Result;
6721    /// async fn sample(
6722    ///    client: &KnowledgeBases, project_id: &str, knowledge_base_id: &str
6723    /// ) -> Result<()> {
6724    ///     client.delete_knowledge_base()
6725    ///         .set_name(format!("projects/{project_id}/knowledgeBases/{knowledge_base_id}"))
6726    ///         .send().await?;
6727    ///     Ok(())
6728    /// }
6729    /// ```
6730    pub fn delete_knowledge_base(&self) -> super::builder::knowledge_bases::DeleteKnowledgeBase {
6731        super::builder::knowledge_bases::DeleteKnowledgeBase::new(self.inner.clone())
6732    }
6733
6734    /// Updates the specified knowledge base.
6735    ///
6736    /// # Example
6737    /// ```
6738    /// # use google_cloud_dialogflow_v2::client::KnowledgeBases;
6739    /// # extern crate wkt as google_cloud_wkt;
6740    /// use google_cloud_wkt::FieldMask;
6741    /// use google_cloud_dialogflow_v2::model::KnowledgeBase;
6742    /// use google_cloud_dialogflow_v2::Result;
6743    /// async fn sample(
6744    ///    client: &KnowledgeBases, project_id: &str, knowledge_base_id: &str
6745    /// ) -> Result<()> {
6746    ///     let response = client.update_knowledge_base()
6747    ///         .set_knowledge_base(
6748    ///             KnowledgeBase::new().set_name(format!("projects/{project_id}/knowledgeBases/{knowledge_base_id}"))/* set fields */
6749    ///         )
6750    ///         .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
6751    ///         .send().await?;
6752    ///     println!("response {:?}", response);
6753    ///     Ok(())
6754    /// }
6755    /// ```
6756    pub fn update_knowledge_base(&self) -> super::builder::knowledge_bases::UpdateKnowledgeBase {
6757        super::builder::knowledge_bases::UpdateKnowledgeBase::new(self.inner.clone())
6758    }
6759
6760    /// Lists information about the supported locations for this service.
6761    ///
6762    /// This method lists locations based on the resource scope provided in
6763    /// the [ListLocationsRequest.name][google.cloud.location.ListLocationsRequest.name] field: *
6764    /// **Global locations**: If `name` is empty, the method lists the
6765    /// public locations available to all projects. * **Project-specific
6766    /// locations**: If `name` follows the format
6767    /// `projects/{project}`, the method lists locations visible to that
6768    /// specific project. This includes public, private, or other
6769    /// project-specific locations enabled for the project.
6770    ///
6771    /// For gRPC and client library implementations, the resource name is
6772    /// passed as the `name` field. For direct service calls, the resource
6773    /// name is
6774    /// incorporated into the request path based on the specific service
6775    /// implementation and version.
6776    ///
6777    /// [google.cloud.location.ListLocationsRequest.name]: google_cloud_location::model::ListLocationsRequest::name
6778    ///
6779    /// # Example
6780    /// ```
6781    /// # use google_cloud_dialogflow_v2::client::KnowledgeBases;
6782    /// use google_cloud_gax::paginator::ItemPaginator as _;
6783    /// use google_cloud_dialogflow_v2::Result;
6784    /// async fn sample(
6785    ///    client: &KnowledgeBases
6786    /// ) -> Result<()> {
6787    ///     let mut list = client.list_locations()
6788    ///         /* set fields */
6789    ///         .by_item();
6790    ///     while let Some(item) = list.next().await.transpose()? {
6791    ///         println!("{:?}", item);
6792    ///     }
6793    ///     Ok(())
6794    /// }
6795    /// ```
6796    pub fn list_locations(&self) -> super::builder::knowledge_bases::ListLocations {
6797        super::builder::knowledge_bases::ListLocations::new(self.inner.clone())
6798    }
6799
6800    /// Gets information about a location.
6801    ///
6802    /// # Example
6803    /// ```
6804    /// # use google_cloud_dialogflow_v2::client::KnowledgeBases;
6805    /// use google_cloud_dialogflow_v2::Result;
6806    /// async fn sample(
6807    ///    client: &KnowledgeBases
6808    /// ) -> Result<()> {
6809    ///     let response = client.get_location()
6810    ///         /* set fields */
6811    ///         .send().await?;
6812    ///     println!("response {:?}", response);
6813    ///     Ok(())
6814    /// }
6815    /// ```
6816    pub fn get_location(&self) -> super::builder::knowledge_bases::GetLocation {
6817        super::builder::knowledge_bases::GetLocation::new(self.inner.clone())
6818    }
6819
6820    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
6821    ///
6822    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
6823    ///
6824    /// # Example
6825    /// ```
6826    /// # use google_cloud_dialogflow_v2::client::KnowledgeBases;
6827    /// use google_cloud_gax::paginator::ItemPaginator as _;
6828    /// use google_cloud_dialogflow_v2::Result;
6829    /// async fn sample(
6830    ///    client: &KnowledgeBases
6831    /// ) -> Result<()> {
6832    ///     let mut list = client.list_operations()
6833    ///         /* set fields */
6834    ///         .by_item();
6835    ///     while let Some(item) = list.next().await.transpose()? {
6836    ///         println!("{:?}", item);
6837    ///     }
6838    ///     Ok(())
6839    /// }
6840    /// ```
6841    pub fn list_operations(&self) -> super::builder::knowledge_bases::ListOperations {
6842        super::builder::knowledge_bases::ListOperations::new(self.inner.clone())
6843    }
6844
6845    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
6846    ///
6847    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
6848    ///
6849    /// # Example
6850    /// ```
6851    /// # use google_cloud_dialogflow_v2::client::KnowledgeBases;
6852    /// use google_cloud_dialogflow_v2::Result;
6853    /// async fn sample(
6854    ///    client: &KnowledgeBases
6855    /// ) -> Result<()> {
6856    ///     let response = client.get_operation()
6857    ///         /* set fields */
6858    ///         .send().await?;
6859    ///     println!("response {:?}", response);
6860    ///     Ok(())
6861    /// }
6862    /// ```
6863    pub fn get_operation(&self) -> super::builder::knowledge_bases::GetOperation {
6864        super::builder::knowledge_bases::GetOperation::new(self.inner.clone())
6865    }
6866
6867    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
6868    ///
6869    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
6870    ///
6871    /// # Example
6872    /// ```
6873    /// # use google_cloud_dialogflow_v2::client::KnowledgeBases;
6874    /// use google_cloud_dialogflow_v2::Result;
6875    /// async fn sample(
6876    ///    client: &KnowledgeBases
6877    /// ) -> Result<()> {
6878    ///     client.cancel_operation()
6879    ///         /* set fields */
6880    ///         .send().await?;
6881    ///     Ok(())
6882    /// }
6883    /// ```
6884    pub fn cancel_operation(&self) -> super::builder::knowledge_bases::CancelOperation {
6885        super::builder::knowledge_bases::CancelOperation::new(self.inner.clone())
6886    }
6887}
6888
6889/// Implements a client for the Dialogflow API.
6890///
6891/// # Example
6892/// ```
6893/// # use google_cloud_dialogflow_v2::client::Participants;
6894/// use google_cloud_gax::paginator::ItemPaginator as _;
6895/// async fn sample(
6896///    project_id: &str,
6897///    conversation_id: &str,
6898/// ) -> anyhow::Result<()> {
6899///     let client = Participants::builder().build().await?;
6900///     let mut list = client.list_participants()
6901///         .set_parent(format!("projects/{project_id}/conversations/{conversation_id}"))
6902///         .by_item();
6903///     while let Some(item) = list.next().await.transpose()? {
6904///         println!("{:?}", item);
6905///     }
6906///     Ok(())
6907/// }
6908/// ```
6909///
6910/// # Service Description
6911///
6912/// Service for managing [Participants][google.cloud.dialogflow.v2.Participant].
6913///
6914/// [google.cloud.dialogflow.v2.Participant]: crate::model::Participant
6915///
6916/// # Configuration
6917///
6918/// To configure `Participants` use the `with_*` methods in the type returned
6919/// by [builder()][Participants::builder]. The default configuration should
6920/// work for most applications. Common configuration changes include
6921///
6922/// * [with_endpoint()]: by default this client uses the global default endpoint
6923///   (`https://dialogflow.googleapis.com`). Applications using regional
6924///   endpoints or running in restricted networks (e.g. a network configured
6925///   with [Private Google Access with VPC Service Controls]) may want to
6926///   override this default.
6927/// * [with_credentials()]: by default this client uses
6928///   [Application Default Credentials]. Applications using custom
6929///   authentication may need to override this default.
6930///
6931/// [with_endpoint()]: super::builder::participants::ClientBuilder::with_endpoint
6932/// [with_credentials()]: super::builder::participants::ClientBuilder::with_credentials
6933/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
6934/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
6935///
6936/// # Pooling and Cloning
6937///
6938/// `Participants` holds a connection pool internally, it is advised to
6939/// create one and reuse it. You do not need to wrap `Participants` in
6940/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
6941/// already uses an `Arc` internally.
6942#[cfg(feature = "participants")]
6943#[cfg_attr(docsrs, doc(cfg(feature = "participants")))]
6944#[derive(Clone, Debug)]
6945pub struct Participants {
6946    inner: std::sync::Arc<dyn super::stub::dynamic::Participants>,
6947}
6948
6949#[cfg(feature = "participants")]
6950impl Participants {
6951    /// Returns a builder for [Participants].
6952    ///
6953    /// ```
6954    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
6955    /// # use google_cloud_dialogflow_v2::client::Participants;
6956    /// let client = Participants::builder().build().await?;
6957    /// # Ok(()) }
6958    /// ```
6959    pub fn builder() -> super::builder::participants::ClientBuilder {
6960        crate::new_client_builder(super::builder::participants::client::Factory)
6961    }
6962
6963    /// Creates a new client from the provided stub.
6964    ///
6965    /// The most common case for calling this function is in tests mocking the
6966    /// client's behavior.
6967    pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
6968    where
6969        T: super::stub::Participants + 'static,
6970    {
6971        Self { inner: stub.into() }
6972    }
6973
6974    pub(crate) async fn new(
6975        config: gaxi::options::ClientConfig,
6976    ) -> crate::ClientBuilderResult<Self> {
6977        let inner = Self::build_inner(config).await?;
6978        Ok(Self { inner })
6979    }
6980
6981    async fn build_inner(
6982        conf: gaxi::options::ClientConfig,
6983    ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::Participants>> {
6984        if gaxi::options::tracing_enabled(&conf) {
6985            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
6986        }
6987        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
6988    }
6989
6990    async fn build_transport(
6991        conf: gaxi::options::ClientConfig,
6992    ) -> crate::ClientBuilderResult<impl super::stub::Participants> {
6993        super::transport::Participants::new(conf).await
6994    }
6995
6996    async fn build_with_tracing(
6997        conf: gaxi::options::ClientConfig,
6998    ) -> crate::ClientBuilderResult<impl super::stub::Participants> {
6999        Self::build_transport(conf)
7000            .await
7001            .map(super::tracing::Participants::new)
7002    }
7003
7004    /// Creates a new participant in a conversation.
7005    ///
7006    /// # Example
7007    /// ```
7008    /// # use google_cloud_dialogflow_v2::client::Participants;
7009    /// use google_cloud_dialogflow_v2::model::Participant;
7010    /// use google_cloud_dialogflow_v2::Result;
7011    /// async fn sample(
7012    ///    client: &Participants, project_id: &str, conversation_id: &str
7013    /// ) -> Result<()> {
7014    ///     let response = client.create_participant()
7015    ///         .set_parent(format!("projects/{project_id}/conversations/{conversation_id}"))
7016    ///         .set_participant(
7017    ///             Participant::new()/* set fields */
7018    ///         )
7019    ///         .send().await?;
7020    ///     println!("response {:?}", response);
7021    ///     Ok(())
7022    /// }
7023    /// ```
7024    pub fn create_participant(&self) -> super::builder::participants::CreateParticipant {
7025        super::builder::participants::CreateParticipant::new(self.inner.clone())
7026    }
7027
7028    /// Retrieves a conversation participant.
7029    ///
7030    /// # Example
7031    /// ```
7032    /// # use google_cloud_dialogflow_v2::client::Participants;
7033    /// use google_cloud_dialogflow_v2::Result;
7034    /// async fn sample(
7035    ///    client: &Participants, project_id: &str, conversation_id: &str, participant_id: &str
7036    /// ) -> Result<()> {
7037    ///     let response = client.get_participant()
7038    ///         .set_name(format!("projects/{project_id}/conversations/{conversation_id}/participants/{participant_id}"))
7039    ///         .send().await?;
7040    ///     println!("response {:?}", response);
7041    ///     Ok(())
7042    /// }
7043    /// ```
7044    pub fn get_participant(&self) -> super::builder::participants::GetParticipant {
7045        super::builder::participants::GetParticipant::new(self.inner.clone())
7046    }
7047
7048    /// Returns the list of all participants in the specified conversation.
7049    ///
7050    /// # Example
7051    /// ```
7052    /// # use google_cloud_dialogflow_v2::client::Participants;
7053    /// use google_cloud_gax::paginator::ItemPaginator as _;
7054    /// use google_cloud_dialogflow_v2::Result;
7055    /// async fn sample(
7056    ///    client: &Participants, project_id: &str, conversation_id: &str
7057    /// ) -> Result<()> {
7058    ///     let mut list = client.list_participants()
7059    ///         .set_parent(format!("projects/{project_id}/conversations/{conversation_id}"))
7060    ///         .by_item();
7061    ///     while let Some(item) = list.next().await.transpose()? {
7062    ///         println!("{:?}", item);
7063    ///     }
7064    ///     Ok(())
7065    /// }
7066    /// ```
7067    pub fn list_participants(&self) -> super::builder::participants::ListParticipants {
7068        super::builder::participants::ListParticipants::new(self.inner.clone())
7069    }
7070
7071    /// Updates the specified participant.
7072    ///
7073    /// # Example
7074    /// ```
7075    /// # use google_cloud_dialogflow_v2::client::Participants;
7076    /// # extern crate wkt as google_cloud_wkt;
7077    /// use google_cloud_wkt::FieldMask;
7078    /// use google_cloud_dialogflow_v2::model::Participant;
7079    /// use google_cloud_dialogflow_v2::Result;
7080    /// async fn sample(
7081    ///    client: &Participants, project_id: &str, conversation_id: &str, participant_id: &str
7082    /// ) -> Result<()> {
7083    ///     let response = client.update_participant()
7084    ///         .set_participant(
7085    ///             Participant::new().set_name(format!("projects/{project_id}/conversations/{conversation_id}/participants/{participant_id}"))/* set fields */
7086    ///         )
7087    ///         .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
7088    ///         .send().await?;
7089    ///     println!("response {:?}", response);
7090    ///     Ok(())
7091    /// }
7092    /// ```
7093    pub fn update_participant(&self) -> super::builder::participants::UpdateParticipant {
7094        super::builder::participants::UpdateParticipant::new(self.inner.clone())
7095    }
7096
7097    /// Adds a text (chat, for example), or audio (phone recording, for example)
7098    /// message from a participant into the conversation.
7099    ///
7100    /// Note: Always use agent versions for production traffic
7101    /// sent to virtual agents. See [Versions and
7102    /// environments](https://cloud.google.com/dialogflow/es/docs/agents-versions).
7103    ///
7104    /// # Example
7105    /// ```
7106    /// # use google_cloud_dialogflow_v2::client::Participants;
7107    /// use google_cloud_dialogflow_v2::Result;
7108    /// async fn sample(
7109    ///    client: &Participants
7110    /// ) -> Result<()> {
7111    ///     let response = client.analyze_content()
7112    ///         /* set fields */
7113    ///         .send().await?;
7114    ///     println!("response {:?}", response);
7115    ///     Ok(())
7116    /// }
7117    /// ```
7118    pub fn analyze_content(&self) -> super::builder::participants::AnalyzeContent {
7119        super::builder::participants::AnalyzeContent::new(self.inner.clone())
7120    }
7121
7122    /// Gets suggested articles for a participant based on specific historical
7123    /// messages.
7124    ///
7125    /// # Example
7126    /// ```
7127    /// # use google_cloud_dialogflow_v2::client::Participants;
7128    /// use google_cloud_dialogflow_v2::Result;
7129    /// async fn sample(
7130    ///    client: &Participants
7131    /// ) -> Result<()> {
7132    ///     let response = client.suggest_articles()
7133    ///         /* set fields */
7134    ///         .send().await?;
7135    ///     println!("response {:?}", response);
7136    ///     Ok(())
7137    /// }
7138    /// ```
7139    pub fn suggest_articles(&self) -> super::builder::participants::SuggestArticles {
7140        super::builder::participants::SuggestArticles::new(self.inner.clone())
7141    }
7142
7143    /// Gets suggested faq answers for a participant based on specific historical
7144    /// messages.
7145    ///
7146    /// # Example
7147    /// ```
7148    /// # use google_cloud_dialogflow_v2::client::Participants;
7149    /// use google_cloud_dialogflow_v2::Result;
7150    /// async fn sample(
7151    ///    client: &Participants
7152    /// ) -> Result<()> {
7153    ///     let response = client.suggest_faq_answers()
7154    ///         /* set fields */
7155    ///         .send().await?;
7156    ///     println!("response {:?}", response);
7157    ///     Ok(())
7158    /// }
7159    /// ```
7160    pub fn suggest_faq_answers(&self) -> super::builder::participants::SuggestFaqAnswers {
7161        super::builder::participants::SuggestFaqAnswers::new(self.inner.clone())
7162    }
7163
7164    /// Gets smart replies for a participant based on specific historical
7165    /// messages.
7166    ///
7167    /// # Example
7168    /// ```
7169    /// # use google_cloud_dialogflow_v2::client::Participants;
7170    /// use google_cloud_dialogflow_v2::Result;
7171    /// async fn sample(
7172    ///    client: &Participants
7173    /// ) -> Result<()> {
7174    ///     let response = client.suggest_smart_replies()
7175    ///         /* set fields */
7176    ///         .send().await?;
7177    ///     println!("response {:?}", response);
7178    ///     Ok(())
7179    /// }
7180    /// ```
7181    pub fn suggest_smart_replies(&self) -> super::builder::participants::SuggestSmartReplies {
7182        super::builder::participants::SuggestSmartReplies::new(self.inner.clone())
7183    }
7184
7185    /// Gets knowledge assist suggestions based on historical messages.
7186    ///
7187    /// # Example
7188    /// ```
7189    /// # use google_cloud_dialogflow_v2::client::Participants;
7190    /// use google_cloud_dialogflow_v2::Result;
7191    /// async fn sample(
7192    ///    client: &Participants
7193    /// ) -> Result<()> {
7194    ///     let response = client.suggest_knowledge_assist()
7195    ///         /* set fields */
7196    ///         .send().await?;
7197    ///     println!("response {:?}", response);
7198    ///     Ok(())
7199    /// }
7200    /// ```
7201    pub fn suggest_knowledge_assist(&self) -> super::builder::participants::SuggestKnowledgeAssist {
7202        super::builder::participants::SuggestKnowledgeAssist::new(self.inner.clone())
7203    }
7204
7205    /// Lists information about the supported locations for this service.
7206    ///
7207    /// This method lists locations based on the resource scope provided in
7208    /// the [ListLocationsRequest.name][google.cloud.location.ListLocationsRequest.name] field: *
7209    /// **Global locations**: If `name` is empty, the method lists the
7210    /// public locations available to all projects. * **Project-specific
7211    /// locations**: If `name` follows the format
7212    /// `projects/{project}`, the method lists locations visible to that
7213    /// specific project. This includes public, private, or other
7214    /// project-specific locations enabled for the project.
7215    ///
7216    /// For gRPC and client library implementations, the resource name is
7217    /// passed as the `name` field. For direct service calls, the resource
7218    /// name is
7219    /// incorporated into the request path based on the specific service
7220    /// implementation and version.
7221    ///
7222    /// [google.cloud.location.ListLocationsRequest.name]: google_cloud_location::model::ListLocationsRequest::name
7223    ///
7224    /// # Example
7225    /// ```
7226    /// # use google_cloud_dialogflow_v2::client::Participants;
7227    /// use google_cloud_gax::paginator::ItemPaginator as _;
7228    /// use google_cloud_dialogflow_v2::Result;
7229    /// async fn sample(
7230    ///    client: &Participants
7231    /// ) -> Result<()> {
7232    ///     let mut list = client.list_locations()
7233    ///         /* set fields */
7234    ///         .by_item();
7235    ///     while let Some(item) = list.next().await.transpose()? {
7236    ///         println!("{:?}", item);
7237    ///     }
7238    ///     Ok(())
7239    /// }
7240    /// ```
7241    pub fn list_locations(&self) -> super::builder::participants::ListLocations {
7242        super::builder::participants::ListLocations::new(self.inner.clone())
7243    }
7244
7245    /// Gets information about a location.
7246    ///
7247    /// # Example
7248    /// ```
7249    /// # use google_cloud_dialogflow_v2::client::Participants;
7250    /// use google_cloud_dialogflow_v2::Result;
7251    /// async fn sample(
7252    ///    client: &Participants
7253    /// ) -> Result<()> {
7254    ///     let response = client.get_location()
7255    ///         /* set fields */
7256    ///         .send().await?;
7257    ///     println!("response {:?}", response);
7258    ///     Ok(())
7259    /// }
7260    /// ```
7261    pub fn get_location(&self) -> super::builder::participants::GetLocation {
7262        super::builder::participants::GetLocation::new(self.inner.clone())
7263    }
7264
7265    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
7266    ///
7267    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
7268    ///
7269    /// # Example
7270    /// ```
7271    /// # use google_cloud_dialogflow_v2::client::Participants;
7272    /// use google_cloud_gax::paginator::ItemPaginator as _;
7273    /// use google_cloud_dialogflow_v2::Result;
7274    /// async fn sample(
7275    ///    client: &Participants
7276    /// ) -> Result<()> {
7277    ///     let mut list = client.list_operations()
7278    ///         /* set fields */
7279    ///         .by_item();
7280    ///     while let Some(item) = list.next().await.transpose()? {
7281    ///         println!("{:?}", item);
7282    ///     }
7283    ///     Ok(())
7284    /// }
7285    /// ```
7286    pub fn list_operations(&self) -> super::builder::participants::ListOperations {
7287        super::builder::participants::ListOperations::new(self.inner.clone())
7288    }
7289
7290    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
7291    ///
7292    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
7293    ///
7294    /// # Example
7295    /// ```
7296    /// # use google_cloud_dialogflow_v2::client::Participants;
7297    /// use google_cloud_dialogflow_v2::Result;
7298    /// async fn sample(
7299    ///    client: &Participants
7300    /// ) -> Result<()> {
7301    ///     let response = client.get_operation()
7302    ///         /* set fields */
7303    ///         .send().await?;
7304    ///     println!("response {:?}", response);
7305    ///     Ok(())
7306    /// }
7307    /// ```
7308    pub fn get_operation(&self) -> super::builder::participants::GetOperation {
7309        super::builder::participants::GetOperation::new(self.inner.clone())
7310    }
7311
7312    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
7313    ///
7314    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
7315    ///
7316    /// # Example
7317    /// ```
7318    /// # use google_cloud_dialogflow_v2::client::Participants;
7319    /// use google_cloud_dialogflow_v2::Result;
7320    /// async fn sample(
7321    ///    client: &Participants
7322    /// ) -> Result<()> {
7323    ///     client.cancel_operation()
7324    ///         /* set fields */
7325    ///         .send().await?;
7326    ///     Ok(())
7327    /// }
7328    /// ```
7329    pub fn cancel_operation(&self) -> super::builder::participants::CancelOperation {
7330        super::builder::participants::CancelOperation::new(self.inner.clone())
7331    }
7332}
7333
7334/// Implements a client for the Dialogflow API.
7335///
7336/// # Example
7337/// ```
7338/// # use google_cloud_dialogflow_v2::client::Sessions;
7339/// async fn sample(
7340/// ) -> anyhow::Result<()> {
7341///     let client = Sessions::builder().build().await?;
7342///     let response = client.detect_intent()
7343///         /* set fields */
7344///         .send().await?;
7345///     println!("response {:?}", response);
7346///     Ok(())
7347/// }
7348/// ```
7349///
7350/// # Service Description
7351///
7352/// A service used for session interactions.
7353///
7354/// For more information, see the [API interactions
7355/// guide](https://cloud.google.com/dialogflow/docs/api-overview).
7356///
7357/// # Configuration
7358///
7359/// To configure `Sessions` use the `with_*` methods in the type returned
7360/// by [builder()][Sessions::builder]. The default configuration should
7361/// work for most applications. Common configuration changes include
7362///
7363/// * [with_endpoint()]: by default this client uses the global default endpoint
7364///   (`https://dialogflow.googleapis.com`). Applications using regional
7365///   endpoints or running in restricted networks (e.g. a network configured
7366///   with [Private Google Access with VPC Service Controls]) may want to
7367///   override this default.
7368/// * [with_credentials()]: by default this client uses
7369///   [Application Default Credentials]. Applications using custom
7370///   authentication may need to override this default.
7371///
7372/// [with_endpoint()]: super::builder::sessions::ClientBuilder::with_endpoint
7373/// [with_credentials()]: super::builder::sessions::ClientBuilder::with_credentials
7374/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
7375/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
7376///
7377/// # Pooling and Cloning
7378///
7379/// `Sessions` holds a connection pool internally, it is advised to
7380/// create one and reuse it. You do not need to wrap `Sessions` in
7381/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
7382/// already uses an `Arc` internally.
7383#[cfg(feature = "sessions")]
7384#[cfg_attr(docsrs, doc(cfg(feature = "sessions")))]
7385#[derive(Clone, Debug)]
7386pub struct Sessions {
7387    inner: std::sync::Arc<dyn super::stub::dynamic::Sessions>,
7388}
7389
7390#[cfg(feature = "sessions")]
7391impl Sessions {
7392    /// Returns a builder for [Sessions].
7393    ///
7394    /// ```
7395    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
7396    /// # use google_cloud_dialogflow_v2::client::Sessions;
7397    /// let client = Sessions::builder().build().await?;
7398    /// # Ok(()) }
7399    /// ```
7400    pub fn builder() -> super::builder::sessions::ClientBuilder {
7401        crate::new_client_builder(super::builder::sessions::client::Factory)
7402    }
7403
7404    /// Creates a new client from the provided stub.
7405    ///
7406    /// The most common case for calling this function is in tests mocking the
7407    /// client's behavior.
7408    pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
7409    where
7410        T: super::stub::Sessions + 'static,
7411    {
7412        Self { inner: stub.into() }
7413    }
7414
7415    pub(crate) async fn new(
7416        config: gaxi::options::ClientConfig,
7417    ) -> crate::ClientBuilderResult<Self> {
7418        let inner = Self::build_inner(config).await?;
7419        Ok(Self { inner })
7420    }
7421
7422    async fn build_inner(
7423        conf: gaxi::options::ClientConfig,
7424    ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::Sessions>> {
7425        if gaxi::options::tracing_enabled(&conf) {
7426            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
7427        }
7428        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
7429    }
7430
7431    async fn build_transport(
7432        conf: gaxi::options::ClientConfig,
7433    ) -> crate::ClientBuilderResult<impl super::stub::Sessions> {
7434        super::transport::Sessions::new(conf).await
7435    }
7436
7437    async fn build_with_tracing(
7438        conf: gaxi::options::ClientConfig,
7439    ) -> crate::ClientBuilderResult<impl super::stub::Sessions> {
7440        Self::build_transport(conf)
7441            .await
7442            .map(super::tracing::Sessions::new)
7443    }
7444
7445    /// Processes a natural language query and returns structured, actionable data
7446    /// as a result. This method is not idempotent, because it may cause contexts
7447    /// and session entity types to be updated, which in turn might affect
7448    /// results of future queries.
7449    ///
7450    /// If you might use
7451    /// [Agent Assist](https://cloud.google.com/dialogflow/docs/#aa)
7452    /// or other CCAI products now or in the future, consider using
7453    /// [AnalyzeContent][google.cloud.dialogflow.v2.Participants.AnalyzeContent]
7454    /// instead of `DetectIntent`. `AnalyzeContent` has additional
7455    /// functionality for Agent Assist and other CCAI products.
7456    ///
7457    /// Note: Always use agent versions for production traffic.
7458    /// See [Versions and
7459    /// environments](https://cloud.google.com/dialogflow/es/docs/agents-versions).
7460    ///
7461    /// [google.cloud.dialogflow.v2.Participants.AnalyzeContent]: crate::client::Participants::analyze_content
7462    ///
7463    /// # Example
7464    /// ```
7465    /// # use google_cloud_dialogflow_v2::client::Sessions;
7466    /// use google_cloud_dialogflow_v2::Result;
7467    /// async fn sample(
7468    ///    client: &Sessions
7469    /// ) -> Result<()> {
7470    ///     let response = client.detect_intent()
7471    ///         /* set fields */
7472    ///         .send().await?;
7473    ///     println!("response {:?}", response);
7474    ///     Ok(())
7475    /// }
7476    /// ```
7477    pub fn detect_intent(&self) -> super::builder::sessions::DetectIntent {
7478        super::builder::sessions::DetectIntent::new(self.inner.clone())
7479    }
7480
7481    /// Lists information about the supported locations for this service.
7482    ///
7483    /// This method lists locations based on the resource scope provided in
7484    /// the [ListLocationsRequest.name][google.cloud.location.ListLocationsRequest.name] field: *
7485    /// **Global locations**: If `name` is empty, the method lists the
7486    /// public locations available to all projects. * **Project-specific
7487    /// locations**: If `name` follows the format
7488    /// `projects/{project}`, the method lists locations visible to that
7489    /// specific project. This includes public, private, or other
7490    /// project-specific locations enabled for the project.
7491    ///
7492    /// For gRPC and client library implementations, the resource name is
7493    /// passed as the `name` field. For direct service calls, the resource
7494    /// name is
7495    /// incorporated into the request path based on the specific service
7496    /// implementation and version.
7497    ///
7498    /// [google.cloud.location.ListLocationsRequest.name]: google_cloud_location::model::ListLocationsRequest::name
7499    ///
7500    /// # Example
7501    /// ```
7502    /// # use google_cloud_dialogflow_v2::client::Sessions;
7503    /// use google_cloud_gax::paginator::ItemPaginator as _;
7504    /// use google_cloud_dialogflow_v2::Result;
7505    /// async fn sample(
7506    ///    client: &Sessions
7507    /// ) -> Result<()> {
7508    ///     let mut list = client.list_locations()
7509    ///         /* set fields */
7510    ///         .by_item();
7511    ///     while let Some(item) = list.next().await.transpose()? {
7512    ///         println!("{:?}", item);
7513    ///     }
7514    ///     Ok(())
7515    /// }
7516    /// ```
7517    pub fn list_locations(&self) -> super::builder::sessions::ListLocations {
7518        super::builder::sessions::ListLocations::new(self.inner.clone())
7519    }
7520
7521    /// Gets information about a location.
7522    ///
7523    /// # Example
7524    /// ```
7525    /// # use google_cloud_dialogflow_v2::client::Sessions;
7526    /// use google_cloud_dialogflow_v2::Result;
7527    /// async fn sample(
7528    ///    client: &Sessions
7529    /// ) -> Result<()> {
7530    ///     let response = client.get_location()
7531    ///         /* set fields */
7532    ///         .send().await?;
7533    ///     println!("response {:?}", response);
7534    ///     Ok(())
7535    /// }
7536    /// ```
7537    pub fn get_location(&self) -> super::builder::sessions::GetLocation {
7538        super::builder::sessions::GetLocation::new(self.inner.clone())
7539    }
7540
7541    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
7542    ///
7543    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
7544    ///
7545    /// # Example
7546    /// ```
7547    /// # use google_cloud_dialogflow_v2::client::Sessions;
7548    /// use google_cloud_gax::paginator::ItemPaginator as _;
7549    /// use google_cloud_dialogflow_v2::Result;
7550    /// async fn sample(
7551    ///    client: &Sessions
7552    /// ) -> Result<()> {
7553    ///     let mut list = client.list_operations()
7554    ///         /* set fields */
7555    ///         .by_item();
7556    ///     while let Some(item) = list.next().await.transpose()? {
7557    ///         println!("{:?}", item);
7558    ///     }
7559    ///     Ok(())
7560    /// }
7561    /// ```
7562    pub fn list_operations(&self) -> super::builder::sessions::ListOperations {
7563        super::builder::sessions::ListOperations::new(self.inner.clone())
7564    }
7565
7566    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
7567    ///
7568    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
7569    ///
7570    /// # Example
7571    /// ```
7572    /// # use google_cloud_dialogflow_v2::client::Sessions;
7573    /// use google_cloud_dialogflow_v2::Result;
7574    /// async fn sample(
7575    ///    client: &Sessions
7576    /// ) -> Result<()> {
7577    ///     let response = client.get_operation()
7578    ///         /* set fields */
7579    ///         .send().await?;
7580    ///     println!("response {:?}", response);
7581    ///     Ok(())
7582    /// }
7583    /// ```
7584    pub fn get_operation(&self) -> super::builder::sessions::GetOperation {
7585        super::builder::sessions::GetOperation::new(self.inner.clone())
7586    }
7587
7588    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
7589    ///
7590    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
7591    ///
7592    /// # Example
7593    /// ```
7594    /// # use google_cloud_dialogflow_v2::client::Sessions;
7595    /// use google_cloud_dialogflow_v2::Result;
7596    /// async fn sample(
7597    ///    client: &Sessions
7598    /// ) -> Result<()> {
7599    ///     client.cancel_operation()
7600    ///         /* set fields */
7601    ///         .send().await?;
7602    ///     Ok(())
7603    /// }
7604    /// ```
7605    pub fn cancel_operation(&self) -> super::builder::sessions::CancelOperation {
7606        super::builder::sessions::CancelOperation::new(self.inner.clone())
7607    }
7608}
7609
7610/// Implements a client for the Dialogflow API.
7611///
7612/// # Example
7613/// ```
7614/// # use google_cloud_dialogflow_v2::client::SessionEntityTypes;
7615/// use google_cloud_gax::paginator::ItemPaginator as _;
7616/// async fn sample(
7617///    project_id: &str,
7618///    session_id: &str,
7619/// ) -> anyhow::Result<()> {
7620///     let client = SessionEntityTypes::builder().build().await?;
7621///     let mut list = client.list_session_entity_types()
7622///         .set_parent(format!("projects/{project_id}/agent/sessions/{session_id}"))
7623///         .by_item();
7624///     while let Some(item) = list.next().await.transpose()? {
7625///         println!("{:?}", item);
7626///     }
7627///     Ok(())
7628/// }
7629/// ```
7630///
7631/// # Service Description
7632///
7633/// Service for managing
7634/// [SessionEntityTypes][google.cloud.dialogflow.v2.SessionEntityType].
7635///
7636/// [google.cloud.dialogflow.v2.SessionEntityType]: crate::model::SessionEntityType
7637///
7638/// # Configuration
7639///
7640/// To configure `SessionEntityTypes` use the `with_*` methods in the type returned
7641/// by [builder()][SessionEntityTypes::builder]. The default configuration should
7642/// work for most applications. Common configuration changes include
7643///
7644/// * [with_endpoint()]: by default this client uses the global default endpoint
7645///   (`https://dialogflow.googleapis.com`). Applications using regional
7646///   endpoints or running in restricted networks (e.g. a network configured
7647///   with [Private Google Access with VPC Service Controls]) may want to
7648///   override this default.
7649/// * [with_credentials()]: by default this client uses
7650///   [Application Default Credentials]. Applications using custom
7651///   authentication may need to override this default.
7652///
7653/// [with_endpoint()]: super::builder::session_entity_types::ClientBuilder::with_endpoint
7654/// [with_credentials()]: super::builder::session_entity_types::ClientBuilder::with_credentials
7655/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
7656/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
7657///
7658/// # Pooling and Cloning
7659///
7660/// `SessionEntityTypes` holds a connection pool internally, it is advised to
7661/// create one and reuse it. You do not need to wrap `SessionEntityTypes` in
7662/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
7663/// already uses an `Arc` internally.
7664#[cfg(feature = "session-entity-types")]
7665#[cfg_attr(docsrs, doc(cfg(feature = "session-entity-types")))]
7666#[derive(Clone, Debug)]
7667pub struct SessionEntityTypes {
7668    inner: std::sync::Arc<dyn super::stub::dynamic::SessionEntityTypes>,
7669}
7670
7671#[cfg(feature = "session-entity-types")]
7672impl SessionEntityTypes {
7673    /// Returns a builder for [SessionEntityTypes].
7674    ///
7675    /// ```
7676    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
7677    /// # use google_cloud_dialogflow_v2::client::SessionEntityTypes;
7678    /// let client = SessionEntityTypes::builder().build().await?;
7679    /// # Ok(()) }
7680    /// ```
7681    pub fn builder() -> super::builder::session_entity_types::ClientBuilder {
7682        crate::new_client_builder(super::builder::session_entity_types::client::Factory)
7683    }
7684
7685    /// Creates a new client from the provided stub.
7686    ///
7687    /// The most common case for calling this function is in tests mocking the
7688    /// client's behavior.
7689    pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
7690    where
7691        T: super::stub::SessionEntityTypes + 'static,
7692    {
7693        Self { inner: stub.into() }
7694    }
7695
7696    pub(crate) async fn new(
7697        config: gaxi::options::ClientConfig,
7698    ) -> crate::ClientBuilderResult<Self> {
7699        let inner = Self::build_inner(config).await?;
7700        Ok(Self { inner })
7701    }
7702
7703    async fn build_inner(
7704        conf: gaxi::options::ClientConfig,
7705    ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::SessionEntityTypes>>
7706    {
7707        if gaxi::options::tracing_enabled(&conf) {
7708            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
7709        }
7710        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
7711    }
7712
7713    async fn build_transport(
7714        conf: gaxi::options::ClientConfig,
7715    ) -> crate::ClientBuilderResult<impl super::stub::SessionEntityTypes> {
7716        super::transport::SessionEntityTypes::new(conf).await
7717    }
7718
7719    async fn build_with_tracing(
7720        conf: gaxi::options::ClientConfig,
7721    ) -> crate::ClientBuilderResult<impl super::stub::SessionEntityTypes> {
7722        Self::build_transport(conf)
7723            .await
7724            .map(super::tracing::SessionEntityTypes::new)
7725    }
7726
7727    /// Returns the list of all session entity types in the specified session.
7728    ///
7729    /// This method doesn't work with Google Assistant integration.
7730    /// Contact Dialogflow support if you need to use session entities
7731    /// with Google Assistant integration.
7732    ///
7733    /// # Example
7734    /// ```
7735    /// # use google_cloud_dialogflow_v2::client::SessionEntityTypes;
7736    /// use google_cloud_gax::paginator::ItemPaginator as _;
7737    /// use google_cloud_dialogflow_v2::Result;
7738    /// async fn sample(
7739    ///    client: &SessionEntityTypes, project_id: &str, session_id: &str
7740    /// ) -> Result<()> {
7741    ///     let mut list = client.list_session_entity_types()
7742    ///         .set_parent(format!("projects/{project_id}/agent/sessions/{session_id}"))
7743    ///         .by_item();
7744    ///     while let Some(item) = list.next().await.transpose()? {
7745    ///         println!("{:?}", item);
7746    ///     }
7747    ///     Ok(())
7748    /// }
7749    /// ```
7750    pub fn list_session_entity_types(
7751        &self,
7752    ) -> super::builder::session_entity_types::ListSessionEntityTypes {
7753        super::builder::session_entity_types::ListSessionEntityTypes::new(self.inner.clone())
7754    }
7755
7756    /// Retrieves the specified session entity type.
7757    ///
7758    /// This method doesn't work with Google Assistant integration.
7759    /// Contact Dialogflow support if you need to use session entities
7760    /// with Google Assistant integration.
7761    ///
7762    /// # Example
7763    /// ```
7764    /// # use google_cloud_dialogflow_v2::client::SessionEntityTypes;
7765    /// use google_cloud_dialogflow_v2::Result;
7766    /// async fn sample(
7767    ///    client: &SessionEntityTypes, project_id: &str, session_id: &str, entity_type_id: &str
7768    /// ) -> Result<()> {
7769    ///     let response = client.get_session_entity_type()
7770    ///         .set_name(format!("projects/{project_id}/agent/sessions/{session_id}/entityTypes/{entity_type_id}"))
7771    ///         .send().await?;
7772    ///     println!("response {:?}", response);
7773    ///     Ok(())
7774    /// }
7775    /// ```
7776    pub fn get_session_entity_type(
7777        &self,
7778    ) -> super::builder::session_entity_types::GetSessionEntityType {
7779        super::builder::session_entity_types::GetSessionEntityType::new(self.inner.clone())
7780    }
7781
7782    /// Creates a session entity type.
7783    ///
7784    /// If the specified session entity type already exists, overrides the session
7785    /// entity type.
7786    ///
7787    /// This method doesn't work with Google Assistant integration.
7788    /// Contact Dialogflow support if you need to use session entities
7789    /// with Google Assistant integration.
7790    ///
7791    /// # Example
7792    /// ```
7793    /// # use google_cloud_dialogflow_v2::client::SessionEntityTypes;
7794    /// use google_cloud_dialogflow_v2::model::SessionEntityType;
7795    /// use google_cloud_dialogflow_v2::Result;
7796    /// async fn sample(
7797    ///    client: &SessionEntityTypes, project_id: &str, session_id: &str
7798    /// ) -> Result<()> {
7799    ///     let response = client.create_session_entity_type()
7800    ///         .set_parent(format!("projects/{project_id}/agent/sessions/{session_id}"))
7801    ///         .set_session_entity_type(
7802    ///             SessionEntityType::new()/* set fields */
7803    ///         )
7804    ///         .send().await?;
7805    ///     println!("response {:?}", response);
7806    ///     Ok(())
7807    /// }
7808    /// ```
7809    pub fn create_session_entity_type(
7810        &self,
7811    ) -> super::builder::session_entity_types::CreateSessionEntityType {
7812        super::builder::session_entity_types::CreateSessionEntityType::new(self.inner.clone())
7813    }
7814
7815    /// Updates the specified session entity type.
7816    ///
7817    /// This method doesn't work with Google Assistant integration.
7818    /// Contact Dialogflow support if you need to use session entities
7819    /// with Google Assistant integration.
7820    ///
7821    /// # Example
7822    /// ```
7823    /// # use google_cloud_dialogflow_v2::client::SessionEntityTypes;
7824    /// # extern crate wkt as google_cloud_wkt;
7825    /// use google_cloud_wkt::FieldMask;
7826    /// use google_cloud_dialogflow_v2::model::SessionEntityType;
7827    /// use google_cloud_dialogflow_v2::Result;
7828    /// async fn sample(
7829    ///    client: &SessionEntityTypes, project_id: &str, session_id: &str, entity_type_id: &str
7830    /// ) -> Result<()> {
7831    ///     let response = client.update_session_entity_type()
7832    ///         .set_session_entity_type(
7833    ///             SessionEntityType::new().set_name(format!("projects/{project_id}/agent/sessions/{session_id}/entityTypes/{entity_type_id}"))/* set fields */
7834    ///         )
7835    ///         .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
7836    ///         .send().await?;
7837    ///     println!("response {:?}", response);
7838    ///     Ok(())
7839    /// }
7840    /// ```
7841    pub fn update_session_entity_type(
7842        &self,
7843    ) -> super::builder::session_entity_types::UpdateSessionEntityType {
7844        super::builder::session_entity_types::UpdateSessionEntityType::new(self.inner.clone())
7845    }
7846
7847    /// Deletes the specified session entity type.
7848    ///
7849    /// This method doesn't work with Google Assistant integration.
7850    /// Contact Dialogflow support if you need to use session entities
7851    /// with Google Assistant integration.
7852    ///
7853    /// # Example
7854    /// ```
7855    /// # use google_cloud_dialogflow_v2::client::SessionEntityTypes;
7856    /// use google_cloud_dialogflow_v2::Result;
7857    /// async fn sample(
7858    ///    client: &SessionEntityTypes, project_id: &str, session_id: &str, entity_type_id: &str
7859    /// ) -> Result<()> {
7860    ///     client.delete_session_entity_type()
7861    ///         .set_name(format!("projects/{project_id}/agent/sessions/{session_id}/entityTypes/{entity_type_id}"))
7862    ///         .send().await?;
7863    ///     Ok(())
7864    /// }
7865    /// ```
7866    pub fn delete_session_entity_type(
7867        &self,
7868    ) -> super::builder::session_entity_types::DeleteSessionEntityType {
7869        super::builder::session_entity_types::DeleteSessionEntityType::new(self.inner.clone())
7870    }
7871
7872    /// Lists information about the supported locations for this service.
7873    ///
7874    /// This method lists locations based on the resource scope provided in
7875    /// the [ListLocationsRequest.name][google.cloud.location.ListLocationsRequest.name] field: *
7876    /// **Global locations**: If `name` is empty, the method lists the
7877    /// public locations available to all projects. * **Project-specific
7878    /// locations**: If `name` follows the format
7879    /// `projects/{project}`, the method lists locations visible to that
7880    /// specific project. This includes public, private, or other
7881    /// project-specific locations enabled for the project.
7882    ///
7883    /// For gRPC and client library implementations, the resource name is
7884    /// passed as the `name` field. For direct service calls, the resource
7885    /// name is
7886    /// incorporated into the request path based on the specific service
7887    /// implementation and version.
7888    ///
7889    /// [google.cloud.location.ListLocationsRequest.name]: google_cloud_location::model::ListLocationsRequest::name
7890    ///
7891    /// # Example
7892    /// ```
7893    /// # use google_cloud_dialogflow_v2::client::SessionEntityTypes;
7894    /// use google_cloud_gax::paginator::ItemPaginator as _;
7895    /// use google_cloud_dialogflow_v2::Result;
7896    /// async fn sample(
7897    ///    client: &SessionEntityTypes
7898    /// ) -> Result<()> {
7899    ///     let mut list = client.list_locations()
7900    ///         /* set fields */
7901    ///         .by_item();
7902    ///     while let Some(item) = list.next().await.transpose()? {
7903    ///         println!("{:?}", item);
7904    ///     }
7905    ///     Ok(())
7906    /// }
7907    /// ```
7908    pub fn list_locations(&self) -> super::builder::session_entity_types::ListLocations {
7909        super::builder::session_entity_types::ListLocations::new(self.inner.clone())
7910    }
7911
7912    /// Gets information about a location.
7913    ///
7914    /// # Example
7915    /// ```
7916    /// # use google_cloud_dialogflow_v2::client::SessionEntityTypes;
7917    /// use google_cloud_dialogflow_v2::Result;
7918    /// async fn sample(
7919    ///    client: &SessionEntityTypes
7920    /// ) -> Result<()> {
7921    ///     let response = client.get_location()
7922    ///         /* set fields */
7923    ///         .send().await?;
7924    ///     println!("response {:?}", response);
7925    ///     Ok(())
7926    /// }
7927    /// ```
7928    pub fn get_location(&self) -> super::builder::session_entity_types::GetLocation {
7929        super::builder::session_entity_types::GetLocation::new(self.inner.clone())
7930    }
7931
7932    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
7933    ///
7934    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
7935    ///
7936    /// # Example
7937    /// ```
7938    /// # use google_cloud_dialogflow_v2::client::SessionEntityTypes;
7939    /// use google_cloud_gax::paginator::ItemPaginator as _;
7940    /// use google_cloud_dialogflow_v2::Result;
7941    /// async fn sample(
7942    ///    client: &SessionEntityTypes
7943    /// ) -> Result<()> {
7944    ///     let mut list = client.list_operations()
7945    ///         /* set fields */
7946    ///         .by_item();
7947    ///     while let Some(item) = list.next().await.transpose()? {
7948    ///         println!("{:?}", item);
7949    ///     }
7950    ///     Ok(())
7951    /// }
7952    /// ```
7953    pub fn list_operations(&self) -> super::builder::session_entity_types::ListOperations {
7954        super::builder::session_entity_types::ListOperations::new(self.inner.clone())
7955    }
7956
7957    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
7958    ///
7959    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
7960    ///
7961    /// # Example
7962    /// ```
7963    /// # use google_cloud_dialogflow_v2::client::SessionEntityTypes;
7964    /// use google_cloud_dialogflow_v2::Result;
7965    /// async fn sample(
7966    ///    client: &SessionEntityTypes
7967    /// ) -> Result<()> {
7968    ///     let response = client.get_operation()
7969    ///         /* set fields */
7970    ///         .send().await?;
7971    ///     println!("response {:?}", response);
7972    ///     Ok(())
7973    /// }
7974    /// ```
7975    pub fn get_operation(&self) -> super::builder::session_entity_types::GetOperation {
7976        super::builder::session_entity_types::GetOperation::new(self.inner.clone())
7977    }
7978
7979    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
7980    ///
7981    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
7982    ///
7983    /// # Example
7984    /// ```
7985    /// # use google_cloud_dialogflow_v2::client::SessionEntityTypes;
7986    /// use google_cloud_dialogflow_v2::Result;
7987    /// async fn sample(
7988    ///    client: &SessionEntityTypes
7989    /// ) -> Result<()> {
7990    ///     client.cancel_operation()
7991    ///         /* set fields */
7992    ///         .send().await?;
7993    ///     Ok(())
7994    /// }
7995    /// ```
7996    pub fn cancel_operation(&self) -> super::builder::session_entity_types::CancelOperation {
7997        super::builder::session_entity_types::CancelOperation::new(self.inner.clone())
7998    }
7999}
8000
8001/// Implements a client for the Dialogflow API.
8002///
8003/// # Example
8004/// ```
8005/// # use google_cloud_dialogflow_v2::client::SipTrunks;
8006/// use google_cloud_gax::paginator::ItemPaginator as _;
8007/// async fn sample(
8008///    project_id: &str,
8009///    location_id: &str,
8010/// ) -> anyhow::Result<()> {
8011///     let client = SipTrunks::builder().build().await?;
8012///     let mut list = client.list_sip_trunks()
8013///         .set_parent(format!("projects/{project_id}/locations/{location_id}"))
8014///         .by_item();
8015///     while let Some(item) = list.next().await.transpose()? {
8016///         println!("{:?}", item);
8017///     }
8018///     Ok(())
8019/// }
8020/// ```
8021///
8022/// # Service Description
8023///
8024/// Service for managing [SipTrunks][google.cloud.dialogflow.v2.SipTrunk].
8025///
8026/// [google.cloud.dialogflow.v2.SipTrunk]: crate::model::SipTrunk
8027///
8028/// # Configuration
8029///
8030/// To configure `SipTrunks` use the `with_*` methods in the type returned
8031/// by [builder()][SipTrunks::builder]. The default configuration should
8032/// work for most applications. Common configuration changes include
8033///
8034/// * [with_endpoint()]: by default this client uses the global default endpoint
8035///   (`https://dialogflow.googleapis.com`). Applications using regional
8036///   endpoints or running in restricted networks (e.g. a network configured
8037///   with [Private Google Access with VPC Service Controls]) may want to
8038///   override this default.
8039/// * [with_credentials()]: by default this client uses
8040///   [Application Default Credentials]. Applications using custom
8041///   authentication may need to override this default.
8042///
8043/// [with_endpoint()]: super::builder::sip_trunks::ClientBuilder::with_endpoint
8044/// [with_credentials()]: super::builder::sip_trunks::ClientBuilder::with_credentials
8045/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
8046/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
8047///
8048/// # Pooling and Cloning
8049///
8050/// `SipTrunks` holds a connection pool internally, it is advised to
8051/// create one and reuse it. You do not need to wrap `SipTrunks` in
8052/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
8053/// already uses an `Arc` internally.
8054#[cfg(feature = "sip-trunks")]
8055#[cfg_attr(docsrs, doc(cfg(feature = "sip-trunks")))]
8056#[derive(Clone, Debug)]
8057pub struct SipTrunks {
8058    inner: std::sync::Arc<dyn super::stub::dynamic::SipTrunks>,
8059}
8060
8061#[cfg(feature = "sip-trunks")]
8062impl SipTrunks {
8063    /// Returns a builder for [SipTrunks].
8064    ///
8065    /// ```
8066    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
8067    /// # use google_cloud_dialogflow_v2::client::SipTrunks;
8068    /// let client = SipTrunks::builder().build().await?;
8069    /// # Ok(()) }
8070    /// ```
8071    pub fn builder() -> super::builder::sip_trunks::ClientBuilder {
8072        crate::new_client_builder(super::builder::sip_trunks::client::Factory)
8073    }
8074
8075    /// Creates a new client from the provided stub.
8076    ///
8077    /// The most common case for calling this function is in tests mocking the
8078    /// client's behavior.
8079    pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
8080    where
8081        T: super::stub::SipTrunks + 'static,
8082    {
8083        Self { inner: stub.into() }
8084    }
8085
8086    pub(crate) async fn new(
8087        config: gaxi::options::ClientConfig,
8088    ) -> crate::ClientBuilderResult<Self> {
8089        let inner = Self::build_inner(config).await?;
8090        Ok(Self { inner })
8091    }
8092
8093    async fn build_inner(
8094        conf: gaxi::options::ClientConfig,
8095    ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::SipTrunks>> {
8096        if gaxi::options::tracing_enabled(&conf) {
8097            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
8098        }
8099        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
8100    }
8101
8102    async fn build_transport(
8103        conf: gaxi::options::ClientConfig,
8104    ) -> crate::ClientBuilderResult<impl super::stub::SipTrunks> {
8105        super::transport::SipTrunks::new(conf).await
8106    }
8107
8108    async fn build_with_tracing(
8109        conf: gaxi::options::ClientConfig,
8110    ) -> crate::ClientBuilderResult<impl super::stub::SipTrunks> {
8111        Self::build_transport(conf)
8112            .await
8113            .map(super::tracing::SipTrunks::new)
8114    }
8115
8116    /// Creates a SipTrunk for a specified location.
8117    ///
8118    /// # Example
8119    /// ```
8120    /// # use google_cloud_dialogflow_v2::client::SipTrunks;
8121    /// use google_cloud_dialogflow_v2::model::SipTrunk;
8122    /// use google_cloud_dialogflow_v2::Result;
8123    /// async fn sample(
8124    ///    client: &SipTrunks, project_id: &str, location_id: &str
8125    /// ) -> Result<()> {
8126    ///     let response = client.create_sip_trunk()
8127    ///         .set_parent(format!("projects/{project_id}/locations/{location_id}"))
8128    ///         .set_sip_trunk(
8129    ///             SipTrunk::new()/* set fields */
8130    ///         )
8131    ///         .send().await?;
8132    ///     println!("response {:?}", response);
8133    ///     Ok(())
8134    /// }
8135    /// ```
8136    pub fn create_sip_trunk(&self) -> super::builder::sip_trunks::CreateSipTrunk {
8137        super::builder::sip_trunks::CreateSipTrunk::new(self.inner.clone())
8138    }
8139
8140    /// Deletes a specified SipTrunk.
8141    ///
8142    /// # Example
8143    /// ```
8144    /// # use google_cloud_dialogflow_v2::client::SipTrunks;
8145    /// use google_cloud_dialogflow_v2::Result;
8146    /// async fn sample(
8147    ///    client: &SipTrunks, project_id: &str, location_id: &str, siptrunk_id: &str
8148    /// ) -> Result<()> {
8149    ///     client.delete_sip_trunk()
8150    ///         .set_name(format!("projects/{project_id}/locations/{location_id}/sipTrunks/{siptrunk_id}"))
8151    ///         .send().await?;
8152    ///     Ok(())
8153    /// }
8154    /// ```
8155    pub fn delete_sip_trunk(&self) -> super::builder::sip_trunks::DeleteSipTrunk {
8156        super::builder::sip_trunks::DeleteSipTrunk::new(self.inner.clone())
8157    }
8158
8159    /// Returns a list of SipTrunks in the specified location.
8160    ///
8161    /// # Example
8162    /// ```
8163    /// # use google_cloud_dialogflow_v2::client::SipTrunks;
8164    /// use google_cloud_gax::paginator::ItemPaginator as _;
8165    /// use google_cloud_dialogflow_v2::Result;
8166    /// async fn sample(
8167    ///    client: &SipTrunks, project_id: &str, location_id: &str
8168    /// ) -> Result<()> {
8169    ///     let mut list = client.list_sip_trunks()
8170    ///         .set_parent(format!("projects/{project_id}/locations/{location_id}"))
8171    ///         .by_item();
8172    ///     while let Some(item) = list.next().await.transpose()? {
8173    ///         println!("{:?}", item);
8174    ///     }
8175    ///     Ok(())
8176    /// }
8177    /// ```
8178    pub fn list_sip_trunks(&self) -> super::builder::sip_trunks::ListSipTrunks {
8179        super::builder::sip_trunks::ListSipTrunks::new(self.inner.clone())
8180    }
8181
8182    /// Retrieves the specified SipTrunk.
8183    ///
8184    /// # Example
8185    /// ```
8186    /// # use google_cloud_dialogflow_v2::client::SipTrunks;
8187    /// use google_cloud_dialogflow_v2::Result;
8188    /// async fn sample(
8189    ///    client: &SipTrunks, project_id: &str, location_id: &str, siptrunk_id: &str
8190    /// ) -> Result<()> {
8191    ///     let response = client.get_sip_trunk()
8192    ///         .set_name(format!("projects/{project_id}/locations/{location_id}/sipTrunks/{siptrunk_id}"))
8193    ///         .send().await?;
8194    ///     println!("response {:?}", response);
8195    ///     Ok(())
8196    /// }
8197    /// ```
8198    pub fn get_sip_trunk(&self) -> super::builder::sip_trunks::GetSipTrunk {
8199        super::builder::sip_trunks::GetSipTrunk::new(self.inner.clone())
8200    }
8201
8202    /// Updates the specified SipTrunk.
8203    ///
8204    /// # Example
8205    /// ```
8206    /// # use google_cloud_dialogflow_v2::client::SipTrunks;
8207    /// # extern crate wkt as google_cloud_wkt;
8208    /// use google_cloud_wkt::FieldMask;
8209    /// use google_cloud_dialogflow_v2::model::SipTrunk;
8210    /// use google_cloud_dialogflow_v2::Result;
8211    /// async fn sample(
8212    ///    client: &SipTrunks, project_id: &str, location_id: &str, siptrunk_id: &str
8213    /// ) -> Result<()> {
8214    ///     let response = client.update_sip_trunk()
8215    ///         .set_sip_trunk(
8216    ///             SipTrunk::new().set_name(format!("projects/{project_id}/locations/{location_id}/sipTrunks/{siptrunk_id}"))/* set fields */
8217    ///         )
8218    ///         .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
8219    ///         .send().await?;
8220    ///     println!("response {:?}", response);
8221    ///     Ok(())
8222    /// }
8223    /// ```
8224    pub fn update_sip_trunk(&self) -> super::builder::sip_trunks::UpdateSipTrunk {
8225        super::builder::sip_trunks::UpdateSipTrunk::new(self.inner.clone())
8226    }
8227
8228    /// Lists information about the supported locations for this service.
8229    ///
8230    /// This method lists locations based on the resource scope provided in
8231    /// the [ListLocationsRequest.name][google.cloud.location.ListLocationsRequest.name] field: *
8232    /// **Global locations**: If `name` is empty, the method lists the
8233    /// public locations available to all projects. * **Project-specific
8234    /// locations**: If `name` follows the format
8235    /// `projects/{project}`, the method lists locations visible to that
8236    /// specific project. This includes public, private, or other
8237    /// project-specific locations enabled for the project.
8238    ///
8239    /// For gRPC and client library implementations, the resource name is
8240    /// passed as the `name` field. For direct service calls, the resource
8241    /// name is
8242    /// incorporated into the request path based on the specific service
8243    /// implementation and version.
8244    ///
8245    /// [google.cloud.location.ListLocationsRequest.name]: google_cloud_location::model::ListLocationsRequest::name
8246    ///
8247    /// # Example
8248    /// ```
8249    /// # use google_cloud_dialogflow_v2::client::SipTrunks;
8250    /// use google_cloud_gax::paginator::ItemPaginator as _;
8251    /// use google_cloud_dialogflow_v2::Result;
8252    /// async fn sample(
8253    ///    client: &SipTrunks
8254    /// ) -> Result<()> {
8255    ///     let mut list = client.list_locations()
8256    ///         /* set fields */
8257    ///         .by_item();
8258    ///     while let Some(item) = list.next().await.transpose()? {
8259    ///         println!("{:?}", item);
8260    ///     }
8261    ///     Ok(())
8262    /// }
8263    /// ```
8264    pub fn list_locations(&self) -> super::builder::sip_trunks::ListLocations {
8265        super::builder::sip_trunks::ListLocations::new(self.inner.clone())
8266    }
8267
8268    /// Gets information about a location.
8269    ///
8270    /// # Example
8271    /// ```
8272    /// # use google_cloud_dialogflow_v2::client::SipTrunks;
8273    /// use google_cloud_dialogflow_v2::Result;
8274    /// async fn sample(
8275    ///    client: &SipTrunks
8276    /// ) -> Result<()> {
8277    ///     let response = client.get_location()
8278    ///         /* set fields */
8279    ///         .send().await?;
8280    ///     println!("response {:?}", response);
8281    ///     Ok(())
8282    /// }
8283    /// ```
8284    pub fn get_location(&self) -> super::builder::sip_trunks::GetLocation {
8285        super::builder::sip_trunks::GetLocation::new(self.inner.clone())
8286    }
8287
8288    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
8289    ///
8290    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
8291    ///
8292    /// # Example
8293    /// ```
8294    /// # use google_cloud_dialogflow_v2::client::SipTrunks;
8295    /// use google_cloud_gax::paginator::ItemPaginator as _;
8296    /// use google_cloud_dialogflow_v2::Result;
8297    /// async fn sample(
8298    ///    client: &SipTrunks
8299    /// ) -> Result<()> {
8300    ///     let mut list = client.list_operations()
8301    ///         /* set fields */
8302    ///         .by_item();
8303    ///     while let Some(item) = list.next().await.transpose()? {
8304    ///         println!("{:?}", item);
8305    ///     }
8306    ///     Ok(())
8307    /// }
8308    /// ```
8309    pub fn list_operations(&self) -> super::builder::sip_trunks::ListOperations {
8310        super::builder::sip_trunks::ListOperations::new(self.inner.clone())
8311    }
8312
8313    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
8314    ///
8315    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
8316    ///
8317    /// # Example
8318    /// ```
8319    /// # use google_cloud_dialogflow_v2::client::SipTrunks;
8320    /// use google_cloud_dialogflow_v2::Result;
8321    /// async fn sample(
8322    ///    client: &SipTrunks
8323    /// ) -> Result<()> {
8324    ///     let response = client.get_operation()
8325    ///         /* set fields */
8326    ///         .send().await?;
8327    ///     println!("response {:?}", response);
8328    ///     Ok(())
8329    /// }
8330    /// ```
8331    pub fn get_operation(&self) -> super::builder::sip_trunks::GetOperation {
8332        super::builder::sip_trunks::GetOperation::new(self.inner.clone())
8333    }
8334
8335    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
8336    ///
8337    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
8338    ///
8339    /// # Example
8340    /// ```
8341    /// # use google_cloud_dialogflow_v2::client::SipTrunks;
8342    /// use google_cloud_dialogflow_v2::Result;
8343    /// async fn sample(
8344    ///    client: &SipTrunks
8345    /// ) -> Result<()> {
8346    ///     client.cancel_operation()
8347    ///         /* set fields */
8348    ///         .send().await?;
8349    ///     Ok(())
8350    /// }
8351    /// ```
8352    pub fn cancel_operation(&self) -> super::builder::sip_trunks::CancelOperation {
8353        super::builder::sip_trunks::CancelOperation::new(self.inner.clone())
8354    }
8355}
8356
8357/// Implements a client for the Dialogflow API.
8358///
8359/// # Example
8360/// ```
8361/// # use google_cloud_dialogflow_v2::client::Tools;
8362/// use google_cloud_gax::paginator::ItemPaginator as _;
8363/// async fn sample(
8364///    project_id: &str,
8365///    location_id: &str,
8366/// ) -> anyhow::Result<()> {
8367///     let client = Tools::builder().build().await?;
8368///     let mut list = client.list_tools()
8369///         .set_parent(format!("projects/{project_id}/locations/{location_id}"))
8370///         .by_item();
8371///     while let Some(item) = list.next().await.transpose()? {
8372///         println!("{:?}", item);
8373///     }
8374///     Ok(())
8375/// }
8376/// ```
8377///
8378/// # Service Description
8379///
8380/// Tool Service for LLM powered Agent Assist. Tools can be used to interact with
8381/// remote APIs (e.g. fetching orders) to retrieve additional information as
8382/// input to LLM.
8383///
8384/// # Configuration
8385///
8386/// To configure `Tools` use the `with_*` methods in the type returned
8387/// by [builder()][Tools::builder]. The default configuration should
8388/// work for most applications. Common configuration changes include
8389///
8390/// * [with_endpoint()]: by default this client uses the global default endpoint
8391///   (`https://dialogflow.googleapis.com`). Applications using regional
8392///   endpoints or running in restricted networks (e.g. a network configured
8393///   with [Private Google Access with VPC Service Controls]) may want to
8394///   override this default.
8395/// * [with_credentials()]: by default this client uses
8396///   [Application Default Credentials]. Applications using custom
8397///   authentication may need to override this default.
8398///
8399/// [with_endpoint()]: super::builder::tools::ClientBuilder::with_endpoint
8400/// [with_credentials()]: super::builder::tools::ClientBuilder::with_credentials
8401/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
8402/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
8403///
8404/// # Pooling and Cloning
8405///
8406/// `Tools` holds a connection pool internally, it is advised to
8407/// create one and reuse it. You do not need to wrap `Tools` in
8408/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
8409/// already uses an `Arc` internally.
8410#[cfg(feature = "tools")]
8411#[cfg_attr(docsrs, doc(cfg(feature = "tools")))]
8412#[derive(Clone, Debug)]
8413pub struct Tools {
8414    inner: std::sync::Arc<dyn super::stub::dynamic::Tools>,
8415}
8416
8417#[cfg(feature = "tools")]
8418impl Tools {
8419    /// Returns a builder for [Tools].
8420    ///
8421    /// ```
8422    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
8423    /// # use google_cloud_dialogflow_v2::client::Tools;
8424    /// let client = Tools::builder().build().await?;
8425    /// # Ok(()) }
8426    /// ```
8427    pub fn builder() -> super::builder::tools::ClientBuilder {
8428        crate::new_client_builder(super::builder::tools::client::Factory)
8429    }
8430
8431    /// Creates a new client from the provided stub.
8432    ///
8433    /// The most common case for calling this function is in tests mocking the
8434    /// client's behavior.
8435    pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
8436    where
8437        T: super::stub::Tools + 'static,
8438    {
8439        Self { inner: stub.into() }
8440    }
8441
8442    pub(crate) async fn new(
8443        config: gaxi::options::ClientConfig,
8444    ) -> crate::ClientBuilderResult<Self> {
8445        let inner = Self::build_inner(config).await?;
8446        Ok(Self { inner })
8447    }
8448
8449    async fn build_inner(
8450        conf: gaxi::options::ClientConfig,
8451    ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::Tools>> {
8452        if gaxi::options::tracing_enabled(&conf) {
8453            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
8454        }
8455        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
8456    }
8457
8458    async fn build_transport(
8459        conf: gaxi::options::ClientConfig,
8460    ) -> crate::ClientBuilderResult<impl super::stub::Tools> {
8461        super::transport::Tools::new(conf).await
8462    }
8463
8464    async fn build_with_tracing(
8465        conf: gaxi::options::ClientConfig,
8466    ) -> crate::ClientBuilderResult<impl super::stub::Tools> {
8467        Self::build_transport(conf)
8468            .await
8469            .map(super::tracing::Tools::new)
8470    }
8471
8472    /// Creates a tool.
8473    ///
8474    /// # Example
8475    /// ```
8476    /// # use google_cloud_dialogflow_v2::client::Tools;
8477    /// use google_cloud_dialogflow_v2::model::Tool;
8478    /// use google_cloud_dialogflow_v2::Result;
8479    /// async fn sample(
8480    ///    client: &Tools, project_id: &str, location_id: &str
8481    /// ) -> Result<()> {
8482    ///     let response = client.create_tool()
8483    ///         .set_parent(format!("projects/{project_id}/locations/{location_id}"))
8484    ///         .set_tool_id("tool_id_value")
8485    ///         .set_tool(
8486    ///             Tool::new()/* set fields */
8487    ///         )
8488    ///         .send().await?;
8489    ///     println!("response {:?}", response);
8490    ///     Ok(())
8491    /// }
8492    /// ```
8493    pub fn create_tool(&self) -> super::builder::tools::CreateTool {
8494        super::builder::tools::CreateTool::new(self.inner.clone())
8495    }
8496
8497    /// Retrieves a tool.
8498    ///
8499    /// # Example
8500    /// ```
8501    /// # use google_cloud_dialogflow_v2::client::Tools;
8502    /// use google_cloud_dialogflow_v2::Result;
8503    /// async fn sample(
8504    ///    client: &Tools, project_id: &str, location_id: &str, tool_id: &str
8505    /// ) -> Result<()> {
8506    ///     let response = client.get_tool()
8507    ///         .set_name(format!("projects/{project_id}/locations/{location_id}/tools/{tool_id}"))
8508    ///         .send().await?;
8509    ///     println!("response {:?}", response);
8510    ///     Ok(())
8511    /// }
8512    /// ```
8513    pub fn get_tool(&self) -> super::builder::tools::GetTool {
8514        super::builder::tools::GetTool::new(self.inner.clone())
8515    }
8516
8517    /// Lists tools.
8518    ///
8519    /// # Example
8520    /// ```
8521    /// # use google_cloud_dialogflow_v2::client::Tools;
8522    /// use google_cloud_gax::paginator::ItemPaginator as _;
8523    /// use google_cloud_dialogflow_v2::Result;
8524    /// async fn sample(
8525    ///    client: &Tools, project_id: &str, location_id: &str
8526    /// ) -> Result<()> {
8527    ///     let mut list = client.list_tools()
8528    ///         .set_parent(format!("projects/{project_id}/locations/{location_id}"))
8529    ///         .by_item();
8530    ///     while let Some(item) = list.next().await.transpose()? {
8531    ///         println!("{:?}", item);
8532    ///     }
8533    ///     Ok(())
8534    /// }
8535    /// ```
8536    pub fn list_tools(&self) -> super::builder::tools::ListTools {
8537        super::builder::tools::ListTools::new(self.inner.clone())
8538    }
8539
8540    /// Deletes a tool.
8541    ///
8542    /// # Example
8543    /// ```
8544    /// # use google_cloud_dialogflow_v2::client::Tools;
8545    /// use google_cloud_dialogflow_v2::Result;
8546    /// async fn sample(
8547    ///    client: &Tools, project_id: &str, location_id: &str, tool_id: &str
8548    /// ) -> Result<()> {
8549    ///     client.delete_tool()
8550    ///         .set_name(format!("projects/{project_id}/locations/{location_id}/tools/{tool_id}"))
8551    ///         .send().await?;
8552    ///     Ok(())
8553    /// }
8554    /// ```
8555    pub fn delete_tool(&self) -> super::builder::tools::DeleteTool {
8556        super::builder::tools::DeleteTool::new(self.inner.clone())
8557    }
8558
8559    /// Updates a tool.
8560    ///
8561    /// # Example
8562    /// ```
8563    /// # use google_cloud_dialogflow_v2::client::Tools;
8564    /// # extern crate wkt as google_cloud_wkt;
8565    /// use google_cloud_wkt::FieldMask;
8566    /// use google_cloud_dialogflow_v2::model::Tool;
8567    /// use google_cloud_dialogflow_v2::Result;
8568    /// async fn sample(
8569    ///    client: &Tools, project_id: &str, location_id: &str, tool_id: &str
8570    /// ) -> Result<()> {
8571    ///     let response = client.update_tool()
8572    ///         .set_tool(
8573    ///             Tool::new().set_name(format!("projects/{project_id}/locations/{location_id}/tools/{tool_id}"))/* set fields */
8574    ///         )
8575    ///         .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
8576    ///         .send().await?;
8577    ///     println!("response {:?}", response);
8578    ///     Ok(())
8579    /// }
8580    /// ```
8581    pub fn update_tool(&self) -> super::builder::tools::UpdateTool {
8582        super::builder::tools::UpdateTool::new(self.inner.clone())
8583    }
8584
8585    /// Lists information about the supported locations for this service.
8586    ///
8587    /// This method lists locations based on the resource scope provided in
8588    /// the [ListLocationsRequest.name][google.cloud.location.ListLocationsRequest.name] field: *
8589    /// **Global locations**: If `name` is empty, the method lists the
8590    /// public locations available to all projects. * **Project-specific
8591    /// locations**: If `name` follows the format
8592    /// `projects/{project}`, the method lists locations visible to that
8593    /// specific project. This includes public, private, or other
8594    /// project-specific locations enabled for the project.
8595    ///
8596    /// For gRPC and client library implementations, the resource name is
8597    /// passed as the `name` field. For direct service calls, the resource
8598    /// name is
8599    /// incorporated into the request path based on the specific service
8600    /// implementation and version.
8601    ///
8602    /// [google.cloud.location.ListLocationsRequest.name]: google_cloud_location::model::ListLocationsRequest::name
8603    ///
8604    /// # Example
8605    /// ```
8606    /// # use google_cloud_dialogflow_v2::client::Tools;
8607    /// use google_cloud_gax::paginator::ItemPaginator as _;
8608    /// use google_cloud_dialogflow_v2::Result;
8609    /// async fn sample(
8610    ///    client: &Tools
8611    /// ) -> Result<()> {
8612    ///     let mut list = client.list_locations()
8613    ///         /* set fields */
8614    ///         .by_item();
8615    ///     while let Some(item) = list.next().await.transpose()? {
8616    ///         println!("{:?}", item);
8617    ///     }
8618    ///     Ok(())
8619    /// }
8620    /// ```
8621    pub fn list_locations(&self) -> super::builder::tools::ListLocations {
8622        super::builder::tools::ListLocations::new(self.inner.clone())
8623    }
8624
8625    /// Gets information about a location.
8626    ///
8627    /// # Example
8628    /// ```
8629    /// # use google_cloud_dialogflow_v2::client::Tools;
8630    /// use google_cloud_dialogflow_v2::Result;
8631    /// async fn sample(
8632    ///    client: &Tools
8633    /// ) -> Result<()> {
8634    ///     let response = client.get_location()
8635    ///         /* set fields */
8636    ///         .send().await?;
8637    ///     println!("response {:?}", response);
8638    ///     Ok(())
8639    /// }
8640    /// ```
8641    pub fn get_location(&self) -> super::builder::tools::GetLocation {
8642        super::builder::tools::GetLocation::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::Tools;
8652    /// use google_cloud_gax::paginator::ItemPaginator as _;
8653    /// use google_cloud_dialogflow_v2::Result;
8654    /// async fn sample(
8655    ///    client: &Tools
8656    /// ) -> Result<()> {
8657    ///     let mut list = client.list_operations()
8658    ///         /* set fields */
8659    ///         .by_item();
8660    ///     while let Some(item) = list.next().await.transpose()? {
8661    ///         println!("{:?}", item);
8662    ///     }
8663    ///     Ok(())
8664    /// }
8665    /// ```
8666    pub fn list_operations(&self) -> super::builder::tools::ListOperations {
8667        super::builder::tools::ListOperations::new(self.inner.clone())
8668    }
8669
8670    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
8671    ///
8672    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
8673    ///
8674    /// # Example
8675    /// ```
8676    /// # use google_cloud_dialogflow_v2::client::Tools;
8677    /// use google_cloud_dialogflow_v2::Result;
8678    /// async fn sample(
8679    ///    client: &Tools
8680    /// ) -> Result<()> {
8681    ///     let response = client.get_operation()
8682    ///         /* set fields */
8683    ///         .send().await?;
8684    ///     println!("response {:?}", response);
8685    ///     Ok(())
8686    /// }
8687    /// ```
8688    pub fn get_operation(&self) -> super::builder::tools::GetOperation {
8689        super::builder::tools::GetOperation::new(self.inner.clone())
8690    }
8691
8692    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
8693    ///
8694    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
8695    ///
8696    /// # Example
8697    /// ```
8698    /// # use google_cloud_dialogflow_v2::client::Tools;
8699    /// use google_cloud_dialogflow_v2::Result;
8700    /// async fn sample(
8701    ///    client: &Tools
8702    /// ) -> Result<()> {
8703    ///     client.cancel_operation()
8704    ///         /* set fields */
8705    ///         .send().await?;
8706    ///     Ok(())
8707    /// }
8708    /// ```
8709    pub fn cancel_operation(&self) -> super::builder::tools::CancelOperation {
8710        super::builder::tools::CancelOperation::new(self.inner.clone())
8711    }
8712}
8713
8714/// Implements a client for the Dialogflow API.
8715///
8716/// # Example
8717/// ```
8718/// # use google_cloud_dialogflow_v2::client::Versions;
8719/// use google_cloud_gax::paginator::ItemPaginator as _;
8720/// async fn sample(
8721///    project_id: &str,
8722/// ) -> anyhow::Result<()> {
8723///     let client = Versions::builder().build().await?;
8724///     let mut list = client.list_versions()
8725///         .set_parent(format!("projects/{project_id}/agent"))
8726///         .by_item();
8727///     while let Some(item) = list.next().await.transpose()? {
8728///         println!("{:?}", item);
8729///     }
8730///     Ok(())
8731/// }
8732/// ```
8733///
8734/// # Service Description
8735///
8736/// Service for managing [Versions][google.cloud.dialogflow.v2.Version].
8737///
8738/// [google.cloud.dialogflow.v2.Version]: crate::model::Version
8739///
8740/// # Configuration
8741///
8742/// To configure `Versions` use the `with_*` methods in the type returned
8743/// by [builder()][Versions::builder]. The default configuration should
8744/// work for most applications. Common configuration changes include
8745///
8746/// * [with_endpoint()]: by default this client uses the global default endpoint
8747///   (`https://dialogflow.googleapis.com`). Applications using regional
8748///   endpoints or running in restricted networks (e.g. a network configured
8749///   with [Private Google Access with VPC Service Controls]) may want to
8750///   override this default.
8751/// * [with_credentials()]: by default this client uses
8752///   [Application Default Credentials]. Applications using custom
8753///   authentication may need to override this default.
8754///
8755/// [with_endpoint()]: super::builder::versions::ClientBuilder::with_endpoint
8756/// [with_credentials()]: super::builder::versions::ClientBuilder::with_credentials
8757/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
8758/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
8759///
8760/// # Pooling and Cloning
8761///
8762/// `Versions` holds a connection pool internally, it is advised to
8763/// create one and reuse it. You do not need to wrap `Versions` in
8764/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
8765/// already uses an `Arc` internally.
8766#[cfg(feature = "versions")]
8767#[cfg_attr(docsrs, doc(cfg(feature = "versions")))]
8768#[derive(Clone, Debug)]
8769pub struct Versions {
8770    inner: std::sync::Arc<dyn super::stub::dynamic::Versions>,
8771}
8772
8773#[cfg(feature = "versions")]
8774impl Versions {
8775    /// Returns a builder for [Versions].
8776    ///
8777    /// ```
8778    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
8779    /// # use google_cloud_dialogflow_v2::client::Versions;
8780    /// let client = Versions::builder().build().await?;
8781    /// # Ok(()) }
8782    /// ```
8783    pub fn builder() -> super::builder::versions::ClientBuilder {
8784        crate::new_client_builder(super::builder::versions::client::Factory)
8785    }
8786
8787    /// Creates a new client from the provided stub.
8788    ///
8789    /// The most common case for calling this function is in tests mocking the
8790    /// client's behavior.
8791    pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
8792    where
8793        T: super::stub::Versions + 'static,
8794    {
8795        Self { inner: stub.into() }
8796    }
8797
8798    pub(crate) async fn new(
8799        config: gaxi::options::ClientConfig,
8800    ) -> crate::ClientBuilderResult<Self> {
8801        let inner = Self::build_inner(config).await?;
8802        Ok(Self { inner })
8803    }
8804
8805    async fn build_inner(
8806        conf: gaxi::options::ClientConfig,
8807    ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::Versions>> {
8808        if gaxi::options::tracing_enabled(&conf) {
8809            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
8810        }
8811        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
8812    }
8813
8814    async fn build_transport(
8815        conf: gaxi::options::ClientConfig,
8816    ) -> crate::ClientBuilderResult<impl super::stub::Versions> {
8817        super::transport::Versions::new(conf).await
8818    }
8819
8820    async fn build_with_tracing(
8821        conf: gaxi::options::ClientConfig,
8822    ) -> crate::ClientBuilderResult<impl super::stub::Versions> {
8823        Self::build_transport(conf)
8824            .await
8825            .map(super::tracing::Versions::new)
8826    }
8827
8828    /// Returns the list of all versions of the specified agent.
8829    ///
8830    /// # Example
8831    /// ```
8832    /// # use google_cloud_dialogflow_v2::client::Versions;
8833    /// use google_cloud_gax::paginator::ItemPaginator as _;
8834    /// use google_cloud_dialogflow_v2::Result;
8835    /// async fn sample(
8836    ///    client: &Versions, project_id: &str
8837    /// ) -> Result<()> {
8838    ///     let mut list = client.list_versions()
8839    ///         .set_parent(format!("projects/{project_id}/agent"))
8840    ///         .by_item();
8841    ///     while let Some(item) = list.next().await.transpose()? {
8842    ///         println!("{:?}", item);
8843    ///     }
8844    ///     Ok(())
8845    /// }
8846    /// ```
8847    pub fn list_versions(&self) -> super::builder::versions::ListVersions {
8848        super::builder::versions::ListVersions::new(self.inner.clone())
8849    }
8850
8851    /// Retrieves the specified agent version.
8852    ///
8853    /// # Example
8854    /// ```
8855    /// # use google_cloud_dialogflow_v2::client::Versions;
8856    /// use google_cloud_dialogflow_v2::Result;
8857    /// async fn sample(
8858    ///    client: &Versions, project_id: &str, version_id: &str
8859    /// ) -> Result<()> {
8860    ///     let response = client.get_version()
8861    ///         .set_name(format!("projects/{project_id}/agent/versions/{version_id}"))
8862    ///         .send().await?;
8863    ///     println!("response {:?}", response);
8864    ///     Ok(())
8865    /// }
8866    /// ```
8867    pub fn get_version(&self) -> super::builder::versions::GetVersion {
8868        super::builder::versions::GetVersion::new(self.inner.clone())
8869    }
8870
8871    /// Creates an agent version.
8872    ///
8873    /// The new version points to the agent instance in the "default" environment.
8874    ///
8875    /// # Example
8876    /// ```
8877    /// # use google_cloud_dialogflow_v2::client::Versions;
8878    /// use google_cloud_dialogflow_v2::model::Version;
8879    /// use google_cloud_dialogflow_v2::Result;
8880    /// async fn sample(
8881    ///    client: &Versions, project_id: &str
8882    /// ) -> Result<()> {
8883    ///     let response = client.create_version()
8884    ///         .set_parent(format!("projects/{project_id}/agent"))
8885    ///         .set_version(
8886    ///             Version::new()/* set fields */
8887    ///         )
8888    ///         .send().await?;
8889    ///     println!("response {:?}", response);
8890    ///     Ok(())
8891    /// }
8892    /// ```
8893    pub fn create_version(&self) -> super::builder::versions::CreateVersion {
8894        super::builder::versions::CreateVersion::new(self.inner.clone())
8895    }
8896
8897    /// Updates the specified agent version.
8898    ///
8899    /// Note that this method does not allow you to update the state of the agent
8900    /// the given version points to. It allows you to update only mutable
8901    /// properties of the version resource.
8902    ///
8903    /// # Example
8904    /// ```
8905    /// # use google_cloud_dialogflow_v2::client::Versions;
8906    /// # extern crate wkt as google_cloud_wkt;
8907    /// use google_cloud_wkt::FieldMask;
8908    /// use google_cloud_dialogflow_v2::model::Version;
8909    /// use google_cloud_dialogflow_v2::Result;
8910    /// async fn sample(
8911    ///    client: &Versions, project_id: &str, version_id: &str
8912    /// ) -> Result<()> {
8913    ///     let response = client.update_version()
8914    ///         .set_version(
8915    ///             Version::new().set_name(format!("projects/{project_id}/agent/versions/{version_id}"))/* set fields */
8916    ///         )
8917    ///         .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
8918    ///         .send().await?;
8919    ///     println!("response {:?}", response);
8920    ///     Ok(())
8921    /// }
8922    /// ```
8923    pub fn update_version(&self) -> super::builder::versions::UpdateVersion {
8924        super::builder::versions::UpdateVersion::new(self.inner.clone())
8925    }
8926
8927    /// Delete the specified agent version.
8928    ///
8929    /// # Example
8930    /// ```
8931    /// # use google_cloud_dialogflow_v2::client::Versions;
8932    /// use google_cloud_dialogflow_v2::Result;
8933    /// async fn sample(
8934    ///    client: &Versions, project_id: &str, version_id: &str
8935    /// ) -> Result<()> {
8936    ///     client.delete_version()
8937    ///         .set_name(format!("projects/{project_id}/agent/versions/{version_id}"))
8938    ///         .send().await?;
8939    ///     Ok(())
8940    /// }
8941    /// ```
8942    pub fn delete_version(&self) -> super::builder::versions::DeleteVersion {
8943        super::builder::versions::DeleteVersion::new(self.inner.clone())
8944    }
8945
8946    /// Lists information about the supported locations for this service.
8947    ///
8948    /// This method lists locations based on the resource scope provided in
8949    /// the [ListLocationsRequest.name][google.cloud.location.ListLocationsRequest.name] field: *
8950    /// **Global locations**: If `name` is empty, the method lists the
8951    /// public locations available to all projects. * **Project-specific
8952    /// locations**: If `name` follows the format
8953    /// `projects/{project}`, the method lists locations visible to that
8954    /// specific project. This includes public, private, or other
8955    /// project-specific locations enabled for the project.
8956    ///
8957    /// For gRPC and client library implementations, the resource name is
8958    /// passed as the `name` field. For direct service calls, the resource
8959    /// name is
8960    /// incorporated into the request path based on the specific service
8961    /// implementation and version.
8962    ///
8963    /// [google.cloud.location.ListLocationsRequest.name]: google_cloud_location::model::ListLocationsRequest::name
8964    ///
8965    /// # Example
8966    /// ```
8967    /// # use google_cloud_dialogflow_v2::client::Versions;
8968    /// use google_cloud_gax::paginator::ItemPaginator as _;
8969    /// use google_cloud_dialogflow_v2::Result;
8970    /// async fn sample(
8971    ///    client: &Versions
8972    /// ) -> Result<()> {
8973    ///     let mut list = client.list_locations()
8974    ///         /* set fields */
8975    ///         .by_item();
8976    ///     while let Some(item) = list.next().await.transpose()? {
8977    ///         println!("{:?}", item);
8978    ///     }
8979    ///     Ok(())
8980    /// }
8981    /// ```
8982    pub fn list_locations(&self) -> super::builder::versions::ListLocations {
8983        super::builder::versions::ListLocations::new(self.inner.clone())
8984    }
8985
8986    /// Gets information about a location.
8987    ///
8988    /// # Example
8989    /// ```
8990    /// # use google_cloud_dialogflow_v2::client::Versions;
8991    /// use google_cloud_dialogflow_v2::Result;
8992    /// async fn sample(
8993    ///    client: &Versions
8994    /// ) -> Result<()> {
8995    ///     let response = client.get_location()
8996    ///         /* set fields */
8997    ///         .send().await?;
8998    ///     println!("response {:?}", response);
8999    ///     Ok(())
9000    /// }
9001    /// ```
9002    pub fn get_location(&self) -> super::builder::versions::GetLocation {
9003        super::builder::versions::GetLocation::new(self.inner.clone())
9004    }
9005
9006    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
9007    ///
9008    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
9009    ///
9010    /// # Example
9011    /// ```
9012    /// # use google_cloud_dialogflow_v2::client::Versions;
9013    /// use google_cloud_gax::paginator::ItemPaginator as _;
9014    /// use google_cloud_dialogflow_v2::Result;
9015    /// async fn sample(
9016    ///    client: &Versions
9017    /// ) -> Result<()> {
9018    ///     let mut list = client.list_operations()
9019    ///         /* set fields */
9020    ///         .by_item();
9021    ///     while let Some(item) = list.next().await.transpose()? {
9022    ///         println!("{:?}", item);
9023    ///     }
9024    ///     Ok(())
9025    /// }
9026    /// ```
9027    pub fn list_operations(&self) -> super::builder::versions::ListOperations {
9028        super::builder::versions::ListOperations::new(self.inner.clone())
9029    }
9030
9031    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
9032    ///
9033    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
9034    ///
9035    /// # Example
9036    /// ```
9037    /// # use google_cloud_dialogflow_v2::client::Versions;
9038    /// use google_cloud_dialogflow_v2::Result;
9039    /// async fn sample(
9040    ///    client: &Versions
9041    /// ) -> Result<()> {
9042    ///     let response = client.get_operation()
9043    ///         /* set fields */
9044    ///         .send().await?;
9045    ///     println!("response {:?}", response);
9046    ///     Ok(())
9047    /// }
9048    /// ```
9049    pub fn get_operation(&self) -> super::builder::versions::GetOperation {
9050        super::builder::versions::GetOperation::new(self.inner.clone())
9051    }
9052
9053    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
9054    ///
9055    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
9056    ///
9057    /// # Example
9058    /// ```
9059    /// # use google_cloud_dialogflow_v2::client::Versions;
9060    /// use google_cloud_dialogflow_v2::Result;
9061    /// async fn sample(
9062    ///    client: &Versions
9063    /// ) -> Result<()> {
9064    ///     client.cancel_operation()
9065    ///         /* set fields */
9066    ///         .send().await?;
9067    ///     Ok(())
9068    /// }
9069    /// ```
9070    pub fn cancel_operation(&self) -> super::builder::versions::CancelOperation {
9071        super::builder::versions::CancelOperation::new(self.inner.clone())
9072    }
9073}