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::redundant_explicit_links)]
17#![allow(rustdoc::broken_intra_doc_links)]
18
19/// Implements a client for the Dialogflow API.
20///
21/// # Example
22/// ```
23/// # use google_cloud_dialogflow_v2::client::Agents;
24/// use google_cloud_gax::paginator::ItemPaginator as _;
25/// # async fn sample() -> Result<(), Box<dyn std::error::Error>> {
26///     let client = Agents::builder().build().await?;
27///     let mut list = client.search_agents()
28///         /* set fields */
29///         .by_item();
30///     while let Some(item) = list.next().await.transpose()? {
31///         println!("{:?}", item);
32///     }
33/// # Ok(()) }
34/// ```
35///
36/// # Service Description
37///
38/// Service for managing [Agents][google.cloud.dialogflow.v2.Agent].
39///
40/// [google.cloud.dialogflow.v2.Agent]: crate::model::Agent
41///
42/// # Configuration
43///
44/// To configure `Agents` use the `with_*` methods in the type returned
45/// by [builder()][Agents::builder]. The default configuration should
46/// work for most applications. Common configuration changes include
47///
48/// * [with_endpoint()]: by default this client uses the global default endpoint
49///   (`https://dialogflow.googleapis.com`). Applications using regional
50///   endpoints or running in restricted networks (e.g. a network configured
51//    with [Private Google Access with VPC Service Controls]) may want to
52///   override this default.
53/// * [with_credentials()]: by default this client uses
54///   [Application Default Credentials]. Applications using custom
55///   authentication may need to override this default.
56///
57/// [with_endpoint()]: super::builder::agents::ClientBuilder::with_endpoint
58/// [with_credentials()]: super::builder::agents::ClientBuilder::with_credentials
59/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
60/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
61///
62/// # Pooling and Cloning
63///
64/// `Agents` holds a connection pool internally, it is advised to
65/// create one and reuse it. You do not need to wrap `Agents` in
66/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
67/// already uses an `Arc` internally.
68#[cfg(feature = "agents")]
69#[cfg_attr(docsrs, doc(cfg(feature = "agents")))]
70#[derive(Clone, Debug)]
71pub struct Agents {
72    inner: std::sync::Arc<dyn super::stub::dynamic::Agents>,
73}
74
75#[cfg(feature = "agents")]
76impl Agents {
77    /// Returns a builder for [Agents].
78    ///
79    /// ```
80    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
81    /// # use google_cloud_dialogflow_v2::client::Agents;
82    /// let client = Agents::builder().build().await?;
83    /// # Ok(()) }
84    /// ```
85    pub fn builder() -> super::builder::agents::ClientBuilder {
86        crate::new_client_builder(super::builder::agents::client::Factory)
87    }
88
89    /// Creates a new client from the provided stub.
90    ///
91    /// The most common case for calling this function is in tests mocking the
92    /// client's behavior.
93    pub fn from_stub<T>(stub: T) -> Self
94    where
95        T: super::stub::Agents + 'static,
96    {
97        Self {
98            inner: std::sync::Arc::new(stub),
99        }
100    }
101
102    pub(crate) async fn new(
103        config: gaxi::options::ClientConfig,
104    ) -> crate::ClientBuilderResult<Self> {
105        let inner = Self::build_inner(config).await?;
106        Ok(Self { inner })
107    }
108
109    async fn build_inner(
110        conf: gaxi::options::ClientConfig,
111    ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::Agents>> {
112        if gaxi::options::tracing_enabled(&conf) {
113            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
114        }
115        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
116    }
117
118    async fn build_transport(
119        conf: gaxi::options::ClientConfig,
120    ) -> crate::ClientBuilderResult<impl super::stub::Agents> {
121        super::transport::Agents::new(conf).await
122    }
123
124    async fn build_with_tracing(
125        conf: gaxi::options::ClientConfig,
126    ) -> crate::ClientBuilderResult<impl super::stub::Agents> {
127        Self::build_transport(conf)
128            .await
129            .map(super::tracing::Agents::new)
130    }
131
132    /// Retrieves the specified agent.
133    ///
134    /// # Example
135    /// ```
136    /// # use google_cloud_dialogflow_v2::client::Agents;
137    /// use google_cloud_dialogflow_v2::Result;
138    /// async fn sample(
139    ///    client: &Agents
140    /// ) -> Result<()> {
141    ///     let response = client.get_agent()
142    ///         /* set fields */
143    ///         .send().await?;
144    ///     println!("response {:?}", response);
145    ///     Ok(())
146    /// }
147    /// ```
148    pub fn get_agent(&self) -> super::builder::agents::GetAgent {
149        super::builder::agents::GetAgent::new(self.inner.clone())
150    }
151
152    /// Creates/updates the specified agent.
153    ///
154    /// Note: You should always train an agent prior to sending it queries. See the
155    /// [training
156    /// documentation](https://cloud.google.com/dialogflow/es/docs/training).
157    ///
158    /// # Example
159    /// ```
160    /// # use google_cloud_dialogflow_v2::client::Agents;
161    /// use google_cloud_dialogflow_v2::Result;
162    /// async fn sample(
163    ///    client: &Agents
164    /// ) -> Result<()> {
165    ///     let response = client.set_agent()
166    ///         /* set fields */
167    ///         .send().await?;
168    ///     println!("response {:?}", response);
169    ///     Ok(())
170    /// }
171    /// ```
172    pub fn set_agent(&self) -> super::builder::agents::SetAgent {
173        super::builder::agents::SetAgent::new(self.inner.clone())
174    }
175
176    /// Deletes the specified agent.
177    ///
178    /// # Example
179    /// ```
180    /// # use google_cloud_dialogflow_v2::client::Agents;
181    /// use google_cloud_dialogflow_v2::Result;
182    /// async fn sample(
183    ///    client: &Agents
184    /// ) -> Result<()> {
185    ///     client.delete_agent()
186    ///         /* set fields */
187    ///         .send().await?;
188    ///     Ok(())
189    /// }
190    /// ```
191    pub fn delete_agent(&self) -> super::builder::agents::DeleteAgent {
192        super::builder::agents::DeleteAgent::new(self.inner.clone())
193    }
194
195    /// Returns the list of agents.
196    ///
197    /// Since there is at most one conversational agent per project, this method is
198    /// useful primarily for listing all agents across projects the caller has
199    /// access to. One can achieve that with a wildcard project collection id "-".
200    /// Refer to [List
201    /// Sub-Collections](https://cloud.google.com/apis/design/design_patterns#list_sub-collections).
202    ///
203    /// # Example
204    /// ```
205    /// # use google_cloud_dialogflow_v2::client::Agents;
206    /// use google_cloud_gax::paginator::ItemPaginator as _;
207    /// use google_cloud_dialogflow_v2::Result;
208    /// async fn sample(
209    ///    client: &Agents
210    /// ) -> Result<()> {
211    ///     let mut list = client.search_agents()
212    ///         /* set fields */
213    ///         .by_item();
214    ///     while let Some(item) = list.next().await.transpose()? {
215    ///         println!("{:?}", item);
216    ///     }
217    ///     Ok(())
218    /// }
219    /// ```
220    pub fn search_agents(&self) -> super::builder::agents::SearchAgents {
221        super::builder::agents::SearchAgents::new(self.inner.clone())
222    }
223
224    /// Trains the specified agent.
225    ///
226    /// This method is a [long-running
227    /// operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations).
228    /// The returned `Operation` type has the following method-specific fields:
229    ///
230    /// - `metadata`: An empty [Struct
231    ///   message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct)
232    /// - `response`: An [Empty
233    ///   message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
234    ///
235    /// Note: You should always train an agent prior to sending it queries. See the
236    /// [training
237    /// documentation](https://cloud.google.com/dialogflow/es/docs/training).
238    ///
239    /// # Long running operations
240    ///
241    /// This method is used to start, and/or poll a [long-running Operation].
242    /// The [Working with long-running operations] chapter in the [user guide]
243    /// covers these operations in detail.
244    ///
245    /// [long-running operation]: https://google.aip.dev/151
246    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
247    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
248    ///
249    /// # Example
250    /// ```
251    /// # use google_cloud_dialogflow_v2::client::Agents;
252    /// use google_cloud_lro::Poller;
253    /// use google_cloud_dialogflow_v2::Result;
254    /// async fn sample(
255    ///    client: &Agents
256    /// ) -> Result<()> {
257    ///     client.train_agent()
258    ///         /* set fields */
259    ///         .poller().until_done().await?;
260    ///     Ok(())
261    /// }
262    /// ```
263    pub fn train_agent(&self) -> super::builder::agents::TrainAgent {
264        super::builder::agents::TrainAgent::new(self.inner.clone())
265    }
266
267    /// Exports the specified agent to a ZIP file.
268    ///
269    /// This method is a [long-running
270    /// operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations).
271    /// The returned `Operation` type has the following method-specific fields:
272    ///
273    /// - `metadata`: An empty [Struct
274    ///   message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct)
275    /// - `response`:
276    ///   [ExportAgentResponse][google.cloud.dialogflow.v2.ExportAgentResponse]
277    ///
278    /// [google.cloud.dialogflow.v2.ExportAgentResponse]: crate::model::ExportAgentResponse
279    ///
280    /// # Long running operations
281    ///
282    /// This method is used to start, and/or poll a [long-running Operation].
283    /// The [Working with long-running operations] chapter in the [user guide]
284    /// covers these operations in detail.
285    ///
286    /// [long-running operation]: https://google.aip.dev/151
287    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
288    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
289    ///
290    /// # Example
291    /// ```
292    /// # use google_cloud_dialogflow_v2::client::Agents;
293    /// use google_cloud_lro::Poller;
294    /// use google_cloud_dialogflow_v2::Result;
295    /// async fn sample(
296    ///    client: &Agents
297    /// ) -> Result<()> {
298    ///     let response = client.export_agent()
299    ///         /* set fields */
300    ///         .poller().until_done().await?;
301    ///     println!("response {:?}", response);
302    ///     Ok(())
303    /// }
304    /// ```
305    pub fn export_agent(&self) -> super::builder::agents::ExportAgent {
306        super::builder::agents::ExportAgent::new(self.inner.clone())
307    }
308
309    /// Imports the specified agent from a ZIP file.
310    ///
311    /// Uploads new intents and entity types without deleting the existing ones.
312    /// Intents and entity types with the same name are replaced with the new
313    /// versions from
314    /// [ImportAgentRequest][google.cloud.dialogflow.v2.ImportAgentRequest]. After
315    /// the import, the imported draft agent will be trained automatically (unless
316    /// disabled in agent settings). However, once the import is done, training may
317    /// not be completed yet. Please call
318    /// [TrainAgent][google.cloud.dialogflow.v2.Agents.TrainAgent] and wait for the
319    /// operation it returns in order to train explicitly.
320    ///
321    /// This method is a [long-running
322    /// operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations).
323    /// The returned `Operation` type has the following method-specific fields:
324    ///
325    /// - `metadata`: An empty [Struct
326    ///   message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct)
327    /// - `response`: An [Empty
328    ///   message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
329    ///
330    /// The operation only tracks when importing is complete, not when it is done
331    /// training.
332    ///
333    /// Note: You should always train an agent prior to sending it queries. See the
334    /// [training
335    /// documentation](https://cloud.google.com/dialogflow/es/docs/training).
336    ///
337    /// [google.cloud.dialogflow.v2.Agents.TrainAgent]: crate::client::Agents::train_agent
338    /// [google.cloud.dialogflow.v2.ImportAgentRequest]: crate::model::ImportAgentRequest
339    ///
340    /// # Long running operations
341    ///
342    /// This method is used to start, and/or poll a [long-running Operation].
343    /// The [Working with long-running operations] chapter in the [user guide]
344    /// covers these operations in detail.
345    ///
346    /// [long-running operation]: https://google.aip.dev/151
347    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
348    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
349    ///
350    /// # Example
351    /// ```
352    /// # use google_cloud_dialogflow_v2::client::Agents;
353    /// use google_cloud_lro::Poller;
354    /// use google_cloud_dialogflow_v2::Result;
355    /// async fn sample(
356    ///    client: &Agents
357    /// ) -> Result<()> {
358    ///     client.import_agent()
359    ///         /* set fields */
360    ///         .poller().until_done().await?;
361    ///     Ok(())
362    /// }
363    /// ```
364    pub fn import_agent(&self) -> super::builder::agents::ImportAgent {
365        super::builder::agents::ImportAgent::new(self.inner.clone())
366    }
367
368    /// Restores the specified agent from a ZIP file.
369    ///
370    /// Replaces the current agent version with a new one. All the intents and
371    /// entity types in the older version are deleted. After the restore, the
372    /// restored draft agent will be trained automatically (unless disabled in
373    /// agent settings). However, once the restore is done, training may not be
374    /// completed yet. Please call
375    /// [TrainAgent][google.cloud.dialogflow.v2.Agents.TrainAgent] and wait for the
376    /// operation it returns in order to train explicitly.
377    ///
378    /// This method is a [long-running
379    /// operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations).
380    /// The returned `Operation` type has the following method-specific fields:
381    ///
382    /// - `metadata`: An empty [Struct
383    ///   message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct)
384    /// - `response`: An [Empty
385    ///   message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
386    ///
387    /// The operation only tracks when restoring is complete, not when it is done
388    /// training.
389    ///
390    /// Note: You should always train an agent prior to sending it queries. See the
391    /// [training
392    /// documentation](https://cloud.google.com/dialogflow/es/docs/training).
393    ///
394    /// [google.cloud.dialogflow.v2.Agents.TrainAgent]: crate::client::Agents::train_agent
395    ///
396    /// # Long running operations
397    ///
398    /// This method is used to start, and/or poll a [long-running Operation].
399    /// The [Working with long-running operations] chapter in the [user guide]
400    /// covers these operations in detail.
401    ///
402    /// [long-running operation]: https://google.aip.dev/151
403    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
404    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
405    ///
406    /// # Example
407    /// ```
408    /// # use google_cloud_dialogflow_v2::client::Agents;
409    /// use google_cloud_lro::Poller;
410    /// use google_cloud_dialogflow_v2::Result;
411    /// async fn sample(
412    ///    client: &Agents
413    /// ) -> Result<()> {
414    ///     client.restore_agent()
415    ///         /* set fields */
416    ///         .poller().until_done().await?;
417    ///     Ok(())
418    /// }
419    /// ```
420    pub fn restore_agent(&self) -> super::builder::agents::RestoreAgent {
421        super::builder::agents::RestoreAgent::new(self.inner.clone())
422    }
423
424    /// Gets agent validation result. Agent validation is performed during
425    /// training time and is updated automatically when training is completed.
426    ///
427    /// # Example
428    /// ```
429    /// # use google_cloud_dialogflow_v2::client::Agents;
430    /// use google_cloud_dialogflow_v2::Result;
431    /// async fn sample(
432    ///    client: &Agents
433    /// ) -> Result<()> {
434    ///     let response = client.get_validation_result()
435    ///         /* set fields */
436    ///         .send().await?;
437    ///     println!("response {:?}", response);
438    ///     Ok(())
439    /// }
440    /// ```
441    pub fn get_validation_result(&self) -> super::builder::agents::GetValidationResult {
442        super::builder::agents::GetValidationResult::new(self.inner.clone())
443    }
444
445    /// Lists information about the supported locations for this service.
446    ///
447    /// This method lists locations based on the resource scope provided in
448    /// the [ListLocationsRequest.name] field:
449    ///
450    /// * **Global locations**: If `name` is empty, the method lists the
451    ///   public locations available to all projects. * **Project-specific
452    ///   locations**: If `name` follows the format
453    ///   `projects/{project}`, the method lists locations visible to that
454    ///   specific project. This includes public, private, or other
455    ///   project-specific locations enabled for the project.
456    ///
457    /// For gRPC and client library implementations, the resource name is
458    /// passed as the `name` field. For direct service calls, the resource
459    /// name is
460    /// incorporated into the request path based on the specific service
461    /// implementation and version.
462    ///
463    /// # Example
464    /// ```
465    /// # use google_cloud_dialogflow_v2::client::Agents;
466    /// use google_cloud_gax::paginator::ItemPaginator as _;
467    /// use google_cloud_dialogflow_v2::Result;
468    /// async fn sample(
469    ///    client: &Agents
470    /// ) -> Result<()> {
471    ///     let mut list = client.list_locations()
472    ///         /* set fields */
473    ///         .by_item();
474    ///     while let Some(item) = list.next().await.transpose()? {
475    ///         println!("{:?}", item);
476    ///     }
477    ///     Ok(())
478    /// }
479    /// ```
480    pub fn list_locations(&self) -> super::builder::agents::ListLocations {
481        super::builder::agents::ListLocations::new(self.inner.clone())
482    }
483
484    /// Gets information about a location.
485    ///
486    /// # Example
487    /// ```
488    /// # use google_cloud_dialogflow_v2::client::Agents;
489    /// use google_cloud_dialogflow_v2::Result;
490    /// async fn sample(
491    ///    client: &Agents
492    /// ) -> Result<()> {
493    ///     let response = client.get_location()
494    ///         /* set fields */
495    ///         .send().await?;
496    ///     println!("response {:?}", response);
497    ///     Ok(())
498    /// }
499    /// ```
500    pub fn get_location(&self) -> super::builder::agents::GetLocation {
501        super::builder::agents::GetLocation::new(self.inner.clone())
502    }
503
504    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
505    ///
506    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
507    ///
508    /// # Example
509    /// ```
510    /// # use google_cloud_dialogflow_v2::client::Agents;
511    /// use google_cloud_gax::paginator::ItemPaginator as _;
512    /// use google_cloud_dialogflow_v2::Result;
513    /// async fn sample(
514    ///    client: &Agents
515    /// ) -> Result<()> {
516    ///     let mut list = client.list_operations()
517    ///         /* set fields */
518    ///         .by_item();
519    ///     while let Some(item) = list.next().await.transpose()? {
520    ///         println!("{:?}", item);
521    ///     }
522    ///     Ok(())
523    /// }
524    /// ```
525    pub fn list_operations(&self) -> super::builder::agents::ListOperations {
526        super::builder::agents::ListOperations::new(self.inner.clone())
527    }
528
529    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
530    ///
531    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
532    ///
533    /// # Example
534    /// ```
535    /// # use google_cloud_dialogflow_v2::client::Agents;
536    /// use google_cloud_dialogflow_v2::Result;
537    /// async fn sample(
538    ///    client: &Agents
539    /// ) -> Result<()> {
540    ///     let response = client.get_operation()
541    ///         /* set fields */
542    ///         .send().await?;
543    ///     println!("response {:?}", response);
544    ///     Ok(())
545    /// }
546    /// ```
547    pub fn get_operation(&self) -> super::builder::agents::GetOperation {
548        super::builder::agents::GetOperation::new(self.inner.clone())
549    }
550
551    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
552    ///
553    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
554    ///
555    /// # Example
556    /// ```
557    /// # use google_cloud_dialogflow_v2::client::Agents;
558    /// use google_cloud_dialogflow_v2::Result;
559    /// async fn sample(
560    ///    client: &Agents
561    /// ) -> Result<()> {
562    ///     client.cancel_operation()
563    ///         /* set fields */
564    ///         .send().await?;
565    ///     Ok(())
566    /// }
567    /// ```
568    pub fn cancel_operation(&self) -> super::builder::agents::CancelOperation {
569        super::builder::agents::CancelOperation::new(self.inner.clone())
570    }
571}
572
573/// Implements a client for the Dialogflow API.
574///
575/// # Example
576/// ```
577/// # use google_cloud_dialogflow_v2::client::AnswerRecords;
578/// use google_cloud_gax::paginator::ItemPaginator as _;
579/// # async fn sample() -> Result<(), Box<dyn std::error::Error>> {
580///     let client = AnswerRecords::builder().build().await?;
581///     let parent = "parent_value";
582///     let mut list = client.list_answer_records()
583///         .set_parent(parent)
584///         .by_item();
585///     while let Some(item) = list.next().await.transpose()? {
586///         println!("{:?}", item);
587///     }
588/// # Ok(()) }
589/// ```
590///
591/// # Service Description
592///
593/// Service for managing
594/// [AnswerRecords][google.cloud.dialogflow.v2.AnswerRecord].
595///
596/// [google.cloud.dialogflow.v2.AnswerRecord]: crate::model::AnswerRecord
597///
598/// # Configuration
599///
600/// To configure `AnswerRecords` use the `with_*` methods in the type returned
601/// by [builder()][AnswerRecords::builder]. The default configuration should
602/// work for most applications. Common configuration changes include
603///
604/// * [with_endpoint()]: by default this client uses the global default endpoint
605///   (`https://dialogflow.googleapis.com`). Applications using regional
606///   endpoints or running in restricted networks (e.g. a network configured
607//    with [Private Google Access with VPC Service Controls]) may want to
608///   override this default.
609/// * [with_credentials()]: by default this client uses
610///   [Application Default Credentials]. Applications using custom
611///   authentication may need to override this default.
612///
613/// [with_endpoint()]: super::builder::answer_records::ClientBuilder::with_endpoint
614/// [with_credentials()]: super::builder::answer_records::ClientBuilder::with_credentials
615/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
616/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
617///
618/// # Pooling and Cloning
619///
620/// `AnswerRecords` holds a connection pool internally, it is advised to
621/// create one and reuse it. You do not need to wrap `AnswerRecords` in
622/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
623/// already uses an `Arc` internally.
624#[cfg(feature = "answer-records")]
625#[cfg_attr(docsrs, doc(cfg(feature = "answer-records")))]
626#[derive(Clone, Debug)]
627pub struct AnswerRecords {
628    inner: std::sync::Arc<dyn super::stub::dynamic::AnswerRecords>,
629}
630
631#[cfg(feature = "answer-records")]
632impl AnswerRecords {
633    /// Returns a builder for [AnswerRecords].
634    ///
635    /// ```
636    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
637    /// # use google_cloud_dialogflow_v2::client::AnswerRecords;
638    /// let client = AnswerRecords::builder().build().await?;
639    /// # Ok(()) }
640    /// ```
641    pub fn builder() -> super::builder::answer_records::ClientBuilder {
642        crate::new_client_builder(super::builder::answer_records::client::Factory)
643    }
644
645    /// Creates a new client from the provided stub.
646    ///
647    /// The most common case for calling this function is in tests mocking the
648    /// client's behavior.
649    pub fn from_stub<T>(stub: T) -> Self
650    where
651        T: super::stub::AnswerRecords + 'static,
652    {
653        Self {
654            inner: std::sync::Arc::new(stub),
655        }
656    }
657
658    pub(crate) async fn new(
659        config: gaxi::options::ClientConfig,
660    ) -> crate::ClientBuilderResult<Self> {
661        let inner = Self::build_inner(config).await?;
662        Ok(Self { inner })
663    }
664
665    async fn build_inner(
666        conf: gaxi::options::ClientConfig,
667    ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::AnswerRecords>> {
668        if gaxi::options::tracing_enabled(&conf) {
669            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
670        }
671        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
672    }
673
674    async fn build_transport(
675        conf: gaxi::options::ClientConfig,
676    ) -> crate::ClientBuilderResult<impl super::stub::AnswerRecords> {
677        super::transport::AnswerRecords::new(conf).await
678    }
679
680    async fn build_with_tracing(
681        conf: gaxi::options::ClientConfig,
682    ) -> crate::ClientBuilderResult<impl super::stub::AnswerRecords> {
683        Self::build_transport(conf)
684            .await
685            .map(super::tracing::AnswerRecords::new)
686    }
687
688    /// Returns the list of all answer records in the specified project in reverse
689    /// chronological order.
690    ///
691    /// # Example
692    /// ```
693    /// # use google_cloud_dialogflow_v2::client::AnswerRecords;
694    /// use google_cloud_gax::paginator::ItemPaginator as _;
695    /// use google_cloud_dialogflow_v2::Result;
696    /// async fn sample(
697    ///    client: &AnswerRecords, parent: &str
698    /// ) -> Result<()> {
699    ///     let mut list = client.list_answer_records()
700    ///         .set_parent(parent)
701    ///         .by_item();
702    ///     while let Some(item) = list.next().await.transpose()? {
703    ///         println!("{:?}", item);
704    ///     }
705    ///     Ok(())
706    /// }
707    /// ```
708    pub fn list_answer_records(&self) -> super::builder::answer_records::ListAnswerRecords {
709        super::builder::answer_records::ListAnswerRecords::new(self.inner.clone())
710    }
711
712    /// Updates the specified answer record.
713    ///
714    /// # Example
715    /// ```
716    /// # use google_cloud_dialogflow_v2::client::AnswerRecords;
717    /// # extern crate wkt as google_cloud_wkt;
718    /// use google_cloud_wkt::FieldMask;
719    /// use google_cloud_dialogflow_v2::model::AnswerRecord;
720    /// use google_cloud_dialogflow_v2::Result;
721    /// async fn sample(
722    ///    client: &AnswerRecords, name: &str
723    /// ) -> Result<()> {
724    ///     let response = client.update_answer_record()
725    ///         .set_answer_record(
726    ///             AnswerRecord::new().set_name(name)/* set fields */
727    ///         )
728    ///         .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
729    ///         .send().await?;
730    ///     println!("response {:?}", response);
731    ///     Ok(())
732    /// }
733    /// ```
734    pub fn update_answer_record(&self) -> super::builder::answer_records::UpdateAnswerRecord {
735        super::builder::answer_records::UpdateAnswerRecord::new(self.inner.clone())
736    }
737
738    /// Lists information about the supported locations for this service.
739    ///
740    /// This method lists locations based on the resource scope provided in
741    /// the [ListLocationsRequest.name] field:
742    ///
743    /// * **Global locations**: If `name` is empty, the method lists the
744    ///   public locations available to all projects. * **Project-specific
745    ///   locations**: If `name` follows the format
746    ///   `projects/{project}`, the method lists locations visible to that
747    ///   specific project. This includes public, private, or other
748    ///   project-specific locations enabled for the project.
749    ///
750    /// For gRPC and client library implementations, the resource name is
751    /// passed as the `name` field. For direct service calls, the resource
752    /// name is
753    /// incorporated into the request path based on the specific service
754    /// implementation and version.
755    ///
756    /// # Example
757    /// ```
758    /// # use google_cloud_dialogflow_v2::client::AnswerRecords;
759    /// use google_cloud_gax::paginator::ItemPaginator as _;
760    /// use google_cloud_dialogflow_v2::Result;
761    /// async fn sample(
762    ///    client: &AnswerRecords
763    /// ) -> Result<()> {
764    ///     let mut list = client.list_locations()
765    ///         /* set fields */
766    ///         .by_item();
767    ///     while let Some(item) = list.next().await.transpose()? {
768    ///         println!("{:?}", item);
769    ///     }
770    ///     Ok(())
771    /// }
772    /// ```
773    pub fn list_locations(&self) -> super::builder::answer_records::ListLocations {
774        super::builder::answer_records::ListLocations::new(self.inner.clone())
775    }
776
777    /// Gets information about a location.
778    ///
779    /// # Example
780    /// ```
781    /// # use google_cloud_dialogflow_v2::client::AnswerRecords;
782    /// use google_cloud_dialogflow_v2::Result;
783    /// async fn sample(
784    ///    client: &AnswerRecords
785    /// ) -> Result<()> {
786    ///     let response = client.get_location()
787    ///         /* set fields */
788    ///         .send().await?;
789    ///     println!("response {:?}", response);
790    ///     Ok(())
791    /// }
792    /// ```
793    pub fn get_location(&self) -> super::builder::answer_records::GetLocation {
794        super::builder::answer_records::GetLocation::new(self.inner.clone())
795    }
796
797    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
798    ///
799    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
800    ///
801    /// # Example
802    /// ```
803    /// # use google_cloud_dialogflow_v2::client::AnswerRecords;
804    /// use google_cloud_gax::paginator::ItemPaginator as _;
805    /// use google_cloud_dialogflow_v2::Result;
806    /// async fn sample(
807    ///    client: &AnswerRecords
808    /// ) -> Result<()> {
809    ///     let mut list = client.list_operations()
810    ///         /* set fields */
811    ///         .by_item();
812    ///     while let Some(item) = list.next().await.transpose()? {
813    ///         println!("{:?}", item);
814    ///     }
815    ///     Ok(())
816    /// }
817    /// ```
818    pub fn list_operations(&self) -> super::builder::answer_records::ListOperations {
819        super::builder::answer_records::ListOperations::new(self.inner.clone())
820    }
821
822    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
823    ///
824    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
825    ///
826    /// # Example
827    /// ```
828    /// # use google_cloud_dialogflow_v2::client::AnswerRecords;
829    /// use google_cloud_dialogflow_v2::Result;
830    /// async fn sample(
831    ///    client: &AnswerRecords
832    /// ) -> Result<()> {
833    ///     let response = client.get_operation()
834    ///         /* set fields */
835    ///         .send().await?;
836    ///     println!("response {:?}", response);
837    ///     Ok(())
838    /// }
839    /// ```
840    pub fn get_operation(&self) -> super::builder::answer_records::GetOperation {
841        super::builder::answer_records::GetOperation::new(self.inner.clone())
842    }
843
844    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
845    ///
846    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
847    ///
848    /// # Example
849    /// ```
850    /// # use google_cloud_dialogflow_v2::client::AnswerRecords;
851    /// use google_cloud_dialogflow_v2::Result;
852    /// async fn sample(
853    ///    client: &AnswerRecords
854    /// ) -> Result<()> {
855    ///     client.cancel_operation()
856    ///         /* set fields */
857    ///         .send().await?;
858    ///     Ok(())
859    /// }
860    /// ```
861    pub fn cancel_operation(&self) -> super::builder::answer_records::CancelOperation {
862        super::builder::answer_records::CancelOperation::new(self.inner.clone())
863    }
864}
865
866/// Implements a client for the Dialogflow API.
867///
868/// # Example
869/// ```
870/// # use google_cloud_dialogflow_v2::client::Contexts;
871/// use google_cloud_gax::paginator::ItemPaginator as _;
872/// # async fn sample() -> Result<(), Box<dyn std::error::Error>> {
873///     let client = Contexts::builder().build().await?;
874///     let parent = "parent_value";
875///     let mut list = client.list_contexts()
876///         .set_parent(parent)
877///         .by_item();
878///     while let Some(item) = list.next().await.transpose()? {
879///         println!("{:?}", item);
880///     }
881/// # Ok(()) }
882/// ```
883///
884/// # Service Description
885///
886/// Service for managing [Contexts][google.cloud.dialogflow.v2.Context].
887///
888/// [google.cloud.dialogflow.v2.Context]: crate::model::Context
889///
890/// # Configuration
891///
892/// To configure `Contexts` use the `with_*` methods in the type returned
893/// by [builder()][Contexts::builder]. The default configuration should
894/// work for most applications. Common configuration changes include
895///
896/// * [with_endpoint()]: by default this client uses the global default endpoint
897///   (`https://dialogflow.googleapis.com`). Applications using regional
898///   endpoints or running in restricted networks (e.g. a network configured
899//    with [Private Google Access with VPC Service Controls]) may want to
900///   override this default.
901/// * [with_credentials()]: by default this client uses
902///   [Application Default Credentials]. Applications using custom
903///   authentication may need to override this default.
904///
905/// [with_endpoint()]: super::builder::contexts::ClientBuilder::with_endpoint
906/// [with_credentials()]: super::builder::contexts::ClientBuilder::with_credentials
907/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
908/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
909///
910/// # Pooling and Cloning
911///
912/// `Contexts` holds a connection pool internally, it is advised to
913/// create one and reuse it. You do not need to wrap `Contexts` in
914/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
915/// already uses an `Arc` internally.
916#[cfg(feature = "contexts")]
917#[cfg_attr(docsrs, doc(cfg(feature = "contexts")))]
918#[derive(Clone, Debug)]
919pub struct Contexts {
920    inner: std::sync::Arc<dyn super::stub::dynamic::Contexts>,
921}
922
923#[cfg(feature = "contexts")]
924impl Contexts {
925    /// Returns a builder for [Contexts].
926    ///
927    /// ```
928    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
929    /// # use google_cloud_dialogflow_v2::client::Contexts;
930    /// let client = Contexts::builder().build().await?;
931    /// # Ok(()) }
932    /// ```
933    pub fn builder() -> super::builder::contexts::ClientBuilder {
934        crate::new_client_builder(super::builder::contexts::client::Factory)
935    }
936
937    /// Creates a new client from the provided stub.
938    ///
939    /// The most common case for calling this function is in tests mocking the
940    /// client's behavior.
941    pub fn from_stub<T>(stub: T) -> Self
942    where
943        T: super::stub::Contexts + 'static,
944    {
945        Self {
946            inner: std::sync::Arc::new(stub),
947        }
948    }
949
950    pub(crate) async fn new(
951        config: gaxi::options::ClientConfig,
952    ) -> crate::ClientBuilderResult<Self> {
953        let inner = Self::build_inner(config).await?;
954        Ok(Self { inner })
955    }
956
957    async fn build_inner(
958        conf: gaxi::options::ClientConfig,
959    ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::Contexts>> {
960        if gaxi::options::tracing_enabled(&conf) {
961            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
962        }
963        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
964    }
965
966    async fn build_transport(
967        conf: gaxi::options::ClientConfig,
968    ) -> crate::ClientBuilderResult<impl super::stub::Contexts> {
969        super::transport::Contexts::new(conf).await
970    }
971
972    async fn build_with_tracing(
973        conf: gaxi::options::ClientConfig,
974    ) -> crate::ClientBuilderResult<impl super::stub::Contexts> {
975        Self::build_transport(conf)
976            .await
977            .map(super::tracing::Contexts::new)
978    }
979
980    /// Returns the list of all contexts in the specified session.
981    ///
982    /// # Example
983    /// ```
984    /// # use google_cloud_dialogflow_v2::client::Contexts;
985    /// use google_cloud_gax::paginator::ItemPaginator as _;
986    /// use google_cloud_dialogflow_v2::Result;
987    /// async fn sample(
988    ///    client: &Contexts, parent: &str
989    /// ) -> Result<()> {
990    ///     let mut list = client.list_contexts()
991    ///         .set_parent(parent)
992    ///         .by_item();
993    ///     while let Some(item) = list.next().await.transpose()? {
994    ///         println!("{:?}", item);
995    ///     }
996    ///     Ok(())
997    /// }
998    /// ```
999    pub fn list_contexts(&self) -> super::builder::contexts::ListContexts {
1000        super::builder::contexts::ListContexts::new(self.inner.clone())
1001    }
1002
1003    /// Retrieves the specified context.
1004    ///
1005    /// # Example
1006    /// ```
1007    /// # use google_cloud_dialogflow_v2::client::Contexts;
1008    /// use google_cloud_dialogflow_v2::Result;
1009    /// async fn sample(
1010    ///    client: &Contexts, name: &str
1011    /// ) -> Result<()> {
1012    ///     let response = client.get_context()
1013    ///         .set_name(name)
1014    ///         .send().await?;
1015    ///     println!("response {:?}", response);
1016    ///     Ok(())
1017    /// }
1018    /// ```
1019    pub fn get_context(&self) -> super::builder::contexts::GetContext {
1020        super::builder::contexts::GetContext::new(self.inner.clone())
1021    }
1022
1023    /// Creates a context.
1024    ///
1025    /// If the specified context already exists, overrides the context.
1026    ///
1027    /// # Example
1028    /// ```
1029    /// # use google_cloud_dialogflow_v2::client::Contexts;
1030    /// use google_cloud_dialogflow_v2::model::Context;
1031    /// use google_cloud_dialogflow_v2::Result;
1032    /// async fn sample(
1033    ///    client: &Contexts, parent: &str
1034    /// ) -> Result<()> {
1035    ///     let response = client.create_context()
1036    ///         .set_parent(parent)
1037    ///         .set_context(
1038    ///             Context::new()/* set fields */
1039    ///         )
1040    ///         .send().await?;
1041    ///     println!("response {:?}", response);
1042    ///     Ok(())
1043    /// }
1044    /// ```
1045    pub fn create_context(&self) -> super::builder::contexts::CreateContext {
1046        super::builder::contexts::CreateContext::new(self.inner.clone())
1047    }
1048
1049    /// Updates the specified context.
1050    ///
1051    /// # Example
1052    /// ```
1053    /// # use google_cloud_dialogflow_v2::client::Contexts;
1054    /// # extern crate wkt as google_cloud_wkt;
1055    /// use google_cloud_wkt::FieldMask;
1056    /// use google_cloud_dialogflow_v2::model::Context;
1057    /// use google_cloud_dialogflow_v2::Result;
1058    /// async fn sample(
1059    ///    client: &Contexts, name: &str
1060    /// ) -> Result<()> {
1061    ///     let response = client.update_context()
1062    ///         .set_context(
1063    ///             Context::new().set_name(name)/* set fields */
1064    ///         )
1065    ///         .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
1066    ///         .send().await?;
1067    ///     println!("response {:?}", response);
1068    ///     Ok(())
1069    /// }
1070    /// ```
1071    pub fn update_context(&self) -> super::builder::contexts::UpdateContext {
1072        super::builder::contexts::UpdateContext::new(self.inner.clone())
1073    }
1074
1075    /// Deletes the specified context.
1076    ///
1077    /// # Example
1078    /// ```
1079    /// # use google_cloud_dialogflow_v2::client::Contexts;
1080    /// use google_cloud_dialogflow_v2::Result;
1081    /// async fn sample(
1082    ///    client: &Contexts, name: &str
1083    /// ) -> Result<()> {
1084    ///     client.delete_context()
1085    ///         .set_name(name)
1086    ///         .send().await?;
1087    ///     Ok(())
1088    /// }
1089    /// ```
1090    pub fn delete_context(&self) -> super::builder::contexts::DeleteContext {
1091        super::builder::contexts::DeleteContext::new(self.inner.clone())
1092    }
1093
1094    /// Deletes all active contexts in the specified session.
1095    ///
1096    /// # Example
1097    /// ```
1098    /// # use google_cloud_dialogflow_v2::client::Contexts;
1099    /// use google_cloud_dialogflow_v2::Result;
1100    /// async fn sample(
1101    ///    client: &Contexts
1102    /// ) -> Result<()> {
1103    ///     client.delete_all_contexts()
1104    ///         /* set fields */
1105    ///         .send().await?;
1106    ///     Ok(())
1107    /// }
1108    /// ```
1109    pub fn delete_all_contexts(&self) -> super::builder::contexts::DeleteAllContexts {
1110        super::builder::contexts::DeleteAllContexts::new(self.inner.clone())
1111    }
1112
1113    /// Lists information about the supported locations for this service.
1114    ///
1115    /// This method lists locations based on the resource scope provided in
1116    /// the [ListLocationsRequest.name] field:
1117    ///
1118    /// * **Global locations**: If `name` is empty, the method lists the
1119    ///   public locations available to all projects. * **Project-specific
1120    ///   locations**: If `name` follows the format
1121    ///   `projects/{project}`, the method lists locations visible to that
1122    ///   specific project. This includes public, private, or other
1123    ///   project-specific locations enabled for the project.
1124    ///
1125    /// For gRPC and client library implementations, the resource name is
1126    /// passed as the `name` field. For direct service calls, the resource
1127    /// name is
1128    /// incorporated into the request path based on the specific service
1129    /// implementation and version.
1130    ///
1131    /// # Example
1132    /// ```
1133    /// # use google_cloud_dialogflow_v2::client::Contexts;
1134    /// use google_cloud_gax::paginator::ItemPaginator as _;
1135    /// use google_cloud_dialogflow_v2::Result;
1136    /// async fn sample(
1137    ///    client: &Contexts
1138    /// ) -> Result<()> {
1139    ///     let mut list = client.list_locations()
1140    ///         /* set fields */
1141    ///         .by_item();
1142    ///     while let Some(item) = list.next().await.transpose()? {
1143    ///         println!("{:?}", item);
1144    ///     }
1145    ///     Ok(())
1146    /// }
1147    /// ```
1148    pub fn list_locations(&self) -> super::builder::contexts::ListLocations {
1149        super::builder::contexts::ListLocations::new(self.inner.clone())
1150    }
1151
1152    /// Gets information about a location.
1153    ///
1154    /// # Example
1155    /// ```
1156    /// # use google_cloud_dialogflow_v2::client::Contexts;
1157    /// use google_cloud_dialogflow_v2::Result;
1158    /// async fn sample(
1159    ///    client: &Contexts
1160    /// ) -> Result<()> {
1161    ///     let response = client.get_location()
1162    ///         /* set fields */
1163    ///         .send().await?;
1164    ///     println!("response {:?}", response);
1165    ///     Ok(())
1166    /// }
1167    /// ```
1168    pub fn get_location(&self) -> super::builder::contexts::GetLocation {
1169        super::builder::contexts::GetLocation::new(self.inner.clone())
1170    }
1171
1172    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1173    ///
1174    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1175    ///
1176    /// # Example
1177    /// ```
1178    /// # use google_cloud_dialogflow_v2::client::Contexts;
1179    /// use google_cloud_gax::paginator::ItemPaginator as _;
1180    /// use google_cloud_dialogflow_v2::Result;
1181    /// async fn sample(
1182    ///    client: &Contexts
1183    /// ) -> Result<()> {
1184    ///     let mut list = client.list_operations()
1185    ///         /* set fields */
1186    ///         .by_item();
1187    ///     while let Some(item) = list.next().await.transpose()? {
1188    ///         println!("{:?}", item);
1189    ///     }
1190    ///     Ok(())
1191    /// }
1192    /// ```
1193    pub fn list_operations(&self) -> super::builder::contexts::ListOperations {
1194        super::builder::contexts::ListOperations::new(self.inner.clone())
1195    }
1196
1197    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1198    ///
1199    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1200    ///
1201    /// # Example
1202    /// ```
1203    /// # use google_cloud_dialogflow_v2::client::Contexts;
1204    /// use google_cloud_dialogflow_v2::Result;
1205    /// async fn sample(
1206    ///    client: &Contexts
1207    /// ) -> Result<()> {
1208    ///     let response = client.get_operation()
1209    ///         /* set fields */
1210    ///         .send().await?;
1211    ///     println!("response {:?}", response);
1212    ///     Ok(())
1213    /// }
1214    /// ```
1215    pub fn get_operation(&self) -> super::builder::contexts::GetOperation {
1216        super::builder::contexts::GetOperation::new(self.inner.clone())
1217    }
1218
1219    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1220    ///
1221    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1222    ///
1223    /// # Example
1224    /// ```
1225    /// # use google_cloud_dialogflow_v2::client::Contexts;
1226    /// use google_cloud_dialogflow_v2::Result;
1227    /// async fn sample(
1228    ///    client: &Contexts
1229    /// ) -> Result<()> {
1230    ///     client.cancel_operation()
1231    ///         /* set fields */
1232    ///         .send().await?;
1233    ///     Ok(())
1234    /// }
1235    /// ```
1236    pub fn cancel_operation(&self) -> super::builder::contexts::CancelOperation {
1237        super::builder::contexts::CancelOperation::new(self.inner.clone())
1238    }
1239}
1240
1241/// Implements a client for the Dialogflow API.
1242///
1243/// # Example
1244/// ```
1245/// # use google_cloud_dialogflow_v2::client::Conversations;
1246/// use google_cloud_gax::paginator::ItemPaginator as _;
1247/// # async fn sample() -> Result<(), Box<dyn std::error::Error>> {
1248///     let client = Conversations::builder().build().await?;
1249///     let parent = "parent_value";
1250///     let mut list = client.list_conversations()
1251///         .set_parent(parent)
1252///         .by_item();
1253///     while let Some(item) = list.next().await.transpose()? {
1254///         println!("{:?}", item);
1255///     }
1256/// # Ok(()) }
1257/// ```
1258///
1259/// # Service Description
1260///
1261/// Service for managing
1262/// [Conversations][google.cloud.dialogflow.v2.Conversation].
1263///
1264/// [google.cloud.dialogflow.v2.Conversation]: crate::model::Conversation
1265///
1266/// # Configuration
1267///
1268/// To configure `Conversations` use the `with_*` methods in the type returned
1269/// by [builder()][Conversations::builder]. The default configuration should
1270/// work for most applications. Common configuration changes include
1271///
1272/// * [with_endpoint()]: by default this client uses the global default endpoint
1273///   (`https://dialogflow.googleapis.com`). Applications using regional
1274///   endpoints or running in restricted networks (e.g. a network configured
1275//    with [Private Google Access with VPC Service Controls]) may want to
1276///   override this default.
1277/// * [with_credentials()]: by default this client uses
1278///   [Application Default Credentials]. Applications using custom
1279///   authentication may need to override this default.
1280///
1281/// [with_endpoint()]: super::builder::conversations::ClientBuilder::with_endpoint
1282/// [with_credentials()]: super::builder::conversations::ClientBuilder::with_credentials
1283/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
1284/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
1285///
1286/// # Pooling and Cloning
1287///
1288/// `Conversations` holds a connection pool internally, it is advised to
1289/// create one and reuse it. You do not need to wrap `Conversations` in
1290/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
1291/// already uses an `Arc` internally.
1292#[cfg(feature = "conversations")]
1293#[cfg_attr(docsrs, doc(cfg(feature = "conversations")))]
1294#[derive(Clone, Debug)]
1295pub struct Conversations {
1296    inner: std::sync::Arc<dyn super::stub::dynamic::Conversations>,
1297}
1298
1299#[cfg(feature = "conversations")]
1300impl Conversations {
1301    /// Returns a builder for [Conversations].
1302    ///
1303    /// ```
1304    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
1305    /// # use google_cloud_dialogflow_v2::client::Conversations;
1306    /// let client = Conversations::builder().build().await?;
1307    /// # Ok(()) }
1308    /// ```
1309    pub fn builder() -> super::builder::conversations::ClientBuilder {
1310        crate::new_client_builder(super::builder::conversations::client::Factory)
1311    }
1312
1313    /// Creates a new client from the provided stub.
1314    ///
1315    /// The most common case for calling this function is in tests mocking the
1316    /// client's behavior.
1317    pub fn from_stub<T>(stub: T) -> Self
1318    where
1319        T: super::stub::Conversations + 'static,
1320    {
1321        Self {
1322            inner: std::sync::Arc::new(stub),
1323        }
1324    }
1325
1326    pub(crate) async fn new(
1327        config: gaxi::options::ClientConfig,
1328    ) -> crate::ClientBuilderResult<Self> {
1329        let inner = Self::build_inner(config).await?;
1330        Ok(Self { inner })
1331    }
1332
1333    async fn build_inner(
1334        conf: gaxi::options::ClientConfig,
1335    ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::Conversations>> {
1336        if gaxi::options::tracing_enabled(&conf) {
1337            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
1338        }
1339        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
1340    }
1341
1342    async fn build_transport(
1343        conf: gaxi::options::ClientConfig,
1344    ) -> crate::ClientBuilderResult<impl super::stub::Conversations> {
1345        super::transport::Conversations::new(conf).await
1346    }
1347
1348    async fn build_with_tracing(
1349        conf: gaxi::options::ClientConfig,
1350    ) -> crate::ClientBuilderResult<impl super::stub::Conversations> {
1351        Self::build_transport(conf)
1352            .await
1353            .map(super::tracing::Conversations::new)
1354    }
1355
1356    /// Creates a new conversation. Conversations are auto-completed after 24
1357    /// hours.
1358    ///
1359    /// Conversation Lifecycle:
1360    /// There are two stages during a conversation: Automated Agent Stage and
1361    /// Assist Stage.
1362    ///
1363    /// For Automated Agent Stage, there will be a dialogflow agent responding to
1364    /// user queries.
1365    ///
1366    /// For Assist Stage, there's no dialogflow agent responding to user queries.
1367    /// But we will provide suggestions which are generated from conversation.
1368    ///
1369    /// If
1370    /// [Conversation.conversation_profile][google.cloud.dialogflow.v2.Conversation.conversation_profile]
1371    /// is configured for a dialogflow agent, conversation will start from
1372    /// `Automated Agent Stage`, otherwise, it will start from `Assist Stage`. And
1373    /// during `Automated Agent Stage`, once an
1374    /// [Intent][google.cloud.dialogflow.v2.Intent] with
1375    /// [Intent.live_agent_handoff][google.cloud.dialogflow.v2.Intent.live_agent_handoff]
1376    /// is triggered, conversation will transfer to Assist Stage.
1377    ///
1378    /// [google.cloud.dialogflow.v2.Conversation.conversation_profile]: crate::model::Conversation::conversation_profile
1379    /// [google.cloud.dialogflow.v2.Intent]: crate::model::Intent
1380    /// [google.cloud.dialogflow.v2.Intent.live_agent_handoff]: crate::model::Intent::live_agent_handoff
1381    ///
1382    /// # Example
1383    /// ```
1384    /// # use google_cloud_dialogflow_v2::client::Conversations;
1385    /// use google_cloud_dialogflow_v2::model::Conversation;
1386    /// use google_cloud_dialogflow_v2::Result;
1387    /// async fn sample(
1388    ///    client: &Conversations, parent: &str
1389    /// ) -> Result<()> {
1390    ///     let response = client.create_conversation()
1391    ///         .set_parent(parent)
1392    ///         .set_conversation_id("conversation_id_value")
1393    ///         .set_conversation(
1394    ///             Conversation::new()/* set fields */
1395    ///         )
1396    ///         .send().await?;
1397    ///     println!("response {:?}", response);
1398    ///     Ok(())
1399    /// }
1400    /// ```
1401    pub fn create_conversation(&self) -> super::builder::conversations::CreateConversation {
1402        super::builder::conversations::CreateConversation::new(self.inner.clone())
1403    }
1404
1405    /// Returns the list of all conversations in the specified project.
1406    ///
1407    /// # Example
1408    /// ```
1409    /// # use google_cloud_dialogflow_v2::client::Conversations;
1410    /// use google_cloud_gax::paginator::ItemPaginator as _;
1411    /// use google_cloud_dialogflow_v2::Result;
1412    /// async fn sample(
1413    ///    client: &Conversations, parent: &str
1414    /// ) -> Result<()> {
1415    ///     let mut list = client.list_conversations()
1416    ///         .set_parent(parent)
1417    ///         .by_item();
1418    ///     while let Some(item) = list.next().await.transpose()? {
1419    ///         println!("{:?}", item);
1420    ///     }
1421    ///     Ok(())
1422    /// }
1423    /// ```
1424    pub fn list_conversations(&self) -> super::builder::conversations::ListConversations {
1425        super::builder::conversations::ListConversations::new(self.inner.clone())
1426    }
1427
1428    /// Retrieves the specific conversation.
1429    ///
1430    /// # Example
1431    /// ```
1432    /// # use google_cloud_dialogflow_v2::client::Conversations;
1433    /// use google_cloud_dialogflow_v2::Result;
1434    /// async fn sample(
1435    ///    client: &Conversations, name: &str
1436    /// ) -> Result<()> {
1437    ///     let response = client.get_conversation()
1438    ///         .set_name(name)
1439    ///         .send().await?;
1440    ///     println!("response {:?}", response);
1441    ///     Ok(())
1442    /// }
1443    /// ```
1444    pub fn get_conversation(&self) -> super::builder::conversations::GetConversation {
1445        super::builder::conversations::GetConversation::new(self.inner.clone())
1446    }
1447
1448    /// Completes the specified conversation. Finished conversations are purged
1449    /// from the database after 30 days.
1450    ///
1451    /// # Example
1452    /// ```
1453    /// # use google_cloud_dialogflow_v2::client::Conversations;
1454    /// use google_cloud_dialogflow_v2::Result;
1455    /// async fn sample(
1456    ///    client: &Conversations
1457    /// ) -> Result<()> {
1458    ///     let response = client.complete_conversation()
1459    ///         /* set fields */
1460    ///         .send().await?;
1461    ///     println!("response {:?}", response);
1462    ///     Ok(())
1463    /// }
1464    /// ```
1465    pub fn complete_conversation(&self) -> super::builder::conversations::CompleteConversation {
1466        super::builder::conversations::CompleteConversation::new(self.inner.clone())
1467    }
1468
1469    /// Data ingestion API.
1470    /// Ingests context references for an existing conversation.
1471    ///
1472    /// # Example
1473    /// ```
1474    /// # use google_cloud_dialogflow_v2::client::Conversations;
1475    /// use google_cloud_dialogflow_v2::Result;
1476    /// async fn sample(
1477    ///    client: &Conversations
1478    /// ) -> Result<()> {
1479    ///     let response = client.ingest_context_references()
1480    ///         /* set fields */
1481    ///         .send().await?;
1482    ///     println!("response {:?}", response);
1483    ///     Ok(())
1484    /// }
1485    /// ```
1486    pub fn ingest_context_references(
1487        &self,
1488    ) -> super::builder::conversations::IngestContextReferences {
1489        super::builder::conversations::IngestContextReferences::new(self.inner.clone())
1490    }
1491
1492    /// Lists messages that belong to a given conversation.
1493    /// `messages` are ordered by `create_time` in descending order. To fetch
1494    /// updates without duplication, send request with filter
1495    /// `create_time_epoch_microseconds >
1496    /// [first item's create_time of previous request]` and empty page_token.
1497    ///
1498    /// # Example
1499    /// ```
1500    /// # use google_cloud_dialogflow_v2::client::Conversations;
1501    /// use google_cloud_gax::paginator::ItemPaginator as _;
1502    /// use google_cloud_dialogflow_v2::Result;
1503    /// async fn sample(
1504    ///    client: &Conversations, parent: &str
1505    /// ) -> Result<()> {
1506    ///     let mut list = client.list_messages()
1507    ///         .set_parent(parent)
1508    ///         .by_item();
1509    ///     while let Some(item) = list.next().await.transpose()? {
1510    ///         println!("{:?}", item);
1511    ///     }
1512    ///     Ok(())
1513    /// }
1514    /// ```
1515    pub fn list_messages(&self) -> super::builder::conversations::ListMessages {
1516        super::builder::conversations::ListMessages::new(self.inner.clone())
1517    }
1518
1519    /// Suggests summary for a conversation based on specific historical messages.
1520    /// The range of the messages to be used for summary can be specified in the
1521    /// request.
1522    ///
1523    /// # Example
1524    /// ```
1525    /// # use google_cloud_dialogflow_v2::client::Conversations;
1526    /// use google_cloud_dialogflow_v2::Result;
1527    /// async fn sample(
1528    ///    client: &Conversations
1529    /// ) -> Result<()> {
1530    ///     let response = client.suggest_conversation_summary()
1531    ///         /* set fields */
1532    ///         .send().await?;
1533    ///     println!("response {:?}", response);
1534    ///     Ok(())
1535    /// }
1536    /// ```
1537    pub fn suggest_conversation_summary(
1538        &self,
1539    ) -> super::builder::conversations::SuggestConversationSummary {
1540        super::builder::conversations::SuggestConversationSummary::new(self.inner.clone())
1541    }
1542
1543    /// Generates and returns a summary for a conversation that does not have a
1544    /// resource created for it.
1545    ///
1546    /// # Example
1547    /// ```
1548    /// # use google_cloud_dialogflow_v2::client::Conversations;
1549    /// use google_cloud_dialogflow_v2::Result;
1550    /// async fn sample(
1551    ///    client: &Conversations
1552    /// ) -> Result<()> {
1553    ///     let response = client.generate_stateless_summary()
1554    ///         /* set fields */
1555    ///         .send().await?;
1556    ///     println!("response {:?}", response);
1557    ///     Ok(())
1558    /// }
1559    /// ```
1560    pub fn generate_stateless_summary(
1561        &self,
1562    ) -> super::builder::conversations::GenerateStatelessSummary {
1563        super::builder::conversations::GenerateStatelessSummary::new(self.inner.clone())
1564    }
1565
1566    /// Generates and returns a suggestion for a conversation that does not have a
1567    /// resource created for it.
1568    ///
1569    /// # Example
1570    /// ```
1571    /// # use google_cloud_dialogflow_v2::client::Conversations;
1572    /// use google_cloud_dialogflow_v2::Result;
1573    /// async fn sample(
1574    ///    client: &Conversations
1575    /// ) -> Result<()> {
1576    ///     let response = client.generate_stateless_suggestion()
1577    ///         /* set fields */
1578    ///         .send().await?;
1579    ///     println!("response {:?}", response);
1580    ///     Ok(())
1581    /// }
1582    /// ```
1583    pub fn generate_stateless_suggestion(
1584        &self,
1585    ) -> super::builder::conversations::GenerateStatelessSuggestion {
1586        super::builder::conversations::GenerateStatelessSuggestion::new(self.inner.clone())
1587    }
1588
1589    /// Get answers for the given query based on knowledge documents.
1590    ///
1591    /// # Example
1592    /// ```
1593    /// # use google_cloud_dialogflow_v2::client::Conversations;
1594    /// use google_cloud_dialogflow_v2::Result;
1595    /// async fn sample(
1596    ///    client: &Conversations
1597    /// ) -> Result<()> {
1598    ///     let response = client.search_knowledge()
1599    ///         /* set fields */
1600    ///         .send().await?;
1601    ///     println!("response {:?}", response);
1602    ///     Ok(())
1603    /// }
1604    /// ```
1605    pub fn search_knowledge(&self) -> super::builder::conversations::SearchKnowledge {
1606        super::builder::conversations::SearchKnowledge::new(self.inner.clone())
1607    }
1608
1609    /// Generates all the suggestions using generators configured in the
1610    /// conversation profile. A generator is used only if its trigger event is
1611    /// matched.
1612    ///
1613    /// # Example
1614    /// ```
1615    /// # use google_cloud_dialogflow_v2::client::Conversations;
1616    /// use google_cloud_dialogflow_v2::Result;
1617    /// async fn sample(
1618    ///    client: &Conversations
1619    /// ) -> Result<()> {
1620    ///     let response = client.generate_suggestions()
1621    ///         /* set fields */
1622    ///         .send().await?;
1623    ///     println!("response {:?}", response);
1624    ///     Ok(())
1625    /// }
1626    /// ```
1627    pub fn generate_suggestions(&self) -> super::builder::conversations::GenerateSuggestions {
1628        super::builder::conversations::GenerateSuggestions::new(self.inner.clone())
1629    }
1630
1631    /// Lists information about the supported locations for this service.
1632    ///
1633    /// This method lists locations based on the resource scope provided in
1634    /// the [ListLocationsRequest.name] field:
1635    ///
1636    /// * **Global locations**: If `name` is empty, the method lists the
1637    ///   public locations available to all projects. * **Project-specific
1638    ///   locations**: If `name` follows the format
1639    ///   `projects/{project}`, the method lists locations visible to that
1640    ///   specific project. This includes public, private, or other
1641    ///   project-specific locations enabled for the project.
1642    ///
1643    /// For gRPC and client library implementations, the resource name is
1644    /// passed as the `name` field. For direct service calls, the resource
1645    /// name is
1646    /// incorporated into the request path based on the specific service
1647    /// implementation and version.
1648    ///
1649    /// # Example
1650    /// ```
1651    /// # use google_cloud_dialogflow_v2::client::Conversations;
1652    /// use google_cloud_gax::paginator::ItemPaginator as _;
1653    /// use google_cloud_dialogflow_v2::Result;
1654    /// async fn sample(
1655    ///    client: &Conversations
1656    /// ) -> Result<()> {
1657    ///     let mut list = client.list_locations()
1658    ///         /* set fields */
1659    ///         .by_item();
1660    ///     while let Some(item) = list.next().await.transpose()? {
1661    ///         println!("{:?}", item);
1662    ///     }
1663    ///     Ok(())
1664    /// }
1665    /// ```
1666    pub fn list_locations(&self) -> super::builder::conversations::ListLocations {
1667        super::builder::conversations::ListLocations::new(self.inner.clone())
1668    }
1669
1670    /// Gets information about a location.
1671    ///
1672    /// # Example
1673    /// ```
1674    /// # use google_cloud_dialogflow_v2::client::Conversations;
1675    /// use google_cloud_dialogflow_v2::Result;
1676    /// async fn sample(
1677    ///    client: &Conversations
1678    /// ) -> Result<()> {
1679    ///     let response = client.get_location()
1680    ///         /* set fields */
1681    ///         .send().await?;
1682    ///     println!("response {:?}", response);
1683    ///     Ok(())
1684    /// }
1685    /// ```
1686    pub fn get_location(&self) -> super::builder::conversations::GetLocation {
1687        super::builder::conversations::GetLocation::new(self.inner.clone())
1688    }
1689
1690    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1691    ///
1692    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1693    ///
1694    /// # Example
1695    /// ```
1696    /// # use google_cloud_dialogflow_v2::client::Conversations;
1697    /// use google_cloud_gax::paginator::ItemPaginator as _;
1698    /// use google_cloud_dialogflow_v2::Result;
1699    /// async fn sample(
1700    ///    client: &Conversations
1701    /// ) -> Result<()> {
1702    ///     let mut list = client.list_operations()
1703    ///         /* set fields */
1704    ///         .by_item();
1705    ///     while let Some(item) = list.next().await.transpose()? {
1706    ///         println!("{:?}", item);
1707    ///     }
1708    ///     Ok(())
1709    /// }
1710    /// ```
1711    pub fn list_operations(&self) -> super::builder::conversations::ListOperations {
1712        super::builder::conversations::ListOperations::new(self.inner.clone())
1713    }
1714
1715    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1716    ///
1717    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1718    ///
1719    /// # Example
1720    /// ```
1721    /// # use google_cloud_dialogflow_v2::client::Conversations;
1722    /// use google_cloud_dialogflow_v2::Result;
1723    /// async fn sample(
1724    ///    client: &Conversations
1725    /// ) -> Result<()> {
1726    ///     let response = client.get_operation()
1727    ///         /* set fields */
1728    ///         .send().await?;
1729    ///     println!("response {:?}", response);
1730    ///     Ok(())
1731    /// }
1732    /// ```
1733    pub fn get_operation(&self) -> super::builder::conversations::GetOperation {
1734        super::builder::conversations::GetOperation::new(self.inner.clone())
1735    }
1736
1737    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1738    ///
1739    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1740    ///
1741    /// # Example
1742    /// ```
1743    /// # use google_cloud_dialogflow_v2::client::Conversations;
1744    /// use google_cloud_dialogflow_v2::Result;
1745    /// async fn sample(
1746    ///    client: &Conversations
1747    /// ) -> Result<()> {
1748    ///     client.cancel_operation()
1749    ///         /* set fields */
1750    ///         .send().await?;
1751    ///     Ok(())
1752    /// }
1753    /// ```
1754    pub fn cancel_operation(&self) -> super::builder::conversations::CancelOperation {
1755        super::builder::conversations::CancelOperation::new(self.inner.clone())
1756    }
1757}
1758
1759/// Implements a client for the Dialogflow API.
1760///
1761/// # Example
1762/// ```
1763/// # use google_cloud_dialogflow_v2::client::ConversationDatasets;
1764/// use google_cloud_gax::paginator::ItemPaginator as _;
1765/// # async fn sample() -> Result<(), Box<dyn std::error::Error>> {
1766///     let client = ConversationDatasets::builder().build().await?;
1767///     let parent = "parent_value";
1768///     let mut list = client.list_conversation_datasets()
1769///         .set_parent(parent)
1770///         .by_item();
1771///     while let Some(item) = list.next().await.transpose()? {
1772///         println!("{:?}", item);
1773///     }
1774/// # Ok(()) }
1775/// ```
1776///
1777/// # Service Description
1778///
1779/// Conversation datasets.
1780///
1781/// Conversation datasets contain raw conversation files and their
1782/// customizable metadata that can be used for model training.
1783///
1784/// # Configuration
1785///
1786/// To configure `ConversationDatasets` use the `with_*` methods in the type returned
1787/// by [builder()][ConversationDatasets::builder]. The default configuration should
1788/// work for most applications. Common configuration changes include
1789///
1790/// * [with_endpoint()]: by default this client uses the global default endpoint
1791///   (`https://dialogflow.googleapis.com`). Applications using regional
1792///   endpoints or running in restricted networks (e.g. a network configured
1793//    with [Private Google Access with VPC Service Controls]) may want to
1794///   override this default.
1795/// * [with_credentials()]: by default this client uses
1796///   [Application Default Credentials]. Applications using custom
1797///   authentication may need to override this default.
1798///
1799/// [with_endpoint()]: super::builder::conversation_datasets::ClientBuilder::with_endpoint
1800/// [with_credentials()]: super::builder::conversation_datasets::ClientBuilder::with_credentials
1801/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
1802/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
1803///
1804/// # Pooling and Cloning
1805///
1806/// `ConversationDatasets` holds a connection pool internally, it is advised to
1807/// create one and reuse it. You do not need to wrap `ConversationDatasets` in
1808/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
1809/// already uses an `Arc` internally.
1810#[cfg(feature = "conversation-datasets")]
1811#[cfg_attr(docsrs, doc(cfg(feature = "conversation-datasets")))]
1812#[derive(Clone, Debug)]
1813pub struct ConversationDatasets {
1814    inner: std::sync::Arc<dyn super::stub::dynamic::ConversationDatasets>,
1815}
1816
1817#[cfg(feature = "conversation-datasets")]
1818impl ConversationDatasets {
1819    /// Returns a builder for [ConversationDatasets].
1820    ///
1821    /// ```
1822    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
1823    /// # use google_cloud_dialogflow_v2::client::ConversationDatasets;
1824    /// let client = ConversationDatasets::builder().build().await?;
1825    /// # Ok(()) }
1826    /// ```
1827    pub fn builder() -> super::builder::conversation_datasets::ClientBuilder {
1828        crate::new_client_builder(super::builder::conversation_datasets::client::Factory)
1829    }
1830
1831    /// Creates a new client from the provided stub.
1832    ///
1833    /// The most common case for calling this function is in tests mocking the
1834    /// client's behavior.
1835    pub fn from_stub<T>(stub: T) -> Self
1836    where
1837        T: super::stub::ConversationDatasets + 'static,
1838    {
1839        Self {
1840            inner: std::sync::Arc::new(stub),
1841        }
1842    }
1843
1844    pub(crate) async fn new(
1845        config: gaxi::options::ClientConfig,
1846    ) -> crate::ClientBuilderResult<Self> {
1847        let inner = Self::build_inner(config).await?;
1848        Ok(Self { inner })
1849    }
1850
1851    async fn build_inner(
1852        conf: gaxi::options::ClientConfig,
1853    ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::ConversationDatasets>>
1854    {
1855        if gaxi::options::tracing_enabled(&conf) {
1856            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
1857        }
1858        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
1859    }
1860
1861    async fn build_transport(
1862        conf: gaxi::options::ClientConfig,
1863    ) -> crate::ClientBuilderResult<impl super::stub::ConversationDatasets> {
1864        super::transport::ConversationDatasets::new(conf).await
1865    }
1866
1867    async fn build_with_tracing(
1868        conf: gaxi::options::ClientConfig,
1869    ) -> crate::ClientBuilderResult<impl super::stub::ConversationDatasets> {
1870        Self::build_transport(conf)
1871            .await
1872            .map(super::tracing::ConversationDatasets::new)
1873    }
1874
1875    /// Creates a new conversation dataset.
1876    ///
1877    /// This method is a [long-running
1878    /// operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations).
1879    /// The returned `Operation` type has the following method-specific fields:
1880    ///
1881    /// - `metadata`:
1882    ///   [CreateConversationDatasetOperationMetadata][google.cloud.dialogflow.v2.CreateConversationDatasetOperationMetadata]
1883    /// - `response`:
1884    ///   [ConversationDataset][google.cloud.dialogflow.v2.ConversationDataset]
1885    ///
1886    /// [google.cloud.dialogflow.v2.ConversationDataset]: crate::model::ConversationDataset
1887    /// [google.cloud.dialogflow.v2.CreateConversationDatasetOperationMetadata]: crate::model::CreateConversationDatasetOperationMetadata
1888    ///
1889    /// # Long running operations
1890    ///
1891    /// This method is used to start, and/or poll a [long-running Operation].
1892    /// The [Working with long-running operations] chapter in the [user guide]
1893    /// covers these operations in detail.
1894    ///
1895    /// [long-running operation]: https://google.aip.dev/151
1896    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1897    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1898    ///
1899    /// # Example
1900    /// ```
1901    /// # use google_cloud_dialogflow_v2::client::ConversationDatasets;
1902    /// use google_cloud_lro::Poller;
1903    /// use google_cloud_dialogflow_v2::model::ConversationDataset;
1904    /// use google_cloud_dialogflow_v2::Result;
1905    /// async fn sample(
1906    ///    client: &ConversationDatasets, parent: &str
1907    /// ) -> Result<()> {
1908    ///     let response = client.create_conversation_dataset()
1909    ///         .set_parent(parent)
1910    ///         .set_conversation_dataset(
1911    ///             ConversationDataset::new()/* set fields */
1912    ///         )
1913    ///         .poller().until_done().await?;
1914    ///     println!("response {:?}", response);
1915    ///     Ok(())
1916    /// }
1917    /// ```
1918    pub fn create_conversation_dataset(
1919        &self,
1920    ) -> super::builder::conversation_datasets::CreateConversationDataset {
1921        super::builder::conversation_datasets::CreateConversationDataset::new(self.inner.clone())
1922    }
1923
1924    /// Retrieves the specified conversation dataset.
1925    ///
1926    /// # Example
1927    /// ```
1928    /// # use google_cloud_dialogflow_v2::client::ConversationDatasets;
1929    /// use google_cloud_dialogflow_v2::Result;
1930    /// async fn sample(
1931    ///    client: &ConversationDatasets, name: &str
1932    /// ) -> Result<()> {
1933    ///     let response = client.get_conversation_dataset()
1934    ///         .set_name(name)
1935    ///         .send().await?;
1936    ///     println!("response {:?}", response);
1937    ///     Ok(())
1938    /// }
1939    /// ```
1940    pub fn get_conversation_dataset(
1941        &self,
1942    ) -> super::builder::conversation_datasets::GetConversationDataset {
1943        super::builder::conversation_datasets::GetConversationDataset::new(self.inner.clone())
1944    }
1945
1946    /// Returns the list of all conversation datasets in the specified
1947    /// project and location.
1948    ///
1949    /// # Example
1950    /// ```
1951    /// # use google_cloud_dialogflow_v2::client::ConversationDatasets;
1952    /// use google_cloud_gax::paginator::ItemPaginator as _;
1953    /// use google_cloud_dialogflow_v2::Result;
1954    /// async fn sample(
1955    ///    client: &ConversationDatasets, parent: &str
1956    /// ) -> Result<()> {
1957    ///     let mut list = client.list_conversation_datasets()
1958    ///         .set_parent(parent)
1959    ///         .by_item();
1960    ///     while let Some(item) = list.next().await.transpose()? {
1961    ///         println!("{:?}", item);
1962    ///     }
1963    ///     Ok(())
1964    /// }
1965    /// ```
1966    pub fn list_conversation_datasets(
1967        &self,
1968    ) -> super::builder::conversation_datasets::ListConversationDatasets {
1969        super::builder::conversation_datasets::ListConversationDatasets::new(self.inner.clone())
1970    }
1971
1972    /// Deletes the specified conversation dataset.
1973    ///
1974    /// This method is a [long-running
1975    /// operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations).
1976    /// The returned `Operation` type has the following method-specific fields:
1977    ///
1978    /// - `metadata`:
1979    ///   [DeleteConversationDatasetOperationMetadata][google.cloud.dialogflow.v2.DeleteConversationDatasetOperationMetadata]
1980    /// - `response`: An [Empty
1981    ///   message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
1982    ///
1983    /// [google.cloud.dialogflow.v2.DeleteConversationDatasetOperationMetadata]: crate::model::DeleteConversationDatasetOperationMetadata
1984    ///
1985    /// # Long running operations
1986    ///
1987    /// This method is used to start, and/or poll a [long-running Operation].
1988    /// The [Working with long-running operations] chapter in the [user guide]
1989    /// covers these operations in detail.
1990    ///
1991    /// [long-running operation]: https://google.aip.dev/151
1992    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1993    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1994    ///
1995    /// # Example
1996    /// ```
1997    /// # use google_cloud_dialogflow_v2::client::ConversationDatasets;
1998    /// use google_cloud_lro::Poller;
1999    /// use google_cloud_dialogflow_v2::Result;
2000    /// async fn sample(
2001    ///    client: &ConversationDatasets, name: &str
2002    /// ) -> Result<()> {
2003    ///     client.delete_conversation_dataset()
2004    ///         .set_name(name)
2005    ///         .poller().until_done().await?;
2006    ///     Ok(())
2007    /// }
2008    /// ```
2009    pub fn delete_conversation_dataset(
2010        &self,
2011    ) -> super::builder::conversation_datasets::DeleteConversationDataset {
2012        super::builder::conversation_datasets::DeleteConversationDataset::new(self.inner.clone())
2013    }
2014
2015    /// Import data into the specified conversation dataset. Note that it
2016    /// is not allowed to import data to a conversation dataset that
2017    /// already has data in it.
2018    ///
2019    /// This method is a [long-running
2020    /// operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations).
2021    /// The returned `Operation` type has the following method-specific fields:
2022    ///
2023    /// - `metadata`:
2024    ///   [ImportConversationDataOperationMetadata][google.cloud.dialogflow.v2.ImportConversationDataOperationMetadata]
2025    /// - `response`:
2026    ///   [ImportConversationDataOperationResponse][google.cloud.dialogflow.v2.ImportConversationDataOperationResponse]
2027    ///
2028    /// [google.cloud.dialogflow.v2.ImportConversationDataOperationMetadata]: crate::model::ImportConversationDataOperationMetadata
2029    /// [google.cloud.dialogflow.v2.ImportConversationDataOperationResponse]: crate::model::ImportConversationDataOperationResponse
2030    ///
2031    /// # Long running operations
2032    ///
2033    /// This method is used to start, and/or poll a [long-running Operation].
2034    /// The [Working with long-running operations] chapter in the [user guide]
2035    /// covers these operations in detail.
2036    ///
2037    /// [long-running operation]: https://google.aip.dev/151
2038    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2039    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2040    ///
2041    /// # Example
2042    /// ```
2043    /// # use google_cloud_dialogflow_v2::client::ConversationDatasets;
2044    /// use google_cloud_lro::Poller;
2045    /// use google_cloud_dialogflow_v2::Result;
2046    /// async fn sample(
2047    ///    client: &ConversationDatasets
2048    /// ) -> Result<()> {
2049    ///     let response = client.import_conversation_data()
2050    ///         /* set fields */
2051    ///         .poller().until_done().await?;
2052    ///     println!("response {:?}", response);
2053    ///     Ok(())
2054    /// }
2055    /// ```
2056    pub fn import_conversation_data(
2057        &self,
2058    ) -> super::builder::conversation_datasets::ImportConversationData {
2059        super::builder::conversation_datasets::ImportConversationData::new(self.inner.clone())
2060    }
2061
2062    /// Lists information about the supported locations for this service.
2063    ///
2064    /// This method lists locations based on the resource scope provided in
2065    /// the [ListLocationsRequest.name] field:
2066    ///
2067    /// * **Global locations**: If `name` is empty, the method lists the
2068    ///   public locations available to all projects. * **Project-specific
2069    ///   locations**: If `name` follows the format
2070    ///   `projects/{project}`, the method lists locations visible to that
2071    ///   specific project. This includes public, private, or other
2072    ///   project-specific locations enabled for the project.
2073    ///
2074    /// For gRPC and client library implementations, the resource name is
2075    /// passed as the `name` field. For direct service calls, the resource
2076    /// name is
2077    /// incorporated into the request path based on the specific service
2078    /// implementation and version.
2079    ///
2080    /// # Example
2081    /// ```
2082    /// # use google_cloud_dialogflow_v2::client::ConversationDatasets;
2083    /// use google_cloud_gax::paginator::ItemPaginator as _;
2084    /// use google_cloud_dialogflow_v2::Result;
2085    /// async fn sample(
2086    ///    client: &ConversationDatasets
2087    /// ) -> Result<()> {
2088    ///     let mut list = client.list_locations()
2089    ///         /* set fields */
2090    ///         .by_item();
2091    ///     while let Some(item) = list.next().await.transpose()? {
2092    ///         println!("{:?}", item);
2093    ///     }
2094    ///     Ok(())
2095    /// }
2096    /// ```
2097    pub fn list_locations(&self) -> super::builder::conversation_datasets::ListLocations {
2098        super::builder::conversation_datasets::ListLocations::new(self.inner.clone())
2099    }
2100
2101    /// Gets information about a location.
2102    ///
2103    /// # Example
2104    /// ```
2105    /// # use google_cloud_dialogflow_v2::client::ConversationDatasets;
2106    /// use google_cloud_dialogflow_v2::Result;
2107    /// async fn sample(
2108    ///    client: &ConversationDatasets
2109    /// ) -> Result<()> {
2110    ///     let response = client.get_location()
2111    ///         /* set fields */
2112    ///         .send().await?;
2113    ///     println!("response {:?}", response);
2114    ///     Ok(())
2115    /// }
2116    /// ```
2117    pub fn get_location(&self) -> super::builder::conversation_datasets::GetLocation {
2118        super::builder::conversation_datasets::GetLocation::new(self.inner.clone())
2119    }
2120
2121    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2122    ///
2123    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
2124    ///
2125    /// # Example
2126    /// ```
2127    /// # use google_cloud_dialogflow_v2::client::ConversationDatasets;
2128    /// use google_cloud_gax::paginator::ItemPaginator as _;
2129    /// use google_cloud_dialogflow_v2::Result;
2130    /// async fn sample(
2131    ///    client: &ConversationDatasets
2132    /// ) -> Result<()> {
2133    ///     let mut list = client.list_operations()
2134    ///         /* set fields */
2135    ///         .by_item();
2136    ///     while let Some(item) = list.next().await.transpose()? {
2137    ///         println!("{:?}", item);
2138    ///     }
2139    ///     Ok(())
2140    /// }
2141    /// ```
2142    pub fn list_operations(&self) -> super::builder::conversation_datasets::ListOperations {
2143        super::builder::conversation_datasets::ListOperations::new(self.inner.clone())
2144    }
2145
2146    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2147    ///
2148    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
2149    ///
2150    /// # Example
2151    /// ```
2152    /// # use google_cloud_dialogflow_v2::client::ConversationDatasets;
2153    /// use google_cloud_dialogflow_v2::Result;
2154    /// async fn sample(
2155    ///    client: &ConversationDatasets
2156    /// ) -> Result<()> {
2157    ///     let response = client.get_operation()
2158    ///         /* set fields */
2159    ///         .send().await?;
2160    ///     println!("response {:?}", response);
2161    ///     Ok(())
2162    /// }
2163    /// ```
2164    pub fn get_operation(&self) -> super::builder::conversation_datasets::GetOperation {
2165        super::builder::conversation_datasets::GetOperation::new(self.inner.clone())
2166    }
2167
2168    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2169    ///
2170    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
2171    ///
2172    /// # Example
2173    /// ```
2174    /// # use google_cloud_dialogflow_v2::client::ConversationDatasets;
2175    /// use google_cloud_dialogflow_v2::Result;
2176    /// async fn sample(
2177    ///    client: &ConversationDatasets
2178    /// ) -> Result<()> {
2179    ///     client.cancel_operation()
2180    ///         /* set fields */
2181    ///         .send().await?;
2182    ///     Ok(())
2183    /// }
2184    /// ```
2185    pub fn cancel_operation(&self) -> super::builder::conversation_datasets::CancelOperation {
2186        super::builder::conversation_datasets::CancelOperation::new(self.inner.clone())
2187    }
2188}
2189
2190/// Implements a client for the Dialogflow API.
2191///
2192/// # Example
2193/// ```
2194/// # use google_cloud_dialogflow_v2::client::ConversationModels;
2195/// use google_cloud_gax::paginator::ItemPaginator as _;
2196/// # async fn sample() -> Result<(), Box<dyn std::error::Error>> {
2197///     let client = ConversationModels::builder().build().await?;
2198///     let parent = "parent_value";
2199///     let mut list = client.list_conversation_models()
2200///         .set_parent(parent)
2201///         .by_item();
2202///     while let Some(item) = list.next().await.transpose()? {
2203///         println!("{:?}", item);
2204///     }
2205/// # Ok(()) }
2206/// ```
2207///
2208/// # Service Description
2209///
2210/// Manages a collection of models for human agent assistant.
2211///
2212/// # Configuration
2213///
2214/// To configure `ConversationModels` use the `with_*` methods in the type returned
2215/// by [builder()][ConversationModels::builder]. The default configuration should
2216/// work for most applications. Common configuration changes include
2217///
2218/// * [with_endpoint()]: by default this client uses the global default endpoint
2219///   (`https://dialogflow.googleapis.com`). Applications using regional
2220///   endpoints or running in restricted networks (e.g. a network configured
2221//    with [Private Google Access with VPC Service Controls]) may want to
2222///   override this default.
2223/// * [with_credentials()]: by default this client uses
2224///   [Application Default Credentials]. Applications using custom
2225///   authentication may need to override this default.
2226///
2227/// [with_endpoint()]: super::builder::conversation_models::ClientBuilder::with_endpoint
2228/// [with_credentials()]: super::builder::conversation_models::ClientBuilder::with_credentials
2229/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
2230/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
2231///
2232/// # Pooling and Cloning
2233///
2234/// `ConversationModels` holds a connection pool internally, it is advised to
2235/// create one and reuse it. You do not need to wrap `ConversationModels` in
2236/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
2237/// already uses an `Arc` internally.
2238#[cfg(feature = "conversation-models")]
2239#[cfg_attr(docsrs, doc(cfg(feature = "conversation-models")))]
2240#[derive(Clone, Debug)]
2241pub struct ConversationModels {
2242    inner: std::sync::Arc<dyn super::stub::dynamic::ConversationModels>,
2243}
2244
2245#[cfg(feature = "conversation-models")]
2246impl ConversationModels {
2247    /// Returns a builder for [ConversationModels].
2248    ///
2249    /// ```
2250    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
2251    /// # use google_cloud_dialogflow_v2::client::ConversationModels;
2252    /// let client = ConversationModels::builder().build().await?;
2253    /// # Ok(()) }
2254    /// ```
2255    pub fn builder() -> super::builder::conversation_models::ClientBuilder {
2256        crate::new_client_builder(super::builder::conversation_models::client::Factory)
2257    }
2258
2259    /// Creates a new client from the provided stub.
2260    ///
2261    /// The most common case for calling this function is in tests mocking the
2262    /// client's behavior.
2263    pub fn from_stub<T>(stub: T) -> Self
2264    where
2265        T: super::stub::ConversationModels + 'static,
2266    {
2267        Self {
2268            inner: std::sync::Arc::new(stub),
2269        }
2270    }
2271
2272    pub(crate) async fn new(
2273        config: gaxi::options::ClientConfig,
2274    ) -> crate::ClientBuilderResult<Self> {
2275        let inner = Self::build_inner(config).await?;
2276        Ok(Self { inner })
2277    }
2278
2279    async fn build_inner(
2280        conf: gaxi::options::ClientConfig,
2281    ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::ConversationModels>>
2282    {
2283        if gaxi::options::tracing_enabled(&conf) {
2284            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
2285        }
2286        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
2287    }
2288
2289    async fn build_transport(
2290        conf: gaxi::options::ClientConfig,
2291    ) -> crate::ClientBuilderResult<impl super::stub::ConversationModels> {
2292        super::transport::ConversationModels::new(conf).await
2293    }
2294
2295    async fn build_with_tracing(
2296        conf: gaxi::options::ClientConfig,
2297    ) -> crate::ClientBuilderResult<impl super::stub::ConversationModels> {
2298        Self::build_transport(conf)
2299            .await
2300            .map(super::tracing::ConversationModels::new)
2301    }
2302
2303    /// Creates a model.
2304    ///
2305    /// This method is a [long-running
2306    /// operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations).
2307    /// The returned `Operation` type has the following method-specific fields:
2308    ///
2309    /// - `metadata`:
2310    ///   [CreateConversationModelOperationMetadata][google.cloud.dialogflow.v2.CreateConversationModelOperationMetadata]
2311    /// - `response`:
2312    ///   [ConversationModel][google.cloud.dialogflow.v2.ConversationModel]
2313    ///
2314    /// [google.cloud.dialogflow.v2.ConversationModel]: crate::model::ConversationModel
2315    /// [google.cloud.dialogflow.v2.CreateConversationModelOperationMetadata]: crate::model::CreateConversationModelOperationMetadata
2316    ///
2317    /// # Long running operations
2318    ///
2319    /// This method is used to start, and/or poll a [long-running Operation].
2320    /// The [Working with long-running operations] chapter in the [user guide]
2321    /// covers these operations in detail.
2322    ///
2323    /// [long-running operation]: https://google.aip.dev/151
2324    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2325    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2326    ///
2327    /// # Example
2328    /// ```
2329    /// # use google_cloud_dialogflow_v2::client::ConversationModels;
2330    /// use google_cloud_lro::Poller;
2331    /// use google_cloud_dialogflow_v2::model::ConversationModel;
2332    /// use google_cloud_dialogflow_v2::Result;
2333    /// async fn sample(
2334    ///    client: &ConversationModels, parent: &str
2335    /// ) -> Result<()> {
2336    ///     let response = client.create_conversation_model()
2337    ///         .set_parent(parent)
2338    ///         .set_conversation_model(
2339    ///             ConversationModel::new()/* set fields */
2340    ///         )
2341    ///         .poller().until_done().await?;
2342    ///     println!("response {:?}", response);
2343    ///     Ok(())
2344    /// }
2345    /// ```
2346    pub fn create_conversation_model(
2347        &self,
2348    ) -> super::builder::conversation_models::CreateConversationModel {
2349        super::builder::conversation_models::CreateConversationModel::new(self.inner.clone())
2350    }
2351
2352    /// Gets conversation model.
2353    ///
2354    /// # Example
2355    /// ```
2356    /// # use google_cloud_dialogflow_v2::client::ConversationModels;
2357    /// use google_cloud_dialogflow_v2::Result;
2358    /// async fn sample(
2359    ///    client: &ConversationModels
2360    /// ) -> Result<()> {
2361    ///     let response = client.get_conversation_model()
2362    ///         /* set fields */
2363    ///         .send().await?;
2364    ///     println!("response {:?}", response);
2365    ///     Ok(())
2366    /// }
2367    /// ```
2368    pub fn get_conversation_model(
2369        &self,
2370    ) -> super::builder::conversation_models::GetConversationModel {
2371        super::builder::conversation_models::GetConversationModel::new(self.inner.clone())
2372    }
2373
2374    /// Lists conversation models.
2375    ///
2376    /// # Example
2377    /// ```
2378    /// # use google_cloud_dialogflow_v2::client::ConversationModels;
2379    /// use google_cloud_gax::paginator::ItemPaginator as _;
2380    /// use google_cloud_dialogflow_v2::Result;
2381    /// async fn sample(
2382    ///    client: &ConversationModels, parent: &str
2383    /// ) -> Result<()> {
2384    ///     let mut list = client.list_conversation_models()
2385    ///         .set_parent(parent)
2386    ///         .by_item();
2387    ///     while let Some(item) = list.next().await.transpose()? {
2388    ///         println!("{:?}", item);
2389    ///     }
2390    ///     Ok(())
2391    /// }
2392    /// ```
2393    pub fn list_conversation_models(
2394        &self,
2395    ) -> super::builder::conversation_models::ListConversationModels {
2396        super::builder::conversation_models::ListConversationModels::new(self.inner.clone())
2397    }
2398
2399    /// Deletes a model.
2400    ///
2401    /// This method is a [long-running
2402    /// operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations).
2403    /// The returned `Operation` type has the following method-specific fields:
2404    ///
2405    /// - `metadata`:
2406    ///   [DeleteConversationModelOperationMetadata][google.cloud.dialogflow.v2.DeleteConversationModelOperationMetadata]
2407    /// - `response`: An [Empty
2408    ///   message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
2409    ///
2410    /// [google.cloud.dialogflow.v2.DeleteConversationModelOperationMetadata]: crate::model::DeleteConversationModelOperationMetadata
2411    ///
2412    /// # Long running operations
2413    ///
2414    /// This method is used to start, and/or poll a [long-running Operation].
2415    /// The [Working with long-running operations] chapter in the [user guide]
2416    /// covers these operations in detail.
2417    ///
2418    /// [long-running operation]: https://google.aip.dev/151
2419    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2420    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2421    ///
2422    /// # Example
2423    /// ```
2424    /// # use google_cloud_dialogflow_v2::client::ConversationModels;
2425    /// use google_cloud_lro::Poller;
2426    /// use google_cloud_dialogflow_v2::Result;
2427    /// async fn sample(
2428    ///    client: &ConversationModels
2429    /// ) -> Result<()> {
2430    ///     client.delete_conversation_model()
2431    ///         /* set fields */
2432    ///         .poller().until_done().await?;
2433    ///     Ok(())
2434    /// }
2435    /// ```
2436    pub fn delete_conversation_model(
2437        &self,
2438    ) -> super::builder::conversation_models::DeleteConversationModel {
2439        super::builder::conversation_models::DeleteConversationModel::new(self.inner.clone())
2440    }
2441
2442    /// Deploys a model. If a model is already deployed, deploying it
2443    /// has no effect. A model can only serve prediction requests after it gets
2444    /// deployed. For article suggestion, custom model will not be used unless
2445    /// it is deployed.
2446    ///
2447    /// This method is a [long-running
2448    /// operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations).
2449    /// The returned `Operation` type has the following method-specific fields:
2450    ///
2451    /// - `metadata`:
2452    ///   [DeployConversationModelOperationMetadata][google.cloud.dialogflow.v2.DeployConversationModelOperationMetadata]
2453    /// - `response`: An [Empty
2454    ///   message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
2455    ///
2456    /// [google.cloud.dialogflow.v2.DeployConversationModelOperationMetadata]: crate::model::DeployConversationModelOperationMetadata
2457    ///
2458    /// # Long running operations
2459    ///
2460    /// This method is used to start, and/or poll a [long-running Operation].
2461    /// The [Working with long-running operations] chapter in the [user guide]
2462    /// covers these operations in detail.
2463    ///
2464    /// [long-running operation]: https://google.aip.dev/151
2465    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2466    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2467    ///
2468    /// # Example
2469    /// ```
2470    /// # use google_cloud_dialogflow_v2::client::ConversationModels;
2471    /// use google_cloud_lro::Poller;
2472    /// use google_cloud_dialogflow_v2::Result;
2473    /// async fn sample(
2474    ///    client: &ConversationModels
2475    /// ) -> Result<()> {
2476    ///     client.deploy_conversation_model()
2477    ///         /* set fields */
2478    ///         .poller().until_done().await?;
2479    ///     Ok(())
2480    /// }
2481    /// ```
2482    pub fn deploy_conversation_model(
2483        &self,
2484    ) -> super::builder::conversation_models::DeployConversationModel {
2485        super::builder::conversation_models::DeployConversationModel::new(self.inner.clone())
2486    }
2487
2488    /// Undeploys a model. If the model is not deployed this method has no effect.
2489    /// If the model is currently being used:
2490    ///
2491    /// - For article suggestion, article suggestion will fallback to the default
2492    ///   model if model is undeployed.
2493    ///
2494    /// This method is a [long-running
2495    /// operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations).
2496    /// The returned `Operation` type has the following method-specific fields:
2497    ///
2498    /// - `metadata`:
2499    ///   [UndeployConversationModelOperationMetadata][google.cloud.dialogflow.v2.UndeployConversationModelOperationMetadata]
2500    /// - `response`: An [Empty
2501    ///   message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
2502    ///
2503    /// [google.cloud.dialogflow.v2.UndeployConversationModelOperationMetadata]: crate::model::UndeployConversationModelOperationMetadata
2504    ///
2505    /// # Long running operations
2506    ///
2507    /// This method is used to start, and/or poll a [long-running Operation].
2508    /// The [Working with long-running operations] chapter in the [user guide]
2509    /// covers these operations in detail.
2510    ///
2511    /// [long-running operation]: https://google.aip.dev/151
2512    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2513    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2514    ///
2515    /// # Example
2516    /// ```
2517    /// # use google_cloud_dialogflow_v2::client::ConversationModels;
2518    /// use google_cloud_lro::Poller;
2519    /// use google_cloud_dialogflow_v2::Result;
2520    /// async fn sample(
2521    ///    client: &ConversationModels
2522    /// ) -> Result<()> {
2523    ///     client.undeploy_conversation_model()
2524    ///         /* set fields */
2525    ///         .poller().until_done().await?;
2526    ///     Ok(())
2527    /// }
2528    /// ```
2529    pub fn undeploy_conversation_model(
2530        &self,
2531    ) -> super::builder::conversation_models::UndeployConversationModel {
2532        super::builder::conversation_models::UndeployConversationModel::new(self.inner.clone())
2533    }
2534
2535    /// Gets an evaluation of conversation model.
2536    ///
2537    /// # Example
2538    /// ```
2539    /// # use google_cloud_dialogflow_v2::client::ConversationModels;
2540    /// use google_cloud_dialogflow_v2::Result;
2541    /// async fn sample(
2542    ///    client: &ConversationModels
2543    /// ) -> Result<()> {
2544    ///     let response = client.get_conversation_model_evaluation()
2545    ///         /* set fields */
2546    ///         .send().await?;
2547    ///     println!("response {:?}", response);
2548    ///     Ok(())
2549    /// }
2550    /// ```
2551    pub fn get_conversation_model_evaluation(
2552        &self,
2553    ) -> super::builder::conversation_models::GetConversationModelEvaluation {
2554        super::builder::conversation_models::GetConversationModelEvaluation::new(self.inner.clone())
2555    }
2556
2557    /// Lists evaluations of a conversation model.
2558    ///
2559    /// # Example
2560    /// ```
2561    /// # use google_cloud_dialogflow_v2::client::ConversationModels;
2562    /// use google_cloud_gax::paginator::ItemPaginator as _;
2563    /// use google_cloud_dialogflow_v2::Result;
2564    /// async fn sample(
2565    ///    client: &ConversationModels, parent: &str
2566    /// ) -> Result<()> {
2567    ///     let mut list = client.list_conversation_model_evaluations()
2568    ///         .set_parent(parent)
2569    ///         .by_item();
2570    ///     while let Some(item) = list.next().await.transpose()? {
2571    ///         println!("{:?}", item);
2572    ///     }
2573    ///     Ok(())
2574    /// }
2575    /// ```
2576    pub fn list_conversation_model_evaluations(
2577        &self,
2578    ) -> super::builder::conversation_models::ListConversationModelEvaluations {
2579        super::builder::conversation_models::ListConversationModelEvaluations::new(
2580            self.inner.clone(),
2581        )
2582    }
2583
2584    /// Creates evaluation of a conversation model.
2585    ///
2586    /// # Long running operations
2587    ///
2588    /// This method is used to start, and/or poll a [long-running Operation].
2589    /// The [Working with long-running operations] chapter in the [user guide]
2590    /// covers these operations in detail.
2591    ///
2592    /// [long-running operation]: https://google.aip.dev/151
2593    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2594    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2595    ///
2596    /// # Example
2597    /// ```
2598    /// # use google_cloud_dialogflow_v2::client::ConversationModels;
2599    /// use google_cloud_lro::Poller;
2600    /// use google_cloud_dialogflow_v2::Result;
2601    /// async fn sample(
2602    ///    client: &ConversationModels
2603    /// ) -> Result<()> {
2604    ///     let response = client.create_conversation_model_evaluation()
2605    ///         /* set fields */
2606    ///         .poller().until_done().await?;
2607    ///     println!("response {:?}", response);
2608    ///     Ok(())
2609    /// }
2610    /// ```
2611    pub fn create_conversation_model_evaluation(
2612        &self,
2613    ) -> super::builder::conversation_models::CreateConversationModelEvaluation {
2614        super::builder::conversation_models::CreateConversationModelEvaluation::new(
2615            self.inner.clone(),
2616        )
2617    }
2618
2619    /// Lists information about the supported locations for this service.
2620    ///
2621    /// This method lists locations based on the resource scope provided in
2622    /// the [ListLocationsRequest.name] field:
2623    ///
2624    /// * **Global locations**: If `name` is empty, the method lists the
2625    ///   public locations available to all projects. * **Project-specific
2626    ///   locations**: If `name` follows the format
2627    ///   `projects/{project}`, the method lists locations visible to that
2628    ///   specific project. This includes public, private, or other
2629    ///   project-specific locations enabled for the project.
2630    ///
2631    /// For gRPC and client library implementations, the resource name is
2632    /// passed as the `name` field. For direct service calls, the resource
2633    /// name is
2634    /// incorporated into the request path based on the specific service
2635    /// implementation and version.
2636    ///
2637    /// # Example
2638    /// ```
2639    /// # use google_cloud_dialogflow_v2::client::ConversationModels;
2640    /// use google_cloud_gax::paginator::ItemPaginator as _;
2641    /// use google_cloud_dialogflow_v2::Result;
2642    /// async fn sample(
2643    ///    client: &ConversationModels
2644    /// ) -> Result<()> {
2645    ///     let mut list = client.list_locations()
2646    ///         /* set fields */
2647    ///         .by_item();
2648    ///     while let Some(item) = list.next().await.transpose()? {
2649    ///         println!("{:?}", item);
2650    ///     }
2651    ///     Ok(())
2652    /// }
2653    /// ```
2654    pub fn list_locations(&self) -> super::builder::conversation_models::ListLocations {
2655        super::builder::conversation_models::ListLocations::new(self.inner.clone())
2656    }
2657
2658    /// Gets information about a location.
2659    ///
2660    /// # Example
2661    /// ```
2662    /// # use google_cloud_dialogflow_v2::client::ConversationModels;
2663    /// use google_cloud_dialogflow_v2::Result;
2664    /// async fn sample(
2665    ///    client: &ConversationModels
2666    /// ) -> Result<()> {
2667    ///     let response = client.get_location()
2668    ///         /* set fields */
2669    ///         .send().await?;
2670    ///     println!("response {:?}", response);
2671    ///     Ok(())
2672    /// }
2673    /// ```
2674    pub fn get_location(&self) -> super::builder::conversation_models::GetLocation {
2675        super::builder::conversation_models::GetLocation::new(self.inner.clone())
2676    }
2677
2678    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2679    ///
2680    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
2681    ///
2682    /// # Example
2683    /// ```
2684    /// # use google_cloud_dialogflow_v2::client::ConversationModels;
2685    /// use google_cloud_gax::paginator::ItemPaginator as _;
2686    /// use google_cloud_dialogflow_v2::Result;
2687    /// async fn sample(
2688    ///    client: &ConversationModels
2689    /// ) -> Result<()> {
2690    ///     let mut list = client.list_operations()
2691    ///         /* set fields */
2692    ///         .by_item();
2693    ///     while let Some(item) = list.next().await.transpose()? {
2694    ///         println!("{:?}", item);
2695    ///     }
2696    ///     Ok(())
2697    /// }
2698    /// ```
2699    pub fn list_operations(&self) -> super::builder::conversation_models::ListOperations {
2700        super::builder::conversation_models::ListOperations::new(self.inner.clone())
2701    }
2702
2703    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2704    ///
2705    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
2706    ///
2707    /// # Example
2708    /// ```
2709    /// # use google_cloud_dialogflow_v2::client::ConversationModels;
2710    /// use google_cloud_dialogflow_v2::Result;
2711    /// async fn sample(
2712    ///    client: &ConversationModels
2713    /// ) -> Result<()> {
2714    ///     let response = client.get_operation()
2715    ///         /* set fields */
2716    ///         .send().await?;
2717    ///     println!("response {:?}", response);
2718    ///     Ok(())
2719    /// }
2720    /// ```
2721    pub fn get_operation(&self) -> super::builder::conversation_models::GetOperation {
2722        super::builder::conversation_models::GetOperation::new(self.inner.clone())
2723    }
2724
2725    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2726    ///
2727    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
2728    ///
2729    /// # Example
2730    /// ```
2731    /// # use google_cloud_dialogflow_v2::client::ConversationModels;
2732    /// use google_cloud_dialogflow_v2::Result;
2733    /// async fn sample(
2734    ///    client: &ConversationModels
2735    /// ) -> Result<()> {
2736    ///     client.cancel_operation()
2737    ///         /* set fields */
2738    ///         .send().await?;
2739    ///     Ok(())
2740    /// }
2741    /// ```
2742    pub fn cancel_operation(&self) -> super::builder::conversation_models::CancelOperation {
2743        super::builder::conversation_models::CancelOperation::new(self.inner.clone())
2744    }
2745}
2746
2747/// Implements a client for the Dialogflow API.
2748///
2749/// # Example
2750/// ```
2751/// # use google_cloud_dialogflow_v2::client::ConversationProfiles;
2752/// use google_cloud_gax::paginator::ItemPaginator as _;
2753/// # async fn sample() -> Result<(), Box<dyn std::error::Error>> {
2754///     let client = ConversationProfiles::builder().build().await?;
2755///     let parent = "parent_value";
2756///     let mut list = client.list_conversation_profiles()
2757///         .set_parent(parent)
2758///         .by_item();
2759///     while let Some(item) = list.next().await.transpose()? {
2760///         println!("{:?}", item);
2761///     }
2762/// # Ok(()) }
2763/// ```
2764///
2765/// # Service Description
2766///
2767/// Service for managing
2768/// [ConversationProfiles][google.cloud.dialogflow.v2.ConversationProfile].
2769///
2770/// [google.cloud.dialogflow.v2.ConversationProfile]: crate::model::ConversationProfile
2771///
2772/// # Configuration
2773///
2774/// To configure `ConversationProfiles` use the `with_*` methods in the type returned
2775/// by [builder()][ConversationProfiles::builder]. The default configuration should
2776/// work for most applications. Common configuration changes include
2777///
2778/// * [with_endpoint()]: by default this client uses the global default endpoint
2779///   (`https://dialogflow.googleapis.com`). Applications using regional
2780///   endpoints or running in restricted networks (e.g. a network configured
2781//    with [Private Google Access with VPC Service Controls]) may want to
2782///   override this default.
2783/// * [with_credentials()]: by default this client uses
2784///   [Application Default Credentials]. Applications using custom
2785///   authentication may need to override this default.
2786///
2787/// [with_endpoint()]: super::builder::conversation_profiles::ClientBuilder::with_endpoint
2788/// [with_credentials()]: super::builder::conversation_profiles::ClientBuilder::with_credentials
2789/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
2790/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
2791///
2792/// # Pooling and Cloning
2793///
2794/// `ConversationProfiles` holds a connection pool internally, it is advised to
2795/// create one and reuse it. You do not need to wrap `ConversationProfiles` in
2796/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
2797/// already uses an `Arc` internally.
2798#[cfg(feature = "conversation-profiles")]
2799#[cfg_attr(docsrs, doc(cfg(feature = "conversation-profiles")))]
2800#[derive(Clone, Debug)]
2801pub struct ConversationProfiles {
2802    inner: std::sync::Arc<dyn super::stub::dynamic::ConversationProfiles>,
2803}
2804
2805#[cfg(feature = "conversation-profiles")]
2806impl ConversationProfiles {
2807    /// Returns a builder for [ConversationProfiles].
2808    ///
2809    /// ```
2810    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
2811    /// # use google_cloud_dialogflow_v2::client::ConversationProfiles;
2812    /// let client = ConversationProfiles::builder().build().await?;
2813    /// # Ok(()) }
2814    /// ```
2815    pub fn builder() -> super::builder::conversation_profiles::ClientBuilder {
2816        crate::new_client_builder(super::builder::conversation_profiles::client::Factory)
2817    }
2818
2819    /// Creates a new client from the provided stub.
2820    ///
2821    /// The most common case for calling this function is in tests mocking the
2822    /// client's behavior.
2823    pub fn from_stub<T>(stub: T) -> Self
2824    where
2825        T: super::stub::ConversationProfiles + 'static,
2826    {
2827        Self {
2828            inner: std::sync::Arc::new(stub),
2829        }
2830    }
2831
2832    pub(crate) async fn new(
2833        config: gaxi::options::ClientConfig,
2834    ) -> crate::ClientBuilderResult<Self> {
2835        let inner = Self::build_inner(config).await?;
2836        Ok(Self { inner })
2837    }
2838
2839    async fn build_inner(
2840        conf: gaxi::options::ClientConfig,
2841    ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::ConversationProfiles>>
2842    {
2843        if gaxi::options::tracing_enabled(&conf) {
2844            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
2845        }
2846        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
2847    }
2848
2849    async fn build_transport(
2850        conf: gaxi::options::ClientConfig,
2851    ) -> crate::ClientBuilderResult<impl super::stub::ConversationProfiles> {
2852        super::transport::ConversationProfiles::new(conf).await
2853    }
2854
2855    async fn build_with_tracing(
2856        conf: gaxi::options::ClientConfig,
2857    ) -> crate::ClientBuilderResult<impl super::stub::ConversationProfiles> {
2858        Self::build_transport(conf)
2859            .await
2860            .map(super::tracing::ConversationProfiles::new)
2861    }
2862
2863    /// Returns the list of all conversation profiles in the specified project.
2864    ///
2865    /// # Example
2866    /// ```
2867    /// # use google_cloud_dialogflow_v2::client::ConversationProfiles;
2868    /// use google_cloud_gax::paginator::ItemPaginator as _;
2869    /// use google_cloud_dialogflow_v2::Result;
2870    /// async fn sample(
2871    ///    client: &ConversationProfiles, parent: &str
2872    /// ) -> Result<()> {
2873    ///     let mut list = client.list_conversation_profiles()
2874    ///         .set_parent(parent)
2875    ///         .by_item();
2876    ///     while let Some(item) = list.next().await.transpose()? {
2877    ///         println!("{:?}", item);
2878    ///     }
2879    ///     Ok(())
2880    /// }
2881    /// ```
2882    pub fn list_conversation_profiles(
2883        &self,
2884    ) -> super::builder::conversation_profiles::ListConversationProfiles {
2885        super::builder::conversation_profiles::ListConversationProfiles::new(self.inner.clone())
2886    }
2887
2888    /// Retrieves the specified conversation profile.
2889    ///
2890    /// # Example
2891    /// ```
2892    /// # use google_cloud_dialogflow_v2::client::ConversationProfiles;
2893    /// use google_cloud_dialogflow_v2::Result;
2894    /// async fn sample(
2895    ///    client: &ConversationProfiles, name: &str
2896    /// ) -> Result<()> {
2897    ///     let response = client.get_conversation_profile()
2898    ///         .set_name(name)
2899    ///         .send().await?;
2900    ///     println!("response {:?}", response);
2901    ///     Ok(())
2902    /// }
2903    /// ```
2904    pub fn get_conversation_profile(
2905        &self,
2906    ) -> super::builder::conversation_profiles::GetConversationProfile {
2907        super::builder::conversation_profiles::GetConversationProfile::new(self.inner.clone())
2908    }
2909
2910    /// Creates a conversation profile in the specified project.
2911    ///
2912    /// [ConversationProfile.create_time][google.cloud.dialogflow.v2.ConversationProfile.create_time]
2913    /// and
2914    /// [ConversationProfile.update_time][google.cloud.dialogflow.v2.ConversationProfile.update_time]
2915    /// aren't populated in the response. You can retrieve them via
2916    /// [GetConversationProfile][google.cloud.dialogflow.v2.ConversationProfiles.GetConversationProfile]
2917    /// API.
2918    ///
2919    /// [google.cloud.dialogflow.v2.ConversationProfile.create_time]: crate::model::ConversationProfile::create_time
2920    /// [google.cloud.dialogflow.v2.ConversationProfile.update_time]: crate::model::ConversationProfile::update_time
2921    /// [google.cloud.dialogflow.v2.ConversationProfiles.GetConversationProfile]: crate::client::ConversationProfiles::get_conversation_profile
2922    ///
2923    /// # Example
2924    /// ```
2925    /// # use google_cloud_dialogflow_v2::client::ConversationProfiles;
2926    /// use google_cloud_dialogflow_v2::model::ConversationProfile;
2927    /// use google_cloud_dialogflow_v2::Result;
2928    /// async fn sample(
2929    ///    client: &ConversationProfiles, parent: &str
2930    /// ) -> Result<()> {
2931    ///     let response = client.create_conversation_profile()
2932    ///         .set_parent(parent)
2933    ///         .set_conversation_profile(
2934    ///             ConversationProfile::new()/* set fields */
2935    ///         )
2936    ///         .send().await?;
2937    ///     println!("response {:?}", response);
2938    ///     Ok(())
2939    /// }
2940    /// ```
2941    pub fn create_conversation_profile(
2942        &self,
2943    ) -> super::builder::conversation_profiles::CreateConversationProfile {
2944        super::builder::conversation_profiles::CreateConversationProfile::new(self.inner.clone())
2945    }
2946
2947    /// Updates the specified conversation profile.
2948    ///
2949    /// [ConversationProfile.create_time][google.cloud.dialogflow.v2.ConversationProfile.create_time]
2950    /// and
2951    /// [ConversationProfile.update_time][google.cloud.dialogflow.v2.ConversationProfile.update_time]
2952    /// aren't populated in the response. You can retrieve them via
2953    /// [GetConversationProfile][google.cloud.dialogflow.v2.ConversationProfiles.GetConversationProfile]
2954    /// API.
2955    ///
2956    /// [google.cloud.dialogflow.v2.ConversationProfile.create_time]: crate::model::ConversationProfile::create_time
2957    /// [google.cloud.dialogflow.v2.ConversationProfile.update_time]: crate::model::ConversationProfile::update_time
2958    /// [google.cloud.dialogflow.v2.ConversationProfiles.GetConversationProfile]: crate::client::ConversationProfiles::get_conversation_profile
2959    ///
2960    /// # Example
2961    /// ```
2962    /// # use google_cloud_dialogflow_v2::client::ConversationProfiles;
2963    /// # extern crate wkt as google_cloud_wkt;
2964    /// use google_cloud_wkt::FieldMask;
2965    /// use google_cloud_dialogflow_v2::model::ConversationProfile;
2966    /// use google_cloud_dialogflow_v2::Result;
2967    /// async fn sample(
2968    ///    client: &ConversationProfiles, name: &str
2969    /// ) -> Result<()> {
2970    ///     let response = client.update_conversation_profile()
2971    ///         .set_conversation_profile(
2972    ///             ConversationProfile::new().set_name(name)/* set fields */
2973    ///         )
2974    ///         .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
2975    ///         .send().await?;
2976    ///     println!("response {:?}", response);
2977    ///     Ok(())
2978    /// }
2979    /// ```
2980    pub fn update_conversation_profile(
2981        &self,
2982    ) -> super::builder::conversation_profiles::UpdateConversationProfile {
2983        super::builder::conversation_profiles::UpdateConversationProfile::new(self.inner.clone())
2984    }
2985
2986    /// Deletes the specified conversation profile.
2987    ///
2988    /// # Example
2989    /// ```
2990    /// # use google_cloud_dialogflow_v2::client::ConversationProfiles;
2991    /// use google_cloud_dialogflow_v2::Result;
2992    /// async fn sample(
2993    ///    client: &ConversationProfiles, name: &str
2994    /// ) -> Result<()> {
2995    ///     client.delete_conversation_profile()
2996    ///         .set_name(name)
2997    ///         .send().await?;
2998    ///     Ok(())
2999    /// }
3000    /// ```
3001    pub fn delete_conversation_profile(
3002        &self,
3003    ) -> super::builder::conversation_profiles::DeleteConversationProfile {
3004        super::builder::conversation_profiles::DeleteConversationProfile::new(self.inner.clone())
3005    }
3006
3007    /// Adds or updates a suggestion feature in a conversation profile.
3008    /// If the conversation profile contains the type of suggestion feature for
3009    /// the participant role, it will update it. Otherwise it will insert the
3010    /// suggestion feature.
3011    ///
3012    /// This method is a [long-running
3013    /// operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations).
3014    /// The returned `Operation` type has the following method-specific fields:
3015    ///
3016    /// - `metadata`:
3017    ///   [SetSuggestionFeatureConfigOperationMetadata][google.cloud.dialogflow.v2.SetSuggestionFeatureConfigOperationMetadata]
3018    /// - `response`:
3019    ///   [ConversationProfile][google.cloud.dialogflow.v2.ConversationProfile]
3020    ///
3021    /// If a long running operation to add or update suggestion feature
3022    /// config for the same conversation profile, participant role and suggestion
3023    /// feature type exists, please cancel the existing long running operation
3024    /// before sending such request, otherwise the request will be rejected.
3025    ///
3026    /// [google.cloud.dialogflow.v2.ConversationProfile]: crate::model::ConversationProfile
3027    /// [google.cloud.dialogflow.v2.SetSuggestionFeatureConfigOperationMetadata]: crate::model::SetSuggestionFeatureConfigOperationMetadata
3028    ///
3029    /// # Long running operations
3030    ///
3031    /// This method is used to start, and/or poll a [long-running Operation].
3032    /// The [Working with long-running operations] chapter in the [user guide]
3033    /// covers these operations in detail.
3034    ///
3035    /// [long-running operation]: https://google.aip.dev/151
3036    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
3037    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
3038    ///
3039    /// # Example
3040    /// ```
3041    /// # use google_cloud_dialogflow_v2::client::ConversationProfiles;
3042    /// use google_cloud_lro::Poller;
3043    /// use google_cloud_dialogflow_v2::Result;
3044    /// async fn sample(
3045    ///    client: &ConversationProfiles
3046    /// ) -> Result<()> {
3047    ///     let response = client.set_suggestion_feature_config()
3048    ///         /* set fields */
3049    ///         .poller().until_done().await?;
3050    ///     println!("response {:?}", response);
3051    ///     Ok(())
3052    /// }
3053    /// ```
3054    pub fn set_suggestion_feature_config(
3055        &self,
3056    ) -> super::builder::conversation_profiles::SetSuggestionFeatureConfig {
3057        super::builder::conversation_profiles::SetSuggestionFeatureConfig::new(self.inner.clone())
3058    }
3059
3060    /// Clears a suggestion feature from a conversation profile for the given
3061    /// participant role.
3062    ///
3063    /// This method is a [long-running
3064    /// operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations).
3065    /// The returned `Operation` type has the following method-specific fields:
3066    ///
3067    /// - `metadata`:
3068    ///   [ClearSuggestionFeatureConfigOperationMetadata][google.cloud.dialogflow.v2.ClearSuggestionFeatureConfigOperationMetadata]
3069    /// - `response`:
3070    ///   [ConversationProfile][google.cloud.dialogflow.v2.ConversationProfile]
3071    ///
3072    /// [google.cloud.dialogflow.v2.ClearSuggestionFeatureConfigOperationMetadata]: crate::model::ClearSuggestionFeatureConfigOperationMetadata
3073    /// [google.cloud.dialogflow.v2.ConversationProfile]: crate::model::ConversationProfile
3074    ///
3075    /// # Long running operations
3076    ///
3077    /// This method is used to start, and/or poll a [long-running Operation].
3078    /// The [Working with long-running operations] chapter in the [user guide]
3079    /// covers these operations in detail.
3080    ///
3081    /// [long-running operation]: https://google.aip.dev/151
3082    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
3083    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
3084    ///
3085    /// # Example
3086    /// ```
3087    /// # use google_cloud_dialogflow_v2::client::ConversationProfiles;
3088    /// use google_cloud_lro::Poller;
3089    /// use google_cloud_dialogflow_v2::Result;
3090    /// async fn sample(
3091    ///    client: &ConversationProfiles
3092    /// ) -> Result<()> {
3093    ///     let response = client.clear_suggestion_feature_config()
3094    ///         /* set fields */
3095    ///         .poller().until_done().await?;
3096    ///     println!("response {:?}", response);
3097    ///     Ok(())
3098    /// }
3099    /// ```
3100    pub fn clear_suggestion_feature_config(
3101        &self,
3102    ) -> super::builder::conversation_profiles::ClearSuggestionFeatureConfig {
3103        super::builder::conversation_profiles::ClearSuggestionFeatureConfig::new(self.inner.clone())
3104    }
3105
3106    /// Lists information about the supported locations for this service.
3107    ///
3108    /// This method lists locations based on the resource scope provided in
3109    /// the [ListLocationsRequest.name] field:
3110    ///
3111    /// * **Global locations**: If `name` is empty, the method lists the
3112    ///   public locations available to all projects. * **Project-specific
3113    ///   locations**: If `name` follows the format
3114    ///   `projects/{project}`, the method lists locations visible to that
3115    ///   specific project. This includes public, private, or other
3116    ///   project-specific locations enabled for the project.
3117    ///
3118    /// For gRPC and client library implementations, the resource name is
3119    /// passed as the `name` field. For direct service calls, the resource
3120    /// name is
3121    /// incorporated into the request path based on the specific service
3122    /// implementation and version.
3123    ///
3124    /// # Example
3125    /// ```
3126    /// # use google_cloud_dialogflow_v2::client::ConversationProfiles;
3127    /// use google_cloud_gax::paginator::ItemPaginator as _;
3128    /// use google_cloud_dialogflow_v2::Result;
3129    /// async fn sample(
3130    ///    client: &ConversationProfiles
3131    /// ) -> Result<()> {
3132    ///     let mut list = client.list_locations()
3133    ///         /* set fields */
3134    ///         .by_item();
3135    ///     while let Some(item) = list.next().await.transpose()? {
3136    ///         println!("{:?}", item);
3137    ///     }
3138    ///     Ok(())
3139    /// }
3140    /// ```
3141    pub fn list_locations(&self) -> super::builder::conversation_profiles::ListLocations {
3142        super::builder::conversation_profiles::ListLocations::new(self.inner.clone())
3143    }
3144
3145    /// Gets information about a location.
3146    ///
3147    /// # Example
3148    /// ```
3149    /// # use google_cloud_dialogflow_v2::client::ConversationProfiles;
3150    /// use google_cloud_dialogflow_v2::Result;
3151    /// async fn sample(
3152    ///    client: &ConversationProfiles
3153    /// ) -> Result<()> {
3154    ///     let response = client.get_location()
3155    ///         /* set fields */
3156    ///         .send().await?;
3157    ///     println!("response {:?}", response);
3158    ///     Ok(())
3159    /// }
3160    /// ```
3161    pub fn get_location(&self) -> super::builder::conversation_profiles::GetLocation {
3162        super::builder::conversation_profiles::GetLocation::new(self.inner.clone())
3163    }
3164
3165    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3166    ///
3167    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
3168    ///
3169    /// # Example
3170    /// ```
3171    /// # use google_cloud_dialogflow_v2::client::ConversationProfiles;
3172    /// use google_cloud_gax::paginator::ItemPaginator as _;
3173    /// use google_cloud_dialogflow_v2::Result;
3174    /// async fn sample(
3175    ///    client: &ConversationProfiles
3176    /// ) -> Result<()> {
3177    ///     let mut list = client.list_operations()
3178    ///         /* set fields */
3179    ///         .by_item();
3180    ///     while let Some(item) = list.next().await.transpose()? {
3181    ///         println!("{:?}", item);
3182    ///     }
3183    ///     Ok(())
3184    /// }
3185    /// ```
3186    pub fn list_operations(&self) -> super::builder::conversation_profiles::ListOperations {
3187        super::builder::conversation_profiles::ListOperations::new(self.inner.clone())
3188    }
3189
3190    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3191    ///
3192    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
3193    ///
3194    /// # Example
3195    /// ```
3196    /// # use google_cloud_dialogflow_v2::client::ConversationProfiles;
3197    /// use google_cloud_dialogflow_v2::Result;
3198    /// async fn sample(
3199    ///    client: &ConversationProfiles
3200    /// ) -> Result<()> {
3201    ///     let response = client.get_operation()
3202    ///         /* set fields */
3203    ///         .send().await?;
3204    ///     println!("response {:?}", response);
3205    ///     Ok(())
3206    /// }
3207    /// ```
3208    pub fn get_operation(&self) -> super::builder::conversation_profiles::GetOperation {
3209        super::builder::conversation_profiles::GetOperation::new(self.inner.clone())
3210    }
3211
3212    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3213    ///
3214    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
3215    ///
3216    /// # Example
3217    /// ```
3218    /// # use google_cloud_dialogflow_v2::client::ConversationProfiles;
3219    /// use google_cloud_dialogflow_v2::Result;
3220    /// async fn sample(
3221    ///    client: &ConversationProfiles
3222    /// ) -> Result<()> {
3223    ///     client.cancel_operation()
3224    ///         /* set fields */
3225    ///         .send().await?;
3226    ///     Ok(())
3227    /// }
3228    /// ```
3229    pub fn cancel_operation(&self) -> super::builder::conversation_profiles::CancelOperation {
3230        super::builder::conversation_profiles::CancelOperation::new(self.inner.clone())
3231    }
3232}
3233
3234/// Implements a client for the Dialogflow API.
3235///
3236/// # Example
3237/// ```
3238/// # use google_cloud_dialogflow_v2::client::Documents;
3239/// use google_cloud_gax::paginator::ItemPaginator as _;
3240/// # async fn sample() -> Result<(), Box<dyn std::error::Error>> {
3241///     let client = Documents::builder().build().await?;
3242///     let parent = "parent_value";
3243///     let mut list = client.list_documents()
3244///         .set_parent(parent)
3245///         .by_item();
3246///     while let Some(item) = list.next().await.transpose()? {
3247///         println!("{:?}", item);
3248///     }
3249/// # Ok(()) }
3250/// ```
3251///
3252/// # Service Description
3253///
3254/// Service for managing knowledge
3255/// [Documents][google.cloud.dialogflow.v2.Document].
3256///
3257/// [google.cloud.dialogflow.v2.Document]: crate::model::Document
3258///
3259/// # Configuration
3260///
3261/// To configure `Documents` use the `with_*` methods in the type returned
3262/// by [builder()][Documents::builder]. The default configuration should
3263/// work for most applications. Common configuration changes include
3264///
3265/// * [with_endpoint()]: by default this client uses the global default endpoint
3266///   (`https://dialogflow.googleapis.com`). Applications using regional
3267///   endpoints or running in restricted networks (e.g. a network configured
3268//    with [Private Google Access with VPC Service Controls]) may want to
3269///   override this default.
3270/// * [with_credentials()]: by default this client uses
3271///   [Application Default Credentials]. Applications using custom
3272///   authentication may need to override this default.
3273///
3274/// [with_endpoint()]: super::builder::documents::ClientBuilder::with_endpoint
3275/// [with_credentials()]: super::builder::documents::ClientBuilder::with_credentials
3276/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
3277/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
3278///
3279/// # Pooling and Cloning
3280///
3281/// `Documents` holds a connection pool internally, it is advised to
3282/// create one and reuse it. You do not need to wrap `Documents` in
3283/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
3284/// already uses an `Arc` internally.
3285#[cfg(feature = "documents")]
3286#[cfg_attr(docsrs, doc(cfg(feature = "documents")))]
3287#[derive(Clone, Debug)]
3288pub struct Documents {
3289    inner: std::sync::Arc<dyn super::stub::dynamic::Documents>,
3290}
3291
3292#[cfg(feature = "documents")]
3293impl Documents {
3294    /// Returns a builder for [Documents].
3295    ///
3296    /// ```
3297    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
3298    /// # use google_cloud_dialogflow_v2::client::Documents;
3299    /// let client = Documents::builder().build().await?;
3300    /// # Ok(()) }
3301    /// ```
3302    pub fn builder() -> super::builder::documents::ClientBuilder {
3303        crate::new_client_builder(super::builder::documents::client::Factory)
3304    }
3305
3306    /// Creates a new client from the provided stub.
3307    ///
3308    /// The most common case for calling this function is in tests mocking the
3309    /// client's behavior.
3310    pub fn from_stub<T>(stub: T) -> Self
3311    where
3312        T: super::stub::Documents + 'static,
3313    {
3314        Self {
3315            inner: std::sync::Arc::new(stub),
3316        }
3317    }
3318
3319    pub(crate) async fn new(
3320        config: gaxi::options::ClientConfig,
3321    ) -> crate::ClientBuilderResult<Self> {
3322        let inner = Self::build_inner(config).await?;
3323        Ok(Self { inner })
3324    }
3325
3326    async fn build_inner(
3327        conf: gaxi::options::ClientConfig,
3328    ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::Documents>> {
3329        if gaxi::options::tracing_enabled(&conf) {
3330            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
3331        }
3332        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
3333    }
3334
3335    async fn build_transport(
3336        conf: gaxi::options::ClientConfig,
3337    ) -> crate::ClientBuilderResult<impl super::stub::Documents> {
3338        super::transport::Documents::new(conf).await
3339    }
3340
3341    async fn build_with_tracing(
3342        conf: gaxi::options::ClientConfig,
3343    ) -> crate::ClientBuilderResult<impl super::stub::Documents> {
3344        Self::build_transport(conf)
3345            .await
3346            .map(super::tracing::Documents::new)
3347    }
3348
3349    /// Returns the list of all documents of the knowledge base.
3350    ///
3351    /// # Example
3352    /// ```
3353    /// # use google_cloud_dialogflow_v2::client::Documents;
3354    /// use google_cloud_gax::paginator::ItemPaginator as _;
3355    /// use google_cloud_dialogflow_v2::Result;
3356    /// async fn sample(
3357    ///    client: &Documents, parent: &str
3358    /// ) -> Result<()> {
3359    ///     let mut list = client.list_documents()
3360    ///         .set_parent(parent)
3361    ///         .by_item();
3362    ///     while let Some(item) = list.next().await.transpose()? {
3363    ///         println!("{:?}", item);
3364    ///     }
3365    ///     Ok(())
3366    /// }
3367    /// ```
3368    pub fn list_documents(&self) -> super::builder::documents::ListDocuments {
3369        super::builder::documents::ListDocuments::new(self.inner.clone())
3370    }
3371
3372    /// Retrieves the specified document.
3373    ///
3374    /// # Example
3375    /// ```
3376    /// # use google_cloud_dialogflow_v2::client::Documents;
3377    /// use google_cloud_dialogflow_v2::Result;
3378    /// async fn sample(
3379    ///    client: &Documents, name: &str
3380    /// ) -> Result<()> {
3381    ///     let response = client.get_document()
3382    ///         .set_name(name)
3383    ///         .send().await?;
3384    ///     println!("response {:?}", response);
3385    ///     Ok(())
3386    /// }
3387    /// ```
3388    pub fn get_document(&self) -> super::builder::documents::GetDocument {
3389        super::builder::documents::GetDocument::new(self.inner.clone())
3390    }
3391
3392    /// Creates a new document.
3393    ///
3394    /// This method is a [long-running
3395    /// operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation).
3396    /// The returned `Operation` type has the following method-specific fields:
3397    ///
3398    /// - `metadata`:
3399    ///   [KnowledgeOperationMetadata][google.cloud.dialogflow.v2.KnowledgeOperationMetadata]
3400    /// - `response`: [Document][google.cloud.dialogflow.v2.Document]
3401    ///
3402    /// [google.cloud.dialogflow.v2.Document]: crate::model::Document
3403    /// [google.cloud.dialogflow.v2.KnowledgeOperationMetadata]: crate::model::KnowledgeOperationMetadata
3404    ///
3405    /// # Long running operations
3406    ///
3407    /// This method is used to start, and/or poll a [long-running Operation].
3408    /// The [Working with long-running operations] chapter in the [user guide]
3409    /// covers these operations in detail.
3410    ///
3411    /// [long-running operation]: https://google.aip.dev/151
3412    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
3413    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
3414    ///
3415    /// # Example
3416    /// ```
3417    /// # use google_cloud_dialogflow_v2::client::Documents;
3418    /// use google_cloud_lro::Poller;
3419    /// use google_cloud_dialogflow_v2::model::Document;
3420    /// use google_cloud_dialogflow_v2::Result;
3421    /// async fn sample(
3422    ///    client: &Documents, parent: &str
3423    /// ) -> Result<()> {
3424    ///     let response = client.create_document()
3425    ///         .set_parent(parent)
3426    ///         .set_document(
3427    ///             Document::new()/* set fields */
3428    ///         )
3429    ///         .poller().until_done().await?;
3430    ///     println!("response {:?}", response);
3431    ///     Ok(())
3432    /// }
3433    /// ```
3434    pub fn create_document(&self) -> super::builder::documents::CreateDocument {
3435        super::builder::documents::CreateDocument::new(self.inner.clone())
3436    }
3437
3438    /// Creates documents by importing data from external sources.
3439    /// Dialogflow supports up to 350 documents in each request. If you try to
3440    /// import more, Dialogflow will return an error.
3441    ///
3442    /// This method is a [long-running
3443    /// operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation).
3444    /// The returned `Operation` type has the following method-specific fields:
3445    ///
3446    /// - `metadata`:
3447    ///   [KnowledgeOperationMetadata][google.cloud.dialogflow.v2.KnowledgeOperationMetadata]
3448    /// - `response`:
3449    ///   [ImportDocumentsResponse][google.cloud.dialogflow.v2.ImportDocumentsResponse]
3450    ///
3451    /// [google.cloud.dialogflow.v2.ImportDocumentsResponse]: crate::model::ImportDocumentsResponse
3452    /// [google.cloud.dialogflow.v2.KnowledgeOperationMetadata]: crate::model::KnowledgeOperationMetadata
3453    ///
3454    /// # Long running operations
3455    ///
3456    /// This method is used to start, and/or poll a [long-running Operation].
3457    /// The [Working with long-running operations] chapter in the [user guide]
3458    /// covers these operations in detail.
3459    ///
3460    /// [long-running operation]: https://google.aip.dev/151
3461    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
3462    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
3463    ///
3464    /// # Example
3465    /// ```
3466    /// # use google_cloud_dialogflow_v2::client::Documents;
3467    /// use google_cloud_lro::Poller;
3468    /// use google_cloud_dialogflow_v2::Result;
3469    /// async fn sample(
3470    ///    client: &Documents
3471    /// ) -> Result<()> {
3472    ///     let response = client.import_documents()
3473    ///         /* set fields */
3474    ///         .poller().until_done().await?;
3475    ///     println!("response {:?}", response);
3476    ///     Ok(())
3477    /// }
3478    /// ```
3479    pub fn import_documents(&self) -> super::builder::documents::ImportDocuments {
3480        super::builder::documents::ImportDocuments::new(self.inner.clone())
3481    }
3482
3483    /// Deletes the specified document.
3484    ///
3485    /// This method is a [long-running
3486    /// operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation).
3487    /// The returned `Operation` type has the following method-specific fields:
3488    ///
3489    /// - `metadata`:
3490    ///   [KnowledgeOperationMetadata][google.cloud.dialogflow.v2.KnowledgeOperationMetadata]
3491    /// - `response`: An [Empty
3492    ///   message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
3493    ///
3494    /// [google.cloud.dialogflow.v2.KnowledgeOperationMetadata]: crate::model::KnowledgeOperationMetadata
3495    ///
3496    /// # Long running operations
3497    ///
3498    /// This method is used to start, and/or poll a [long-running Operation].
3499    /// The [Working with long-running operations] chapter in the [user guide]
3500    /// covers these operations in detail.
3501    ///
3502    /// [long-running operation]: https://google.aip.dev/151
3503    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
3504    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
3505    ///
3506    /// # Example
3507    /// ```
3508    /// # use google_cloud_dialogflow_v2::client::Documents;
3509    /// use google_cloud_lro::Poller;
3510    /// use google_cloud_dialogflow_v2::Result;
3511    /// async fn sample(
3512    ///    client: &Documents, name: &str
3513    /// ) -> Result<()> {
3514    ///     client.delete_document()
3515    ///         .set_name(name)
3516    ///         .poller().until_done().await?;
3517    ///     Ok(())
3518    /// }
3519    /// ```
3520    pub fn delete_document(&self) -> super::builder::documents::DeleteDocument {
3521        super::builder::documents::DeleteDocument::new(self.inner.clone())
3522    }
3523
3524    /// Updates the specified document.
3525    ///
3526    /// This method is a [long-running
3527    /// operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation).
3528    /// The returned `Operation` type has the following method-specific fields:
3529    ///
3530    /// - `metadata`:
3531    ///   [KnowledgeOperationMetadata][google.cloud.dialogflow.v2.KnowledgeOperationMetadata]
3532    /// - `response`: [Document][google.cloud.dialogflow.v2.Document]
3533    ///
3534    /// [google.cloud.dialogflow.v2.Document]: crate::model::Document
3535    /// [google.cloud.dialogflow.v2.KnowledgeOperationMetadata]: crate::model::KnowledgeOperationMetadata
3536    ///
3537    /// # Long running operations
3538    ///
3539    /// This method is used to start, and/or poll a [long-running Operation].
3540    /// The [Working with long-running operations] chapter in the [user guide]
3541    /// covers these operations in detail.
3542    ///
3543    /// [long-running operation]: https://google.aip.dev/151
3544    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
3545    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
3546    ///
3547    /// # Example
3548    /// ```
3549    /// # use google_cloud_dialogflow_v2::client::Documents;
3550    /// use google_cloud_lro::Poller;
3551    /// # extern crate wkt as google_cloud_wkt;
3552    /// use google_cloud_wkt::FieldMask;
3553    /// use google_cloud_dialogflow_v2::model::Document;
3554    /// use google_cloud_dialogflow_v2::Result;
3555    /// async fn sample(
3556    ///    client: &Documents, name: &str
3557    /// ) -> Result<()> {
3558    ///     let response = client.update_document()
3559    ///         .set_document(
3560    ///             Document::new().set_name(name)/* set fields */
3561    ///         )
3562    ///         .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
3563    ///         .poller().until_done().await?;
3564    ///     println!("response {:?}", response);
3565    ///     Ok(())
3566    /// }
3567    /// ```
3568    pub fn update_document(&self) -> super::builder::documents::UpdateDocument {
3569        super::builder::documents::UpdateDocument::new(self.inner.clone())
3570    }
3571
3572    /// Reloads the specified document from its specified source, content_uri or
3573    /// content. The previously loaded content of the document will be deleted.
3574    /// Note: Even when the content of the document has not changed, there still
3575    /// may be side effects because of internal implementation changes.
3576    ///
3577    /// This method is a [long-running
3578    /// operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation).
3579    /// The returned `Operation` type has the following method-specific fields:
3580    ///
3581    /// - `metadata`:
3582    ///   [KnowledgeOperationMetadata][google.cloud.dialogflow.v2.KnowledgeOperationMetadata]
3583    /// - `response`: [Document][google.cloud.dialogflow.v2.Document]
3584    ///
3585    /// Note: The `projects.agent.knowledgeBases.documents` resource is deprecated;
3586    /// only use `projects.knowledgeBases.documents`.
3587    ///
3588    /// [google.cloud.dialogflow.v2.Document]: crate::model::Document
3589    /// [google.cloud.dialogflow.v2.KnowledgeOperationMetadata]: crate::model::KnowledgeOperationMetadata
3590    ///
3591    /// # Long running operations
3592    ///
3593    /// This method is used to start, and/or poll a [long-running Operation].
3594    /// The [Working with long-running operations] chapter in the [user guide]
3595    /// covers these operations in detail.
3596    ///
3597    /// [long-running operation]: https://google.aip.dev/151
3598    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
3599    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
3600    ///
3601    /// # Example
3602    /// ```
3603    /// # use google_cloud_dialogflow_v2::client::Documents;
3604    /// use google_cloud_lro::Poller;
3605    /// use google_cloud_dialogflow_v2::Result;
3606    /// async fn sample(
3607    ///    client: &Documents
3608    /// ) -> Result<()> {
3609    ///     let response = client.reload_document()
3610    ///         /* set fields */
3611    ///         .poller().until_done().await?;
3612    ///     println!("response {:?}", response);
3613    ///     Ok(())
3614    /// }
3615    /// ```
3616    pub fn reload_document(&self) -> super::builder::documents::ReloadDocument {
3617        super::builder::documents::ReloadDocument::new(self.inner.clone())
3618    }
3619
3620    /// Exports a smart messaging candidate document into the specified
3621    /// destination.
3622    ///
3623    /// This method is a [long-running
3624    /// operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation).
3625    /// The returned `Operation` type has the following method-specific fields:
3626    ///
3627    /// - `metadata`:
3628    ///   [KnowledgeOperationMetadata][google.cloud.dialogflow.v2.KnowledgeOperationMetadata]
3629    /// - `response`: [Document][google.cloud.dialogflow.v2.Document]
3630    ///
3631    /// [google.cloud.dialogflow.v2.Document]: crate::model::Document
3632    /// [google.cloud.dialogflow.v2.KnowledgeOperationMetadata]: crate::model::KnowledgeOperationMetadata
3633    ///
3634    /// # Long running operations
3635    ///
3636    /// This method is used to start, and/or poll a [long-running Operation].
3637    /// The [Working with long-running operations] chapter in the [user guide]
3638    /// covers these operations in detail.
3639    ///
3640    /// [long-running operation]: https://google.aip.dev/151
3641    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
3642    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
3643    ///
3644    /// # Example
3645    /// ```
3646    /// # use google_cloud_dialogflow_v2::client::Documents;
3647    /// use google_cloud_lro::Poller;
3648    /// use google_cloud_dialogflow_v2::Result;
3649    /// async fn sample(
3650    ///    client: &Documents
3651    /// ) -> Result<()> {
3652    ///     let response = client.export_document()
3653    ///         /* set fields */
3654    ///         .poller().until_done().await?;
3655    ///     println!("response {:?}", response);
3656    ///     Ok(())
3657    /// }
3658    /// ```
3659    pub fn export_document(&self) -> super::builder::documents::ExportDocument {
3660        super::builder::documents::ExportDocument::new(self.inner.clone())
3661    }
3662
3663    /// Lists information about the supported locations for this service.
3664    ///
3665    /// This method lists locations based on the resource scope provided in
3666    /// the [ListLocationsRequest.name] field:
3667    ///
3668    /// * **Global locations**: If `name` is empty, the method lists the
3669    ///   public locations available to all projects. * **Project-specific
3670    ///   locations**: If `name` follows the format
3671    ///   `projects/{project}`, the method lists locations visible to that
3672    ///   specific project. This includes public, private, or other
3673    ///   project-specific locations enabled for the project.
3674    ///
3675    /// For gRPC and client library implementations, the resource name is
3676    /// passed as the `name` field. For direct service calls, the resource
3677    /// name is
3678    /// incorporated into the request path based on the specific service
3679    /// implementation and version.
3680    ///
3681    /// # Example
3682    /// ```
3683    /// # use google_cloud_dialogflow_v2::client::Documents;
3684    /// use google_cloud_gax::paginator::ItemPaginator as _;
3685    /// use google_cloud_dialogflow_v2::Result;
3686    /// async fn sample(
3687    ///    client: &Documents
3688    /// ) -> Result<()> {
3689    ///     let mut list = client.list_locations()
3690    ///         /* set fields */
3691    ///         .by_item();
3692    ///     while let Some(item) = list.next().await.transpose()? {
3693    ///         println!("{:?}", item);
3694    ///     }
3695    ///     Ok(())
3696    /// }
3697    /// ```
3698    pub fn list_locations(&self) -> super::builder::documents::ListLocations {
3699        super::builder::documents::ListLocations::new(self.inner.clone())
3700    }
3701
3702    /// Gets information about a location.
3703    ///
3704    /// # Example
3705    /// ```
3706    /// # use google_cloud_dialogflow_v2::client::Documents;
3707    /// use google_cloud_dialogflow_v2::Result;
3708    /// async fn sample(
3709    ///    client: &Documents
3710    /// ) -> Result<()> {
3711    ///     let response = client.get_location()
3712    ///         /* set fields */
3713    ///         .send().await?;
3714    ///     println!("response {:?}", response);
3715    ///     Ok(())
3716    /// }
3717    /// ```
3718    pub fn get_location(&self) -> super::builder::documents::GetLocation {
3719        super::builder::documents::GetLocation::new(self.inner.clone())
3720    }
3721
3722    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3723    ///
3724    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
3725    ///
3726    /// # Example
3727    /// ```
3728    /// # use google_cloud_dialogflow_v2::client::Documents;
3729    /// use google_cloud_gax::paginator::ItemPaginator as _;
3730    /// use google_cloud_dialogflow_v2::Result;
3731    /// async fn sample(
3732    ///    client: &Documents
3733    /// ) -> Result<()> {
3734    ///     let mut list = client.list_operations()
3735    ///         /* set fields */
3736    ///         .by_item();
3737    ///     while let Some(item) = list.next().await.transpose()? {
3738    ///         println!("{:?}", item);
3739    ///     }
3740    ///     Ok(())
3741    /// }
3742    /// ```
3743    pub fn list_operations(&self) -> super::builder::documents::ListOperations {
3744        super::builder::documents::ListOperations::new(self.inner.clone())
3745    }
3746
3747    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3748    ///
3749    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
3750    ///
3751    /// # Example
3752    /// ```
3753    /// # use google_cloud_dialogflow_v2::client::Documents;
3754    /// use google_cloud_dialogflow_v2::Result;
3755    /// async fn sample(
3756    ///    client: &Documents
3757    /// ) -> Result<()> {
3758    ///     let response = client.get_operation()
3759    ///         /* set fields */
3760    ///         .send().await?;
3761    ///     println!("response {:?}", response);
3762    ///     Ok(())
3763    /// }
3764    /// ```
3765    pub fn get_operation(&self) -> super::builder::documents::GetOperation {
3766        super::builder::documents::GetOperation::new(self.inner.clone())
3767    }
3768
3769    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3770    ///
3771    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
3772    ///
3773    /// # Example
3774    /// ```
3775    /// # use google_cloud_dialogflow_v2::client::Documents;
3776    /// use google_cloud_dialogflow_v2::Result;
3777    /// async fn sample(
3778    ///    client: &Documents
3779    /// ) -> Result<()> {
3780    ///     client.cancel_operation()
3781    ///         /* set fields */
3782    ///         .send().await?;
3783    ///     Ok(())
3784    /// }
3785    /// ```
3786    pub fn cancel_operation(&self) -> super::builder::documents::CancelOperation {
3787        super::builder::documents::CancelOperation::new(self.inner.clone())
3788    }
3789}
3790
3791/// Implements a client for the Dialogflow API.
3792///
3793/// # Example
3794/// ```
3795/// # use google_cloud_dialogflow_v2::client::EncryptionSpecService;
3796/// # async fn sample() -> Result<(), Box<dyn std::error::Error>> {
3797///     let client = EncryptionSpecService::builder().build().await?;
3798///     let name = "name_value";
3799///     let response = client.get_encryption_spec()
3800///         .set_name(name)
3801///         .send().await?;
3802///     println!("response {:?}", response);
3803/// # Ok(()) }
3804/// ```
3805///
3806/// # Service Description
3807///
3808/// Manages encryption spec settings for Dialogflow and Agent Assist.
3809///
3810/// # Configuration
3811///
3812/// To configure `EncryptionSpecService` use the `with_*` methods in the type returned
3813/// by [builder()][EncryptionSpecService::builder]. The default configuration should
3814/// work for most applications. Common configuration changes include
3815///
3816/// * [with_endpoint()]: by default this client uses the global default endpoint
3817///   (`https://dialogflow.googleapis.com`). Applications using regional
3818///   endpoints or running in restricted networks (e.g. a network configured
3819//    with [Private Google Access with VPC Service Controls]) may want to
3820///   override this default.
3821/// * [with_credentials()]: by default this client uses
3822///   [Application Default Credentials]. Applications using custom
3823///   authentication may need to override this default.
3824///
3825/// [with_endpoint()]: super::builder::encryption_spec_service::ClientBuilder::with_endpoint
3826/// [with_credentials()]: super::builder::encryption_spec_service::ClientBuilder::with_credentials
3827/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
3828/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
3829///
3830/// # Pooling and Cloning
3831///
3832/// `EncryptionSpecService` holds a connection pool internally, it is advised to
3833/// create one and reuse it. You do not need to wrap `EncryptionSpecService` in
3834/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
3835/// already uses an `Arc` internally.
3836#[cfg(feature = "encryption-spec-service")]
3837#[cfg_attr(docsrs, doc(cfg(feature = "encryption-spec-service")))]
3838#[derive(Clone, Debug)]
3839pub struct EncryptionSpecService {
3840    inner: std::sync::Arc<dyn super::stub::dynamic::EncryptionSpecService>,
3841}
3842
3843#[cfg(feature = "encryption-spec-service")]
3844impl EncryptionSpecService {
3845    /// Returns a builder for [EncryptionSpecService].
3846    ///
3847    /// ```
3848    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
3849    /// # use google_cloud_dialogflow_v2::client::EncryptionSpecService;
3850    /// let client = EncryptionSpecService::builder().build().await?;
3851    /// # Ok(()) }
3852    /// ```
3853    pub fn builder() -> super::builder::encryption_spec_service::ClientBuilder {
3854        crate::new_client_builder(super::builder::encryption_spec_service::client::Factory)
3855    }
3856
3857    /// Creates a new client from the provided stub.
3858    ///
3859    /// The most common case for calling this function is in tests mocking the
3860    /// client's behavior.
3861    pub fn from_stub<T>(stub: T) -> Self
3862    where
3863        T: super::stub::EncryptionSpecService + 'static,
3864    {
3865        Self {
3866            inner: std::sync::Arc::new(stub),
3867        }
3868    }
3869
3870    pub(crate) async fn new(
3871        config: gaxi::options::ClientConfig,
3872    ) -> crate::ClientBuilderResult<Self> {
3873        let inner = Self::build_inner(config).await?;
3874        Ok(Self { inner })
3875    }
3876
3877    async fn build_inner(
3878        conf: gaxi::options::ClientConfig,
3879    ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::EncryptionSpecService>>
3880    {
3881        if gaxi::options::tracing_enabled(&conf) {
3882            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
3883        }
3884        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
3885    }
3886
3887    async fn build_transport(
3888        conf: gaxi::options::ClientConfig,
3889    ) -> crate::ClientBuilderResult<impl super::stub::EncryptionSpecService> {
3890        super::transport::EncryptionSpecService::new(conf).await
3891    }
3892
3893    async fn build_with_tracing(
3894        conf: gaxi::options::ClientConfig,
3895    ) -> crate::ClientBuilderResult<impl super::stub::EncryptionSpecService> {
3896        Self::build_transport(conf)
3897            .await
3898            .map(super::tracing::EncryptionSpecService::new)
3899    }
3900
3901    /// Gets location-level encryption key specification.
3902    ///
3903    /// # Example
3904    /// ```
3905    /// # use google_cloud_dialogflow_v2::client::EncryptionSpecService;
3906    /// use google_cloud_dialogflow_v2::Result;
3907    /// async fn sample(
3908    ///    client: &EncryptionSpecService, name: &str
3909    /// ) -> Result<()> {
3910    ///     let response = client.get_encryption_spec()
3911    ///         .set_name(name)
3912    ///         .send().await?;
3913    ///     println!("response {:?}", response);
3914    ///     Ok(())
3915    /// }
3916    /// ```
3917    pub fn get_encryption_spec(
3918        &self,
3919    ) -> super::builder::encryption_spec_service::GetEncryptionSpec {
3920        super::builder::encryption_spec_service::GetEncryptionSpec::new(self.inner.clone())
3921    }
3922
3923    /// Initializes a location-level encryption key specification.  An error will
3924    /// be thrown if the location has resources already created before the
3925    /// initialization. Once the encryption specification is initialized at a
3926    /// location, it is immutable and all newly created resources under the
3927    /// location will be encrypted with the existing specification.
3928    ///
3929    /// # Long running operations
3930    ///
3931    /// This method is used to start, and/or poll a [long-running Operation].
3932    /// The [Working with long-running operations] chapter in the [user guide]
3933    /// covers these operations in detail.
3934    ///
3935    /// [long-running operation]: https://google.aip.dev/151
3936    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
3937    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
3938    ///
3939    /// # Example
3940    /// ```
3941    /// # use google_cloud_dialogflow_v2::client::EncryptionSpecService;
3942    /// use google_cloud_lro::Poller;
3943    /// use google_cloud_dialogflow_v2::Result;
3944    /// async fn sample(
3945    ///    client: &EncryptionSpecService
3946    /// ) -> Result<()> {
3947    ///     let response = client.initialize_encryption_spec()
3948    ///         /* set fields */
3949    ///         .poller().until_done().await?;
3950    ///     println!("response {:?}", response);
3951    ///     Ok(())
3952    /// }
3953    /// ```
3954    pub fn initialize_encryption_spec(
3955        &self,
3956    ) -> super::builder::encryption_spec_service::InitializeEncryptionSpec {
3957        super::builder::encryption_spec_service::InitializeEncryptionSpec::new(self.inner.clone())
3958    }
3959
3960    /// Lists information about the supported locations for this service.
3961    ///
3962    /// This method lists locations based on the resource scope provided in
3963    /// the [ListLocationsRequest.name] field:
3964    ///
3965    /// * **Global locations**: If `name` is empty, the method lists the
3966    ///   public locations available to all projects. * **Project-specific
3967    ///   locations**: If `name` follows the format
3968    ///   `projects/{project}`, the method lists locations visible to that
3969    ///   specific project. This includes public, private, or other
3970    ///   project-specific locations enabled for the project.
3971    ///
3972    /// For gRPC and client library implementations, the resource name is
3973    /// passed as the `name` field. For direct service calls, the resource
3974    /// name is
3975    /// incorporated into the request path based on the specific service
3976    /// implementation and version.
3977    ///
3978    /// # Example
3979    /// ```
3980    /// # use google_cloud_dialogflow_v2::client::EncryptionSpecService;
3981    /// use google_cloud_gax::paginator::ItemPaginator as _;
3982    /// use google_cloud_dialogflow_v2::Result;
3983    /// async fn sample(
3984    ///    client: &EncryptionSpecService
3985    /// ) -> Result<()> {
3986    ///     let mut list = client.list_locations()
3987    ///         /* set fields */
3988    ///         .by_item();
3989    ///     while let Some(item) = list.next().await.transpose()? {
3990    ///         println!("{:?}", item);
3991    ///     }
3992    ///     Ok(())
3993    /// }
3994    /// ```
3995    pub fn list_locations(&self) -> super::builder::encryption_spec_service::ListLocations {
3996        super::builder::encryption_spec_service::ListLocations::new(self.inner.clone())
3997    }
3998
3999    /// Gets information about a location.
4000    ///
4001    /// # Example
4002    /// ```
4003    /// # use google_cloud_dialogflow_v2::client::EncryptionSpecService;
4004    /// use google_cloud_dialogflow_v2::Result;
4005    /// async fn sample(
4006    ///    client: &EncryptionSpecService
4007    /// ) -> Result<()> {
4008    ///     let response = client.get_location()
4009    ///         /* set fields */
4010    ///         .send().await?;
4011    ///     println!("response {:?}", response);
4012    ///     Ok(())
4013    /// }
4014    /// ```
4015    pub fn get_location(&self) -> super::builder::encryption_spec_service::GetLocation {
4016        super::builder::encryption_spec_service::GetLocation::new(self.inner.clone())
4017    }
4018
4019    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
4020    ///
4021    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
4022    ///
4023    /// # Example
4024    /// ```
4025    /// # use google_cloud_dialogflow_v2::client::EncryptionSpecService;
4026    /// use google_cloud_gax::paginator::ItemPaginator as _;
4027    /// use google_cloud_dialogflow_v2::Result;
4028    /// async fn sample(
4029    ///    client: &EncryptionSpecService
4030    /// ) -> Result<()> {
4031    ///     let mut list = client.list_operations()
4032    ///         /* set fields */
4033    ///         .by_item();
4034    ///     while let Some(item) = list.next().await.transpose()? {
4035    ///         println!("{:?}", item);
4036    ///     }
4037    ///     Ok(())
4038    /// }
4039    /// ```
4040    pub fn list_operations(&self) -> super::builder::encryption_spec_service::ListOperations {
4041        super::builder::encryption_spec_service::ListOperations::new(self.inner.clone())
4042    }
4043
4044    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
4045    ///
4046    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
4047    ///
4048    /// # Example
4049    /// ```
4050    /// # use google_cloud_dialogflow_v2::client::EncryptionSpecService;
4051    /// use google_cloud_dialogflow_v2::Result;
4052    /// async fn sample(
4053    ///    client: &EncryptionSpecService
4054    /// ) -> Result<()> {
4055    ///     let response = client.get_operation()
4056    ///         /* set fields */
4057    ///         .send().await?;
4058    ///     println!("response {:?}", response);
4059    ///     Ok(())
4060    /// }
4061    /// ```
4062    pub fn get_operation(&self) -> super::builder::encryption_spec_service::GetOperation {
4063        super::builder::encryption_spec_service::GetOperation::new(self.inner.clone())
4064    }
4065
4066    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
4067    ///
4068    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
4069    ///
4070    /// # Example
4071    /// ```
4072    /// # use google_cloud_dialogflow_v2::client::EncryptionSpecService;
4073    /// use google_cloud_dialogflow_v2::Result;
4074    /// async fn sample(
4075    ///    client: &EncryptionSpecService
4076    /// ) -> Result<()> {
4077    ///     client.cancel_operation()
4078    ///         /* set fields */
4079    ///         .send().await?;
4080    ///     Ok(())
4081    /// }
4082    /// ```
4083    pub fn cancel_operation(&self) -> super::builder::encryption_spec_service::CancelOperation {
4084        super::builder::encryption_spec_service::CancelOperation::new(self.inner.clone())
4085    }
4086}
4087
4088/// Implements a client for the Dialogflow API.
4089///
4090/// # Example
4091/// ```
4092/// # use google_cloud_dialogflow_v2::client::EntityTypes;
4093/// use google_cloud_gax::paginator::ItemPaginator as _;
4094/// # async fn sample() -> Result<(), Box<dyn std::error::Error>> {
4095///     let client = EntityTypes::builder().build().await?;
4096///     let parent = "parent_value";
4097///     let mut list = client.list_entity_types()
4098///         .set_parent(parent)
4099///         .by_item();
4100///     while let Some(item) = list.next().await.transpose()? {
4101///         println!("{:?}", item);
4102///     }
4103/// # Ok(()) }
4104/// ```
4105///
4106/// # Service Description
4107///
4108/// Service for managing [EntityTypes][google.cloud.dialogflow.v2.EntityType].
4109///
4110/// [google.cloud.dialogflow.v2.EntityType]: crate::model::EntityType
4111///
4112/// # Configuration
4113///
4114/// To configure `EntityTypes` use the `with_*` methods in the type returned
4115/// by [builder()][EntityTypes::builder]. The default configuration should
4116/// work for most applications. Common configuration changes include
4117///
4118/// * [with_endpoint()]: by default this client uses the global default endpoint
4119///   (`https://dialogflow.googleapis.com`). Applications using regional
4120///   endpoints or running in restricted networks (e.g. a network configured
4121//    with [Private Google Access with VPC Service Controls]) may want to
4122///   override this default.
4123/// * [with_credentials()]: by default this client uses
4124///   [Application Default Credentials]. Applications using custom
4125///   authentication may need to override this default.
4126///
4127/// [with_endpoint()]: super::builder::entity_types::ClientBuilder::with_endpoint
4128/// [with_credentials()]: super::builder::entity_types::ClientBuilder::with_credentials
4129/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
4130/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
4131///
4132/// # Pooling and Cloning
4133///
4134/// `EntityTypes` holds a connection pool internally, it is advised to
4135/// create one and reuse it. You do not need to wrap `EntityTypes` in
4136/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
4137/// already uses an `Arc` internally.
4138#[cfg(feature = "entity-types")]
4139#[cfg_attr(docsrs, doc(cfg(feature = "entity-types")))]
4140#[derive(Clone, Debug)]
4141pub struct EntityTypes {
4142    inner: std::sync::Arc<dyn super::stub::dynamic::EntityTypes>,
4143}
4144
4145#[cfg(feature = "entity-types")]
4146impl EntityTypes {
4147    /// Returns a builder for [EntityTypes].
4148    ///
4149    /// ```
4150    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
4151    /// # use google_cloud_dialogflow_v2::client::EntityTypes;
4152    /// let client = EntityTypes::builder().build().await?;
4153    /// # Ok(()) }
4154    /// ```
4155    pub fn builder() -> super::builder::entity_types::ClientBuilder {
4156        crate::new_client_builder(super::builder::entity_types::client::Factory)
4157    }
4158
4159    /// Creates a new client from the provided stub.
4160    ///
4161    /// The most common case for calling this function is in tests mocking the
4162    /// client's behavior.
4163    pub fn from_stub<T>(stub: T) -> Self
4164    where
4165        T: super::stub::EntityTypes + 'static,
4166    {
4167        Self {
4168            inner: std::sync::Arc::new(stub),
4169        }
4170    }
4171
4172    pub(crate) async fn new(
4173        config: gaxi::options::ClientConfig,
4174    ) -> crate::ClientBuilderResult<Self> {
4175        let inner = Self::build_inner(config).await?;
4176        Ok(Self { inner })
4177    }
4178
4179    async fn build_inner(
4180        conf: gaxi::options::ClientConfig,
4181    ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::EntityTypes>> {
4182        if gaxi::options::tracing_enabled(&conf) {
4183            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
4184        }
4185        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
4186    }
4187
4188    async fn build_transport(
4189        conf: gaxi::options::ClientConfig,
4190    ) -> crate::ClientBuilderResult<impl super::stub::EntityTypes> {
4191        super::transport::EntityTypes::new(conf).await
4192    }
4193
4194    async fn build_with_tracing(
4195        conf: gaxi::options::ClientConfig,
4196    ) -> crate::ClientBuilderResult<impl super::stub::EntityTypes> {
4197        Self::build_transport(conf)
4198            .await
4199            .map(super::tracing::EntityTypes::new)
4200    }
4201
4202    /// Returns the list of all entity types in the specified agent.
4203    ///
4204    /// # Example
4205    /// ```
4206    /// # use google_cloud_dialogflow_v2::client::EntityTypes;
4207    /// use google_cloud_gax::paginator::ItemPaginator as _;
4208    /// use google_cloud_dialogflow_v2::Result;
4209    /// async fn sample(
4210    ///    client: &EntityTypes, parent: &str
4211    /// ) -> Result<()> {
4212    ///     let mut list = client.list_entity_types()
4213    ///         .set_parent(parent)
4214    ///         .by_item();
4215    ///     while let Some(item) = list.next().await.transpose()? {
4216    ///         println!("{:?}", item);
4217    ///     }
4218    ///     Ok(())
4219    /// }
4220    /// ```
4221    pub fn list_entity_types(&self) -> super::builder::entity_types::ListEntityTypes {
4222        super::builder::entity_types::ListEntityTypes::new(self.inner.clone())
4223    }
4224
4225    /// Retrieves the specified entity type.
4226    ///
4227    /// # Example
4228    /// ```
4229    /// # use google_cloud_dialogflow_v2::client::EntityTypes;
4230    /// use google_cloud_dialogflow_v2::Result;
4231    /// async fn sample(
4232    ///    client: &EntityTypes, name: &str
4233    /// ) -> Result<()> {
4234    ///     let response = client.get_entity_type()
4235    ///         .set_name(name)
4236    ///         .send().await?;
4237    ///     println!("response {:?}", response);
4238    ///     Ok(())
4239    /// }
4240    /// ```
4241    pub fn get_entity_type(&self) -> super::builder::entity_types::GetEntityType {
4242        super::builder::entity_types::GetEntityType::new(self.inner.clone())
4243    }
4244
4245    /// Creates an entity type in the specified agent.
4246    ///
4247    /// Note: You should always train an agent prior to sending it queries. See the
4248    /// [training
4249    /// documentation](https://cloud.google.com/dialogflow/es/docs/training).
4250    ///
4251    /// # Example
4252    /// ```
4253    /// # use google_cloud_dialogflow_v2::client::EntityTypes;
4254    /// use google_cloud_dialogflow_v2::model::EntityType;
4255    /// use google_cloud_dialogflow_v2::Result;
4256    /// async fn sample(
4257    ///    client: &EntityTypes, parent: &str
4258    /// ) -> Result<()> {
4259    ///     let response = client.create_entity_type()
4260    ///         .set_parent(parent)
4261    ///         .set_entity_type(
4262    ///             EntityType::new()/* set fields */
4263    ///         )
4264    ///         .send().await?;
4265    ///     println!("response {:?}", response);
4266    ///     Ok(())
4267    /// }
4268    /// ```
4269    pub fn create_entity_type(&self) -> super::builder::entity_types::CreateEntityType {
4270        super::builder::entity_types::CreateEntityType::new(self.inner.clone())
4271    }
4272
4273    /// Updates the specified entity type.
4274    ///
4275    /// Note: You should always train an agent prior to sending it queries. See the
4276    /// [training
4277    /// documentation](https://cloud.google.com/dialogflow/es/docs/training).
4278    ///
4279    /// # Example
4280    /// ```
4281    /// # use google_cloud_dialogflow_v2::client::EntityTypes;
4282    /// # extern crate wkt as google_cloud_wkt;
4283    /// use google_cloud_wkt::FieldMask;
4284    /// use google_cloud_dialogflow_v2::model::EntityType;
4285    /// use google_cloud_dialogflow_v2::Result;
4286    /// async fn sample(
4287    ///    client: &EntityTypes, name: &str
4288    /// ) -> Result<()> {
4289    ///     let response = client.update_entity_type()
4290    ///         .set_entity_type(
4291    ///             EntityType::new().set_name(name)/* set fields */
4292    ///         )
4293    ///         .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
4294    ///         .send().await?;
4295    ///     println!("response {:?}", response);
4296    ///     Ok(())
4297    /// }
4298    /// ```
4299    pub fn update_entity_type(&self) -> super::builder::entity_types::UpdateEntityType {
4300        super::builder::entity_types::UpdateEntityType::new(self.inner.clone())
4301    }
4302
4303    /// Deletes the specified entity type.
4304    ///
4305    /// Note: You should always train an agent prior to sending it queries. See the
4306    /// [training
4307    /// documentation](https://cloud.google.com/dialogflow/es/docs/training).
4308    ///
4309    /// # Example
4310    /// ```
4311    /// # use google_cloud_dialogflow_v2::client::EntityTypes;
4312    /// use google_cloud_dialogflow_v2::Result;
4313    /// async fn sample(
4314    ///    client: &EntityTypes, name: &str
4315    /// ) -> Result<()> {
4316    ///     client.delete_entity_type()
4317    ///         .set_name(name)
4318    ///         .send().await?;
4319    ///     Ok(())
4320    /// }
4321    /// ```
4322    pub fn delete_entity_type(&self) -> super::builder::entity_types::DeleteEntityType {
4323        super::builder::entity_types::DeleteEntityType::new(self.inner.clone())
4324    }
4325
4326    /// Updates/Creates multiple entity types in the specified agent.
4327    ///
4328    /// This method is a [long-running
4329    /// operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations).
4330    /// The returned `Operation` type has the following method-specific fields:
4331    ///
4332    /// - `metadata`: An empty [Struct
4333    ///   message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct)
4334    /// - `response`:
4335    ///   [BatchUpdateEntityTypesResponse][google.cloud.dialogflow.v2.BatchUpdateEntityTypesResponse]
4336    ///
4337    /// Note: You should always train an agent prior to sending it queries. See the
4338    /// [training
4339    /// documentation](https://cloud.google.com/dialogflow/es/docs/training).
4340    ///
4341    /// [google.cloud.dialogflow.v2.BatchUpdateEntityTypesResponse]: crate::model::BatchUpdateEntityTypesResponse
4342    ///
4343    /// # Long running operations
4344    ///
4345    /// This method is used to start, and/or poll a [long-running Operation].
4346    /// The [Working with long-running operations] chapter in the [user guide]
4347    /// covers these operations in detail.
4348    ///
4349    /// [long-running operation]: https://google.aip.dev/151
4350    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
4351    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
4352    ///
4353    /// # Example
4354    /// ```
4355    /// # use google_cloud_dialogflow_v2::client::EntityTypes;
4356    /// use google_cloud_lro::Poller;
4357    /// use google_cloud_dialogflow_v2::Result;
4358    /// async fn sample(
4359    ///    client: &EntityTypes
4360    /// ) -> Result<()> {
4361    ///     let response = client.batch_update_entity_types()
4362    ///         /* set fields */
4363    ///         .poller().until_done().await?;
4364    ///     println!("response {:?}", response);
4365    ///     Ok(())
4366    /// }
4367    /// ```
4368    pub fn batch_update_entity_types(
4369        &self,
4370    ) -> super::builder::entity_types::BatchUpdateEntityTypes {
4371        super::builder::entity_types::BatchUpdateEntityTypes::new(self.inner.clone())
4372    }
4373
4374    /// Deletes entity types in the specified agent.
4375    ///
4376    /// This method is a [long-running
4377    /// operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations).
4378    /// The returned `Operation` type has the following method-specific fields:
4379    ///
4380    /// - `metadata`: An empty [Struct
4381    ///   message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct)
4382    /// - `response`: An [Empty
4383    ///   message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
4384    ///
4385    /// Note: You should always train an agent prior to sending it queries. See the
4386    /// [training
4387    /// documentation](https://cloud.google.com/dialogflow/es/docs/training).
4388    ///
4389    /// # Long running operations
4390    ///
4391    /// This method is used to start, and/or poll a [long-running Operation].
4392    /// The [Working with long-running operations] chapter in the [user guide]
4393    /// covers these operations in detail.
4394    ///
4395    /// [long-running operation]: https://google.aip.dev/151
4396    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
4397    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
4398    ///
4399    /// # Example
4400    /// ```
4401    /// # use google_cloud_dialogflow_v2::client::EntityTypes;
4402    /// use google_cloud_lro::Poller;
4403    /// use google_cloud_dialogflow_v2::Result;
4404    /// async fn sample(
4405    ///    client: &EntityTypes
4406    /// ) -> Result<()> {
4407    ///     client.batch_delete_entity_types()
4408    ///         /* set fields */
4409    ///         .poller().until_done().await?;
4410    ///     Ok(())
4411    /// }
4412    /// ```
4413    pub fn batch_delete_entity_types(
4414        &self,
4415    ) -> super::builder::entity_types::BatchDeleteEntityTypes {
4416        super::builder::entity_types::BatchDeleteEntityTypes::new(self.inner.clone())
4417    }
4418
4419    /// Creates multiple new entities in the specified entity type.
4420    ///
4421    /// This method is a [long-running
4422    /// operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations).
4423    /// The returned `Operation` type has the following method-specific fields:
4424    ///
4425    /// - `metadata`: An empty [Struct
4426    ///   message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct)
4427    /// - `response`: An [Empty
4428    ///   message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
4429    ///
4430    /// Note: You should always train an agent prior to sending it queries. See the
4431    /// [training
4432    /// documentation](https://cloud.google.com/dialogflow/es/docs/training).
4433    ///
4434    /// # Long running operations
4435    ///
4436    /// This method is used to start, and/or poll a [long-running Operation].
4437    /// The [Working with long-running operations] chapter in the [user guide]
4438    /// covers these operations in detail.
4439    ///
4440    /// [long-running operation]: https://google.aip.dev/151
4441    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
4442    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
4443    ///
4444    /// # Example
4445    /// ```
4446    /// # use google_cloud_dialogflow_v2::client::EntityTypes;
4447    /// use google_cloud_lro::Poller;
4448    /// use google_cloud_dialogflow_v2::Result;
4449    /// async fn sample(
4450    ///    client: &EntityTypes
4451    /// ) -> Result<()> {
4452    ///     client.batch_create_entities()
4453    ///         /* set fields */
4454    ///         .poller().until_done().await?;
4455    ///     Ok(())
4456    /// }
4457    /// ```
4458    pub fn batch_create_entities(&self) -> super::builder::entity_types::BatchCreateEntities {
4459        super::builder::entity_types::BatchCreateEntities::new(self.inner.clone())
4460    }
4461
4462    /// Updates or creates multiple entities in the specified entity type. This
4463    /// method does not affect entities in the entity type that aren't explicitly
4464    /// specified in the request.
4465    ///
4466    /// This method is a [long-running
4467    /// operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations).
4468    /// The returned `Operation` type has the following method-specific fields:
4469    ///
4470    /// - `metadata`: An empty [Struct
4471    ///   message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct)
4472    /// - `response`: An [Empty
4473    ///   message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
4474    ///
4475    /// Note: You should always train an agent prior to sending it queries. See the
4476    /// [training
4477    /// documentation](https://cloud.google.com/dialogflow/es/docs/training).
4478    ///
4479    /// # Long running operations
4480    ///
4481    /// This method is used to start, and/or poll a [long-running Operation].
4482    /// The [Working with long-running operations] chapter in the [user guide]
4483    /// covers these operations in detail.
4484    ///
4485    /// [long-running operation]: https://google.aip.dev/151
4486    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
4487    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
4488    ///
4489    /// # Example
4490    /// ```
4491    /// # use google_cloud_dialogflow_v2::client::EntityTypes;
4492    /// use google_cloud_lro::Poller;
4493    /// use google_cloud_dialogflow_v2::Result;
4494    /// async fn sample(
4495    ///    client: &EntityTypes
4496    /// ) -> Result<()> {
4497    ///     client.batch_update_entities()
4498    ///         /* set fields */
4499    ///         .poller().until_done().await?;
4500    ///     Ok(())
4501    /// }
4502    /// ```
4503    pub fn batch_update_entities(&self) -> super::builder::entity_types::BatchUpdateEntities {
4504        super::builder::entity_types::BatchUpdateEntities::new(self.inner.clone())
4505    }
4506
4507    /// Deletes entities in the specified entity type.
4508    ///
4509    /// This method is a [long-running
4510    /// operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations).
4511    /// The returned `Operation` type has the following method-specific fields:
4512    ///
4513    /// - `metadata`: An empty [Struct
4514    ///   message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct)
4515    /// - `response`: An [Empty
4516    ///   message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
4517    ///
4518    /// Note: You should always train an agent prior to sending it queries. See the
4519    /// [training
4520    /// documentation](https://cloud.google.com/dialogflow/es/docs/training).
4521    ///
4522    /// # Long running operations
4523    ///
4524    /// This method is used to start, and/or poll a [long-running Operation].
4525    /// The [Working with long-running operations] chapter in the [user guide]
4526    /// covers these operations in detail.
4527    ///
4528    /// [long-running operation]: https://google.aip.dev/151
4529    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
4530    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
4531    ///
4532    /// # Example
4533    /// ```
4534    /// # use google_cloud_dialogflow_v2::client::EntityTypes;
4535    /// use google_cloud_lro::Poller;
4536    /// use google_cloud_dialogflow_v2::Result;
4537    /// async fn sample(
4538    ///    client: &EntityTypes
4539    /// ) -> Result<()> {
4540    ///     client.batch_delete_entities()
4541    ///         /* set fields */
4542    ///         .poller().until_done().await?;
4543    ///     Ok(())
4544    /// }
4545    /// ```
4546    pub fn batch_delete_entities(&self) -> super::builder::entity_types::BatchDeleteEntities {
4547        super::builder::entity_types::BatchDeleteEntities::new(self.inner.clone())
4548    }
4549
4550    /// Lists information about the supported locations for this service.
4551    ///
4552    /// This method lists locations based on the resource scope provided in
4553    /// the [ListLocationsRequest.name] field:
4554    ///
4555    /// * **Global locations**: If `name` is empty, the method lists the
4556    ///   public locations available to all projects. * **Project-specific
4557    ///   locations**: If `name` follows the format
4558    ///   `projects/{project}`, the method lists locations visible to that
4559    ///   specific project. This includes public, private, or other
4560    ///   project-specific locations enabled for the project.
4561    ///
4562    /// For gRPC and client library implementations, the resource name is
4563    /// passed as the `name` field. For direct service calls, the resource
4564    /// name is
4565    /// incorporated into the request path based on the specific service
4566    /// implementation and version.
4567    ///
4568    /// # Example
4569    /// ```
4570    /// # use google_cloud_dialogflow_v2::client::EntityTypes;
4571    /// use google_cloud_gax::paginator::ItemPaginator as _;
4572    /// use google_cloud_dialogflow_v2::Result;
4573    /// async fn sample(
4574    ///    client: &EntityTypes
4575    /// ) -> Result<()> {
4576    ///     let mut list = client.list_locations()
4577    ///         /* set fields */
4578    ///         .by_item();
4579    ///     while let Some(item) = list.next().await.transpose()? {
4580    ///         println!("{:?}", item);
4581    ///     }
4582    ///     Ok(())
4583    /// }
4584    /// ```
4585    pub fn list_locations(&self) -> super::builder::entity_types::ListLocations {
4586        super::builder::entity_types::ListLocations::new(self.inner.clone())
4587    }
4588
4589    /// Gets information about a location.
4590    ///
4591    /// # Example
4592    /// ```
4593    /// # use google_cloud_dialogflow_v2::client::EntityTypes;
4594    /// use google_cloud_dialogflow_v2::Result;
4595    /// async fn sample(
4596    ///    client: &EntityTypes
4597    /// ) -> Result<()> {
4598    ///     let response = client.get_location()
4599    ///         /* set fields */
4600    ///         .send().await?;
4601    ///     println!("response {:?}", response);
4602    ///     Ok(())
4603    /// }
4604    /// ```
4605    pub fn get_location(&self) -> super::builder::entity_types::GetLocation {
4606        super::builder::entity_types::GetLocation::new(self.inner.clone())
4607    }
4608
4609    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
4610    ///
4611    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
4612    ///
4613    /// # Example
4614    /// ```
4615    /// # use google_cloud_dialogflow_v2::client::EntityTypes;
4616    /// use google_cloud_gax::paginator::ItemPaginator as _;
4617    /// use google_cloud_dialogflow_v2::Result;
4618    /// async fn sample(
4619    ///    client: &EntityTypes
4620    /// ) -> Result<()> {
4621    ///     let mut list = client.list_operations()
4622    ///         /* set fields */
4623    ///         .by_item();
4624    ///     while let Some(item) = list.next().await.transpose()? {
4625    ///         println!("{:?}", item);
4626    ///     }
4627    ///     Ok(())
4628    /// }
4629    /// ```
4630    pub fn list_operations(&self) -> super::builder::entity_types::ListOperations {
4631        super::builder::entity_types::ListOperations::new(self.inner.clone())
4632    }
4633
4634    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
4635    ///
4636    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
4637    ///
4638    /// # Example
4639    /// ```
4640    /// # use google_cloud_dialogflow_v2::client::EntityTypes;
4641    /// use google_cloud_dialogflow_v2::Result;
4642    /// async fn sample(
4643    ///    client: &EntityTypes
4644    /// ) -> Result<()> {
4645    ///     let response = client.get_operation()
4646    ///         /* set fields */
4647    ///         .send().await?;
4648    ///     println!("response {:?}", response);
4649    ///     Ok(())
4650    /// }
4651    /// ```
4652    pub fn get_operation(&self) -> super::builder::entity_types::GetOperation {
4653        super::builder::entity_types::GetOperation::new(self.inner.clone())
4654    }
4655
4656    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
4657    ///
4658    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
4659    ///
4660    /// # Example
4661    /// ```
4662    /// # use google_cloud_dialogflow_v2::client::EntityTypes;
4663    /// use google_cloud_dialogflow_v2::Result;
4664    /// async fn sample(
4665    ///    client: &EntityTypes
4666    /// ) -> Result<()> {
4667    ///     client.cancel_operation()
4668    ///         /* set fields */
4669    ///         .send().await?;
4670    ///     Ok(())
4671    /// }
4672    /// ```
4673    pub fn cancel_operation(&self) -> super::builder::entity_types::CancelOperation {
4674        super::builder::entity_types::CancelOperation::new(self.inner.clone())
4675    }
4676}
4677
4678/// Implements a client for the Dialogflow API.
4679///
4680/// # Example
4681/// ```
4682/// # use google_cloud_dialogflow_v2::client::Environments;
4683/// use google_cloud_gax::paginator::ItemPaginator as _;
4684/// # async fn sample() -> Result<(), Box<dyn std::error::Error>> {
4685///     let client = Environments::builder().build().await?;
4686///     let parent = "parent_value";
4687///     let mut list = client.list_environments()
4688///         .set_parent(parent)
4689///         .by_item();
4690///     while let Some(item) = list.next().await.transpose()? {
4691///         println!("{:?}", item);
4692///     }
4693/// # Ok(()) }
4694/// ```
4695///
4696/// # Service Description
4697///
4698/// Service for managing [Environments][google.cloud.dialogflow.v2.Environment].
4699///
4700/// [google.cloud.dialogflow.v2.Environment]: crate::model::Environment
4701///
4702/// # Configuration
4703///
4704/// To configure `Environments` use the `with_*` methods in the type returned
4705/// by [builder()][Environments::builder]. The default configuration should
4706/// work for most applications. Common configuration changes include
4707///
4708/// * [with_endpoint()]: by default this client uses the global default endpoint
4709///   (`https://dialogflow.googleapis.com`). Applications using regional
4710///   endpoints or running in restricted networks (e.g. a network configured
4711//    with [Private Google Access with VPC Service Controls]) may want to
4712///   override this default.
4713/// * [with_credentials()]: by default this client uses
4714///   [Application Default Credentials]. Applications using custom
4715///   authentication may need to override this default.
4716///
4717/// [with_endpoint()]: super::builder::environments::ClientBuilder::with_endpoint
4718/// [with_credentials()]: super::builder::environments::ClientBuilder::with_credentials
4719/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
4720/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
4721///
4722/// # Pooling and Cloning
4723///
4724/// `Environments` holds a connection pool internally, it is advised to
4725/// create one and reuse it. You do not need to wrap `Environments` in
4726/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
4727/// already uses an `Arc` internally.
4728#[cfg(feature = "environments")]
4729#[cfg_attr(docsrs, doc(cfg(feature = "environments")))]
4730#[derive(Clone, Debug)]
4731pub struct Environments {
4732    inner: std::sync::Arc<dyn super::stub::dynamic::Environments>,
4733}
4734
4735#[cfg(feature = "environments")]
4736impl Environments {
4737    /// Returns a builder for [Environments].
4738    ///
4739    /// ```
4740    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
4741    /// # use google_cloud_dialogflow_v2::client::Environments;
4742    /// let client = Environments::builder().build().await?;
4743    /// # Ok(()) }
4744    /// ```
4745    pub fn builder() -> super::builder::environments::ClientBuilder {
4746        crate::new_client_builder(super::builder::environments::client::Factory)
4747    }
4748
4749    /// Creates a new client from the provided stub.
4750    ///
4751    /// The most common case for calling this function is in tests mocking the
4752    /// client's behavior.
4753    pub fn from_stub<T>(stub: T) -> Self
4754    where
4755        T: super::stub::Environments + 'static,
4756    {
4757        Self {
4758            inner: std::sync::Arc::new(stub),
4759        }
4760    }
4761
4762    pub(crate) async fn new(
4763        config: gaxi::options::ClientConfig,
4764    ) -> crate::ClientBuilderResult<Self> {
4765        let inner = Self::build_inner(config).await?;
4766        Ok(Self { inner })
4767    }
4768
4769    async fn build_inner(
4770        conf: gaxi::options::ClientConfig,
4771    ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::Environments>> {
4772        if gaxi::options::tracing_enabled(&conf) {
4773            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
4774        }
4775        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
4776    }
4777
4778    async fn build_transport(
4779        conf: gaxi::options::ClientConfig,
4780    ) -> crate::ClientBuilderResult<impl super::stub::Environments> {
4781        super::transport::Environments::new(conf).await
4782    }
4783
4784    async fn build_with_tracing(
4785        conf: gaxi::options::ClientConfig,
4786    ) -> crate::ClientBuilderResult<impl super::stub::Environments> {
4787        Self::build_transport(conf)
4788            .await
4789            .map(super::tracing::Environments::new)
4790    }
4791
4792    /// Returns the list of all non-default environments of the specified agent.
4793    ///
4794    /// # Example
4795    /// ```
4796    /// # use google_cloud_dialogflow_v2::client::Environments;
4797    /// use google_cloud_gax::paginator::ItemPaginator as _;
4798    /// use google_cloud_dialogflow_v2::Result;
4799    /// async fn sample(
4800    ///    client: &Environments, parent: &str
4801    /// ) -> Result<()> {
4802    ///     let mut list = client.list_environments()
4803    ///         .set_parent(parent)
4804    ///         .by_item();
4805    ///     while let Some(item) = list.next().await.transpose()? {
4806    ///         println!("{:?}", item);
4807    ///     }
4808    ///     Ok(())
4809    /// }
4810    /// ```
4811    pub fn list_environments(&self) -> super::builder::environments::ListEnvironments {
4812        super::builder::environments::ListEnvironments::new(self.inner.clone())
4813    }
4814
4815    /// Retrieves the specified agent environment.
4816    ///
4817    /// # Example
4818    /// ```
4819    /// # use google_cloud_dialogflow_v2::client::Environments;
4820    /// use google_cloud_dialogflow_v2::Result;
4821    /// async fn sample(
4822    ///    client: &Environments, name: &str
4823    /// ) -> Result<()> {
4824    ///     let response = client.get_environment()
4825    ///         .set_name(name)
4826    ///         .send().await?;
4827    ///     println!("response {:?}", response);
4828    ///     Ok(())
4829    /// }
4830    /// ```
4831    pub fn get_environment(&self) -> super::builder::environments::GetEnvironment {
4832        super::builder::environments::GetEnvironment::new(self.inner.clone())
4833    }
4834
4835    /// Creates an agent environment.
4836    ///
4837    /// # Example
4838    /// ```
4839    /// # use google_cloud_dialogflow_v2::client::Environments;
4840    /// use google_cloud_dialogflow_v2::model::Environment;
4841    /// use google_cloud_dialogflow_v2::Result;
4842    /// async fn sample(
4843    ///    client: &Environments, parent: &str
4844    /// ) -> Result<()> {
4845    ///     let response = client.create_environment()
4846    ///         .set_parent(parent)
4847    ///         .set_environment_id("environment_id_value")
4848    ///         .set_environment(
4849    ///             Environment::new()/* set fields */
4850    ///         )
4851    ///         .send().await?;
4852    ///     println!("response {:?}", response);
4853    ///     Ok(())
4854    /// }
4855    /// ```
4856    pub fn create_environment(&self) -> super::builder::environments::CreateEnvironment {
4857        super::builder::environments::CreateEnvironment::new(self.inner.clone())
4858    }
4859
4860    /// Updates the specified agent environment.
4861    ///
4862    /// This method allows you to deploy new agent versions into the environment.
4863    /// When an environment is pointed to a new agent version by setting
4864    /// `environment.agent_version`, the environment is temporarily set to the
4865    /// `LOADING` state. During that time, the environment continues serving the
4866    /// previous version of the agent. After the new agent version is done loading,
4867    /// the environment is set back to the `RUNNING` state.
4868    /// You can use "-" as Environment ID in environment name to update an agent
4869    /// version in the default environment. WARNING: this will negate all recent
4870    /// changes to the draft agent and can't be undone. You may want to save the
4871    /// draft agent to a version before calling this method.
4872    ///
4873    /// # Example
4874    /// ```
4875    /// # use google_cloud_dialogflow_v2::client::Environments;
4876    /// # extern crate wkt as google_cloud_wkt;
4877    /// use google_cloud_wkt::FieldMask;
4878    /// use google_cloud_dialogflow_v2::model::Environment;
4879    /// use google_cloud_dialogflow_v2::Result;
4880    /// async fn sample(
4881    ///    client: &Environments, name: &str
4882    /// ) -> Result<()> {
4883    ///     let response = client.update_environment()
4884    ///         .set_environment(
4885    ///             Environment::new().set_name(name)/* set fields */
4886    ///         )
4887    ///         .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
4888    ///         .send().await?;
4889    ///     println!("response {:?}", response);
4890    ///     Ok(())
4891    /// }
4892    /// ```
4893    pub fn update_environment(&self) -> super::builder::environments::UpdateEnvironment {
4894        super::builder::environments::UpdateEnvironment::new(self.inner.clone())
4895    }
4896
4897    /// Deletes the specified agent environment.
4898    ///
4899    /// # Example
4900    /// ```
4901    /// # use google_cloud_dialogflow_v2::client::Environments;
4902    /// use google_cloud_dialogflow_v2::Result;
4903    /// async fn sample(
4904    ///    client: &Environments, name: &str
4905    /// ) -> Result<()> {
4906    ///     client.delete_environment()
4907    ///         .set_name(name)
4908    ///         .send().await?;
4909    ///     Ok(())
4910    /// }
4911    /// ```
4912    pub fn delete_environment(&self) -> super::builder::environments::DeleteEnvironment {
4913        super::builder::environments::DeleteEnvironment::new(self.inner.clone())
4914    }
4915
4916    /// Gets the history of the specified environment.
4917    ///
4918    /// # Example
4919    /// ```
4920    /// # use google_cloud_dialogflow_v2::client::Environments;
4921    /// use google_cloud_gax::paginator::ItemPaginator as _;
4922    /// use google_cloud_dialogflow_v2::Result;
4923    /// async fn sample(
4924    ///    client: &Environments
4925    /// ) -> Result<()> {
4926    ///     let mut list = client.get_environment_history()
4927    ///         /* set fields */
4928    ///         .by_item();
4929    ///     while let Some(item) = list.next().await.transpose()? {
4930    ///         println!("{:?}", item);
4931    ///     }
4932    ///     Ok(())
4933    /// }
4934    /// ```
4935    pub fn get_environment_history(&self) -> super::builder::environments::GetEnvironmentHistory {
4936        super::builder::environments::GetEnvironmentHistory::new(self.inner.clone())
4937    }
4938
4939    /// Lists information about the supported locations for this service.
4940    ///
4941    /// This method lists locations based on the resource scope provided in
4942    /// the [ListLocationsRequest.name] field:
4943    ///
4944    /// * **Global locations**: If `name` is empty, the method lists the
4945    ///   public locations available to all projects. * **Project-specific
4946    ///   locations**: If `name` follows the format
4947    ///   `projects/{project}`, the method lists locations visible to that
4948    ///   specific project. This includes public, private, or other
4949    ///   project-specific locations enabled for the project.
4950    ///
4951    /// For gRPC and client library implementations, the resource name is
4952    /// passed as the `name` field. For direct service calls, the resource
4953    /// name is
4954    /// incorporated into the request path based on the specific service
4955    /// implementation and version.
4956    ///
4957    /// # Example
4958    /// ```
4959    /// # use google_cloud_dialogflow_v2::client::Environments;
4960    /// use google_cloud_gax::paginator::ItemPaginator as _;
4961    /// use google_cloud_dialogflow_v2::Result;
4962    /// async fn sample(
4963    ///    client: &Environments
4964    /// ) -> Result<()> {
4965    ///     let mut list = client.list_locations()
4966    ///         /* set fields */
4967    ///         .by_item();
4968    ///     while let Some(item) = list.next().await.transpose()? {
4969    ///         println!("{:?}", item);
4970    ///     }
4971    ///     Ok(())
4972    /// }
4973    /// ```
4974    pub fn list_locations(&self) -> super::builder::environments::ListLocations {
4975        super::builder::environments::ListLocations::new(self.inner.clone())
4976    }
4977
4978    /// Gets information about a location.
4979    ///
4980    /// # Example
4981    /// ```
4982    /// # use google_cloud_dialogflow_v2::client::Environments;
4983    /// use google_cloud_dialogflow_v2::Result;
4984    /// async fn sample(
4985    ///    client: &Environments
4986    /// ) -> Result<()> {
4987    ///     let response = client.get_location()
4988    ///         /* set fields */
4989    ///         .send().await?;
4990    ///     println!("response {:?}", response);
4991    ///     Ok(())
4992    /// }
4993    /// ```
4994    pub fn get_location(&self) -> super::builder::environments::GetLocation {
4995        super::builder::environments::GetLocation::new(self.inner.clone())
4996    }
4997
4998    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
4999    ///
5000    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
5001    ///
5002    /// # Example
5003    /// ```
5004    /// # use google_cloud_dialogflow_v2::client::Environments;
5005    /// use google_cloud_gax::paginator::ItemPaginator as _;
5006    /// use google_cloud_dialogflow_v2::Result;
5007    /// async fn sample(
5008    ///    client: &Environments
5009    /// ) -> Result<()> {
5010    ///     let mut list = client.list_operations()
5011    ///         /* set fields */
5012    ///         .by_item();
5013    ///     while let Some(item) = list.next().await.transpose()? {
5014    ///         println!("{:?}", item);
5015    ///     }
5016    ///     Ok(())
5017    /// }
5018    /// ```
5019    pub fn list_operations(&self) -> super::builder::environments::ListOperations {
5020        super::builder::environments::ListOperations::new(self.inner.clone())
5021    }
5022
5023    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
5024    ///
5025    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
5026    ///
5027    /// # Example
5028    /// ```
5029    /// # use google_cloud_dialogflow_v2::client::Environments;
5030    /// use google_cloud_dialogflow_v2::Result;
5031    /// async fn sample(
5032    ///    client: &Environments
5033    /// ) -> Result<()> {
5034    ///     let response = client.get_operation()
5035    ///         /* set fields */
5036    ///         .send().await?;
5037    ///     println!("response {:?}", response);
5038    ///     Ok(())
5039    /// }
5040    /// ```
5041    pub fn get_operation(&self) -> super::builder::environments::GetOperation {
5042        super::builder::environments::GetOperation::new(self.inner.clone())
5043    }
5044
5045    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
5046    ///
5047    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
5048    ///
5049    /// # Example
5050    /// ```
5051    /// # use google_cloud_dialogflow_v2::client::Environments;
5052    /// use google_cloud_dialogflow_v2::Result;
5053    /// async fn sample(
5054    ///    client: &Environments
5055    /// ) -> Result<()> {
5056    ///     client.cancel_operation()
5057    ///         /* set fields */
5058    ///         .send().await?;
5059    ///     Ok(())
5060    /// }
5061    /// ```
5062    pub fn cancel_operation(&self) -> super::builder::environments::CancelOperation {
5063        super::builder::environments::CancelOperation::new(self.inner.clone())
5064    }
5065}
5066
5067/// Implements a client for the Dialogflow API.
5068///
5069/// # Example
5070/// ```
5071/// # use google_cloud_dialogflow_v2::client::Fulfillments;
5072/// # async fn sample() -> Result<(), Box<dyn std::error::Error>> {
5073///     let client = Fulfillments::builder().build().await?;
5074///     let name = "name_value";
5075///     let response = client.get_fulfillment()
5076///         .set_name(name)
5077///         .send().await?;
5078///     println!("response {:?}", response);
5079/// # Ok(()) }
5080/// ```
5081///
5082/// # Service Description
5083///
5084/// Service for managing [Fulfillments][google.cloud.dialogflow.v2.Fulfillment].
5085///
5086/// [google.cloud.dialogflow.v2.Fulfillment]: crate::model::Fulfillment
5087///
5088/// # Configuration
5089///
5090/// To configure `Fulfillments` use the `with_*` methods in the type returned
5091/// by [builder()][Fulfillments::builder]. The default configuration should
5092/// work for most applications. Common configuration changes include
5093///
5094/// * [with_endpoint()]: by default this client uses the global default endpoint
5095///   (`https://dialogflow.googleapis.com`). Applications using regional
5096///   endpoints or running in restricted networks (e.g. a network configured
5097//    with [Private Google Access with VPC Service Controls]) may want to
5098///   override this default.
5099/// * [with_credentials()]: by default this client uses
5100///   [Application Default Credentials]. Applications using custom
5101///   authentication may need to override this default.
5102///
5103/// [with_endpoint()]: super::builder::fulfillments::ClientBuilder::with_endpoint
5104/// [with_credentials()]: super::builder::fulfillments::ClientBuilder::with_credentials
5105/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
5106/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
5107///
5108/// # Pooling and Cloning
5109///
5110/// `Fulfillments` holds a connection pool internally, it is advised to
5111/// create one and reuse it. You do not need to wrap `Fulfillments` in
5112/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
5113/// already uses an `Arc` internally.
5114#[cfg(feature = "fulfillments")]
5115#[cfg_attr(docsrs, doc(cfg(feature = "fulfillments")))]
5116#[derive(Clone, Debug)]
5117pub struct Fulfillments {
5118    inner: std::sync::Arc<dyn super::stub::dynamic::Fulfillments>,
5119}
5120
5121#[cfg(feature = "fulfillments")]
5122impl Fulfillments {
5123    /// Returns a builder for [Fulfillments].
5124    ///
5125    /// ```
5126    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
5127    /// # use google_cloud_dialogflow_v2::client::Fulfillments;
5128    /// let client = Fulfillments::builder().build().await?;
5129    /// # Ok(()) }
5130    /// ```
5131    pub fn builder() -> super::builder::fulfillments::ClientBuilder {
5132        crate::new_client_builder(super::builder::fulfillments::client::Factory)
5133    }
5134
5135    /// Creates a new client from the provided stub.
5136    ///
5137    /// The most common case for calling this function is in tests mocking the
5138    /// client's behavior.
5139    pub fn from_stub<T>(stub: T) -> Self
5140    where
5141        T: super::stub::Fulfillments + 'static,
5142    {
5143        Self {
5144            inner: std::sync::Arc::new(stub),
5145        }
5146    }
5147
5148    pub(crate) async fn new(
5149        config: gaxi::options::ClientConfig,
5150    ) -> crate::ClientBuilderResult<Self> {
5151        let inner = Self::build_inner(config).await?;
5152        Ok(Self { inner })
5153    }
5154
5155    async fn build_inner(
5156        conf: gaxi::options::ClientConfig,
5157    ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::Fulfillments>> {
5158        if gaxi::options::tracing_enabled(&conf) {
5159            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
5160        }
5161        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
5162    }
5163
5164    async fn build_transport(
5165        conf: gaxi::options::ClientConfig,
5166    ) -> crate::ClientBuilderResult<impl super::stub::Fulfillments> {
5167        super::transport::Fulfillments::new(conf).await
5168    }
5169
5170    async fn build_with_tracing(
5171        conf: gaxi::options::ClientConfig,
5172    ) -> crate::ClientBuilderResult<impl super::stub::Fulfillments> {
5173        Self::build_transport(conf)
5174            .await
5175            .map(super::tracing::Fulfillments::new)
5176    }
5177
5178    /// Retrieves the fulfillment.
5179    ///
5180    /// # Example
5181    /// ```
5182    /// # use google_cloud_dialogflow_v2::client::Fulfillments;
5183    /// use google_cloud_dialogflow_v2::Result;
5184    /// async fn sample(
5185    ///    client: &Fulfillments, name: &str
5186    /// ) -> Result<()> {
5187    ///     let response = client.get_fulfillment()
5188    ///         .set_name(name)
5189    ///         .send().await?;
5190    ///     println!("response {:?}", response);
5191    ///     Ok(())
5192    /// }
5193    /// ```
5194    pub fn get_fulfillment(&self) -> super::builder::fulfillments::GetFulfillment {
5195        super::builder::fulfillments::GetFulfillment::new(self.inner.clone())
5196    }
5197
5198    /// Updates the fulfillment.
5199    ///
5200    /// # Example
5201    /// ```
5202    /// # use google_cloud_dialogflow_v2::client::Fulfillments;
5203    /// # extern crate wkt as google_cloud_wkt;
5204    /// use google_cloud_wkt::FieldMask;
5205    /// use google_cloud_dialogflow_v2::model::Fulfillment;
5206    /// use google_cloud_dialogflow_v2::Result;
5207    /// async fn sample(
5208    ///    client: &Fulfillments, name: &str
5209    /// ) -> Result<()> {
5210    ///     let response = client.update_fulfillment()
5211    ///         .set_fulfillment(
5212    ///             Fulfillment::new().set_name(name)/* set fields */
5213    ///         )
5214    ///         .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
5215    ///         .send().await?;
5216    ///     println!("response {:?}", response);
5217    ///     Ok(())
5218    /// }
5219    /// ```
5220    pub fn update_fulfillment(&self) -> super::builder::fulfillments::UpdateFulfillment {
5221        super::builder::fulfillments::UpdateFulfillment::new(self.inner.clone())
5222    }
5223
5224    /// Lists information about the supported locations for this service.
5225    ///
5226    /// This method lists locations based on the resource scope provided in
5227    /// the [ListLocationsRequest.name] field:
5228    ///
5229    /// * **Global locations**: If `name` is empty, the method lists the
5230    ///   public locations available to all projects. * **Project-specific
5231    ///   locations**: If `name` follows the format
5232    ///   `projects/{project}`, the method lists locations visible to that
5233    ///   specific project. This includes public, private, or other
5234    ///   project-specific locations enabled for the project.
5235    ///
5236    /// For gRPC and client library implementations, the resource name is
5237    /// passed as the `name` field. For direct service calls, the resource
5238    /// name is
5239    /// incorporated into the request path based on the specific service
5240    /// implementation and version.
5241    ///
5242    /// # Example
5243    /// ```
5244    /// # use google_cloud_dialogflow_v2::client::Fulfillments;
5245    /// use google_cloud_gax::paginator::ItemPaginator as _;
5246    /// use google_cloud_dialogflow_v2::Result;
5247    /// async fn sample(
5248    ///    client: &Fulfillments
5249    /// ) -> Result<()> {
5250    ///     let mut list = client.list_locations()
5251    ///         /* set fields */
5252    ///         .by_item();
5253    ///     while let Some(item) = list.next().await.transpose()? {
5254    ///         println!("{:?}", item);
5255    ///     }
5256    ///     Ok(())
5257    /// }
5258    /// ```
5259    pub fn list_locations(&self) -> super::builder::fulfillments::ListLocations {
5260        super::builder::fulfillments::ListLocations::new(self.inner.clone())
5261    }
5262
5263    /// Gets information about a location.
5264    ///
5265    /// # Example
5266    /// ```
5267    /// # use google_cloud_dialogflow_v2::client::Fulfillments;
5268    /// use google_cloud_dialogflow_v2::Result;
5269    /// async fn sample(
5270    ///    client: &Fulfillments
5271    /// ) -> Result<()> {
5272    ///     let response = client.get_location()
5273    ///         /* set fields */
5274    ///         .send().await?;
5275    ///     println!("response {:?}", response);
5276    ///     Ok(())
5277    /// }
5278    /// ```
5279    pub fn get_location(&self) -> super::builder::fulfillments::GetLocation {
5280        super::builder::fulfillments::GetLocation::new(self.inner.clone())
5281    }
5282
5283    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
5284    ///
5285    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
5286    ///
5287    /// # Example
5288    /// ```
5289    /// # use google_cloud_dialogflow_v2::client::Fulfillments;
5290    /// use google_cloud_gax::paginator::ItemPaginator as _;
5291    /// use google_cloud_dialogflow_v2::Result;
5292    /// async fn sample(
5293    ///    client: &Fulfillments
5294    /// ) -> Result<()> {
5295    ///     let mut list = client.list_operations()
5296    ///         /* set fields */
5297    ///         .by_item();
5298    ///     while let Some(item) = list.next().await.transpose()? {
5299    ///         println!("{:?}", item);
5300    ///     }
5301    ///     Ok(())
5302    /// }
5303    /// ```
5304    pub fn list_operations(&self) -> super::builder::fulfillments::ListOperations {
5305        super::builder::fulfillments::ListOperations::new(self.inner.clone())
5306    }
5307
5308    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
5309    ///
5310    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
5311    ///
5312    /// # Example
5313    /// ```
5314    /// # use google_cloud_dialogflow_v2::client::Fulfillments;
5315    /// use google_cloud_dialogflow_v2::Result;
5316    /// async fn sample(
5317    ///    client: &Fulfillments
5318    /// ) -> Result<()> {
5319    ///     let response = client.get_operation()
5320    ///         /* set fields */
5321    ///         .send().await?;
5322    ///     println!("response {:?}", response);
5323    ///     Ok(())
5324    /// }
5325    /// ```
5326    pub fn get_operation(&self) -> super::builder::fulfillments::GetOperation {
5327        super::builder::fulfillments::GetOperation::new(self.inner.clone())
5328    }
5329
5330    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
5331    ///
5332    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
5333    ///
5334    /// # Example
5335    /// ```
5336    /// # use google_cloud_dialogflow_v2::client::Fulfillments;
5337    /// use google_cloud_dialogflow_v2::Result;
5338    /// async fn sample(
5339    ///    client: &Fulfillments
5340    /// ) -> Result<()> {
5341    ///     client.cancel_operation()
5342    ///         /* set fields */
5343    ///         .send().await?;
5344    ///     Ok(())
5345    /// }
5346    /// ```
5347    pub fn cancel_operation(&self) -> super::builder::fulfillments::CancelOperation {
5348        super::builder::fulfillments::CancelOperation::new(self.inner.clone())
5349    }
5350}
5351
5352/// Implements a client for the Dialogflow API.
5353///
5354/// # Example
5355/// ```
5356/// # use google_cloud_dialogflow_v2::client::Generators;
5357/// use google_cloud_gax::paginator::ItemPaginator as _;
5358/// # async fn sample() -> Result<(), Box<dyn std::error::Error>> {
5359///     let client = Generators::builder().build().await?;
5360///     let parent = "parent_value";
5361///     let mut list = client.list_generators()
5362///         .set_parent(parent)
5363///         .by_item();
5364///     while let Some(item) = list.next().await.transpose()? {
5365///         println!("{:?}", item);
5366///     }
5367/// # Ok(()) }
5368/// ```
5369///
5370/// # Service Description
5371///
5372/// Generator Service for LLM powered Agent Assist. This service manages the
5373/// configurations of user owned Generators, such as description, context and
5374/// instruction, input/output format, etc. The generator resources will be used
5375/// inside a conversation and will be triggered by TriggerEvent to query LLM for
5376/// answers.
5377///
5378/// # Configuration
5379///
5380/// To configure `Generators` use the `with_*` methods in the type returned
5381/// by [builder()][Generators::builder]. The default configuration should
5382/// work for most applications. Common configuration changes include
5383///
5384/// * [with_endpoint()]: by default this client uses the global default endpoint
5385///   (`https://dialogflow.googleapis.com`). Applications using regional
5386///   endpoints or running in restricted networks (e.g. a network configured
5387//    with [Private Google Access with VPC Service Controls]) may want to
5388///   override this default.
5389/// * [with_credentials()]: by default this client uses
5390///   [Application Default Credentials]. Applications using custom
5391///   authentication may need to override this default.
5392///
5393/// [with_endpoint()]: super::builder::generators::ClientBuilder::with_endpoint
5394/// [with_credentials()]: super::builder::generators::ClientBuilder::with_credentials
5395/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
5396/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
5397///
5398/// # Pooling and Cloning
5399///
5400/// `Generators` holds a connection pool internally, it is advised to
5401/// create one and reuse it. You do not need to wrap `Generators` in
5402/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
5403/// already uses an `Arc` internally.
5404#[cfg(feature = "generators")]
5405#[cfg_attr(docsrs, doc(cfg(feature = "generators")))]
5406#[derive(Clone, Debug)]
5407pub struct Generators {
5408    inner: std::sync::Arc<dyn super::stub::dynamic::Generators>,
5409}
5410
5411#[cfg(feature = "generators")]
5412impl Generators {
5413    /// Returns a builder for [Generators].
5414    ///
5415    /// ```
5416    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
5417    /// # use google_cloud_dialogflow_v2::client::Generators;
5418    /// let client = Generators::builder().build().await?;
5419    /// # Ok(()) }
5420    /// ```
5421    pub fn builder() -> super::builder::generators::ClientBuilder {
5422        crate::new_client_builder(super::builder::generators::client::Factory)
5423    }
5424
5425    /// Creates a new client from the provided stub.
5426    ///
5427    /// The most common case for calling this function is in tests mocking the
5428    /// client's behavior.
5429    pub fn from_stub<T>(stub: T) -> Self
5430    where
5431        T: super::stub::Generators + 'static,
5432    {
5433        Self {
5434            inner: std::sync::Arc::new(stub),
5435        }
5436    }
5437
5438    pub(crate) async fn new(
5439        config: gaxi::options::ClientConfig,
5440    ) -> crate::ClientBuilderResult<Self> {
5441        let inner = Self::build_inner(config).await?;
5442        Ok(Self { inner })
5443    }
5444
5445    async fn build_inner(
5446        conf: gaxi::options::ClientConfig,
5447    ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::Generators>> {
5448        if gaxi::options::tracing_enabled(&conf) {
5449            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
5450        }
5451        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
5452    }
5453
5454    async fn build_transport(
5455        conf: gaxi::options::ClientConfig,
5456    ) -> crate::ClientBuilderResult<impl super::stub::Generators> {
5457        super::transport::Generators::new(conf).await
5458    }
5459
5460    async fn build_with_tracing(
5461        conf: gaxi::options::ClientConfig,
5462    ) -> crate::ClientBuilderResult<impl super::stub::Generators> {
5463        Self::build_transport(conf)
5464            .await
5465            .map(super::tracing::Generators::new)
5466    }
5467
5468    /// Creates a generator.
5469    ///
5470    /// # Example
5471    /// ```
5472    /// # use google_cloud_dialogflow_v2::client::Generators;
5473    /// use google_cloud_dialogflow_v2::model::Generator;
5474    /// use google_cloud_dialogflow_v2::Result;
5475    /// async fn sample(
5476    ///    client: &Generators, parent: &str
5477    /// ) -> Result<()> {
5478    ///     let response = client.create_generator()
5479    ///         .set_parent(parent)
5480    ///         .set_generator_id("generator_id_value")
5481    ///         .set_generator(
5482    ///             Generator::new()/* set fields */
5483    ///         )
5484    ///         .send().await?;
5485    ///     println!("response {:?}", response);
5486    ///     Ok(())
5487    /// }
5488    /// ```
5489    pub fn create_generator(&self) -> super::builder::generators::CreateGenerator {
5490        super::builder::generators::CreateGenerator::new(self.inner.clone())
5491    }
5492
5493    /// Retrieves a generator.
5494    ///
5495    /// # Example
5496    /// ```
5497    /// # use google_cloud_dialogflow_v2::client::Generators;
5498    /// use google_cloud_dialogflow_v2::Result;
5499    /// async fn sample(
5500    ///    client: &Generators, name: &str
5501    /// ) -> Result<()> {
5502    ///     let response = client.get_generator()
5503    ///         .set_name(name)
5504    ///         .send().await?;
5505    ///     println!("response {:?}", response);
5506    ///     Ok(())
5507    /// }
5508    /// ```
5509    pub fn get_generator(&self) -> super::builder::generators::GetGenerator {
5510        super::builder::generators::GetGenerator::new(self.inner.clone())
5511    }
5512
5513    /// Lists generators.
5514    ///
5515    /// # Example
5516    /// ```
5517    /// # use google_cloud_dialogflow_v2::client::Generators;
5518    /// use google_cloud_gax::paginator::ItemPaginator as _;
5519    /// use google_cloud_dialogflow_v2::Result;
5520    /// async fn sample(
5521    ///    client: &Generators, parent: &str
5522    /// ) -> Result<()> {
5523    ///     let mut list = client.list_generators()
5524    ///         .set_parent(parent)
5525    ///         .by_item();
5526    ///     while let Some(item) = list.next().await.transpose()? {
5527    ///         println!("{:?}", item);
5528    ///     }
5529    ///     Ok(())
5530    /// }
5531    /// ```
5532    pub fn list_generators(&self) -> super::builder::generators::ListGenerators {
5533        super::builder::generators::ListGenerators::new(self.inner.clone())
5534    }
5535
5536    /// Deletes a generator.
5537    ///
5538    /// # Example
5539    /// ```
5540    /// # use google_cloud_dialogflow_v2::client::Generators;
5541    /// use google_cloud_dialogflow_v2::Result;
5542    /// async fn sample(
5543    ///    client: &Generators, name: &str
5544    /// ) -> Result<()> {
5545    ///     client.delete_generator()
5546    ///         .set_name(name)
5547    ///         .send().await?;
5548    ///     Ok(())
5549    /// }
5550    /// ```
5551    pub fn delete_generator(&self) -> super::builder::generators::DeleteGenerator {
5552        super::builder::generators::DeleteGenerator::new(self.inner.clone())
5553    }
5554
5555    /// Updates a generator.
5556    ///
5557    /// # Example
5558    /// ```
5559    /// # use google_cloud_dialogflow_v2::client::Generators;
5560    /// # extern crate wkt as google_cloud_wkt;
5561    /// use google_cloud_wkt::FieldMask;
5562    /// use google_cloud_dialogflow_v2::model::Generator;
5563    /// use google_cloud_dialogflow_v2::Result;
5564    /// async fn sample(
5565    ///    client: &Generators, name: &str
5566    /// ) -> Result<()> {
5567    ///     let response = client.update_generator()
5568    ///         .set_generator(
5569    ///             Generator::new().set_name(name)/* set fields */
5570    ///         )
5571    ///         .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
5572    ///         .send().await?;
5573    ///     println!("response {:?}", response);
5574    ///     Ok(())
5575    /// }
5576    /// ```
5577    pub fn update_generator(&self) -> super::builder::generators::UpdateGenerator {
5578        super::builder::generators::UpdateGenerator::new(self.inner.clone())
5579    }
5580
5581    /// Lists information about the supported locations for this service.
5582    ///
5583    /// This method lists locations based on the resource scope provided in
5584    /// the [ListLocationsRequest.name] field:
5585    ///
5586    /// * **Global locations**: If `name` is empty, the method lists the
5587    ///   public locations available to all projects. * **Project-specific
5588    ///   locations**: If `name` follows the format
5589    ///   `projects/{project}`, the method lists locations visible to that
5590    ///   specific project. This includes public, private, or other
5591    ///   project-specific locations enabled for the project.
5592    ///
5593    /// For gRPC and client library implementations, the resource name is
5594    /// passed as the `name` field. For direct service calls, the resource
5595    /// name is
5596    /// incorporated into the request path based on the specific service
5597    /// implementation and version.
5598    ///
5599    /// # Example
5600    /// ```
5601    /// # use google_cloud_dialogflow_v2::client::Generators;
5602    /// use google_cloud_gax::paginator::ItemPaginator as _;
5603    /// use google_cloud_dialogflow_v2::Result;
5604    /// async fn sample(
5605    ///    client: &Generators
5606    /// ) -> Result<()> {
5607    ///     let mut list = client.list_locations()
5608    ///         /* set fields */
5609    ///         .by_item();
5610    ///     while let Some(item) = list.next().await.transpose()? {
5611    ///         println!("{:?}", item);
5612    ///     }
5613    ///     Ok(())
5614    /// }
5615    /// ```
5616    pub fn list_locations(&self) -> super::builder::generators::ListLocations {
5617        super::builder::generators::ListLocations::new(self.inner.clone())
5618    }
5619
5620    /// Gets information about a location.
5621    ///
5622    /// # Example
5623    /// ```
5624    /// # use google_cloud_dialogflow_v2::client::Generators;
5625    /// use google_cloud_dialogflow_v2::Result;
5626    /// async fn sample(
5627    ///    client: &Generators
5628    /// ) -> Result<()> {
5629    ///     let response = client.get_location()
5630    ///         /* set fields */
5631    ///         .send().await?;
5632    ///     println!("response {:?}", response);
5633    ///     Ok(())
5634    /// }
5635    /// ```
5636    pub fn get_location(&self) -> super::builder::generators::GetLocation {
5637        super::builder::generators::GetLocation::new(self.inner.clone())
5638    }
5639
5640    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
5641    ///
5642    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
5643    ///
5644    /// # Example
5645    /// ```
5646    /// # use google_cloud_dialogflow_v2::client::Generators;
5647    /// use google_cloud_gax::paginator::ItemPaginator as _;
5648    /// use google_cloud_dialogflow_v2::Result;
5649    /// async fn sample(
5650    ///    client: &Generators
5651    /// ) -> Result<()> {
5652    ///     let mut list = client.list_operations()
5653    ///         /* set fields */
5654    ///         .by_item();
5655    ///     while let Some(item) = list.next().await.transpose()? {
5656    ///         println!("{:?}", item);
5657    ///     }
5658    ///     Ok(())
5659    /// }
5660    /// ```
5661    pub fn list_operations(&self) -> super::builder::generators::ListOperations {
5662        super::builder::generators::ListOperations::new(self.inner.clone())
5663    }
5664
5665    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
5666    ///
5667    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
5668    ///
5669    /// # Example
5670    /// ```
5671    /// # use google_cloud_dialogflow_v2::client::Generators;
5672    /// use google_cloud_dialogflow_v2::Result;
5673    /// async fn sample(
5674    ///    client: &Generators
5675    /// ) -> Result<()> {
5676    ///     let response = client.get_operation()
5677    ///         /* set fields */
5678    ///         .send().await?;
5679    ///     println!("response {:?}", response);
5680    ///     Ok(())
5681    /// }
5682    /// ```
5683    pub fn get_operation(&self) -> super::builder::generators::GetOperation {
5684        super::builder::generators::GetOperation::new(self.inner.clone())
5685    }
5686
5687    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
5688    ///
5689    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
5690    ///
5691    /// # Example
5692    /// ```
5693    /// # use google_cloud_dialogflow_v2::client::Generators;
5694    /// use google_cloud_dialogflow_v2::Result;
5695    /// async fn sample(
5696    ///    client: &Generators
5697    /// ) -> Result<()> {
5698    ///     client.cancel_operation()
5699    ///         /* set fields */
5700    ///         .send().await?;
5701    ///     Ok(())
5702    /// }
5703    /// ```
5704    pub fn cancel_operation(&self) -> super::builder::generators::CancelOperation {
5705        super::builder::generators::CancelOperation::new(self.inner.clone())
5706    }
5707}
5708
5709/// Implements a client for the Dialogflow API.
5710///
5711/// # Example
5712/// ```
5713/// # use google_cloud_dialogflow_v2::client::GeneratorEvaluations;
5714/// use google_cloud_gax::paginator::ItemPaginator as _;
5715/// # async fn sample() -> Result<(), Box<dyn std::error::Error>> {
5716///     let client = GeneratorEvaluations::builder().build().await?;
5717///     let parent = "parent_value";
5718///     let mut list = client.list_generator_evaluations()
5719///         .set_parent(parent)
5720///         .by_item();
5721///     while let Some(item) = list.next().await.transpose()? {
5722///         println!("{:?}", item);
5723///     }
5724/// # Ok(()) }
5725/// ```
5726///
5727/// # Service Description
5728///
5729/// Service for managing generator evaluations.
5730///
5731/// # Configuration
5732///
5733/// To configure `GeneratorEvaluations` use the `with_*` methods in the type returned
5734/// by [builder()][GeneratorEvaluations::builder]. The default configuration should
5735/// work for most applications. Common configuration changes include
5736///
5737/// * [with_endpoint()]: by default this client uses the global default endpoint
5738///   (`https://dialogflow.googleapis.com`). Applications using regional
5739///   endpoints or running in restricted networks (e.g. a network configured
5740//    with [Private Google Access with VPC Service Controls]) may want to
5741///   override this default.
5742/// * [with_credentials()]: by default this client uses
5743///   [Application Default Credentials]. Applications using custom
5744///   authentication may need to override this default.
5745///
5746/// [with_endpoint()]: super::builder::generator_evaluations::ClientBuilder::with_endpoint
5747/// [with_credentials()]: super::builder::generator_evaluations::ClientBuilder::with_credentials
5748/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
5749/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
5750///
5751/// # Pooling and Cloning
5752///
5753/// `GeneratorEvaluations` holds a connection pool internally, it is advised to
5754/// create one and reuse it. You do not need to wrap `GeneratorEvaluations` in
5755/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
5756/// already uses an `Arc` internally.
5757#[cfg(feature = "generator-evaluations")]
5758#[cfg_attr(docsrs, doc(cfg(feature = "generator-evaluations")))]
5759#[derive(Clone, Debug)]
5760pub struct GeneratorEvaluations {
5761    inner: std::sync::Arc<dyn super::stub::dynamic::GeneratorEvaluations>,
5762}
5763
5764#[cfg(feature = "generator-evaluations")]
5765impl GeneratorEvaluations {
5766    /// Returns a builder for [GeneratorEvaluations].
5767    ///
5768    /// ```
5769    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
5770    /// # use google_cloud_dialogflow_v2::client::GeneratorEvaluations;
5771    /// let client = GeneratorEvaluations::builder().build().await?;
5772    /// # Ok(()) }
5773    /// ```
5774    pub fn builder() -> super::builder::generator_evaluations::ClientBuilder {
5775        crate::new_client_builder(super::builder::generator_evaluations::client::Factory)
5776    }
5777
5778    /// Creates a new client from the provided stub.
5779    ///
5780    /// The most common case for calling this function is in tests mocking the
5781    /// client's behavior.
5782    pub fn from_stub<T>(stub: T) -> Self
5783    where
5784        T: super::stub::GeneratorEvaluations + 'static,
5785    {
5786        Self {
5787            inner: std::sync::Arc::new(stub),
5788        }
5789    }
5790
5791    pub(crate) async fn new(
5792        config: gaxi::options::ClientConfig,
5793    ) -> crate::ClientBuilderResult<Self> {
5794        let inner = Self::build_inner(config).await?;
5795        Ok(Self { inner })
5796    }
5797
5798    async fn build_inner(
5799        conf: gaxi::options::ClientConfig,
5800    ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::GeneratorEvaluations>>
5801    {
5802        if gaxi::options::tracing_enabled(&conf) {
5803            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
5804        }
5805        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
5806    }
5807
5808    async fn build_transport(
5809        conf: gaxi::options::ClientConfig,
5810    ) -> crate::ClientBuilderResult<impl super::stub::GeneratorEvaluations> {
5811        super::transport::GeneratorEvaluations::new(conf).await
5812    }
5813
5814    async fn build_with_tracing(
5815        conf: gaxi::options::ClientConfig,
5816    ) -> crate::ClientBuilderResult<impl super::stub::GeneratorEvaluations> {
5817        Self::build_transport(conf)
5818            .await
5819            .map(super::tracing::GeneratorEvaluations::new)
5820    }
5821
5822    /// Creates evaluation of a generator.
5823    ///
5824    /// # Long running operations
5825    ///
5826    /// This method is used to start, and/or poll a [long-running Operation].
5827    /// The [Working with long-running operations] chapter in the [user guide]
5828    /// covers these operations in detail.
5829    ///
5830    /// [long-running operation]: https://google.aip.dev/151
5831    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
5832    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
5833    ///
5834    /// # Example
5835    /// ```
5836    /// # use google_cloud_dialogflow_v2::client::GeneratorEvaluations;
5837    /// use google_cloud_lro::Poller;
5838    /// use google_cloud_dialogflow_v2::model::GeneratorEvaluation;
5839    /// use google_cloud_dialogflow_v2::Result;
5840    /// async fn sample(
5841    ///    client: &GeneratorEvaluations, parent: &str
5842    /// ) -> Result<()> {
5843    ///     let response = client.create_generator_evaluation()
5844    ///         .set_parent(parent)
5845    ///         .set_generator_evaluation(
5846    ///             GeneratorEvaluation::new()/* set fields */
5847    ///         )
5848    ///         .poller().until_done().await?;
5849    ///     println!("response {:?}", response);
5850    ///     Ok(())
5851    /// }
5852    /// ```
5853    pub fn create_generator_evaluation(
5854        &self,
5855    ) -> super::builder::generator_evaluations::CreateGeneratorEvaluation {
5856        super::builder::generator_evaluations::CreateGeneratorEvaluation::new(self.inner.clone())
5857    }
5858
5859    /// Gets an evaluation of generator.
5860    ///
5861    /// # Example
5862    /// ```
5863    /// # use google_cloud_dialogflow_v2::client::GeneratorEvaluations;
5864    /// use google_cloud_dialogflow_v2::Result;
5865    /// async fn sample(
5866    ///    client: &GeneratorEvaluations, name: &str
5867    /// ) -> Result<()> {
5868    ///     let response = client.get_generator_evaluation()
5869    ///         .set_name(name)
5870    ///         .send().await?;
5871    ///     println!("response {:?}", response);
5872    ///     Ok(())
5873    /// }
5874    /// ```
5875    pub fn get_generator_evaluation(
5876        &self,
5877    ) -> super::builder::generator_evaluations::GetGeneratorEvaluation {
5878        super::builder::generator_evaluations::GetGeneratorEvaluation::new(self.inner.clone())
5879    }
5880
5881    /// Lists evaluations of generator.
5882    ///
5883    /// # Example
5884    /// ```
5885    /// # use google_cloud_dialogflow_v2::client::GeneratorEvaluations;
5886    /// use google_cloud_gax::paginator::ItemPaginator as _;
5887    /// use google_cloud_dialogflow_v2::Result;
5888    /// async fn sample(
5889    ///    client: &GeneratorEvaluations, parent: &str
5890    /// ) -> Result<()> {
5891    ///     let mut list = client.list_generator_evaluations()
5892    ///         .set_parent(parent)
5893    ///         .by_item();
5894    ///     while let Some(item) = list.next().await.transpose()? {
5895    ///         println!("{:?}", item);
5896    ///     }
5897    ///     Ok(())
5898    /// }
5899    /// ```
5900    pub fn list_generator_evaluations(
5901        &self,
5902    ) -> super::builder::generator_evaluations::ListGeneratorEvaluations {
5903        super::builder::generator_evaluations::ListGeneratorEvaluations::new(self.inner.clone())
5904    }
5905
5906    /// Deletes an evaluation of generator.
5907    ///
5908    /// # Example
5909    /// ```
5910    /// # use google_cloud_dialogflow_v2::client::GeneratorEvaluations;
5911    /// use google_cloud_dialogflow_v2::Result;
5912    /// async fn sample(
5913    ///    client: &GeneratorEvaluations, name: &str
5914    /// ) -> Result<()> {
5915    ///     client.delete_generator_evaluation()
5916    ///         .set_name(name)
5917    ///         .send().await?;
5918    ///     Ok(())
5919    /// }
5920    /// ```
5921    pub fn delete_generator_evaluation(
5922        &self,
5923    ) -> super::builder::generator_evaluations::DeleteGeneratorEvaluation {
5924        super::builder::generator_evaluations::DeleteGeneratorEvaluation::new(self.inner.clone())
5925    }
5926
5927    /// Lists information about the supported locations for this service.
5928    ///
5929    /// This method lists locations based on the resource scope provided in
5930    /// the [ListLocationsRequest.name] field:
5931    ///
5932    /// * **Global locations**: If `name` is empty, the method lists the
5933    ///   public locations available to all projects. * **Project-specific
5934    ///   locations**: If `name` follows the format
5935    ///   `projects/{project}`, the method lists locations visible to that
5936    ///   specific project. This includes public, private, or other
5937    ///   project-specific locations enabled for the project.
5938    ///
5939    /// For gRPC and client library implementations, the resource name is
5940    /// passed as the `name` field. For direct service calls, the resource
5941    /// name is
5942    /// incorporated into the request path based on the specific service
5943    /// implementation and version.
5944    ///
5945    /// # Example
5946    /// ```
5947    /// # use google_cloud_dialogflow_v2::client::GeneratorEvaluations;
5948    /// use google_cloud_gax::paginator::ItemPaginator as _;
5949    /// use google_cloud_dialogflow_v2::Result;
5950    /// async fn sample(
5951    ///    client: &GeneratorEvaluations
5952    /// ) -> Result<()> {
5953    ///     let mut list = client.list_locations()
5954    ///         /* set fields */
5955    ///         .by_item();
5956    ///     while let Some(item) = list.next().await.transpose()? {
5957    ///         println!("{:?}", item);
5958    ///     }
5959    ///     Ok(())
5960    /// }
5961    /// ```
5962    pub fn list_locations(&self) -> super::builder::generator_evaluations::ListLocations {
5963        super::builder::generator_evaluations::ListLocations::new(self.inner.clone())
5964    }
5965
5966    /// Gets information about a location.
5967    ///
5968    /// # Example
5969    /// ```
5970    /// # use google_cloud_dialogflow_v2::client::GeneratorEvaluations;
5971    /// use google_cloud_dialogflow_v2::Result;
5972    /// async fn sample(
5973    ///    client: &GeneratorEvaluations
5974    /// ) -> Result<()> {
5975    ///     let response = client.get_location()
5976    ///         /* set fields */
5977    ///         .send().await?;
5978    ///     println!("response {:?}", response);
5979    ///     Ok(())
5980    /// }
5981    /// ```
5982    pub fn get_location(&self) -> super::builder::generator_evaluations::GetLocation {
5983        super::builder::generator_evaluations::GetLocation::new(self.inner.clone())
5984    }
5985
5986    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
5987    ///
5988    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
5989    ///
5990    /// # Example
5991    /// ```
5992    /// # use google_cloud_dialogflow_v2::client::GeneratorEvaluations;
5993    /// use google_cloud_gax::paginator::ItemPaginator as _;
5994    /// use google_cloud_dialogflow_v2::Result;
5995    /// async fn sample(
5996    ///    client: &GeneratorEvaluations
5997    /// ) -> Result<()> {
5998    ///     let mut list = client.list_operations()
5999    ///         /* set fields */
6000    ///         .by_item();
6001    ///     while let Some(item) = list.next().await.transpose()? {
6002    ///         println!("{:?}", item);
6003    ///     }
6004    ///     Ok(())
6005    /// }
6006    /// ```
6007    pub fn list_operations(&self) -> super::builder::generator_evaluations::ListOperations {
6008        super::builder::generator_evaluations::ListOperations::new(self.inner.clone())
6009    }
6010
6011    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
6012    ///
6013    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
6014    ///
6015    /// # Example
6016    /// ```
6017    /// # use google_cloud_dialogflow_v2::client::GeneratorEvaluations;
6018    /// use google_cloud_dialogflow_v2::Result;
6019    /// async fn sample(
6020    ///    client: &GeneratorEvaluations
6021    /// ) -> Result<()> {
6022    ///     let response = client.get_operation()
6023    ///         /* set fields */
6024    ///         .send().await?;
6025    ///     println!("response {:?}", response);
6026    ///     Ok(())
6027    /// }
6028    /// ```
6029    pub fn get_operation(&self) -> super::builder::generator_evaluations::GetOperation {
6030        super::builder::generator_evaluations::GetOperation::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    ///     client.cancel_operation()
6045    ///         /* set fields */
6046    ///         .send().await?;
6047    ///     Ok(())
6048    /// }
6049    /// ```
6050    pub fn cancel_operation(&self) -> super::builder::generator_evaluations::CancelOperation {
6051        super::builder::generator_evaluations::CancelOperation::new(self.inner.clone())
6052    }
6053}
6054
6055/// Implements a client for the Dialogflow API.
6056///
6057/// # Example
6058/// ```
6059/// # use google_cloud_dialogflow_v2::client::Intents;
6060/// use google_cloud_gax::paginator::ItemPaginator as _;
6061/// # async fn sample() -> Result<(), Box<dyn std::error::Error>> {
6062///     let client = Intents::builder().build().await?;
6063///     let parent = "parent_value";
6064///     let mut list = client.list_intents()
6065///         .set_parent(parent)
6066///         .by_item();
6067///     while let Some(item) = list.next().await.transpose()? {
6068///         println!("{:?}", item);
6069///     }
6070/// # Ok(()) }
6071/// ```
6072///
6073/// # Service Description
6074///
6075/// Service for managing [Intents][google.cloud.dialogflow.v2.Intent].
6076///
6077/// [google.cloud.dialogflow.v2.Intent]: crate::model::Intent
6078///
6079/// # Configuration
6080///
6081/// To configure `Intents` use the `with_*` methods in the type returned
6082/// by [builder()][Intents::builder]. The default configuration should
6083/// work for most applications. Common configuration changes include
6084///
6085/// * [with_endpoint()]: by default this client uses the global default endpoint
6086///   (`https://dialogflow.googleapis.com`). Applications using regional
6087///   endpoints or running in restricted networks (e.g. a network configured
6088//    with [Private Google Access with VPC Service Controls]) may want to
6089///   override this default.
6090/// * [with_credentials()]: by default this client uses
6091///   [Application Default Credentials]. Applications using custom
6092///   authentication may need to override this default.
6093///
6094/// [with_endpoint()]: super::builder::intents::ClientBuilder::with_endpoint
6095/// [with_credentials()]: super::builder::intents::ClientBuilder::with_credentials
6096/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
6097/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
6098///
6099/// # Pooling and Cloning
6100///
6101/// `Intents` holds a connection pool internally, it is advised to
6102/// create one and reuse it. You do not need to wrap `Intents` in
6103/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
6104/// already uses an `Arc` internally.
6105#[cfg(feature = "intents")]
6106#[cfg_attr(docsrs, doc(cfg(feature = "intents")))]
6107#[derive(Clone, Debug)]
6108pub struct Intents {
6109    inner: std::sync::Arc<dyn super::stub::dynamic::Intents>,
6110}
6111
6112#[cfg(feature = "intents")]
6113impl Intents {
6114    /// Returns a builder for [Intents].
6115    ///
6116    /// ```
6117    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
6118    /// # use google_cloud_dialogflow_v2::client::Intents;
6119    /// let client = Intents::builder().build().await?;
6120    /// # Ok(()) }
6121    /// ```
6122    pub fn builder() -> super::builder::intents::ClientBuilder {
6123        crate::new_client_builder(super::builder::intents::client::Factory)
6124    }
6125
6126    /// Creates a new client from the provided stub.
6127    ///
6128    /// The most common case for calling this function is in tests mocking the
6129    /// client's behavior.
6130    pub fn from_stub<T>(stub: T) -> Self
6131    where
6132        T: super::stub::Intents + 'static,
6133    {
6134        Self {
6135            inner: std::sync::Arc::new(stub),
6136        }
6137    }
6138
6139    pub(crate) async fn new(
6140        config: gaxi::options::ClientConfig,
6141    ) -> crate::ClientBuilderResult<Self> {
6142        let inner = Self::build_inner(config).await?;
6143        Ok(Self { inner })
6144    }
6145
6146    async fn build_inner(
6147        conf: gaxi::options::ClientConfig,
6148    ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::Intents>> {
6149        if gaxi::options::tracing_enabled(&conf) {
6150            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
6151        }
6152        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
6153    }
6154
6155    async fn build_transport(
6156        conf: gaxi::options::ClientConfig,
6157    ) -> crate::ClientBuilderResult<impl super::stub::Intents> {
6158        super::transport::Intents::new(conf).await
6159    }
6160
6161    async fn build_with_tracing(
6162        conf: gaxi::options::ClientConfig,
6163    ) -> crate::ClientBuilderResult<impl super::stub::Intents> {
6164        Self::build_transport(conf)
6165            .await
6166            .map(super::tracing::Intents::new)
6167    }
6168
6169    /// Returns the list of all intents in the specified agent.
6170    ///
6171    /// # Example
6172    /// ```
6173    /// # use google_cloud_dialogflow_v2::client::Intents;
6174    /// use google_cloud_gax::paginator::ItemPaginator as _;
6175    /// use google_cloud_dialogflow_v2::Result;
6176    /// async fn sample(
6177    ///    client: &Intents, parent: &str
6178    /// ) -> Result<()> {
6179    ///     let mut list = client.list_intents()
6180    ///         .set_parent(parent)
6181    ///         .by_item();
6182    ///     while let Some(item) = list.next().await.transpose()? {
6183    ///         println!("{:?}", item);
6184    ///     }
6185    ///     Ok(())
6186    /// }
6187    /// ```
6188    pub fn list_intents(&self) -> super::builder::intents::ListIntents {
6189        super::builder::intents::ListIntents::new(self.inner.clone())
6190    }
6191
6192    /// Retrieves the specified intent.
6193    ///
6194    /// # Example
6195    /// ```
6196    /// # use google_cloud_dialogflow_v2::client::Intents;
6197    /// use google_cloud_dialogflow_v2::Result;
6198    /// async fn sample(
6199    ///    client: &Intents, name: &str
6200    /// ) -> Result<()> {
6201    ///     let response = client.get_intent()
6202    ///         .set_name(name)
6203    ///         .send().await?;
6204    ///     println!("response {:?}", response);
6205    ///     Ok(())
6206    /// }
6207    /// ```
6208    pub fn get_intent(&self) -> super::builder::intents::GetIntent {
6209        super::builder::intents::GetIntent::new(self.inner.clone())
6210    }
6211
6212    /// Creates an intent in the specified agent.
6213    ///
6214    /// Note: You should always train an agent prior to sending it queries. See the
6215    /// [training
6216    /// documentation](https://cloud.google.com/dialogflow/es/docs/training).
6217    ///
6218    /// # Example
6219    /// ```
6220    /// # use google_cloud_dialogflow_v2::client::Intents;
6221    /// use google_cloud_dialogflow_v2::model::Intent;
6222    /// use google_cloud_dialogflow_v2::Result;
6223    /// async fn sample(
6224    ///    client: &Intents, parent: &str
6225    /// ) -> Result<()> {
6226    ///     let response = client.create_intent()
6227    ///         .set_parent(parent)
6228    ///         .set_intent(
6229    ///             Intent::new()/* set fields */
6230    ///         )
6231    ///         .send().await?;
6232    ///     println!("response {:?}", response);
6233    ///     Ok(())
6234    /// }
6235    /// ```
6236    pub fn create_intent(&self) -> super::builder::intents::CreateIntent {
6237        super::builder::intents::CreateIntent::new(self.inner.clone())
6238    }
6239
6240    /// Updates the specified intent.
6241    ///
6242    /// Note: You should always train an agent prior to sending it queries. See the
6243    /// [training
6244    /// documentation](https://cloud.google.com/dialogflow/es/docs/training).
6245    ///
6246    /// # Example
6247    /// ```
6248    /// # use google_cloud_dialogflow_v2::client::Intents;
6249    /// # extern crate wkt as google_cloud_wkt;
6250    /// use google_cloud_wkt::FieldMask;
6251    /// use google_cloud_dialogflow_v2::model::Intent;
6252    /// use google_cloud_dialogflow_v2::Result;
6253    /// async fn sample(
6254    ///    client: &Intents, name: &str
6255    /// ) -> Result<()> {
6256    ///     let response = client.update_intent()
6257    ///         .set_intent(
6258    ///             Intent::new().set_name(name)/* set fields */
6259    ///         )
6260    ///         .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
6261    ///         .send().await?;
6262    ///     println!("response {:?}", response);
6263    ///     Ok(())
6264    /// }
6265    /// ```
6266    pub fn update_intent(&self) -> super::builder::intents::UpdateIntent {
6267        super::builder::intents::UpdateIntent::new(self.inner.clone())
6268    }
6269
6270    /// Deletes the specified intent and its direct or indirect followup intents.
6271    ///
6272    /// Note: You should always train an agent prior to sending it queries. See the
6273    /// [training
6274    /// documentation](https://cloud.google.com/dialogflow/es/docs/training).
6275    ///
6276    /// # Example
6277    /// ```
6278    /// # use google_cloud_dialogflow_v2::client::Intents;
6279    /// use google_cloud_dialogflow_v2::Result;
6280    /// async fn sample(
6281    ///    client: &Intents, name: &str
6282    /// ) -> Result<()> {
6283    ///     client.delete_intent()
6284    ///         .set_name(name)
6285    ///         .send().await?;
6286    ///     Ok(())
6287    /// }
6288    /// ```
6289    pub fn delete_intent(&self) -> super::builder::intents::DeleteIntent {
6290        super::builder::intents::DeleteIntent::new(self.inner.clone())
6291    }
6292
6293    /// Updates/Creates multiple intents in the specified agent.
6294    ///
6295    /// This method is a [long-running
6296    /// operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations).
6297    /// The returned `Operation` type has the following method-specific fields:
6298    ///
6299    /// - `metadata`: An empty [Struct
6300    ///   message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct)
6301    /// - `response`:
6302    ///   [BatchUpdateIntentsResponse][google.cloud.dialogflow.v2.BatchUpdateIntentsResponse]
6303    ///
6304    /// Note: You should always train an agent prior to sending it queries. See the
6305    /// [training
6306    /// documentation](https://cloud.google.com/dialogflow/es/docs/training).
6307    ///
6308    /// [google.cloud.dialogflow.v2.BatchUpdateIntentsResponse]: crate::model::BatchUpdateIntentsResponse
6309    ///
6310    /// # Long running operations
6311    ///
6312    /// This method is used to start, and/or poll a [long-running Operation].
6313    /// The [Working with long-running operations] chapter in the [user guide]
6314    /// covers these operations in detail.
6315    ///
6316    /// [long-running operation]: https://google.aip.dev/151
6317    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
6318    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
6319    ///
6320    /// # Example
6321    /// ```
6322    /// # use google_cloud_dialogflow_v2::client::Intents;
6323    /// use google_cloud_lro::Poller;
6324    /// use google_cloud_dialogflow_v2::Result;
6325    /// async fn sample(
6326    ///    client: &Intents
6327    /// ) -> Result<()> {
6328    ///     let response = client.batch_update_intents()
6329    ///         /* set fields */
6330    ///         .poller().until_done().await?;
6331    ///     println!("response {:?}", response);
6332    ///     Ok(())
6333    /// }
6334    /// ```
6335    pub fn batch_update_intents(&self) -> super::builder::intents::BatchUpdateIntents {
6336        super::builder::intents::BatchUpdateIntents::new(self.inner.clone())
6337    }
6338
6339    /// Deletes intents in the specified agent.
6340    ///
6341    /// This method is a [long-running
6342    /// operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations).
6343    /// The returned `Operation` type has the following method-specific fields:
6344    ///
6345    /// - `metadata`: An empty [Struct
6346    ///   message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct)
6347    /// - `response`: An [Empty
6348    ///   message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
6349    ///
6350    /// Note: You should always train an agent prior to sending it queries. See the
6351    /// [training
6352    /// documentation](https://cloud.google.com/dialogflow/es/docs/training).
6353    ///
6354    /// # Long running operations
6355    ///
6356    /// This method is used to start, and/or poll a [long-running Operation].
6357    /// The [Working with long-running operations] chapter in the [user guide]
6358    /// covers these operations in detail.
6359    ///
6360    /// [long-running operation]: https://google.aip.dev/151
6361    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
6362    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
6363    ///
6364    /// # Example
6365    /// ```
6366    /// # use google_cloud_dialogflow_v2::client::Intents;
6367    /// use google_cloud_lro::Poller;
6368    /// use google_cloud_dialogflow_v2::Result;
6369    /// async fn sample(
6370    ///    client: &Intents
6371    /// ) -> Result<()> {
6372    ///     client.batch_delete_intents()
6373    ///         /* set fields */
6374    ///         .poller().until_done().await?;
6375    ///     Ok(())
6376    /// }
6377    /// ```
6378    pub fn batch_delete_intents(&self) -> super::builder::intents::BatchDeleteIntents {
6379        super::builder::intents::BatchDeleteIntents::new(self.inner.clone())
6380    }
6381
6382    /// Lists information about the supported locations for this service.
6383    ///
6384    /// This method lists locations based on the resource scope provided in
6385    /// the [ListLocationsRequest.name] field:
6386    ///
6387    /// * **Global locations**: If `name` is empty, the method lists the
6388    ///   public locations available to all projects. * **Project-specific
6389    ///   locations**: If `name` follows the format
6390    ///   `projects/{project}`, the method lists locations visible to that
6391    ///   specific project. This includes public, private, or other
6392    ///   project-specific locations enabled for the project.
6393    ///
6394    /// For gRPC and client library implementations, the resource name is
6395    /// passed as the `name` field. For direct service calls, the resource
6396    /// name is
6397    /// incorporated into the request path based on the specific service
6398    /// implementation and version.
6399    ///
6400    /// # Example
6401    /// ```
6402    /// # use google_cloud_dialogflow_v2::client::Intents;
6403    /// use google_cloud_gax::paginator::ItemPaginator as _;
6404    /// use google_cloud_dialogflow_v2::Result;
6405    /// async fn sample(
6406    ///    client: &Intents
6407    /// ) -> Result<()> {
6408    ///     let mut list = client.list_locations()
6409    ///         /* set fields */
6410    ///         .by_item();
6411    ///     while let Some(item) = list.next().await.transpose()? {
6412    ///         println!("{:?}", item);
6413    ///     }
6414    ///     Ok(())
6415    /// }
6416    /// ```
6417    pub fn list_locations(&self) -> super::builder::intents::ListLocations {
6418        super::builder::intents::ListLocations::new(self.inner.clone())
6419    }
6420
6421    /// Gets information about a location.
6422    ///
6423    /// # Example
6424    /// ```
6425    /// # use google_cloud_dialogflow_v2::client::Intents;
6426    /// use google_cloud_dialogflow_v2::Result;
6427    /// async fn sample(
6428    ///    client: &Intents
6429    /// ) -> Result<()> {
6430    ///     let response = client.get_location()
6431    ///         /* set fields */
6432    ///         .send().await?;
6433    ///     println!("response {:?}", response);
6434    ///     Ok(())
6435    /// }
6436    /// ```
6437    pub fn get_location(&self) -> super::builder::intents::GetLocation {
6438        super::builder::intents::GetLocation::new(self.inner.clone())
6439    }
6440
6441    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
6442    ///
6443    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
6444    ///
6445    /// # Example
6446    /// ```
6447    /// # use google_cloud_dialogflow_v2::client::Intents;
6448    /// use google_cloud_gax::paginator::ItemPaginator as _;
6449    /// use google_cloud_dialogflow_v2::Result;
6450    /// async fn sample(
6451    ///    client: &Intents
6452    /// ) -> Result<()> {
6453    ///     let mut list = client.list_operations()
6454    ///         /* set fields */
6455    ///         .by_item();
6456    ///     while let Some(item) = list.next().await.transpose()? {
6457    ///         println!("{:?}", item);
6458    ///     }
6459    ///     Ok(())
6460    /// }
6461    /// ```
6462    pub fn list_operations(&self) -> super::builder::intents::ListOperations {
6463        super::builder::intents::ListOperations::new(self.inner.clone())
6464    }
6465
6466    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
6467    ///
6468    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
6469    ///
6470    /// # Example
6471    /// ```
6472    /// # use google_cloud_dialogflow_v2::client::Intents;
6473    /// use google_cloud_dialogflow_v2::Result;
6474    /// async fn sample(
6475    ///    client: &Intents
6476    /// ) -> Result<()> {
6477    ///     let response = client.get_operation()
6478    ///         /* set fields */
6479    ///         .send().await?;
6480    ///     println!("response {:?}", response);
6481    ///     Ok(())
6482    /// }
6483    /// ```
6484    pub fn get_operation(&self) -> super::builder::intents::GetOperation {
6485        super::builder::intents::GetOperation::new(self.inner.clone())
6486    }
6487
6488    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
6489    ///
6490    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
6491    ///
6492    /// # Example
6493    /// ```
6494    /// # use google_cloud_dialogflow_v2::client::Intents;
6495    /// use google_cloud_dialogflow_v2::Result;
6496    /// async fn sample(
6497    ///    client: &Intents
6498    /// ) -> Result<()> {
6499    ///     client.cancel_operation()
6500    ///         /* set fields */
6501    ///         .send().await?;
6502    ///     Ok(())
6503    /// }
6504    /// ```
6505    pub fn cancel_operation(&self) -> super::builder::intents::CancelOperation {
6506        super::builder::intents::CancelOperation::new(self.inner.clone())
6507    }
6508}
6509
6510/// Implements a client for the Dialogflow API.
6511///
6512/// # Example
6513/// ```
6514/// # use google_cloud_dialogflow_v2::client::KnowledgeBases;
6515/// use google_cloud_gax::paginator::ItemPaginator as _;
6516/// # async fn sample() -> Result<(), Box<dyn std::error::Error>> {
6517///     let client = KnowledgeBases::builder().build().await?;
6518///     let parent = "parent_value";
6519///     let mut list = client.list_knowledge_bases()
6520///         .set_parent(parent)
6521///         .by_item();
6522///     while let Some(item) = list.next().await.transpose()? {
6523///         println!("{:?}", item);
6524///     }
6525/// # Ok(()) }
6526/// ```
6527///
6528/// # Service Description
6529///
6530/// Service for managing
6531/// [KnowledgeBases][google.cloud.dialogflow.v2.KnowledgeBase].
6532///
6533/// [google.cloud.dialogflow.v2.KnowledgeBase]: crate::model::KnowledgeBase
6534///
6535/// # Configuration
6536///
6537/// To configure `KnowledgeBases` use the `with_*` methods in the type returned
6538/// by [builder()][KnowledgeBases::builder]. The default configuration should
6539/// work for most applications. Common configuration changes include
6540///
6541/// * [with_endpoint()]: by default this client uses the global default endpoint
6542///   (`https://dialogflow.googleapis.com`). Applications using regional
6543///   endpoints or running in restricted networks (e.g. a network configured
6544//    with [Private Google Access with VPC Service Controls]) may want to
6545///   override this default.
6546/// * [with_credentials()]: by default this client uses
6547///   [Application Default Credentials]. Applications using custom
6548///   authentication may need to override this default.
6549///
6550/// [with_endpoint()]: super::builder::knowledge_bases::ClientBuilder::with_endpoint
6551/// [with_credentials()]: super::builder::knowledge_bases::ClientBuilder::with_credentials
6552/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
6553/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
6554///
6555/// # Pooling and Cloning
6556///
6557/// `KnowledgeBases` holds a connection pool internally, it is advised to
6558/// create one and reuse it. You do not need to wrap `KnowledgeBases` in
6559/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
6560/// already uses an `Arc` internally.
6561#[cfg(feature = "knowledge-bases")]
6562#[cfg_attr(docsrs, doc(cfg(feature = "knowledge-bases")))]
6563#[derive(Clone, Debug)]
6564pub struct KnowledgeBases {
6565    inner: std::sync::Arc<dyn super::stub::dynamic::KnowledgeBases>,
6566}
6567
6568#[cfg(feature = "knowledge-bases")]
6569impl KnowledgeBases {
6570    /// Returns a builder for [KnowledgeBases].
6571    ///
6572    /// ```
6573    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
6574    /// # use google_cloud_dialogflow_v2::client::KnowledgeBases;
6575    /// let client = KnowledgeBases::builder().build().await?;
6576    /// # Ok(()) }
6577    /// ```
6578    pub fn builder() -> super::builder::knowledge_bases::ClientBuilder {
6579        crate::new_client_builder(super::builder::knowledge_bases::client::Factory)
6580    }
6581
6582    /// Creates a new client from the provided stub.
6583    ///
6584    /// The most common case for calling this function is in tests mocking the
6585    /// client's behavior.
6586    pub fn from_stub<T>(stub: T) -> Self
6587    where
6588        T: super::stub::KnowledgeBases + 'static,
6589    {
6590        Self {
6591            inner: std::sync::Arc::new(stub),
6592        }
6593    }
6594
6595    pub(crate) async fn new(
6596        config: gaxi::options::ClientConfig,
6597    ) -> crate::ClientBuilderResult<Self> {
6598        let inner = Self::build_inner(config).await?;
6599        Ok(Self { inner })
6600    }
6601
6602    async fn build_inner(
6603        conf: gaxi::options::ClientConfig,
6604    ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::KnowledgeBases>> {
6605        if gaxi::options::tracing_enabled(&conf) {
6606            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
6607        }
6608        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
6609    }
6610
6611    async fn build_transport(
6612        conf: gaxi::options::ClientConfig,
6613    ) -> crate::ClientBuilderResult<impl super::stub::KnowledgeBases> {
6614        super::transport::KnowledgeBases::new(conf).await
6615    }
6616
6617    async fn build_with_tracing(
6618        conf: gaxi::options::ClientConfig,
6619    ) -> crate::ClientBuilderResult<impl super::stub::KnowledgeBases> {
6620        Self::build_transport(conf)
6621            .await
6622            .map(super::tracing::KnowledgeBases::new)
6623    }
6624
6625    /// Returns the list of all knowledge bases of the specified agent.
6626    ///
6627    /// # Example
6628    /// ```
6629    /// # use google_cloud_dialogflow_v2::client::KnowledgeBases;
6630    /// use google_cloud_gax::paginator::ItemPaginator as _;
6631    /// use google_cloud_dialogflow_v2::Result;
6632    /// async fn sample(
6633    ///    client: &KnowledgeBases, parent: &str
6634    /// ) -> Result<()> {
6635    ///     let mut list = client.list_knowledge_bases()
6636    ///         .set_parent(parent)
6637    ///         .by_item();
6638    ///     while let Some(item) = list.next().await.transpose()? {
6639    ///         println!("{:?}", item);
6640    ///     }
6641    ///     Ok(())
6642    /// }
6643    /// ```
6644    pub fn list_knowledge_bases(&self) -> super::builder::knowledge_bases::ListKnowledgeBases {
6645        super::builder::knowledge_bases::ListKnowledgeBases::new(self.inner.clone())
6646    }
6647
6648    /// Retrieves the specified knowledge base.
6649    ///
6650    /// # Example
6651    /// ```
6652    /// # use google_cloud_dialogflow_v2::client::KnowledgeBases;
6653    /// use google_cloud_dialogflow_v2::Result;
6654    /// async fn sample(
6655    ///    client: &KnowledgeBases, name: &str
6656    /// ) -> Result<()> {
6657    ///     let response = client.get_knowledge_base()
6658    ///         .set_name(name)
6659    ///         .send().await?;
6660    ///     println!("response {:?}", response);
6661    ///     Ok(())
6662    /// }
6663    /// ```
6664    pub fn get_knowledge_base(&self) -> super::builder::knowledge_bases::GetKnowledgeBase {
6665        super::builder::knowledge_bases::GetKnowledgeBase::new(self.inner.clone())
6666    }
6667
6668    /// Creates a knowledge base.
6669    ///
6670    /// # Example
6671    /// ```
6672    /// # use google_cloud_dialogflow_v2::client::KnowledgeBases;
6673    /// use google_cloud_dialogflow_v2::model::KnowledgeBase;
6674    /// use google_cloud_dialogflow_v2::Result;
6675    /// async fn sample(
6676    ///    client: &KnowledgeBases, parent: &str
6677    /// ) -> Result<()> {
6678    ///     let response = client.create_knowledge_base()
6679    ///         .set_parent(parent)
6680    ///         .set_knowledge_base(
6681    ///             KnowledgeBase::new()/* set fields */
6682    ///         )
6683    ///         .send().await?;
6684    ///     println!("response {:?}", response);
6685    ///     Ok(())
6686    /// }
6687    /// ```
6688    pub fn create_knowledge_base(&self) -> super::builder::knowledge_bases::CreateKnowledgeBase {
6689        super::builder::knowledge_bases::CreateKnowledgeBase::new(self.inner.clone())
6690    }
6691
6692    /// Deletes the specified knowledge base.
6693    ///
6694    /// # Example
6695    /// ```
6696    /// # use google_cloud_dialogflow_v2::client::KnowledgeBases;
6697    /// use google_cloud_dialogflow_v2::Result;
6698    /// async fn sample(
6699    ///    client: &KnowledgeBases, name: &str
6700    /// ) -> Result<()> {
6701    ///     client.delete_knowledge_base()
6702    ///         .set_name(name)
6703    ///         .send().await?;
6704    ///     Ok(())
6705    /// }
6706    /// ```
6707    pub fn delete_knowledge_base(&self) -> super::builder::knowledge_bases::DeleteKnowledgeBase {
6708        super::builder::knowledge_bases::DeleteKnowledgeBase::new(self.inner.clone())
6709    }
6710
6711    /// Updates the specified knowledge base.
6712    ///
6713    /// # Example
6714    /// ```
6715    /// # use google_cloud_dialogflow_v2::client::KnowledgeBases;
6716    /// # extern crate wkt as google_cloud_wkt;
6717    /// use google_cloud_wkt::FieldMask;
6718    /// use google_cloud_dialogflow_v2::model::KnowledgeBase;
6719    /// use google_cloud_dialogflow_v2::Result;
6720    /// async fn sample(
6721    ///    client: &KnowledgeBases, name: &str
6722    /// ) -> Result<()> {
6723    ///     let response = client.update_knowledge_base()
6724    ///         .set_knowledge_base(
6725    ///             KnowledgeBase::new().set_name(name)/* set fields */
6726    ///         )
6727    ///         .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
6728    ///         .send().await?;
6729    ///     println!("response {:?}", response);
6730    ///     Ok(())
6731    /// }
6732    /// ```
6733    pub fn update_knowledge_base(&self) -> super::builder::knowledge_bases::UpdateKnowledgeBase {
6734        super::builder::knowledge_bases::UpdateKnowledgeBase::new(self.inner.clone())
6735    }
6736
6737    /// Lists information about the supported locations for this service.
6738    ///
6739    /// This method lists locations based on the resource scope provided in
6740    /// the [ListLocationsRequest.name] field:
6741    ///
6742    /// * **Global locations**: If `name` is empty, the method lists the
6743    ///   public locations available to all projects. * **Project-specific
6744    ///   locations**: If `name` follows the format
6745    ///   `projects/{project}`, the method lists locations visible to that
6746    ///   specific project. This includes public, private, or other
6747    ///   project-specific locations enabled for the project.
6748    ///
6749    /// For gRPC and client library implementations, the resource name is
6750    /// passed as the `name` field. For direct service calls, the resource
6751    /// name is
6752    /// incorporated into the request path based on the specific service
6753    /// implementation and version.
6754    ///
6755    /// # Example
6756    /// ```
6757    /// # use google_cloud_dialogflow_v2::client::KnowledgeBases;
6758    /// use google_cloud_gax::paginator::ItemPaginator as _;
6759    /// use google_cloud_dialogflow_v2::Result;
6760    /// async fn sample(
6761    ///    client: &KnowledgeBases
6762    /// ) -> Result<()> {
6763    ///     let mut list = client.list_locations()
6764    ///         /* set fields */
6765    ///         .by_item();
6766    ///     while let Some(item) = list.next().await.transpose()? {
6767    ///         println!("{:?}", item);
6768    ///     }
6769    ///     Ok(())
6770    /// }
6771    /// ```
6772    pub fn list_locations(&self) -> super::builder::knowledge_bases::ListLocations {
6773        super::builder::knowledge_bases::ListLocations::new(self.inner.clone())
6774    }
6775
6776    /// Gets information about a location.
6777    ///
6778    /// # Example
6779    /// ```
6780    /// # use google_cloud_dialogflow_v2::client::KnowledgeBases;
6781    /// use google_cloud_dialogflow_v2::Result;
6782    /// async fn sample(
6783    ///    client: &KnowledgeBases
6784    /// ) -> Result<()> {
6785    ///     let response = client.get_location()
6786    ///         /* set fields */
6787    ///         .send().await?;
6788    ///     println!("response {:?}", response);
6789    ///     Ok(())
6790    /// }
6791    /// ```
6792    pub fn get_location(&self) -> super::builder::knowledge_bases::GetLocation {
6793        super::builder::knowledge_bases::GetLocation::new(self.inner.clone())
6794    }
6795
6796    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
6797    ///
6798    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
6799    ///
6800    /// # Example
6801    /// ```
6802    /// # use google_cloud_dialogflow_v2::client::KnowledgeBases;
6803    /// use google_cloud_gax::paginator::ItemPaginator as _;
6804    /// use google_cloud_dialogflow_v2::Result;
6805    /// async fn sample(
6806    ///    client: &KnowledgeBases
6807    /// ) -> Result<()> {
6808    ///     let mut list = client.list_operations()
6809    ///         /* set fields */
6810    ///         .by_item();
6811    ///     while let Some(item) = list.next().await.transpose()? {
6812    ///         println!("{:?}", item);
6813    ///     }
6814    ///     Ok(())
6815    /// }
6816    /// ```
6817    pub fn list_operations(&self) -> super::builder::knowledge_bases::ListOperations {
6818        super::builder::knowledge_bases::ListOperations::new(self.inner.clone())
6819    }
6820
6821    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
6822    ///
6823    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
6824    ///
6825    /// # Example
6826    /// ```
6827    /// # use google_cloud_dialogflow_v2::client::KnowledgeBases;
6828    /// use google_cloud_dialogflow_v2::Result;
6829    /// async fn sample(
6830    ///    client: &KnowledgeBases
6831    /// ) -> Result<()> {
6832    ///     let response = client.get_operation()
6833    ///         /* set fields */
6834    ///         .send().await?;
6835    ///     println!("response {:?}", response);
6836    ///     Ok(())
6837    /// }
6838    /// ```
6839    pub fn get_operation(&self) -> super::builder::knowledge_bases::GetOperation {
6840        super::builder::knowledge_bases::GetOperation::new(self.inner.clone())
6841    }
6842
6843    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
6844    ///
6845    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
6846    ///
6847    /// # Example
6848    /// ```
6849    /// # use google_cloud_dialogflow_v2::client::KnowledgeBases;
6850    /// use google_cloud_dialogflow_v2::Result;
6851    /// async fn sample(
6852    ///    client: &KnowledgeBases
6853    /// ) -> Result<()> {
6854    ///     client.cancel_operation()
6855    ///         /* set fields */
6856    ///         .send().await?;
6857    ///     Ok(())
6858    /// }
6859    /// ```
6860    pub fn cancel_operation(&self) -> super::builder::knowledge_bases::CancelOperation {
6861        super::builder::knowledge_bases::CancelOperation::new(self.inner.clone())
6862    }
6863}
6864
6865/// Implements a client for the Dialogflow API.
6866///
6867/// # Example
6868/// ```
6869/// # use google_cloud_dialogflow_v2::client::Participants;
6870/// use google_cloud_gax::paginator::ItemPaginator as _;
6871/// # async fn sample() -> Result<(), Box<dyn std::error::Error>> {
6872///     let client = Participants::builder().build().await?;
6873///     let parent = "parent_value";
6874///     let mut list = client.list_participants()
6875///         .set_parent(parent)
6876///         .by_item();
6877///     while let Some(item) = list.next().await.transpose()? {
6878///         println!("{:?}", item);
6879///     }
6880/// # Ok(()) }
6881/// ```
6882///
6883/// # Service Description
6884///
6885/// Service for managing [Participants][google.cloud.dialogflow.v2.Participant].
6886///
6887/// [google.cloud.dialogflow.v2.Participant]: crate::model::Participant
6888///
6889/// # Configuration
6890///
6891/// To configure `Participants` use the `with_*` methods in the type returned
6892/// by [builder()][Participants::builder]. The default configuration should
6893/// work for most applications. Common configuration changes include
6894///
6895/// * [with_endpoint()]: by default this client uses the global default endpoint
6896///   (`https://dialogflow.googleapis.com`). Applications using regional
6897///   endpoints or running in restricted networks (e.g. a network configured
6898//    with [Private Google Access with VPC Service Controls]) may want to
6899///   override this default.
6900/// * [with_credentials()]: by default this client uses
6901///   [Application Default Credentials]. Applications using custom
6902///   authentication may need to override this default.
6903///
6904/// [with_endpoint()]: super::builder::participants::ClientBuilder::with_endpoint
6905/// [with_credentials()]: super::builder::participants::ClientBuilder::with_credentials
6906/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
6907/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
6908///
6909/// # Pooling and Cloning
6910///
6911/// `Participants` holds a connection pool internally, it is advised to
6912/// create one and reuse it. You do not need to wrap `Participants` in
6913/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
6914/// already uses an `Arc` internally.
6915#[cfg(feature = "participants")]
6916#[cfg_attr(docsrs, doc(cfg(feature = "participants")))]
6917#[derive(Clone, Debug)]
6918pub struct Participants {
6919    inner: std::sync::Arc<dyn super::stub::dynamic::Participants>,
6920}
6921
6922#[cfg(feature = "participants")]
6923impl Participants {
6924    /// Returns a builder for [Participants].
6925    ///
6926    /// ```
6927    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
6928    /// # use google_cloud_dialogflow_v2::client::Participants;
6929    /// let client = Participants::builder().build().await?;
6930    /// # Ok(()) }
6931    /// ```
6932    pub fn builder() -> super::builder::participants::ClientBuilder {
6933        crate::new_client_builder(super::builder::participants::client::Factory)
6934    }
6935
6936    /// Creates a new client from the provided stub.
6937    ///
6938    /// The most common case for calling this function is in tests mocking the
6939    /// client's behavior.
6940    pub fn from_stub<T>(stub: T) -> Self
6941    where
6942        T: super::stub::Participants + 'static,
6943    {
6944        Self {
6945            inner: std::sync::Arc::new(stub),
6946        }
6947    }
6948
6949    pub(crate) async fn new(
6950        config: gaxi::options::ClientConfig,
6951    ) -> crate::ClientBuilderResult<Self> {
6952        let inner = Self::build_inner(config).await?;
6953        Ok(Self { inner })
6954    }
6955
6956    async fn build_inner(
6957        conf: gaxi::options::ClientConfig,
6958    ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::Participants>> {
6959        if gaxi::options::tracing_enabled(&conf) {
6960            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
6961        }
6962        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
6963    }
6964
6965    async fn build_transport(
6966        conf: gaxi::options::ClientConfig,
6967    ) -> crate::ClientBuilderResult<impl super::stub::Participants> {
6968        super::transport::Participants::new(conf).await
6969    }
6970
6971    async fn build_with_tracing(
6972        conf: gaxi::options::ClientConfig,
6973    ) -> crate::ClientBuilderResult<impl super::stub::Participants> {
6974        Self::build_transport(conf)
6975            .await
6976            .map(super::tracing::Participants::new)
6977    }
6978
6979    /// Creates a new participant in a conversation.
6980    ///
6981    /// # Example
6982    /// ```
6983    /// # use google_cloud_dialogflow_v2::client::Participants;
6984    /// use google_cloud_dialogflow_v2::model::Participant;
6985    /// use google_cloud_dialogflow_v2::Result;
6986    /// async fn sample(
6987    ///    client: &Participants, parent: &str
6988    /// ) -> Result<()> {
6989    ///     let response = client.create_participant()
6990    ///         .set_parent(parent)
6991    ///         .set_participant(
6992    ///             Participant::new()/* set fields */
6993    ///         )
6994    ///         .send().await?;
6995    ///     println!("response {:?}", response);
6996    ///     Ok(())
6997    /// }
6998    /// ```
6999    pub fn create_participant(&self) -> super::builder::participants::CreateParticipant {
7000        super::builder::participants::CreateParticipant::new(self.inner.clone())
7001    }
7002
7003    /// Retrieves a conversation participant.
7004    ///
7005    /// # Example
7006    /// ```
7007    /// # use google_cloud_dialogflow_v2::client::Participants;
7008    /// use google_cloud_dialogflow_v2::Result;
7009    /// async fn sample(
7010    ///    client: &Participants, name: &str
7011    /// ) -> Result<()> {
7012    ///     let response = client.get_participant()
7013    ///         .set_name(name)
7014    ///         .send().await?;
7015    ///     println!("response {:?}", response);
7016    ///     Ok(())
7017    /// }
7018    /// ```
7019    pub fn get_participant(&self) -> super::builder::participants::GetParticipant {
7020        super::builder::participants::GetParticipant::new(self.inner.clone())
7021    }
7022
7023    /// Returns the list of all participants in the specified conversation.
7024    ///
7025    /// # Example
7026    /// ```
7027    /// # use google_cloud_dialogflow_v2::client::Participants;
7028    /// use google_cloud_gax::paginator::ItemPaginator as _;
7029    /// use google_cloud_dialogflow_v2::Result;
7030    /// async fn sample(
7031    ///    client: &Participants, parent: &str
7032    /// ) -> Result<()> {
7033    ///     let mut list = client.list_participants()
7034    ///         .set_parent(parent)
7035    ///         .by_item();
7036    ///     while let Some(item) = list.next().await.transpose()? {
7037    ///         println!("{:?}", item);
7038    ///     }
7039    ///     Ok(())
7040    /// }
7041    /// ```
7042    pub fn list_participants(&self) -> super::builder::participants::ListParticipants {
7043        super::builder::participants::ListParticipants::new(self.inner.clone())
7044    }
7045
7046    /// Updates the specified participant.
7047    ///
7048    /// # Example
7049    /// ```
7050    /// # use google_cloud_dialogflow_v2::client::Participants;
7051    /// # extern crate wkt as google_cloud_wkt;
7052    /// use google_cloud_wkt::FieldMask;
7053    /// use google_cloud_dialogflow_v2::model::Participant;
7054    /// use google_cloud_dialogflow_v2::Result;
7055    /// async fn sample(
7056    ///    client: &Participants, name: &str
7057    /// ) -> Result<()> {
7058    ///     let response = client.update_participant()
7059    ///         .set_participant(
7060    ///             Participant::new().set_name(name)/* set fields */
7061    ///         )
7062    ///         .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
7063    ///         .send().await?;
7064    ///     println!("response {:?}", response);
7065    ///     Ok(())
7066    /// }
7067    /// ```
7068    pub fn update_participant(&self) -> super::builder::participants::UpdateParticipant {
7069        super::builder::participants::UpdateParticipant::new(self.inner.clone())
7070    }
7071
7072    /// Adds a text (chat, for example), or audio (phone recording, for example)
7073    /// message from a participant into the conversation.
7074    ///
7075    /// Note: Always use agent versions for production traffic
7076    /// sent to virtual agents. See [Versions and
7077    /// environments](https://cloud.google.com/dialogflow/es/docs/agents-versions).
7078    ///
7079    /// # Example
7080    /// ```
7081    /// # use google_cloud_dialogflow_v2::client::Participants;
7082    /// use google_cloud_dialogflow_v2::Result;
7083    /// async fn sample(
7084    ///    client: &Participants
7085    /// ) -> Result<()> {
7086    ///     let response = client.analyze_content()
7087    ///         /* set fields */
7088    ///         .send().await?;
7089    ///     println!("response {:?}", response);
7090    ///     Ok(())
7091    /// }
7092    /// ```
7093    pub fn analyze_content(&self) -> super::builder::participants::AnalyzeContent {
7094        super::builder::participants::AnalyzeContent::new(self.inner.clone())
7095    }
7096
7097    /// Gets suggested articles for a participant based on specific historical
7098    /// messages.
7099    ///
7100    /// # Example
7101    /// ```
7102    /// # use google_cloud_dialogflow_v2::client::Participants;
7103    /// use google_cloud_dialogflow_v2::Result;
7104    /// async fn sample(
7105    ///    client: &Participants
7106    /// ) -> Result<()> {
7107    ///     let response = client.suggest_articles()
7108    ///         /* set fields */
7109    ///         .send().await?;
7110    ///     println!("response {:?}", response);
7111    ///     Ok(())
7112    /// }
7113    /// ```
7114    pub fn suggest_articles(&self) -> super::builder::participants::SuggestArticles {
7115        super::builder::participants::SuggestArticles::new(self.inner.clone())
7116    }
7117
7118    /// Gets suggested faq answers for a participant based on specific historical
7119    /// messages.
7120    ///
7121    /// # Example
7122    /// ```
7123    /// # use google_cloud_dialogflow_v2::client::Participants;
7124    /// use google_cloud_dialogflow_v2::Result;
7125    /// async fn sample(
7126    ///    client: &Participants
7127    /// ) -> Result<()> {
7128    ///     let response = client.suggest_faq_answers()
7129    ///         /* set fields */
7130    ///         .send().await?;
7131    ///     println!("response {:?}", response);
7132    ///     Ok(())
7133    /// }
7134    /// ```
7135    pub fn suggest_faq_answers(&self) -> super::builder::participants::SuggestFaqAnswers {
7136        super::builder::participants::SuggestFaqAnswers::new(self.inner.clone())
7137    }
7138
7139    /// Gets smart replies for a participant based on specific historical
7140    /// messages.
7141    ///
7142    /// # Example
7143    /// ```
7144    /// # use google_cloud_dialogflow_v2::client::Participants;
7145    /// use google_cloud_dialogflow_v2::Result;
7146    /// async fn sample(
7147    ///    client: &Participants
7148    /// ) -> Result<()> {
7149    ///     let response = client.suggest_smart_replies()
7150    ///         /* set fields */
7151    ///         .send().await?;
7152    ///     println!("response {:?}", response);
7153    ///     Ok(())
7154    /// }
7155    /// ```
7156    pub fn suggest_smart_replies(&self) -> super::builder::participants::SuggestSmartReplies {
7157        super::builder::participants::SuggestSmartReplies::new(self.inner.clone())
7158    }
7159
7160    /// Gets knowledge assist suggestions based on historical messages.
7161    ///
7162    /// # Example
7163    /// ```
7164    /// # use google_cloud_dialogflow_v2::client::Participants;
7165    /// use google_cloud_dialogflow_v2::Result;
7166    /// async fn sample(
7167    ///    client: &Participants
7168    /// ) -> Result<()> {
7169    ///     let response = client.suggest_knowledge_assist()
7170    ///         /* set fields */
7171    ///         .send().await?;
7172    ///     println!("response {:?}", response);
7173    ///     Ok(())
7174    /// }
7175    /// ```
7176    pub fn suggest_knowledge_assist(&self) -> super::builder::participants::SuggestKnowledgeAssist {
7177        super::builder::participants::SuggestKnowledgeAssist::new(self.inner.clone())
7178    }
7179
7180    /// Lists information about the supported locations for this service.
7181    ///
7182    /// This method lists locations based on the resource scope provided in
7183    /// the [ListLocationsRequest.name] field:
7184    ///
7185    /// * **Global locations**: If `name` is empty, the method lists the
7186    ///   public locations available to all projects. * **Project-specific
7187    ///   locations**: If `name` follows the format
7188    ///   `projects/{project}`, the method lists locations visible to that
7189    ///   specific project. This includes public, private, or other
7190    ///   project-specific locations enabled for the project.
7191    ///
7192    /// For gRPC and client library implementations, the resource name is
7193    /// passed as the `name` field. For direct service calls, the resource
7194    /// name is
7195    /// incorporated into the request path based on the specific service
7196    /// implementation and version.
7197    ///
7198    /// # Example
7199    /// ```
7200    /// # use google_cloud_dialogflow_v2::client::Participants;
7201    /// use google_cloud_gax::paginator::ItemPaginator as _;
7202    /// use google_cloud_dialogflow_v2::Result;
7203    /// async fn sample(
7204    ///    client: &Participants
7205    /// ) -> Result<()> {
7206    ///     let mut list = client.list_locations()
7207    ///         /* set fields */
7208    ///         .by_item();
7209    ///     while let Some(item) = list.next().await.transpose()? {
7210    ///         println!("{:?}", item);
7211    ///     }
7212    ///     Ok(())
7213    /// }
7214    /// ```
7215    pub fn list_locations(&self) -> super::builder::participants::ListLocations {
7216        super::builder::participants::ListLocations::new(self.inner.clone())
7217    }
7218
7219    /// Gets information about a location.
7220    ///
7221    /// # Example
7222    /// ```
7223    /// # use google_cloud_dialogflow_v2::client::Participants;
7224    /// use google_cloud_dialogflow_v2::Result;
7225    /// async fn sample(
7226    ///    client: &Participants
7227    /// ) -> Result<()> {
7228    ///     let response = client.get_location()
7229    ///         /* set fields */
7230    ///         .send().await?;
7231    ///     println!("response {:?}", response);
7232    ///     Ok(())
7233    /// }
7234    /// ```
7235    pub fn get_location(&self) -> super::builder::participants::GetLocation {
7236        super::builder::participants::GetLocation::new(self.inner.clone())
7237    }
7238
7239    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
7240    ///
7241    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
7242    ///
7243    /// # Example
7244    /// ```
7245    /// # use google_cloud_dialogflow_v2::client::Participants;
7246    /// use google_cloud_gax::paginator::ItemPaginator as _;
7247    /// use google_cloud_dialogflow_v2::Result;
7248    /// async fn sample(
7249    ///    client: &Participants
7250    /// ) -> Result<()> {
7251    ///     let mut list = client.list_operations()
7252    ///         /* set fields */
7253    ///         .by_item();
7254    ///     while let Some(item) = list.next().await.transpose()? {
7255    ///         println!("{:?}", item);
7256    ///     }
7257    ///     Ok(())
7258    /// }
7259    /// ```
7260    pub fn list_operations(&self) -> super::builder::participants::ListOperations {
7261        super::builder::participants::ListOperations::new(self.inner.clone())
7262    }
7263
7264    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
7265    ///
7266    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
7267    ///
7268    /// # Example
7269    /// ```
7270    /// # use google_cloud_dialogflow_v2::client::Participants;
7271    /// use google_cloud_dialogflow_v2::Result;
7272    /// async fn sample(
7273    ///    client: &Participants
7274    /// ) -> Result<()> {
7275    ///     let response = client.get_operation()
7276    ///         /* set fields */
7277    ///         .send().await?;
7278    ///     println!("response {:?}", response);
7279    ///     Ok(())
7280    /// }
7281    /// ```
7282    pub fn get_operation(&self) -> super::builder::participants::GetOperation {
7283        super::builder::participants::GetOperation::new(self.inner.clone())
7284    }
7285
7286    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
7287    ///
7288    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
7289    ///
7290    /// # Example
7291    /// ```
7292    /// # use google_cloud_dialogflow_v2::client::Participants;
7293    /// use google_cloud_dialogflow_v2::Result;
7294    /// async fn sample(
7295    ///    client: &Participants
7296    /// ) -> Result<()> {
7297    ///     client.cancel_operation()
7298    ///         /* set fields */
7299    ///         .send().await?;
7300    ///     Ok(())
7301    /// }
7302    /// ```
7303    pub fn cancel_operation(&self) -> super::builder::participants::CancelOperation {
7304        super::builder::participants::CancelOperation::new(self.inner.clone())
7305    }
7306}
7307
7308/// Implements a client for the Dialogflow API.
7309///
7310/// # Example
7311/// ```
7312/// # use google_cloud_dialogflow_v2::client::Sessions;
7313/// # async fn sample() -> Result<(), Box<dyn std::error::Error>> {
7314///     let client = Sessions::builder().build().await?;
7315///     let response = client.detect_intent()
7316///         /* set fields */
7317///         .send().await?;
7318///     println!("response {:?}", response);
7319/// # Ok(()) }
7320/// ```
7321///
7322/// # Service Description
7323///
7324/// A service used for session interactions.
7325///
7326/// For more information, see the [API interactions
7327/// guide](https://cloud.google.com/dialogflow/docs/api-overview).
7328///
7329/// # Configuration
7330///
7331/// To configure `Sessions` use the `with_*` methods in the type returned
7332/// by [builder()][Sessions::builder]. The default configuration should
7333/// work for most applications. Common configuration changes include
7334///
7335/// * [with_endpoint()]: by default this client uses the global default endpoint
7336///   (`https://dialogflow.googleapis.com`). Applications using regional
7337///   endpoints or running in restricted networks (e.g. a network configured
7338//    with [Private Google Access with VPC Service Controls]) may want to
7339///   override this default.
7340/// * [with_credentials()]: by default this client uses
7341///   [Application Default Credentials]. Applications using custom
7342///   authentication may need to override this default.
7343///
7344/// [with_endpoint()]: super::builder::sessions::ClientBuilder::with_endpoint
7345/// [with_credentials()]: super::builder::sessions::ClientBuilder::with_credentials
7346/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
7347/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
7348///
7349/// # Pooling and Cloning
7350///
7351/// `Sessions` holds a connection pool internally, it is advised to
7352/// create one and reuse it. You do not need to wrap `Sessions` in
7353/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
7354/// already uses an `Arc` internally.
7355#[cfg(feature = "sessions")]
7356#[cfg_attr(docsrs, doc(cfg(feature = "sessions")))]
7357#[derive(Clone, Debug)]
7358pub struct Sessions {
7359    inner: std::sync::Arc<dyn super::stub::dynamic::Sessions>,
7360}
7361
7362#[cfg(feature = "sessions")]
7363impl Sessions {
7364    /// Returns a builder for [Sessions].
7365    ///
7366    /// ```
7367    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
7368    /// # use google_cloud_dialogflow_v2::client::Sessions;
7369    /// let client = Sessions::builder().build().await?;
7370    /// # Ok(()) }
7371    /// ```
7372    pub fn builder() -> super::builder::sessions::ClientBuilder {
7373        crate::new_client_builder(super::builder::sessions::client::Factory)
7374    }
7375
7376    /// Creates a new client from the provided stub.
7377    ///
7378    /// The most common case for calling this function is in tests mocking the
7379    /// client's behavior.
7380    pub fn from_stub<T>(stub: T) -> Self
7381    where
7382        T: super::stub::Sessions + 'static,
7383    {
7384        Self {
7385            inner: std::sync::Arc::new(stub),
7386        }
7387    }
7388
7389    pub(crate) async fn new(
7390        config: gaxi::options::ClientConfig,
7391    ) -> crate::ClientBuilderResult<Self> {
7392        let inner = Self::build_inner(config).await?;
7393        Ok(Self { inner })
7394    }
7395
7396    async fn build_inner(
7397        conf: gaxi::options::ClientConfig,
7398    ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::Sessions>> {
7399        if gaxi::options::tracing_enabled(&conf) {
7400            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
7401        }
7402        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
7403    }
7404
7405    async fn build_transport(
7406        conf: gaxi::options::ClientConfig,
7407    ) -> crate::ClientBuilderResult<impl super::stub::Sessions> {
7408        super::transport::Sessions::new(conf).await
7409    }
7410
7411    async fn build_with_tracing(
7412        conf: gaxi::options::ClientConfig,
7413    ) -> crate::ClientBuilderResult<impl super::stub::Sessions> {
7414        Self::build_transport(conf)
7415            .await
7416            .map(super::tracing::Sessions::new)
7417    }
7418
7419    /// Processes a natural language query and returns structured, actionable data
7420    /// as a result. This method is not idempotent, because it may cause contexts
7421    /// and session entity types to be updated, which in turn might affect
7422    /// results of future queries.
7423    ///
7424    /// If you might use
7425    /// [Agent Assist](https://cloud.google.com/dialogflow/docs/#aa)
7426    /// or other CCAI products now or in the future, consider using
7427    /// [AnalyzeContent][google.cloud.dialogflow.v2.Participants.AnalyzeContent]
7428    /// instead of `DetectIntent`. `AnalyzeContent` has additional
7429    /// functionality for Agent Assist and other CCAI products.
7430    ///
7431    /// Note: Always use agent versions for production traffic.
7432    /// See [Versions and
7433    /// environments](https://cloud.google.com/dialogflow/es/docs/agents-versions).
7434    ///
7435    /// [google.cloud.dialogflow.v2.Participants.AnalyzeContent]: crate::client::Participants::analyze_content
7436    ///
7437    /// # Example
7438    /// ```
7439    /// # use google_cloud_dialogflow_v2::client::Sessions;
7440    /// use google_cloud_dialogflow_v2::Result;
7441    /// async fn sample(
7442    ///    client: &Sessions
7443    /// ) -> Result<()> {
7444    ///     let response = client.detect_intent()
7445    ///         /* set fields */
7446    ///         .send().await?;
7447    ///     println!("response {:?}", response);
7448    ///     Ok(())
7449    /// }
7450    /// ```
7451    pub fn detect_intent(&self) -> super::builder::sessions::DetectIntent {
7452        super::builder::sessions::DetectIntent::new(self.inner.clone())
7453    }
7454
7455    /// Lists information about the supported locations for this service.
7456    ///
7457    /// This method lists locations based on the resource scope provided in
7458    /// the [ListLocationsRequest.name] field:
7459    ///
7460    /// * **Global locations**: If `name` is empty, the method lists the
7461    ///   public locations available to all projects. * **Project-specific
7462    ///   locations**: If `name` follows the format
7463    ///   `projects/{project}`, the method lists locations visible to that
7464    ///   specific project. This includes public, private, or other
7465    ///   project-specific locations enabled for the project.
7466    ///
7467    /// For gRPC and client library implementations, the resource name is
7468    /// passed as the `name` field. For direct service calls, the resource
7469    /// name is
7470    /// incorporated into the request path based on the specific service
7471    /// implementation and version.
7472    ///
7473    /// # Example
7474    /// ```
7475    /// # use google_cloud_dialogflow_v2::client::Sessions;
7476    /// use google_cloud_gax::paginator::ItemPaginator as _;
7477    /// use google_cloud_dialogflow_v2::Result;
7478    /// async fn sample(
7479    ///    client: &Sessions
7480    /// ) -> Result<()> {
7481    ///     let mut list = client.list_locations()
7482    ///         /* set fields */
7483    ///         .by_item();
7484    ///     while let Some(item) = list.next().await.transpose()? {
7485    ///         println!("{:?}", item);
7486    ///     }
7487    ///     Ok(())
7488    /// }
7489    /// ```
7490    pub fn list_locations(&self) -> super::builder::sessions::ListLocations {
7491        super::builder::sessions::ListLocations::new(self.inner.clone())
7492    }
7493
7494    /// Gets information about a location.
7495    ///
7496    /// # Example
7497    /// ```
7498    /// # use google_cloud_dialogflow_v2::client::Sessions;
7499    /// use google_cloud_dialogflow_v2::Result;
7500    /// async fn sample(
7501    ///    client: &Sessions
7502    /// ) -> Result<()> {
7503    ///     let response = client.get_location()
7504    ///         /* set fields */
7505    ///         .send().await?;
7506    ///     println!("response {:?}", response);
7507    ///     Ok(())
7508    /// }
7509    /// ```
7510    pub fn get_location(&self) -> super::builder::sessions::GetLocation {
7511        super::builder::sessions::GetLocation::new(self.inner.clone())
7512    }
7513
7514    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
7515    ///
7516    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
7517    ///
7518    /// # Example
7519    /// ```
7520    /// # use google_cloud_dialogflow_v2::client::Sessions;
7521    /// use google_cloud_gax::paginator::ItemPaginator as _;
7522    /// use google_cloud_dialogflow_v2::Result;
7523    /// async fn sample(
7524    ///    client: &Sessions
7525    /// ) -> Result<()> {
7526    ///     let mut list = client.list_operations()
7527    ///         /* set fields */
7528    ///         .by_item();
7529    ///     while let Some(item) = list.next().await.transpose()? {
7530    ///         println!("{:?}", item);
7531    ///     }
7532    ///     Ok(())
7533    /// }
7534    /// ```
7535    pub fn list_operations(&self) -> super::builder::sessions::ListOperations {
7536        super::builder::sessions::ListOperations::new(self.inner.clone())
7537    }
7538
7539    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
7540    ///
7541    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
7542    ///
7543    /// # Example
7544    /// ```
7545    /// # use google_cloud_dialogflow_v2::client::Sessions;
7546    /// use google_cloud_dialogflow_v2::Result;
7547    /// async fn sample(
7548    ///    client: &Sessions
7549    /// ) -> Result<()> {
7550    ///     let response = client.get_operation()
7551    ///         /* set fields */
7552    ///         .send().await?;
7553    ///     println!("response {:?}", response);
7554    ///     Ok(())
7555    /// }
7556    /// ```
7557    pub fn get_operation(&self) -> super::builder::sessions::GetOperation {
7558        super::builder::sessions::GetOperation::new(self.inner.clone())
7559    }
7560
7561    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
7562    ///
7563    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
7564    ///
7565    /// # Example
7566    /// ```
7567    /// # use google_cloud_dialogflow_v2::client::Sessions;
7568    /// use google_cloud_dialogflow_v2::Result;
7569    /// async fn sample(
7570    ///    client: &Sessions
7571    /// ) -> Result<()> {
7572    ///     client.cancel_operation()
7573    ///         /* set fields */
7574    ///         .send().await?;
7575    ///     Ok(())
7576    /// }
7577    /// ```
7578    pub fn cancel_operation(&self) -> super::builder::sessions::CancelOperation {
7579        super::builder::sessions::CancelOperation::new(self.inner.clone())
7580    }
7581}
7582
7583/// Implements a client for the Dialogflow API.
7584///
7585/// # Example
7586/// ```
7587/// # use google_cloud_dialogflow_v2::client::SessionEntityTypes;
7588/// use google_cloud_gax::paginator::ItemPaginator as _;
7589/// # async fn sample() -> Result<(), Box<dyn std::error::Error>> {
7590///     let client = SessionEntityTypes::builder().build().await?;
7591///     let parent = "parent_value";
7592///     let mut list = client.list_session_entity_types()
7593///         .set_parent(parent)
7594///         .by_item();
7595///     while let Some(item) = list.next().await.transpose()? {
7596///         println!("{:?}", item);
7597///     }
7598/// # Ok(()) }
7599/// ```
7600///
7601/// # Service Description
7602///
7603/// Service for managing
7604/// [SessionEntityTypes][google.cloud.dialogflow.v2.SessionEntityType].
7605///
7606/// [google.cloud.dialogflow.v2.SessionEntityType]: crate::model::SessionEntityType
7607///
7608/// # Configuration
7609///
7610/// To configure `SessionEntityTypes` use the `with_*` methods in the type returned
7611/// by [builder()][SessionEntityTypes::builder]. The default configuration should
7612/// work for most applications. Common configuration changes include
7613///
7614/// * [with_endpoint()]: by default this client uses the global default endpoint
7615///   (`https://dialogflow.googleapis.com`). Applications using regional
7616///   endpoints or running in restricted networks (e.g. a network configured
7617//    with [Private Google Access with VPC Service Controls]) may want to
7618///   override this default.
7619/// * [with_credentials()]: by default this client uses
7620///   [Application Default Credentials]. Applications using custom
7621///   authentication may need to override this default.
7622///
7623/// [with_endpoint()]: super::builder::session_entity_types::ClientBuilder::with_endpoint
7624/// [with_credentials()]: super::builder::session_entity_types::ClientBuilder::with_credentials
7625/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
7626/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
7627///
7628/// # Pooling and Cloning
7629///
7630/// `SessionEntityTypes` holds a connection pool internally, it is advised to
7631/// create one and reuse it. You do not need to wrap `SessionEntityTypes` in
7632/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
7633/// already uses an `Arc` internally.
7634#[cfg(feature = "session-entity-types")]
7635#[cfg_attr(docsrs, doc(cfg(feature = "session-entity-types")))]
7636#[derive(Clone, Debug)]
7637pub struct SessionEntityTypes {
7638    inner: std::sync::Arc<dyn super::stub::dynamic::SessionEntityTypes>,
7639}
7640
7641#[cfg(feature = "session-entity-types")]
7642impl SessionEntityTypes {
7643    /// Returns a builder for [SessionEntityTypes].
7644    ///
7645    /// ```
7646    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
7647    /// # use google_cloud_dialogflow_v2::client::SessionEntityTypes;
7648    /// let client = SessionEntityTypes::builder().build().await?;
7649    /// # Ok(()) }
7650    /// ```
7651    pub fn builder() -> super::builder::session_entity_types::ClientBuilder {
7652        crate::new_client_builder(super::builder::session_entity_types::client::Factory)
7653    }
7654
7655    /// Creates a new client from the provided stub.
7656    ///
7657    /// The most common case for calling this function is in tests mocking the
7658    /// client's behavior.
7659    pub fn from_stub<T>(stub: T) -> Self
7660    where
7661        T: super::stub::SessionEntityTypes + 'static,
7662    {
7663        Self {
7664            inner: std::sync::Arc::new(stub),
7665        }
7666    }
7667
7668    pub(crate) async fn new(
7669        config: gaxi::options::ClientConfig,
7670    ) -> crate::ClientBuilderResult<Self> {
7671        let inner = Self::build_inner(config).await?;
7672        Ok(Self { inner })
7673    }
7674
7675    async fn build_inner(
7676        conf: gaxi::options::ClientConfig,
7677    ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::SessionEntityTypes>>
7678    {
7679        if gaxi::options::tracing_enabled(&conf) {
7680            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
7681        }
7682        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
7683    }
7684
7685    async fn build_transport(
7686        conf: gaxi::options::ClientConfig,
7687    ) -> crate::ClientBuilderResult<impl super::stub::SessionEntityTypes> {
7688        super::transport::SessionEntityTypes::new(conf).await
7689    }
7690
7691    async fn build_with_tracing(
7692        conf: gaxi::options::ClientConfig,
7693    ) -> crate::ClientBuilderResult<impl super::stub::SessionEntityTypes> {
7694        Self::build_transport(conf)
7695            .await
7696            .map(super::tracing::SessionEntityTypes::new)
7697    }
7698
7699    /// Returns the list of all session entity types in the specified session.
7700    ///
7701    /// This method doesn't work with Google Assistant integration.
7702    /// Contact Dialogflow support if you need to use session entities
7703    /// with Google Assistant integration.
7704    ///
7705    /// # Example
7706    /// ```
7707    /// # use google_cloud_dialogflow_v2::client::SessionEntityTypes;
7708    /// use google_cloud_gax::paginator::ItemPaginator as _;
7709    /// use google_cloud_dialogflow_v2::Result;
7710    /// async fn sample(
7711    ///    client: &SessionEntityTypes, parent: &str
7712    /// ) -> Result<()> {
7713    ///     let mut list = client.list_session_entity_types()
7714    ///         .set_parent(parent)
7715    ///         .by_item();
7716    ///     while let Some(item) = list.next().await.transpose()? {
7717    ///         println!("{:?}", item);
7718    ///     }
7719    ///     Ok(())
7720    /// }
7721    /// ```
7722    pub fn list_session_entity_types(
7723        &self,
7724    ) -> super::builder::session_entity_types::ListSessionEntityTypes {
7725        super::builder::session_entity_types::ListSessionEntityTypes::new(self.inner.clone())
7726    }
7727
7728    /// Retrieves the specified session entity type.
7729    ///
7730    /// This method doesn't work with Google Assistant integration.
7731    /// Contact Dialogflow support if you need to use session entities
7732    /// with Google Assistant integration.
7733    ///
7734    /// # Example
7735    /// ```
7736    /// # use google_cloud_dialogflow_v2::client::SessionEntityTypes;
7737    /// use google_cloud_dialogflow_v2::Result;
7738    /// async fn sample(
7739    ///    client: &SessionEntityTypes, name: &str
7740    /// ) -> Result<()> {
7741    ///     let response = client.get_session_entity_type()
7742    ///         .set_name(name)
7743    ///         .send().await?;
7744    ///     println!("response {:?}", response);
7745    ///     Ok(())
7746    /// }
7747    /// ```
7748    pub fn get_session_entity_type(
7749        &self,
7750    ) -> super::builder::session_entity_types::GetSessionEntityType {
7751        super::builder::session_entity_types::GetSessionEntityType::new(self.inner.clone())
7752    }
7753
7754    /// Creates a session entity type.
7755    ///
7756    /// If the specified session entity type already exists, overrides the session
7757    /// entity type.
7758    ///
7759    /// This method doesn't work with Google Assistant integration.
7760    /// Contact Dialogflow support if you need to use session entities
7761    /// with Google Assistant integration.
7762    ///
7763    /// # Example
7764    /// ```
7765    /// # use google_cloud_dialogflow_v2::client::SessionEntityTypes;
7766    /// use google_cloud_dialogflow_v2::model::SessionEntityType;
7767    /// use google_cloud_dialogflow_v2::Result;
7768    /// async fn sample(
7769    ///    client: &SessionEntityTypes, parent: &str
7770    /// ) -> Result<()> {
7771    ///     let response = client.create_session_entity_type()
7772    ///         .set_parent(parent)
7773    ///         .set_session_entity_type(
7774    ///             SessionEntityType::new()/* set fields */
7775    ///         )
7776    ///         .send().await?;
7777    ///     println!("response {:?}", response);
7778    ///     Ok(())
7779    /// }
7780    /// ```
7781    pub fn create_session_entity_type(
7782        &self,
7783    ) -> super::builder::session_entity_types::CreateSessionEntityType {
7784        super::builder::session_entity_types::CreateSessionEntityType::new(self.inner.clone())
7785    }
7786
7787    /// Updates the specified session entity type.
7788    ///
7789    /// This method doesn't work with Google Assistant integration.
7790    /// Contact Dialogflow support if you need to use session entities
7791    /// with Google Assistant integration.
7792    ///
7793    /// # Example
7794    /// ```
7795    /// # use google_cloud_dialogflow_v2::client::SessionEntityTypes;
7796    /// # extern crate wkt as google_cloud_wkt;
7797    /// use google_cloud_wkt::FieldMask;
7798    /// use google_cloud_dialogflow_v2::model::SessionEntityType;
7799    /// use google_cloud_dialogflow_v2::Result;
7800    /// async fn sample(
7801    ///    client: &SessionEntityTypes, name: &str
7802    /// ) -> Result<()> {
7803    ///     let response = client.update_session_entity_type()
7804    ///         .set_session_entity_type(
7805    ///             SessionEntityType::new().set_name(name)/* set fields */
7806    ///         )
7807    ///         .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
7808    ///         .send().await?;
7809    ///     println!("response {:?}", response);
7810    ///     Ok(())
7811    /// }
7812    /// ```
7813    pub fn update_session_entity_type(
7814        &self,
7815    ) -> super::builder::session_entity_types::UpdateSessionEntityType {
7816        super::builder::session_entity_types::UpdateSessionEntityType::new(self.inner.clone())
7817    }
7818
7819    /// Deletes the specified session entity type.
7820    ///
7821    /// This method doesn't work with Google Assistant integration.
7822    /// Contact Dialogflow support if you need to use session entities
7823    /// with Google Assistant integration.
7824    ///
7825    /// # Example
7826    /// ```
7827    /// # use google_cloud_dialogflow_v2::client::SessionEntityTypes;
7828    /// use google_cloud_dialogflow_v2::Result;
7829    /// async fn sample(
7830    ///    client: &SessionEntityTypes, name: &str
7831    /// ) -> Result<()> {
7832    ///     client.delete_session_entity_type()
7833    ///         .set_name(name)
7834    ///         .send().await?;
7835    ///     Ok(())
7836    /// }
7837    /// ```
7838    pub fn delete_session_entity_type(
7839        &self,
7840    ) -> super::builder::session_entity_types::DeleteSessionEntityType {
7841        super::builder::session_entity_types::DeleteSessionEntityType::new(self.inner.clone())
7842    }
7843
7844    /// Lists information about the supported locations for this service.
7845    ///
7846    /// This method lists locations based on the resource scope provided in
7847    /// the [ListLocationsRequest.name] field:
7848    ///
7849    /// * **Global locations**: If `name` is empty, the method lists the
7850    ///   public locations available to all projects. * **Project-specific
7851    ///   locations**: If `name` follows the format
7852    ///   `projects/{project}`, the method lists locations visible to that
7853    ///   specific project. This includes public, private, or other
7854    ///   project-specific locations enabled for the project.
7855    ///
7856    /// For gRPC and client library implementations, the resource name is
7857    /// passed as the `name` field. For direct service calls, the resource
7858    /// name is
7859    /// incorporated into the request path based on the specific service
7860    /// implementation and version.
7861    ///
7862    /// # Example
7863    /// ```
7864    /// # use google_cloud_dialogflow_v2::client::SessionEntityTypes;
7865    /// use google_cloud_gax::paginator::ItemPaginator as _;
7866    /// use google_cloud_dialogflow_v2::Result;
7867    /// async fn sample(
7868    ///    client: &SessionEntityTypes
7869    /// ) -> Result<()> {
7870    ///     let mut list = client.list_locations()
7871    ///         /* set fields */
7872    ///         .by_item();
7873    ///     while let Some(item) = list.next().await.transpose()? {
7874    ///         println!("{:?}", item);
7875    ///     }
7876    ///     Ok(())
7877    /// }
7878    /// ```
7879    pub fn list_locations(&self) -> super::builder::session_entity_types::ListLocations {
7880        super::builder::session_entity_types::ListLocations::new(self.inner.clone())
7881    }
7882
7883    /// Gets information about a location.
7884    ///
7885    /// # Example
7886    /// ```
7887    /// # use google_cloud_dialogflow_v2::client::SessionEntityTypes;
7888    /// use google_cloud_dialogflow_v2::Result;
7889    /// async fn sample(
7890    ///    client: &SessionEntityTypes
7891    /// ) -> Result<()> {
7892    ///     let response = client.get_location()
7893    ///         /* set fields */
7894    ///         .send().await?;
7895    ///     println!("response {:?}", response);
7896    ///     Ok(())
7897    /// }
7898    /// ```
7899    pub fn get_location(&self) -> super::builder::session_entity_types::GetLocation {
7900        super::builder::session_entity_types::GetLocation::new(self.inner.clone())
7901    }
7902
7903    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
7904    ///
7905    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
7906    ///
7907    /// # Example
7908    /// ```
7909    /// # use google_cloud_dialogflow_v2::client::SessionEntityTypes;
7910    /// use google_cloud_gax::paginator::ItemPaginator as _;
7911    /// use google_cloud_dialogflow_v2::Result;
7912    /// async fn sample(
7913    ///    client: &SessionEntityTypes
7914    /// ) -> Result<()> {
7915    ///     let mut list = client.list_operations()
7916    ///         /* set fields */
7917    ///         .by_item();
7918    ///     while let Some(item) = list.next().await.transpose()? {
7919    ///         println!("{:?}", item);
7920    ///     }
7921    ///     Ok(())
7922    /// }
7923    /// ```
7924    pub fn list_operations(&self) -> super::builder::session_entity_types::ListOperations {
7925        super::builder::session_entity_types::ListOperations::new(self.inner.clone())
7926    }
7927
7928    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
7929    ///
7930    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
7931    ///
7932    /// # Example
7933    /// ```
7934    /// # use google_cloud_dialogflow_v2::client::SessionEntityTypes;
7935    /// use google_cloud_dialogflow_v2::Result;
7936    /// async fn sample(
7937    ///    client: &SessionEntityTypes
7938    /// ) -> Result<()> {
7939    ///     let response = client.get_operation()
7940    ///         /* set fields */
7941    ///         .send().await?;
7942    ///     println!("response {:?}", response);
7943    ///     Ok(())
7944    /// }
7945    /// ```
7946    pub fn get_operation(&self) -> super::builder::session_entity_types::GetOperation {
7947        super::builder::session_entity_types::GetOperation::new(self.inner.clone())
7948    }
7949
7950    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
7951    ///
7952    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
7953    ///
7954    /// # Example
7955    /// ```
7956    /// # use google_cloud_dialogflow_v2::client::SessionEntityTypes;
7957    /// use google_cloud_dialogflow_v2::Result;
7958    /// async fn sample(
7959    ///    client: &SessionEntityTypes
7960    /// ) -> Result<()> {
7961    ///     client.cancel_operation()
7962    ///         /* set fields */
7963    ///         .send().await?;
7964    ///     Ok(())
7965    /// }
7966    /// ```
7967    pub fn cancel_operation(&self) -> super::builder::session_entity_types::CancelOperation {
7968        super::builder::session_entity_types::CancelOperation::new(self.inner.clone())
7969    }
7970}
7971
7972/// Implements a client for the Dialogflow API.
7973///
7974/// # Example
7975/// ```
7976/// # use google_cloud_dialogflow_v2::client::SipTrunks;
7977/// use google_cloud_gax::paginator::ItemPaginator as _;
7978/// # async fn sample() -> Result<(), Box<dyn std::error::Error>> {
7979///     let client = SipTrunks::builder().build().await?;
7980///     let parent = "parent_value";
7981///     let mut list = client.list_sip_trunks()
7982///         .set_parent(parent)
7983///         .by_item();
7984///     while let Some(item) = list.next().await.transpose()? {
7985///         println!("{:?}", item);
7986///     }
7987/// # Ok(()) }
7988/// ```
7989///
7990/// # Service Description
7991///
7992/// Service for managing [SipTrunks][google.cloud.dialogflow.v2.SipTrunk].
7993///
7994/// [google.cloud.dialogflow.v2.SipTrunk]: crate::model::SipTrunk
7995///
7996/// # Configuration
7997///
7998/// To configure `SipTrunks` use the `with_*` methods in the type returned
7999/// by [builder()][SipTrunks::builder]. The default configuration should
8000/// work for most applications. Common configuration changes include
8001///
8002/// * [with_endpoint()]: by default this client uses the global default endpoint
8003///   (`https://dialogflow.googleapis.com`). Applications using regional
8004///   endpoints or running in restricted networks (e.g. a network configured
8005//    with [Private Google Access with VPC Service Controls]) may want to
8006///   override this default.
8007/// * [with_credentials()]: by default this client uses
8008///   [Application Default Credentials]. Applications using custom
8009///   authentication may need to override this default.
8010///
8011/// [with_endpoint()]: super::builder::sip_trunks::ClientBuilder::with_endpoint
8012/// [with_credentials()]: super::builder::sip_trunks::ClientBuilder::with_credentials
8013/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
8014/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
8015///
8016/// # Pooling and Cloning
8017///
8018/// `SipTrunks` holds a connection pool internally, it is advised to
8019/// create one and reuse it. You do not need to wrap `SipTrunks` in
8020/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
8021/// already uses an `Arc` internally.
8022#[cfg(feature = "sip-trunks")]
8023#[cfg_attr(docsrs, doc(cfg(feature = "sip-trunks")))]
8024#[derive(Clone, Debug)]
8025pub struct SipTrunks {
8026    inner: std::sync::Arc<dyn super::stub::dynamic::SipTrunks>,
8027}
8028
8029#[cfg(feature = "sip-trunks")]
8030impl SipTrunks {
8031    /// Returns a builder for [SipTrunks].
8032    ///
8033    /// ```
8034    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
8035    /// # use google_cloud_dialogflow_v2::client::SipTrunks;
8036    /// let client = SipTrunks::builder().build().await?;
8037    /// # Ok(()) }
8038    /// ```
8039    pub fn builder() -> super::builder::sip_trunks::ClientBuilder {
8040        crate::new_client_builder(super::builder::sip_trunks::client::Factory)
8041    }
8042
8043    /// Creates a new client from the provided stub.
8044    ///
8045    /// The most common case for calling this function is in tests mocking the
8046    /// client's behavior.
8047    pub fn from_stub<T>(stub: T) -> Self
8048    where
8049        T: super::stub::SipTrunks + 'static,
8050    {
8051        Self {
8052            inner: std::sync::Arc::new(stub),
8053        }
8054    }
8055
8056    pub(crate) async fn new(
8057        config: gaxi::options::ClientConfig,
8058    ) -> crate::ClientBuilderResult<Self> {
8059        let inner = Self::build_inner(config).await?;
8060        Ok(Self { inner })
8061    }
8062
8063    async fn build_inner(
8064        conf: gaxi::options::ClientConfig,
8065    ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::SipTrunks>> {
8066        if gaxi::options::tracing_enabled(&conf) {
8067            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
8068        }
8069        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
8070    }
8071
8072    async fn build_transport(
8073        conf: gaxi::options::ClientConfig,
8074    ) -> crate::ClientBuilderResult<impl super::stub::SipTrunks> {
8075        super::transport::SipTrunks::new(conf).await
8076    }
8077
8078    async fn build_with_tracing(
8079        conf: gaxi::options::ClientConfig,
8080    ) -> crate::ClientBuilderResult<impl super::stub::SipTrunks> {
8081        Self::build_transport(conf)
8082            .await
8083            .map(super::tracing::SipTrunks::new)
8084    }
8085
8086    /// Creates a SipTrunk for a specified location.
8087    ///
8088    /// # Example
8089    /// ```
8090    /// # use google_cloud_dialogflow_v2::client::SipTrunks;
8091    /// use google_cloud_dialogflow_v2::model::SipTrunk;
8092    /// use google_cloud_dialogflow_v2::Result;
8093    /// async fn sample(
8094    ///    client: &SipTrunks, parent: &str
8095    /// ) -> Result<()> {
8096    ///     let response = client.create_sip_trunk()
8097    ///         .set_parent(parent)
8098    ///         .set_sip_trunk(
8099    ///             SipTrunk::new()/* set fields */
8100    ///         )
8101    ///         .send().await?;
8102    ///     println!("response {:?}", response);
8103    ///     Ok(())
8104    /// }
8105    /// ```
8106    pub fn create_sip_trunk(&self) -> super::builder::sip_trunks::CreateSipTrunk {
8107        super::builder::sip_trunks::CreateSipTrunk::new(self.inner.clone())
8108    }
8109
8110    /// Deletes a specified SipTrunk.
8111    ///
8112    /// # Example
8113    /// ```
8114    /// # use google_cloud_dialogflow_v2::client::SipTrunks;
8115    /// use google_cloud_dialogflow_v2::Result;
8116    /// async fn sample(
8117    ///    client: &SipTrunks, name: &str
8118    /// ) -> Result<()> {
8119    ///     client.delete_sip_trunk()
8120    ///         .set_name(name)
8121    ///         .send().await?;
8122    ///     Ok(())
8123    /// }
8124    /// ```
8125    pub fn delete_sip_trunk(&self) -> super::builder::sip_trunks::DeleteSipTrunk {
8126        super::builder::sip_trunks::DeleteSipTrunk::new(self.inner.clone())
8127    }
8128
8129    /// Returns a list of SipTrunks in the specified location.
8130    ///
8131    /// # Example
8132    /// ```
8133    /// # use google_cloud_dialogflow_v2::client::SipTrunks;
8134    /// use google_cloud_gax::paginator::ItemPaginator as _;
8135    /// use google_cloud_dialogflow_v2::Result;
8136    /// async fn sample(
8137    ///    client: &SipTrunks, parent: &str
8138    /// ) -> Result<()> {
8139    ///     let mut list = client.list_sip_trunks()
8140    ///         .set_parent(parent)
8141    ///         .by_item();
8142    ///     while let Some(item) = list.next().await.transpose()? {
8143    ///         println!("{:?}", item);
8144    ///     }
8145    ///     Ok(())
8146    /// }
8147    /// ```
8148    pub fn list_sip_trunks(&self) -> super::builder::sip_trunks::ListSipTrunks {
8149        super::builder::sip_trunks::ListSipTrunks::new(self.inner.clone())
8150    }
8151
8152    /// Retrieves the specified SipTrunk.
8153    ///
8154    /// # Example
8155    /// ```
8156    /// # use google_cloud_dialogflow_v2::client::SipTrunks;
8157    /// use google_cloud_dialogflow_v2::Result;
8158    /// async fn sample(
8159    ///    client: &SipTrunks, name: &str
8160    /// ) -> Result<()> {
8161    ///     let response = client.get_sip_trunk()
8162    ///         .set_name(name)
8163    ///         .send().await?;
8164    ///     println!("response {:?}", response);
8165    ///     Ok(())
8166    /// }
8167    /// ```
8168    pub fn get_sip_trunk(&self) -> super::builder::sip_trunks::GetSipTrunk {
8169        super::builder::sip_trunks::GetSipTrunk::new(self.inner.clone())
8170    }
8171
8172    /// Updates the specified SipTrunk.
8173    ///
8174    /// # Example
8175    /// ```
8176    /// # use google_cloud_dialogflow_v2::client::SipTrunks;
8177    /// # extern crate wkt as google_cloud_wkt;
8178    /// use google_cloud_wkt::FieldMask;
8179    /// use google_cloud_dialogflow_v2::model::SipTrunk;
8180    /// use google_cloud_dialogflow_v2::Result;
8181    /// async fn sample(
8182    ///    client: &SipTrunks, name: &str
8183    /// ) -> Result<()> {
8184    ///     let response = client.update_sip_trunk()
8185    ///         .set_sip_trunk(
8186    ///             SipTrunk::new().set_name(name)/* set fields */
8187    ///         )
8188    ///         .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
8189    ///         .send().await?;
8190    ///     println!("response {:?}", response);
8191    ///     Ok(())
8192    /// }
8193    /// ```
8194    pub fn update_sip_trunk(&self) -> super::builder::sip_trunks::UpdateSipTrunk {
8195        super::builder::sip_trunks::UpdateSipTrunk::new(self.inner.clone())
8196    }
8197
8198    /// Lists information about the supported locations for this service.
8199    ///
8200    /// This method lists locations based on the resource scope provided in
8201    /// the [ListLocationsRequest.name] field:
8202    ///
8203    /// * **Global locations**: If `name` is empty, the method lists the
8204    ///   public locations available to all projects. * **Project-specific
8205    ///   locations**: If `name` follows the format
8206    ///   `projects/{project}`, the method lists locations visible to that
8207    ///   specific project. This includes public, private, or other
8208    ///   project-specific locations enabled for the project.
8209    ///
8210    /// For gRPC and client library implementations, the resource name is
8211    /// passed as the `name` field. For direct service calls, the resource
8212    /// name is
8213    /// incorporated into the request path based on the specific service
8214    /// implementation and version.
8215    ///
8216    /// # Example
8217    /// ```
8218    /// # use google_cloud_dialogflow_v2::client::SipTrunks;
8219    /// use google_cloud_gax::paginator::ItemPaginator as _;
8220    /// use google_cloud_dialogflow_v2::Result;
8221    /// async fn sample(
8222    ///    client: &SipTrunks
8223    /// ) -> Result<()> {
8224    ///     let mut list = client.list_locations()
8225    ///         /* set fields */
8226    ///         .by_item();
8227    ///     while let Some(item) = list.next().await.transpose()? {
8228    ///         println!("{:?}", item);
8229    ///     }
8230    ///     Ok(())
8231    /// }
8232    /// ```
8233    pub fn list_locations(&self) -> super::builder::sip_trunks::ListLocations {
8234        super::builder::sip_trunks::ListLocations::new(self.inner.clone())
8235    }
8236
8237    /// Gets information about a location.
8238    ///
8239    /// # Example
8240    /// ```
8241    /// # use google_cloud_dialogflow_v2::client::SipTrunks;
8242    /// use google_cloud_dialogflow_v2::Result;
8243    /// async fn sample(
8244    ///    client: &SipTrunks
8245    /// ) -> Result<()> {
8246    ///     let response = client.get_location()
8247    ///         /* set fields */
8248    ///         .send().await?;
8249    ///     println!("response {:?}", response);
8250    ///     Ok(())
8251    /// }
8252    /// ```
8253    pub fn get_location(&self) -> super::builder::sip_trunks::GetLocation {
8254        super::builder::sip_trunks::GetLocation::new(self.inner.clone())
8255    }
8256
8257    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
8258    ///
8259    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
8260    ///
8261    /// # Example
8262    /// ```
8263    /// # use google_cloud_dialogflow_v2::client::SipTrunks;
8264    /// use google_cloud_gax::paginator::ItemPaginator as _;
8265    /// use google_cloud_dialogflow_v2::Result;
8266    /// async fn sample(
8267    ///    client: &SipTrunks
8268    /// ) -> Result<()> {
8269    ///     let mut list = client.list_operations()
8270    ///         /* set fields */
8271    ///         .by_item();
8272    ///     while let Some(item) = list.next().await.transpose()? {
8273    ///         println!("{:?}", item);
8274    ///     }
8275    ///     Ok(())
8276    /// }
8277    /// ```
8278    pub fn list_operations(&self) -> super::builder::sip_trunks::ListOperations {
8279        super::builder::sip_trunks::ListOperations::new(self.inner.clone())
8280    }
8281
8282    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
8283    ///
8284    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
8285    ///
8286    /// # Example
8287    /// ```
8288    /// # use google_cloud_dialogflow_v2::client::SipTrunks;
8289    /// use google_cloud_dialogflow_v2::Result;
8290    /// async fn sample(
8291    ///    client: &SipTrunks
8292    /// ) -> Result<()> {
8293    ///     let response = client.get_operation()
8294    ///         /* set fields */
8295    ///         .send().await?;
8296    ///     println!("response {:?}", response);
8297    ///     Ok(())
8298    /// }
8299    /// ```
8300    pub fn get_operation(&self) -> super::builder::sip_trunks::GetOperation {
8301        super::builder::sip_trunks::GetOperation::new(self.inner.clone())
8302    }
8303
8304    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
8305    ///
8306    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
8307    ///
8308    /// # Example
8309    /// ```
8310    /// # use google_cloud_dialogflow_v2::client::SipTrunks;
8311    /// use google_cloud_dialogflow_v2::Result;
8312    /// async fn sample(
8313    ///    client: &SipTrunks
8314    /// ) -> Result<()> {
8315    ///     client.cancel_operation()
8316    ///         /* set fields */
8317    ///         .send().await?;
8318    ///     Ok(())
8319    /// }
8320    /// ```
8321    pub fn cancel_operation(&self) -> super::builder::sip_trunks::CancelOperation {
8322        super::builder::sip_trunks::CancelOperation::new(self.inner.clone())
8323    }
8324}
8325
8326/// Implements a client for the Dialogflow API.
8327///
8328/// # Example
8329/// ```
8330/// # use google_cloud_dialogflow_v2::client::Tools;
8331/// use google_cloud_gax::paginator::ItemPaginator as _;
8332/// # async fn sample() -> Result<(), Box<dyn std::error::Error>> {
8333///     let client = Tools::builder().build().await?;
8334///     let parent = "parent_value";
8335///     let mut list = client.list_tools()
8336///         .set_parent(parent)
8337///         .by_item();
8338///     while let Some(item) = list.next().await.transpose()? {
8339///         println!("{:?}", item);
8340///     }
8341/// # Ok(()) }
8342/// ```
8343///
8344/// # Service Description
8345///
8346/// Tool Service for LLM powered Agent Assist. Tools can be used to interact with
8347/// remote APIs (e.g. fetching orders) to retrieve additional information as
8348/// input to LLM.
8349///
8350/// # Configuration
8351///
8352/// To configure `Tools` use the `with_*` methods in the type returned
8353/// by [builder()][Tools::builder]. The default configuration should
8354/// work for most applications. Common configuration changes include
8355///
8356/// * [with_endpoint()]: by default this client uses the global default endpoint
8357///   (`https://dialogflow.googleapis.com`). Applications using regional
8358///   endpoints or running in restricted networks (e.g. a network configured
8359//    with [Private Google Access with VPC Service Controls]) may want to
8360///   override this default.
8361/// * [with_credentials()]: by default this client uses
8362///   [Application Default Credentials]. Applications using custom
8363///   authentication may need to override this default.
8364///
8365/// [with_endpoint()]: super::builder::tools::ClientBuilder::with_endpoint
8366/// [with_credentials()]: super::builder::tools::ClientBuilder::with_credentials
8367/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
8368/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
8369///
8370/// # Pooling and Cloning
8371///
8372/// `Tools` holds a connection pool internally, it is advised to
8373/// create one and reuse it. You do not need to wrap `Tools` in
8374/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
8375/// already uses an `Arc` internally.
8376#[cfg(feature = "tools")]
8377#[cfg_attr(docsrs, doc(cfg(feature = "tools")))]
8378#[derive(Clone, Debug)]
8379pub struct Tools {
8380    inner: std::sync::Arc<dyn super::stub::dynamic::Tools>,
8381}
8382
8383#[cfg(feature = "tools")]
8384impl Tools {
8385    /// Returns a builder for [Tools].
8386    ///
8387    /// ```
8388    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
8389    /// # use google_cloud_dialogflow_v2::client::Tools;
8390    /// let client = Tools::builder().build().await?;
8391    /// # Ok(()) }
8392    /// ```
8393    pub fn builder() -> super::builder::tools::ClientBuilder {
8394        crate::new_client_builder(super::builder::tools::client::Factory)
8395    }
8396
8397    /// Creates a new client from the provided stub.
8398    ///
8399    /// The most common case for calling this function is in tests mocking the
8400    /// client's behavior.
8401    pub fn from_stub<T>(stub: T) -> Self
8402    where
8403        T: super::stub::Tools + 'static,
8404    {
8405        Self {
8406            inner: std::sync::Arc::new(stub),
8407        }
8408    }
8409
8410    pub(crate) async fn new(
8411        config: gaxi::options::ClientConfig,
8412    ) -> crate::ClientBuilderResult<Self> {
8413        let inner = Self::build_inner(config).await?;
8414        Ok(Self { inner })
8415    }
8416
8417    async fn build_inner(
8418        conf: gaxi::options::ClientConfig,
8419    ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::Tools>> {
8420        if gaxi::options::tracing_enabled(&conf) {
8421            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
8422        }
8423        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
8424    }
8425
8426    async fn build_transport(
8427        conf: gaxi::options::ClientConfig,
8428    ) -> crate::ClientBuilderResult<impl super::stub::Tools> {
8429        super::transport::Tools::new(conf).await
8430    }
8431
8432    async fn build_with_tracing(
8433        conf: gaxi::options::ClientConfig,
8434    ) -> crate::ClientBuilderResult<impl super::stub::Tools> {
8435        Self::build_transport(conf)
8436            .await
8437            .map(super::tracing::Tools::new)
8438    }
8439
8440    /// Creates a tool.
8441    ///
8442    /// # Example
8443    /// ```
8444    /// # use google_cloud_dialogflow_v2::client::Tools;
8445    /// use google_cloud_dialogflow_v2::model::Tool;
8446    /// use google_cloud_dialogflow_v2::Result;
8447    /// async fn sample(
8448    ///    client: &Tools, parent: &str
8449    /// ) -> Result<()> {
8450    ///     let response = client.create_tool()
8451    ///         .set_parent(parent)
8452    ///         .set_tool_id("tool_id_value")
8453    ///         .set_tool(
8454    ///             Tool::new()/* set fields */
8455    ///         )
8456    ///         .send().await?;
8457    ///     println!("response {:?}", response);
8458    ///     Ok(())
8459    /// }
8460    /// ```
8461    pub fn create_tool(&self) -> super::builder::tools::CreateTool {
8462        super::builder::tools::CreateTool::new(self.inner.clone())
8463    }
8464
8465    /// Retrieves a tool.
8466    ///
8467    /// # Example
8468    /// ```
8469    /// # use google_cloud_dialogflow_v2::client::Tools;
8470    /// use google_cloud_dialogflow_v2::Result;
8471    /// async fn sample(
8472    ///    client: &Tools, name: &str
8473    /// ) -> Result<()> {
8474    ///     let response = client.get_tool()
8475    ///         .set_name(name)
8476    ///         .send().await?;
8477    ///     println!("response {:?}", response);
8478    ///     Ok(())
8479    /// }
8480    /// ```
8481    pub fn get_tool(&self) -> super::builder::tools::GetTool {
8482        super::builder::tools::GetTool::new(self.inner.clone())
8483    }
8484
8485    /// Lists tools.
8486    ///
8487    /// # Example
8488    /// ```
8489    /// # use google_cloud_dialogflow_v2::client::Tools;
8490    /// use google_cloud_gax::paginator::ItemPaginator as _;
8491    /// use google_cloud_dialogflow_v2::Result;
8492    /// async fn sample(
8493    ///    client: &Tools, parent: &str
8494    /// ) -> Result<()> {
8495    ///     let mut list = client.list_tools()
8496    ///         .set_parent(parent)
8497    ///         .by_item();
8498    ///     while let Some(item) = list.next().await.transpose()? {
8499    ///         println!("{:?}", item);
8500    ///     }
8501    ///     Ok(())
8502    /// }
8503    /// ```
8504    pub fn list_tools(&self) -> super::builder::tools::ListTools {
8505        super::builder::tools::ListTools::new(self.inner.clone())
8506    }
8507
8508    /// Deletes a tool.
8509    ///
8510    /// # Example
8511    /// ```
8512    /// # use google_cloud_dialogflow_v2::client::Tools;
8513    /// use google_cloud_dialogflow_v2::Result;
8514    /// async fn sample(
8515    ///    client: &Tools, name: &str
8516    /// ) -> Result<()> {
8517    ///     client.delete_tool()
8518    ///         .set_name(name)
8519    ///         .send().await?;
8520    ///     Ok(())
8521    /// }
8522    /// ```
8523    pub fn delete_tool(&self) -> super::builder::tools::DeleteTool {
8524        super::builder::tools::DeleteTool::new(self.inner.clone())
8525    }
8526
8527    /// Updates a tool.
8528    ///
8529    /// # Example
8530    /// ```
8531    /// # use google_cloud_dialogflow_v2::client::Tools;
8532    /// # extern crate wkt as google_cloud_wkt;
8533    /// use google_cloud_wkt::FieldMask;
8534    /// use google_cloud_dialogflow_v2::model::Tool;
8535    /// use google_cloud_dialogflow_v2::Result;
8536    /// async fn sample(
8537    ///    client: &Tools, name: &str
8538    /// ) -> Result<()> {
8539    ///     let response = client.update_tool()
8540    ///         .set_tool(
8541    ///             Tool::new().set_name(name)/* set fields */
8542    ///         )
8543    ///         .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
8544    ///         .send().await?;
8545    ///     println!("response {:?}", response);
8546    ///     Ok(())
8547    /// }
8548    /// ```
8549    pub fn update_tool(&self) -> super::builder::tools::UpdateTool {
8550        super::builder::tools::UpdateTool::new(self.inner.clone())
8551    }
8552
8553    /// Lists information about the supported locations for this service.
8554    ///
8555    /// This method lists locations based on the resource scope provided in
8556    /// the [ListLocationsRequest.name] field:
8557    ///
8558    /// * **Global locations**: If `name` is empty, the method lists the
8559    ///   public locations available to all projects. * **Project-specific
8560    ///   locations**: If `name` follows the format
8561    ///   `projects/{project}`, the method lists locations visible to that
8562    ///   specific project. This includes public, private, or other
8563    ///   project-specific locations enabled for the project.
8564    ///
8565    /// For gRPC and client library implementations, the resource name is
8566    /// passed as the `name` field. For direct service calls, the resource
8567    /// name is
8568    /// incorporated into the request path based on the specific service
8569    /// implementation and version.
8570    ///
8571    /// # Example
8572    /// ```
8573    /// # use google_cloud_dialogflow_v2::client::Tools;
8574    /// use google_cloud_gax::paginator::ItemPaginator as _;
8575    /// use google_cloud_dialogflow_v2::Result;
8576    /// async fn sample(
8577    ///    client: &Tools
8578    /// ) -> Result<()> {
8579    ///     let mut list = client.list_locations()
8580    ///         /* set fields */
8581    ///         .by_item();
8582    ///     while let Some(item) = list.next().await.transpose()? {
8583    ///         println!("{:?}", item);
8584    ///     }
8585    ///     Ok(())
8586    /// }
8587    /// ```
8588    pub fn list_locations(&self) -> super::builder::tools::ListLocations {
8589        super::builder::tools::ListLocations::new(self.inner.clone())
8590    }
8591
8592    /// Gets information about a location.
8593    ///
8594    /// # Example
8595    /// ```
8596    /// # use google_cloud_dialogflow_v2::client::Tools;
8597    /// use google_cloud_dialogflow_v2::Result;
8598    /// async fn sample(
8599    ///    client: &Tools
8600    /// ) -> Result<()> {
8601    ///     let response = client.get_location()
8602    ///         /* set fields */
8603    ///         .send().await?;
8604    ///     println!("response {:?}", response);
8605    ///     Ok(())
8606    /// }
8607    /// ```
8608    pub fn get_location(&self) -> super::builder::tools::GetLocation {
8609        super::builder::tools::GetLocation::new(self.inner.clone())
8610    }
8611
8612    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
8613    ///
8614    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
8615    ///
8616    /// # Example
8617    /// ```
8618    /// # use google_cloud_dialogflow_v2::client::Tools;
8619    /// use google_cloud_gax::paginator::ItemPaginator as _;
8620    /// use google_cloud_dialogflow_v2::Result;
8621    /// async fn sample(
8622    ///    client: &Tools
8623    /// ) -> Result<()> {
8624    ///     let mut list = client.list_operations()
8625    ///         /* set fields */
8626    ///         .by_item();
8627    ///     while let Some(item) = list.next().await.transpose()? {
8628    ///         println!("{:?}", item);
8629    ///     }
8630    ///     Ok(())
8631    /// }
8632    /// ```
8633    pub fn list_operations(&self) -> super::builder::tools::ListOperations {
8634        super::builder::tools::ListOperations::new(self.inner.clone())
8635    }
8636
8637    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
8638    ///
8639    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
8640    ///
8641    /// # Example
8642    /// ```
8643    /// # use google_cloud_dialogflow_v2::client::Tools;
8644    /// use google_cloud_dialogflow_v2::Result;
8645    /// async fn sample(
8646    ///    client: &Tools
8647    /// ) -> Result<()> {
8648    ///     let response = client.get_operation()
8649    ///         /* set fields */
8650    ///         .send().await?;
8651    ///     println!("response {:?}", response);
8652    ///     Ok(())
8653    /// }
8654    /// ```
8655    pub fn get_operation(&self) -> super::builder::tools::GetOperation {
8656        super::builder::tools::GetOperation::new(self.inner.clone())
8657    }
8658
8659    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
8660    ///
8661    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
8662    ///
8663    /// # Example
8664    /// ```
8665    /// # use google_cloud_dialogflow_v2::client::Tools;
8666    /// use google_cloud_dialogflow_v2::Result;
8667    /// async fn sample(
8668    ///    client: &Tools
8669    /// ) -> Result<()> {
8670    ///     client.cancel_operation()
8671    ///         /* set fields */
8672    ///         .send().await?;
8673    ///     Ok(())
8674    /// }
8675    /// ```
8676    pub fn cancel_operation(&self) -> super::builder::tools::CancelOperation {
8677        super::builder::tools::CancelOperation::new(self.inner.clone())
8678    }
8679}
8680
8681/// Implements a client for the Dialogflow API.
8682///
8683/// # Example
8684/// ```
8685/// # use google_cloud_dialogflow_v2::client::Versions;
8686/// use google_cloud_gax::paginator::ItemPaginator as _;
8687/// # async fn sample() -> Result<(), Box<dyn std::error::Error>> {
8688///     let client = Versions::builder().build().await?;
8689///     let parent = "parent_value";
8690///     let mut list = client.list_versions()
8691///         .set_parent(parent)
8692///         .by_item();
8693///     while let Some(item) = list.next().await.transpose()? {
8694///         println!("{:?}", item);
8695///     }
8696/// # Ok(()) }
8697/// ```
8698///
8699/// # Service Description
8700///
8701/// Service for managing [Versions][google.cloud.dialogflow.v2.Version].
8702///
8703/// [google.cloud.dialogflow.v2.Version]: crate::model::Version
8704///
8705/// # Configuration
8706///
8707/// To configure `Versions` use the `with_*` methods in the type returned
8708/// by [builder()][Versions::builder]. The default configuration should
8709/// work for most applications. Common configuration changes include
8710///
8711/// * [with_endpoint()]: by default this client uses the global default endpoint
8712///   (`https://dialogflow.googleapis.com`). Applications using regional
8713///   endpoints or running in restricted networks (e.g. a network configured
8714//    with [Private Google Access with VPC Service Controls]) may want to
8715///   override this default.
8716/// * [with_credentials()]: by default this client uses
8717///   [Application Default Credentials]. Applications using custom
8718///   authentication may need to override this default.
8719///
8720/// [with_endpoint()]: super::builder::versions::ClientBuilder::with_endpoint
8721/// [with_credentials()]: super::builder::versions::ClientBuilder::with_credentials
8722/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
8723/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
8724///
8725/// # Pooling and Cloning
8726///
8727/// `Versions` holds a connection pool internally, it is advised to
8728/// create one and reuse it. You do not need to wrap `Versions` in
8729/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
8730/// already uses an `Arc` internally.
8731#[cfg(feature = "versions")]
8732#[cfg_attr(docsrs, doc(cfg(feature = "versions")))]
8733#[derive(Clone, Debug)]
8734pub struct Versions {
8735    inner: std::sync::Arc<dyn super::stub::dynamic::Versions>,
8736}
8737
8738#[cfg(feature = "versions")]
8739impl Versions {
8740    /// Returns a builder for [Versions].
8741    ///
8742    /// ```
8743    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
8744    /// # use google_cloud_dialogflow_v2::client::Versions;
8745    /// let client = Versions::builder().build().await?;
8746    /// # Ok(()) }
8747    /// ```
8748    pub fn builder() -> super::builder::versions::ClientBuilder {
8749        crate::new_client_builder(super::builder::versions::client::Factory)
8750    }
8751
8752    /// Creates a new client from the provided stub.
8753    ///
8754    /// The most common case for calling this function is in tests mocking the
8755    /// client's behavior.
8756    pub fn from_stub<T>(stub: T) -> Self
8757    where
8758        T: super::stub::Versions + 'static,
8759    {
8760        Self {
8761            inner: std::sync::Arc::new(stub),
8762        }
8763    }
8764
8765    pub(crate) async fn new(
8766        config: gaxi::options::ClientConfig,
8767    ) -> crate::ClientBuilderResult<Self> {
8768        let inner = Self::build_inner(config).await?;
8769        Ok(Self { inner })
8770    }
8771
8772    async fn build_inner(
8773        conf: gaxi::options::ClientConfig,
8774    ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::Versions>> {
8775        if gaxi::options::tracing_enabled(&conf) {
8776            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
8777        }
8778        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
8779    }
8780
8781    async fn build_transport(
8782        conf: gaxi::options::ClientConfig,
8783    ) -> crate::ClientBuilderResult<impl super::stub::Versions> {
8784        super::transport::Versions::new(conf).await
8785    }
8786
8787    async fn build_with_tracing(
8788        conf: gaxi::options::ClientConfig,
8789    ) -> crate::ClientBuilderResult<impl super::stub::Versions> {
8790        Self::build_transport(conf)
8791            .await
8792            .map(super::tracing::Versions::new)
8793    }
8794
8795    /// Returns the list of all versions of the specified agent.
8796    ///
8797    /// # Example
8798    /// ```
8799    /// # use google_cloud_dialogflow_v2::client::Versions;
8800    /// use google_cloud_gax::paginator::ItemPaginator as _;
8801    /// use google_cloud_dialogflow_v2::Result;
8802    /// async fn sample(
8803    ///    client: &Versions, parent: &str
8804    /// ) -> Result<()> {
8805    ///     let mut list = client.list_versions()
8806    ///         .set_parent(parent)
8807    ///         .by_item();
8808    ///     while let Some(item) = list.next().await.transpose()? {
8809    ///         println!("{:?}", item);
8810    ///     }
8811    ///     Ok(())
8812    /// }
8813    /// ```
8814    pub fn list_versions(&self) -> super::builder::versions::ListVersions {
8815        super::builder::versions::ListVersions::new(self.inner.clone())
8816    }
8817
8818    /// Retrieves the specified agent version.
8819    ///
8820    /// # Example
8821    /// ```
8822    /// # use google_cloud_dialogflow_v2::client::Versions;
8823    /// use google_cloud_dialogflow_v2::Result;
8824    /// async fn sample(
8825    ///    client: &Versions, name: &str
8826    /// ) -> Result<()> {
8827    ///     let response = client.get_version()
8828    ///         .set_name(name)
8829    ///         .send().await?;
8830    ///     println!("response {:?}", response);
8831    ///     Ok(())
8832    /// }
8833    /// ```
8834    pub fn get_version(&self) -> super::builder::versions::GetVersion {
8835        super::builder::versions::GetVersion::new(self.inner.clone())
8836    }
8837
8838    /// Creates an agent version.
8839    ///
8840    /// The new version points to the agent instance in the "default" environment.
8841    ///
8842    /// # Example
8843    /// ```
8844    /// # use google_cloud_dialogflow_v2::client::Versions;
8845    /// use google_cloud_dialogflow_v2::model::Version;
8846    /// use google_cloud_dialogflow_v2::Result;
8847    /// async fn sample(
8848    ///    client: &Versions, parent: &str
8849    /// ) -> Result<()> {
8850    ///     let response = client.create_version()
8851    ///         .set_parent(parent)
8852    ///         .set_version(
8853    ///             Version::new()/* set fields */
8854    ///         )
8855    ///         .send().await?;
8856    ///     println!("response {:?}", response);
8857    ///     Ok(())
8858    /// }
8859    /// ```
8860    pub fn create_version(&self) -> super::builder::versions::CreateVersion {
8861        super::builder::versions::CreateVersion::new(self.inner.clone())
8862    }
8863
8864    /// Updates the specified agent version.
8865    ///
8866    /// Note that this method does not allow you to update the state of the agent
8867    /// the given version points to. It allows you to update only mutable
8868    /// properties of the version resource.
8869    ///
8870    /// # Example
8871    /// ```
8872    /// # use google_cloud_dialogflow_v2::client::Versions;
8873    /// # extern crate wkt as google_cloud_wkt;
8874    /// use google_cloud_wkt::FieldMask;
8875    /// use google_cloud_dialogflow_v2::model::Version;
8876    /// use google_cloud_dialogflow_v2::Result;
8877    /// async fn sample(
8878    ///    client: &Versions, name: &str
8879    /// ) -> Result<()> {
8880    ///     let response = client.update_version()
8881    ///         .set_version(
8882    ///             Version::new().set_name(name)/* set fields */
8883    ///         )
8884    ///         .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
8885    ///         .send().await?;
8886    ///     println!("response {:?}", response);
8887    ///     Ok(())
8888    /// }
8889    /// ```
8890    pub fn update_version(&self) -> super::builder::versions::UpdateVersion {
8891        super::builder::versions::UpdateVersion::new(self.inner.clone())
8892    }
8893
8894    /// Delete the specified agent version.
8895    ///
8896    /// # Example
8897    /// ```
8898    /// # use google_cloud_dialogflow_v2::client::Versions;
8899    /// use google_cloud_dialogflow_v2::Result;
8900    /// async fn sample(
8901    ///    client: &Versions, name: &str
8902    /// ) -> Result<()> {
8903    ///     client.delete_version()
8904    ///         .set_name(name)
8905    ///         .send().await?;
8906    ///     Ok(())
8907    /// }
8908    /// ```
8909    pub fn delete_version(&self) -> super::builder::versions::DeleteVersion {
8910        super::builder::versions::DeleteVersion::new(self.inner.clone())
8911    }
8912
8913    /// Lists information about the supported locations for this service.
8914    ///
8915    /// This method lists locations based on the resource scope provided in
8916    /// the [ListLocationsRequest.name] field:
8917    ///
8918    /// * **Global locations**: If `name` is empty, the method lists the
8919    ///   public locations available to all projects. * **Project-specific
8920    ///   locations**: If `name` follows the format
8921    ///   `projects/{project}`, the method lists locations visible to that
8922    ///   specific project. This includes public, private, or other
8923    ///   project-specific locations enabled for the project.
8924    ///
8925    /// For gRPC and client library implementations, the resource name is
8926    /// passed as the `name` field. For direct service calls, the resource
8927    /// name is
8928    /// incorporated into the request path based on the specific service
8929    /// implementation and version.
8930    ///
8931    /// # Example
8932    /// ```
8933    /// # use google_cloud_dialogflow_v2::client::Versions;
8934    /// use google_cloud_gax::paginator::ItemPaginator as _;
8935    /// use google_cloud_dialogflow_v2::Result;
8936    /// async fn sample(
8937    ///    client: &Versions
8938    /// ) -> Result<()> {
8939    ///     let mut list = client.list_locations()
8940    ///         /* set fields */
8941    ///         .by_item();
8942    ///     while let Some(item) = list.next().await.transpose()? {
8943    ///         println!("{:?}", item);
8944    ///     }
8945    ///     Ok(())
8946    /// }
8947    /// ```
8948    pub fn list_locations(&self) -> super::builder::versions::ListLocations {
8949        super::builder::versions::ListLocations::new(self.inner.clone())
8950    }
8951
8952    /// Gets information about a location.
8953    ///
8954    /// # Example
8955    /// ```
8956    /// # use google_cloud_dialogflow_v2::client::Versions;
8957    /// use google_cloud_dialogflow_v2::Result;
8958    /// async fn sample(
8959    ///    client: &Versions
8960    /// ) -> Result<()> {
8961    ///     let response = client.get_location()
8962    ///         /* set fields */
8963    ///         .send().await?;
8964    ///     println!("response {:?}", response);
8965    ///     Ok(())
8966    /// }
8967    /// ```
8968    pub fn get_location(&self) -> super::builder::versions::GetLocation {
8969        super::builder::versions::GetLocation::new(self.inner.clone())
8970    }
8971
8972    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
8973    ///
8974    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
8975    ///
8976    /// # Example
8977    /// ```
8978    /// # use google_cloud_dialogflow_v2::client::Versions;
8979    /// use google_cloud_gax::paginator::ItemPaginator as _;
8980    /// use google_cloud_dialogflow_v2::Result;
8981    /// async fn sample(
8982    ///    client: &Versions
8983    /// ) -> Result<()> {
8984    ///     let mut list = client.list_operations()
8985    ///         /* set fields */
8986    ///         .by_item();
8987    ///     while let Some(item) = list.next().await.transpose()? {
8988    ///         println!("{:?}", item);
8989    ///     }
8990    ///     Ok(())
8991    /// }
8992    /// ```
8993    pub fn list_operations(&self) -> super::builder::versions::ListOperations {
8994        super::builder::versions::ListOperations::new(self.inner.clone())
8995    }
8996
8997    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
8998    ///
8999    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
9000    ///
9001    /// # Example
9002    /// ```
9003    /// # use google_cloud_dialogflow_v2::client::Versions;
9004    /// use google_cloud_dialogflow_v2::Result;
9005    /// async fn sample(
9006    ///    client: &Versions
9007    /// ) -> Result<()> {
9008    ///     let response = client.get_operation()
9009    ///         /* set fields */
9010    ///         .send().await?;
9011    ///     println!("response {:?}", response);
9012    ///     Ok(())
9013    /// }
9014    /// ```
9015    pub fn get_operation(&self) -> super::builder::versions::GetOperation {
9016        super::builder::versions::GetOperation::new(self.inner.clone())
9017    }
9018
9019    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
9020    ///
9021    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
9022    ///
9023    /// # Example
9024    /// ```
9025    /// # use google_cloud_dialogflow_v2::client::Versions;
9026    /// use google_cloud_dialogflow_v2::Result;
9027    /// async fn sample(
9028    ///    client: &Versions
9029    /// ) -> Result<()> {
9030    ///     client.cancel_operation()
9031    ///         /* set fields */
9032    ///         .send().await?;
9033    ///     Ok(())
9034    /// }
9035    /// ```
9036    pub fn cancel_operation(&self) -> super::builder::versions::CancelOperation {
9037        super::builder::versions::CancelOperation::new(self.inner.clone())
9038    }
9039}