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