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/// # async fn sample() -> gax::client_builder::Result<()> {
24/// # use google_cloud_dialogflow_v2::client::Agents;
25/// let client = Agents::builder().build().await?;
26/// // use `client` to make requests to the Dialogflow API.
27/// # Ok(()) }
28/// ```
29///
30/// # Service Description
31///
32/// Service for managing [Agents][google.cloud.dialogflow.v2.Agent].
33///
34/// [google.cloud.dialogflow.v2.Agent]: crate::model::Agent
35///
36/// # Configuration
37///
38/// To configure `Agents` use the `with_*` methods in the type returned
39/// by [builder()][Agents::builder]. The default configuration should
40/// work for most applications. Common configuration changes include
41///
42/// * [with_endpoint()]: by default this client uses the global default endpoint
43///   (`https://dialogflow.googleapis.com`). Applications using regional
44///   endpoints or running in restricted networks (e.g. a network configured
45//    with [Private Google Access with VPC Service Controls]) may want to
46///   override this default.
47/// * [with_credentials()]: by default this client uses
48///   [Application Default Credentials]. Applications using custom
49///   authentication may need to override this default.
50///
51/// [with_endpoint()]: super::builder::agents::ClientBuilder::with_endpoint
52/// [with_credentials()]: super::builder::agents::ClientBuilder::credentials
53/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
54/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
55///
56/// # Pooling and Cloning
57///
58/// `Agents` holds a connection pool internally, it is advised to
59/// create one and the reuse it.  You do not need to wrap `Agents` in
60/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
61/// already uses an `Arc` internally.
62#[cfg(feature = "agents")]
63#[cfg_attr(docsrs, doc(cfg(feature = "agents")))]
64#[derive(Clone, Debug)]
65pub struct Agents {
66    inner: std::sync::Arc<dyn super::stub::dynamic::Agents>,
67}
68
69#[cfg(feature = "agents")]
70impl Agents {
71    /// Returns a builder for [Agents].
72    ///
73    /// ```
74    /// # async fn sample() -> gax::client_builder::Result<()> {
75    /// # use google_cloud_dialogflow_v2::client::Agents;
76    /// let client = Agents::builder().build().await?;
77    /// # Ok(()) }
78    /// ```
79    pub fn builder() -> super::builder::agents::ClientBuilder {
80        gax::client_builder::internal::new_builder(super::builder::agents::client::Factory)
81    }
82
83    /// Creates a new client from the provided stub.
84    ///
85    /// The most common case for calling this function is in tests mocking the
86    /// client's behavior.
87    pub fn from_stub<T>(stub: T) -> Self
88    where
89        T: super::stub::Agents + 'static,
90    {
91        Self {
92            inner: std::sync::Arc::new(stub),
93        }
94    }
95
96    pub(crate) async fn new(
97        config: gaxi::options::ClientConfig,
98    ) -> gax::client_builder::Result<Self> {
99        let inner = Self::build_inner(config).await?;
100        Ok(Self { inner })
101    }
102
103    async fn build_inner(
104        conf: gaxi::options::ClientConfig,
105    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::Agents>> {
106        if gaxi::options::tracing_enabled(&conf) {
107            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
108        }
109        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
110    }
111
112    async fn build_transport(
113        conf: gaxi::options::ClientConfig,
114    ) -> gax::client_builder::Result<impl super::stub::Agents> {
115        super::transport::Agents::new(conf).await
116    }
117
118    async fn build_with_tracing(
119        conf: gaxi::options::ClientConfig,
120    ) -> gax::client_builder::Result<impl super::stub::Agents> {
121        Self::build_transport(conf)
122            .await
123            .map(super::tracing::Agents::new)
124    }
125
126    /// Retrieves the specified agent.
127    pub fn get_agent(&self) -> super::builder::agents::GetAgent {
128        super::builder::agents::GetAgent::new(self.inner.clone())
129    }
130
131    /// Creates/updates the specified agent.
132    ///
133    /// Note: You should always train an agent prior to sending it queries. See the
134    /// [training
135    /// documentation](https://cloud.google.com/dialogflow/es/docs/training).
136    pub fn set_agent(&self) -> super::builder::agents::SetAgent {
137        super::builder::agents::SetAgent::new(self.inner.clone())
138    }
139
140    /// Deletes the specified agent.
141    pub fn delete_agent(&self) -> super::builder::agents::DeleteAgent {
142        super::builder::agents::DeleteAgent::new(self.inner.clone())
143    }
144
145    /// Returns the list of agents.
146    ///
147    /// Since there is at most one conversational agent per project, this method is
148    /// useful primarily for listing all agents across projects the caller has
149    /// access to. One can achieve that with a wildcard project collection id "-".
150    /// Refer to [List
151    /// Sub-Collections](https://cloud.google.com/apis/design/design_patterns#list_sub-collections).
152    pub fn search_agents(&self) -> super::builder::agents::SearchAgents {
153        super::builder::agents::SearchAgents::new(self.inner.clone())
154    }
155
156    /// Trains the specified agent.
157    ///
158    /// This method is a [long-running
159    /// operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations).
160    /// The returned `Operation` type has the following method-specific fields:
161    ///
162    /// - `metadata`: An empty [Struct
163    ///   message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct)
164    /// - `response`: An [Empty
165    ///   message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
166    ///
167    /// Note: You should always train an agent prior to sending it queries. See the
168    /// [training
169    /// documentation](https://cloud.google.com/dialogflow/es/docs/training).
170    ///
171    /// # Long running operations
172    ///
173    /// This method is used to start, and/or poll a [long-running Operation].
174    /// The [Working with long-running operations] chapter in the [user guide]
175    /// covers these operations in detail.
176    ///
177    /// [long-running operation]: https://google.aip.dev/151
178    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
179    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
180    pub fn train_agent(&self) -> super::builder::agents::TrainAgent {
181        super::builder::agents::TrainAgent::new(self.inner.clone())
182    }
183
184    /// Exports the specified agent to a ZIP file.
185    ///
186    /// This method is a [long-running
187    /// operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations).
188    /// The returned `Operation` type has the following method-specific fields:
189    ///
190    /// - `metadata`: An empty [Struct
191    ///   message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct)
192    /// - `response`:
193    ///   [ExportAgentResponse][google.cloud.dialogflow.v2.ExportAgentResponse]
194    ///
195    /// [google.cloud.dialogflow.v2.ExportAgentResponse]: crate::model::ExportAgentResponse
196    ///
197    /// # Long running operations
198    ///
199    /// This method is used to start, and/or poll a [long-running Operation].
200    /// The [Working with long-running operations] chapter in the [user guide]
201    /// covers these operations in detail.
202    ///
203    /// [long-running operation]: https://google.aip.dev/151
204    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
205    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
206    pub fn export_agent(&self) -> super::builder::agents::ExportAgent {
207        super::builder::agents::ExportAgent::new(self.inner.clone())
208    }
209
210    /// Imports the specified agent from a ZIP file.
211    ///
212    /// Uploads new intents and entity types without deleting the existing ones.
213    /// Intents and entity types with the same name are replaced with the new
214    /// versions from
215    /// [ImportAgentRequest][google.cloud.dialogflow.v2.ImportAgentRequest]. After
216    /// the import, the imported draft agent will be trained automatically (unless
217    /// disabled in agent settings). However, once the import is done, training may
218    /// not be completed yet. Please call
219    /// [TrainAgent][google.cloud.dialogflow.v2.Agents.TrainAgent] and wait for the
220    /// operation it returns in order to train explicitly.
221    ///
222    /// This method is a [long-running
223    /// operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations).
224    /// The returned `Operation` type has the following method-specific fields:
225    ///
226    /// - `metadata`: An empty [Struct
227    ///   message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct)
228    /// - `response`: An [Empty
229    ///   message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
230    ///
231    /// The operation only tracks when importing is complete, not when it is done
232    /// training.
233    ///
234    /// Note: You should always train an agent prior to sending it queries. See the
235    /// [training
236    /// documentation](https://cloud.google.com/dialogflow/es/docs/training).
237    ///
238    /// [google.cloud.dialogflow.v2.Agents.TrainAgent]: crate::client::Agents::train_agent
239    /// [google.cloud.dialogflow.v2.ImportAgentRequest]: crate::model::ImportAgentRequest
240    ///
241    /// # Long running operations
242    ///
243    /// This method is used to start, and/or poll a [long-running Operation].
244    /// The [Working with long-running operations] chapter in the [user guide]
245    /// covers these operations in detail.
246    ///
247    /// [long-running operation]: https://google.aip.dev/151
248    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
249    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
250    pub fn import_agent(&self) -> super::builder::agents::ImportAgent {
251        super::builder::agents::ImportAgent::new(self.inner.clone())
252    }
253
254    /// Restores the specified agent from a ZIP file.
255    ///
256    /// Replaces the current agent version with a new one. All the intents and
257    /// entity types in the older version are deleted. After the restore, the
258    /// restored draft agent will be trained automatically (unless disabled in
259    /// agent settings). However, once the restore is done, training may not be
260    /// completed yet. Please call
261    /// [TrainAgent][google.cloud.dialogflow.v2.Agents.TrainAgent] and wait for the
262    /// operation it returns in order to train explicitly.
263    ///
264    /// This method is a [long-running
265    /// operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations).
266    /// The returned `Operation` type has the following method-specific fields:
267    ///
268    /// - `metadata`: An empty [Struct
269    ///   message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct)
270    /// - `response`: An [Empty
271    ///   message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
272    ///
273    /// The operation only tracks when restoring is complete, not when it is done
274    /// training.
275    ///
276    /// Note: You should always train an agent prior to sending it queries. See the
277    /// [training
278    /// documentation](https://cloud.google.com/dialogflow/es/docs/training).
279    ///
280    /// [google.cloud.dialogflow.v2.Agents.TrainAgent]: crate::client::Agents::train_agent
281    ///
282    /// # Long running operations
283    ///
284    /// This method is used to start, and/or poll a [long-running Operation].
285    /// The [Working with long-running operations] chapter in the [user guide]
286    /// covers these operations in detail.
287    ///
288    /// [long-running operation]: https://google.aip.dev/151
289    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
290    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
291    pub fn restore_agent(&self) -> super::builder::agents::RestoreAgent {
292        super::builder::agents::RestoreAgent::new(self.inner.clone())
293    }
294
295    /// Gets agent validation result. Agent validation is performed during
296    /// training time and is updated automatically when training is completed.
297    pub fn get_validation_result(&self) -> super::builder::agents::GetValidationResult {
298        super::builder::agents::GetValidationResult::new(self.inner.clone())
299    }
300
301    /// Lists information about the supported locations for this service.
302    pub fn list_locations(&self) -> super::builder::agents::ListLocations {
303        super::builder::agents::ListLocations::new(self.inner.clone())
304    }
305
306    /// Gets information about a location.
307    pub fn get_location(&self) -> super::builder::agents::GetLocation {
308        super::builder::agents::GetLocation::new(self.inner.clone())
309    }
310
311    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
312    ///
313    /// [google.longrunning.Operations]: longrunning::client::Operations
314    pub fn list_operations(&self) -> super::builder::agents::ListOperations {
315        super::builder::agents::ListOperations::new(self.inner.clone())
316    }
317
318    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
319    ///
320    /// [google.longrunning.Operations]: longrunning::client::Operations
321    pub fn get_operation(&self) -> super::builder::agents::GetOperation {
322        super::builder::agents::GetOperation::new(self.inner.clone())
323    }
324
325    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
326    ///
327    /// [google.longrunning.Operations]: longrunning::client::Operations
328    pub fn cancel_operation(&self) -> super::builder::agents::CancelOperation {
329        super::builder::agents::CancelOperation::new(self.inner.clone())
330    }
331}
332
333/// Implements a client for the Dialogflow API.
334///
335/// # Example
336/// ```
337/// # async fn sample() -> gax::client_builder::Result<()> {
338/// # use google_cloud_dialogflow_v2::client::AnswerRecords;
339/// let client = AnswerRecords::builder().build().await?;
340/// // use `client` to make requests to the Dialogflow API.
341/// # Ok(()) }
342/// ```
343///
344/// # Service Description
345///
346/// Service for managing
347/// [AnswerRecords][google.cloud.dialogflow.v2.AnswerRecord].
348///
349/// [google.cloud.dialogflow.v2.AnswerRecord]: crate::model::AnswerRecord
350///
351/// # Configuration
352///
353/// To configure `AnswerRecords` use the `with_*` methods in the type returned
354/// by [builder()][AnswerRecords::builder]. The default configuration should
355/// work for most applications. Common configuration changes include
356///
357/// * [with_endpoint()]: by default this client uses the global default endpoint
358///   (`https://dialogflow.googleapis.com`). Applications using regional
359///   endpoints or running in restricted networks (e.g. a network configured
360//    with [Private Google Access with VPC Service Controls]) may want to
361///   override this default.
362/// * [with_credentials()]: by default this client uses
363///   [Application Default Credentials]. Applications using custom
364///   authentication may need to override this default.
365///
366/// [with_endpoint()]: super::builder::answer_records::ClientBuilder::with_endpoint
367/// [with_credentials()]: super::builder::answer_records::ClientBuilder::credentials
368/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
369/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
370///
371/// # Pooling and Cloning
372///
373/// `AnswerRecords` holds a connection pool internally, it is advised to
374/// create one and the reuse it.  You do not need to wrap `AnswerRecords` in
375/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
376/// already uses an `Arc` internally.
377#[cfg(feature = "answer-records")]
378#[cfg_attr(docsrs, doc(cfg(feature = "answer-records")))]
379#[derive(Clone, Debug)]
380pub struct AnswerRecords {
381    inner: std::sync::Arc<dyn super::stub::dynamic::AnswerRecords>,
382}
383
384#[cfg(feature = "answer-records")]
385impl AnswerRecords {
386    /// Returns a builder for [AnswerRecords].
387    ///
388    /// ```
389    /// # async fn sample() -> gax::client_builder::Result<()> {
390    /// # use google_cloud_dialogflow_v2::client::AnswerRecords;
391    /// let client = AnswerRecords::builder().build().await?;
392    /// # Ok(()) }
393    /// ```
394    pub fn builder() -> super::builder::answer_records::ClientBuilder {
395        gax::client_builder::internal::new_builder(super::builder::answer_records::client::Factory)
396    }
397
398    /// Creates a new client from the provided stub.
399    ///
400    /// The most common case for calling this function is in tests mocking the
401    /// client's behavior.
402    pub fn from_stub<T>(stub: T) -> Self
403    where
404        T: super::stub::AnswerRecords + 'static,
405    {
406        Self {
407            inner: std::sync::Arc::new(stub),
408        }
409    }
410
411    pub(crate) async fn new(
412        config: gaxi::options::ClientConfig,
413    ) -> gax::client_builder::Result<Self> {
414        let inner = Self::build_inner(config).await?;
415        Ok(Self { inner })
416    }
417
418    async fn build_inner(
419        conf: gaxi::options::ClientConfig,
420    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::AnswerRecords>> {
421        if gaxi::options::tracing_enabled(&conf) {
422            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
423        }
424        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
425    }
426
427    async fn build_transport(
428        conf: gaxi::options::ClientConfig,
429    ) -> gax::client_builder::Result<impl super::stub::AnswerRecords> {
430        super::transport::AnswerRecords::new(conf).await
431    }
432
433    async fn build_with_tracing(
434        conf: gaxi::options::ClientConfig,
435    ) -> gax::client_builder::Result<impl super::stub::AnswerRecords> {
436        Self::build_transport(conf)
437            .await
438            .map(super::tracing::AnswerRecords::new)
439    }
440
441    /// Returns the list of all answer records in the specified project in reverse
442    /// chronological order.
443    pub fn list_answer_records(&self) -> super::builder::answer_records::ListAnswerRecords {
444        super::builder::answer_records::ListAnswerRecords::new(self.inner.clone())
445    }
446
447    /// Updates the specified answer record.
448    pub fn update_answer_record(&self) -> super::builder::answer_records::UpdateAnswerRecord {
449        super::builder::answer_records::UpdateAnswerRecord::new(self.inner.clone())
450    }
451
452    /// Lists information about the supported locations for this service.
453    pub fn list_locations(&self) -> super::builder::answer_records::ListLocations {
454        super::builder::answer_records::ListLocations::new(self.inner.clone())
455    }
456
457    /// Gets information about a location.
458    pub fn get_location(&self) -> super::builder::answer_records::GetLocation {
459        super::builder::answer_records::GetLocation::new(self.inner.clone())
460    }
461
462    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
463    ///
464    /// [google.longrunning.Operations]: longrunning::client::Operations
465    pub fn list_operations(&self) -> super::builder::answer_records::ListOperations {
466        super::builder::answer_records::ListOperations::new(self.inner.clone())
467    }
468
469    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
470    ///
471    /// [google.longrunning.Operations]: longrunning::client::Operations
472    pub fn get_operation(&self) -> super::builder::answer_records::GetOperation {
473        super::builder::answer_records::GetOperation::new(self.inner.clone())
474    }
475
476    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
477    ///
478    /// [google.longrunning.Operations]: longrunning::client::Operations
479    pub fn cancel_operation(&self) -> super::builder::answer_records::CancelOperation {
480        super::builder::answer_records::CancelOperation::new(self.inner.clone())
481    }
482}
483
484/// Implements a client for the Dialogflow API.
485///
486/// # Example
487/// ```
488/// # async fn sample() -> gax::client_builder::Result<()> {
489/// # use google_cloud_dialogflow_v2::client::Contexts;
490/// let client = Contexts::builder().build().await?;
491/// // use `client` to make requests to the Dialogflow API.
492/// # Ok(()) }
493/// ```
494///
495/// # Service Description
496///
497/// Service for managing [Contexts][google.cloud.dialogflow.v2.Context].
498///
499/// [google.cloud.dialogflow.v2.Context]: crate::model::Context
500///
501/// # Configuration
502///
503/// To configure `Contexts` use the `with_*` methods in the type returned
504/// by [builder()][Contexts::builder]. The default configuration should
505/// work for most applications. Common configuration changes include
506///
507/// * [with_endpoint()]: by default this client uses the global default endpoint
508///   (`https://dialogflow.googleapis.com`). Applications using regional
509///   endpoints or running in restricted networks (e.g. a network configured
510//    with [Private Google Access with VPC Service Controls]) may want to
511///   override this default.
512/// * [with_credentials()]: by default this client uses
513///   [Application Default Credentials]. Applications using custom
514///   authentication may need to override this default.
515///
516/// [with_endpoint()]: super::builder::contexts::ClientBuilder::with_endpoint
517/// [with_credentials()]: super::builder::contexts::ClientBuilder::credentials
518/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
519/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
520///
521/// # Pooling and Cloning
522///
523/// `Contexts` holds a connection pool internally, it is advised to
524/// create one and the reuse it.  You do not need to wrap `Contexts` in
525/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
526/// already uses an `Arc` internally.
527#[cfg(feature = "contexts")]
528#[cfg_attr(docsrs, doc(cfg(feature = "contexts")))]
529#[derive(Clone, Debug)]
530pub struct Contexts {
531    inner: std::sync::Arc<dyn super::stub::dynamic::Contexts>,
532}
533
534#[cfg(feature = "contexts")]
535impl Contexts {
536    /// Returns a builder for [Contexts].
537    ///
538    /// ```
539    /// # async fn sample() -> gax::client_builder::Result<()> {
540    /// # use google_cloud_dialogflow_v2::client::Contexts;
541    /// let client = Contexts::builder().build().await?;
542    /// # Ok(()) }
543    /// ```
544    pub fn builder() -> super::builder::contexts::ClientBuilder {
545        gax::client_builder::internal::new_builder(super::builder::contexts::client::Factory)
546    }
547
548    /// Creates a new client from the provided stub.
549    ///
550    /// The most common case for calling this function is in tests mocking the
551    /// client's behavior.
552    pub fn from_stub<T>(stub: T) -> Self
553    where
554        T: super::stub::Contexts + 'static,
555    {
556        Self {
557            inner: std::sync::Arc::new(stub),
558        }
559    }
560
561    pub(crate) async fn new(
562        config: gaxi::options::ClientConfig,
563    ) -> gax::client_builder::Result<Self> {
564        let inner = Self::build_inner(config).await?;
565        Ok(Self { inner })
566    }
567
568    async fn build_inner(
569        conf: gaxi::options::ClientConfig,
570    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::Contexts>> {
571        if gaxi::options::tracing_enabled(&conf) {
572            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
573        }
574        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
575    }
576
577    async fn build_transport(
578        conf: gaxi::options::ClientConfig,
579    ) -> gax::client_builder::Result<impl super::stub::Contexts> {
580        super::transport::Contexts::new(conf).await
581    }
582
583    async fn build_with_tracing(
584        conf: gaxi::options::ClientConfig,
585    ) -> gax::client_builder::Result<impl super::stub::Contexts> {
586        Self::build_transport(conf)
587            .await
588            .map(super::tracing::Contexts::new)
589    }
590
591    /// Returns the list of all contexts in the specified session.
592    pub fn list_contexts(&self) -> super::builder::contexts::ListContexts {
593        super::builder::contexts::ListContexts::new(self.inner.clone())
594    }
595
596    /// Retrieves the specified context.
597    pub fn get_context(&self) -> super::builder::contexts::GetContext {
598        super::builder::contexts::GetContext::new(self.inner.clone())
599    }
600
601    /// Creates a context.
602    ///
603    /// If the specified context already exists, overrides the context.
604    pub fn create_context(&self) -> super::builder::contexts::CreateContext {
605        super::builder::contexts::CreateContext::new(self.inner.clone())
606    }
607
608    /// Updates the specified context.
609    pub fn update_context(&self) -> super::builder::contexts::UpdateContext {
610        super::builder::contexts::UpdateContext::new(self.inner.clone())
611    }
612
613    /// Deletes the specified context.
614    pub fn delete_context(&self) -> super::builder::contexts::DeleteContext {
615        super::builder::contexts::DeleteContext::new(self.inner.clone())
616    }
617
618    /// Deletes all active contexts in the specified session.
619    pub fn delete_all_contexts(&self) -> super::builder::contexts::DeleteAllContexts {
620        super::builder::contexts::DeleteAllContexts::new(self.inner.clone())
621    }
622
623    /// Lists information about the supported locations for this service.
624    pub fn list_locations(&self) -> super::builder::contexts::ListLocations {
625        super::builder::contexts::ListLocations::new(self.inner.clone())
626    }
627
628    /// Gets information about a location.
629    pub fn get_location(&self) -> super::builder::contexts::GetLocation {
630        super::builder::contexts::GetLocation::new(self.inner.clone())
631    }
632
633    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
634    ///
635    /// [google.longrunning.Operations]: longrunning::client::Operations
636    pub fn list_operations(&self) -> super::builder::contexts::ListOperations {
637        super::builder::contexts::ListOperations::new(self.inner.clone())
638    }
639
640    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
641    ///
642    /// [google.longrunning.Operations]: longrunning::client::Operations
643    pub fn get_operation(&self) -> super::builder::contexts::GetOperation {
644        super::builder::contexts::GetOperation::new(self.inner.clone())
645    }
646
647    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
648    ///
649    /// [google.longrunning.Operations]: longrunning::client::Operations
650    pub fn cancel_operation(&self) -> super::builder::contexts::CancelOperation {
651        super::builder::contexts::CancelOperation::new(self.inner.clone())
652    }
653}
654
655/// Implements a client for the Dialogflow API.
656///
657/// # Example
658/// ```
659/// # async fn sample() -> gax::client_builder::Result<()> {
660/// # use google_cloud_dialogflow_v2::client::Conversations;
661/// let client = Conversations::builder().build().await?;
662/// // use `client` to make requests to the Dialogflow API.
663/// # Ok(()) }
664/// ```
665///
666/// # Service Description
667///
668/// Service for managing
669/// [Conversations][google.cloud.dialogflow.v2.Conversation].
670///
671/// [google.cloud.dialogflow.v2.Conversation]: crate::model::Conversation
672///
673/// # Configuration
674///
675/// To configure `Conversations` use the `with_*` methods in the type returned
676/// by [builder()][Conversations::builder]. The default configuration should
677/// work for most applications. Common configuration changes include
678///
679/// * [with_endpoint()]: by default this client uses the global default endpoint
680///   (`https://dialogflow.googleapis.com`). Applications using regional
681///   endpoints or running in restricted networks (e.g. a network configured
682//    with [Private Google Access with VPC Service Controls]) may want to
683///   override this default.
684/// * [with_credentials()]: by default this client uses
685///   [Application Default Credentials]. Applications using custom
686///   authentication may need to override this default.
687///
688/// [with_endpoint()]: super::builder::conversations::ClientBuilder::with_endpoint
689/// [with_credentials()]: super::builder::conversations::ClientBuilder::credentials
690/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
691/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
692///
693/// # Pooling and Cloning
694///
695/// `Conversations` holds a connection pool internally, it is advised to
696/// create one and the reuse it.  You do not need to wrap `Conversations` in
697/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
698/// already uses an `Arc` internally.
699#[cfg(feature = "conversations")]
700#[cfg_attr(docsrs, doc(cfg(feature = "conversations")))]
701#[derive(Clone, Debug)]
702pub struct Conversations {
703    inner: std::sync::Arc<dyn super::stub::dynamic::Conversations>,
704}
705
706#[cfg(feature = "conversations")]
707impl Conversations {
708    /// Returns a builder for [Conversations].
709    ///
710    /// ```
711    /// # async fn sample() -> gax::client_builder::Result<()> {
712    /// # use google_cloud_dialogflow_v2::client::Conversations;
713    /// let client = Conversations::builder().build().await?;
714    /// # Ok(()) }
715    /// ```
716    pub fn builder() -> super::builder::conversations::ClientBuilder {
717        gax::client_builder::internal::new_builder(super::builder::conversations::client::Factory)
718    }
719
720    /// Creates a new client from the provided stub.
721    ///
722    /// The most common case for calling this function is in tests mocking the
723    /// client's behavior.
724    pub fn from_stub<T>(stub: T) -> Self
725    where
726        T: super::stub::Conversations + 'static,
727    {
728        Self {
729            inner: std::sync::Arc::new(stub),
730        }
731    }
732
733    pub(crate) async fn new(
734        config: gaxi::options::ClientConfig,
735    ) -> gax::client_builder::Result<Self> {
736        let inner = Self::build_inner(config).await?;
737        Ok(Self { inner })
738    }
739
740    async fn build_inner(
741        conf: gaxi::options::ClientConfig,
742    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::Conversations>> {
743        if gaxi::options::tracing_enabled(&conf) {
744            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
745        }
746        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
747    }
748
749    async fn build_transport(
750        conf: gaxi::options::ClientConfig,
751    ) -> gax::client_builder::Result<impl super::stub::Conversations> {
752        super::transport::Conversations::new(conf).await
753    }
754
755    async fn build_with_tracing(
756        conf: gaxi::options::ClientConfig,
757    ) -> gax::client_builder::Result<impl super::stub::Conversations> {
758        Self::build_transport(conf)
759            .await
760            .map(super::tracing::Conversations::new)
761    }
762
763    /// Creates a new conversation. Conversations are auto-completed after 24
764    /// hours.
765    ///
766    /// Conversation Lifecycle:
767    /// There are two stages during a conversation: Automated Agent Stage and
768    /// Assist Stage.
769    ///
770    /// For Automated Agent Stage, there will be a dialogflow agent responding to
771    /// user queries.
772    ///
773    /// For Assist Stage, there's no dialogflow agent responding to user queries.
774    /// But we will provide suggestions which are generated from conversation.
775    ///
776    /// If
777    /// [Conversation.conversation_profile][google.cloud.dialogflow.v2.Conversation.conversation_profile]
778    /// is configured for a dialogflow agent, conversation will start from
779    /// `Automated Agent Stage`, otherwise, it will start from `Assist Stage`. And
780    /// during `Automated Agent Stage`, once an
781    /// [Intent][google.cloud.dialogflow.v2.Intent] with
782    /// [Intent.live_agent_handoff][google.cloud.dialogflow.v2.Intent.live_agent_handoff]
783    /// is triggered, conversation will transfer to Assist Stage.
784    ///
785    /// [google.cloud.dialogflow.v2.Conversation.conversation_profile]: crate::model::Conversation::conversation_profile
786    /// [google.cloud.dialogflow.v2.Intent]: crate::model::Intent
787    /// [google.cloud.dialogflow.v2.Intent.live_agent_handoff]: crate::model::Intent::live_agent_handoff
788    pub fn create_conversation(&self) -> super::builder::conversations::CreateConversation {
789        super::builder::conversations::CreateConversation::new(self.inner.clone())
790    }
791
792    /// Returns the list of all conversations in the specified project.
793    pub fn list_conversations(&self) -> super::builder::conversations::ListConversations {
794        super::builder::conversations::ListConversations::new(self.inner.clone())
795    }
796
797    /// Retrieves the specific conversation.
798    pub fn get_conversation(&self) -> super::builder::conversations::GetConversation {
799        super::builder::conversations::GetConversation::new(self.inner.clone())
800    }
801
802    /// Completes the specified conversation. Finished conversations are purged
803    /// from the database after 30 days.
804    pub fn complete_conversation(&self) -> super::builder::conversations::CompleteConversation {
805        super::builder::conversations::CompleteConversation::new(self.inner.clone())
806    }
807
808    /// Data ingestion API.
809    /// Ingests context references for an existing conversation.
810    pub fn ingest_context_references(
811        &self,
812    ) -> super::builder::conversations::IngestContextReferences {
813        super::builder::conversations::IngestContextReferences::new(self.inner.clone())
814    }
815
816    /// Lists messages that belong to a given conversation.
817    /// `messages` are ordered by `create_time` in descending order. To fetch
818    /// updates without duplication, send request with filter
819    /// `create_time_epoch_microseconds >
820    /// [first item's create_time of previous request]` and empty page_token.
821    pub fn list_messages(&self) -> super::builder::conversations::ListMessages {
822        super::builder::conversations::ListMessages::new(self.inner.clone())
823    }
824
825    /// Suggests summary for a conversation based on specific historical messages.
826    /// The range of the messages to be used for summary can be specified in the
827    /// request.
828    pub fn suggest_conversation_summary(
829        &self,
830    ) -> super::builder::conversations::SuggestConversationSummary {
831        super::builder::conversations::SuggestConversationSummary::new(self.inner.clone())
832    }
833
834    /// Generates and returns a summary for a conversation that does not have a
835    /// resource created for it.
836    pub fn generate_stateless_summary(
837        &self,
838    ) -> super::builder::conversations::GenerateStatelessSummary {
839        super::builder::conversations::GenerateStatelessSummary::new(self.inner.clone())
840    }
841
842    /// Generates and returns a suggestion for a conversation that does not have a
843    /// resource created for it.
844    pub fn generate_stateless_suggestion(
845        &self,
846    ) -> super::builder::conversations::GenerateStatelessSuggestion {
847        super::builder::conversations::GenerateStatelessSuggestion::new(self.inner.clone())
848    }
849
850    /// Get answers for the given query based on knowledge documents.
851    pub fn search_knowledge(&self) -> super::builder::conversations::SearchKnowledge {
852        super::builder::conversations::SearchKnowledge::new(self.inner.clone())
853    }
854
855    /// Generates all the suggestions using generators configured in the
856    /// conversation profile. A generator is used only if its trigger event is
857    /// matched.
858    pub fn generate_suggestions(&self) -> super::builder::conversations::GenerateSuggestions {
859        super::builder::conversations::GenerateSuggestions::new(self.inner.clone())
860    }
861
862    /// Lists information about the supported locations for this service.
863    pub fn list_locations(&self) -> super::builder::conversations::ListLocations {
864        super::builder::conversations::ListLocations::new(self.inner.clone())
865    }
866
867    /// Gets information about a location.
868    pub fn get_location(&self) -> super::builder::conversations::GetLocation {
869        super::builder::conversations::GetLocation::new(self.inner.clone())
870    }
871
872    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
873    ///
874    /// [google.longrunning.Operations]: longrunning::client::Operations
875    pub fn list_operations(&self) -> super::builder::conversations::ListOperations {
876        super::builder::conversations::ListOperations::new(self.inner.clone())
877    }
878
879    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
880    ///
881    /// [google.longrunning.Operations]: longrunning::client::Operations
882    pub fn get_operation(&self) -> super::builder::conversations::GetOperation {
883        super::builder::conversations::GetOperation::new(self.inner.clone())
884    }
885
886    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
887    ///
888    /// [google.longrunning.Operations]: longrunning::client::Operations
889    pub fn cancel_operation(&self) -> super::builder::conversations::CancelOperation {
890        super::builder::conversations::CancelOperation::new(self.inner.clone())
891    }
892}
893
894/// Implements a client for the Dialogflow API.
895///
896/// # Example
897/// ```
898/// # async fn sample() -> gax::client_builder::Result<()> {
899/// # use google_cloud_dialogflow_v2::client::ConversationDatasets;
900/// let client = ConversationDatasets::builder().build().await?;
901/// // use `client` to make requests to the Dialogflow API.
902/// # Ok(()) }
903/// ```
904///
905/// # Service Description
906///
907/// Conversation datasets.
908///
909/// Conversation datasets contain raw conversation files and their
910/// customizable metadata that can be used for model training.
911///
912/// # Configuration
913///
914/// To configure `ConversationDatasets` use the `with_*` methods in the type returned
915/// by [builder()][ConversationDatasets::builder]. The default configuration should
916/// work for most applications. Common configuration changes include
917///
918/// * [with_endpoint()]: by default this client uses the global default endpoint
919///   (`https://dialogflow.googleapis.com`). Applications using regional
920///   endpoints or running in restricted networks (e.g. a network configured
921//    with [Private Google Access with VPC Service Controls]) may want to
922///   override this default.
923/// * [with_credentials()]: by default this client uses
924///   [Application Default Credentials]. Applications using custom
925///   authentication may need to override this default.
926///
927/// [with_endpoint()]: super::builder::conversation_datasets::ClientBuilder::with_endpoint
928/// [with_credentials()]: super::builder::conversation_datasets::ClientBuilder::credentials
929/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
930/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
931///
932/// # Pooling and Cloning
933///
934/// `ConversationDatasets` holds a connection pool internally, it is advised to
935/// create one and the reuse it.  You do not need to wrap `ConversationDatasets` in
936/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
937/// already uses an `Arc` internally.
938#[cfg(feature = "conversation-datasets")]
939#[cfg_attr(docsrs, doc(cfg(feature = "conversation-datasets")))]
940#[derive(Clone, Debug)]
941pub struct ConversationDatasets {
942    inner: std::sync::Arc<dyn super::stub::dynamic::ConversationDatasets>,
943}
944
945#[cfg(feature = "conversation-datasets")]
946impl ConversationDatasets {
947    /// Returns a builder for [ConversationDatasets].
948    ///
949    /// ```
950    /// # async fn sample() -> gax::client_builder::Result<()> {
951    /// # use google_cloud_dialogflow_v2::client::ConversationDatasets;
952    /// let client = ConversationDatasets::builder().build().await?;
953    /// # Ok(()) }
954    /// ```
955    pub fn builder() -> super::builder::conversation_datasets::ClientBuilder {
956        gax::client_builder::internal::new_builder(
957            super::builder::conversation_datasets::client::Factory,
958        )
959    }
960
961    /// Creates a new client from the provided stub.
962    ///
963    /// The most common case for calling this function is in tests mocking the
964    /// client's behavior.
965    pub fn from_stub<T>(stub: T) -> Self
966    where
967        T: super::stub::ConversationDatasets + 'static,
968    {
969        Self {
970            inner: std::sync::Arc::new(stub),
971        }
972    }
973
974    pub(crate) async fn new(
975        config: gaxi::options::ClientConfig,
976    ) -> gax::client_builder::Result<Self> {
977        let inner = Self::build_inner(config).await?;
978        Ok(Self { inner })
979    }
980
981    async fn build_inner(
982        conf: gaxi::options::ClientConfig,
983    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::ConversationDatasets>>
984    {
985        if gaxi::options::tracing_enabled(&conf) {
986            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
987        }
988        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
989    }
990
991    async fn build_transport(
992        conf: gaxi::options::ClientConfig,
993    ) -> gax::client_builder::Result<impl super::stub::ConversationDatasets> {
994        super::transport::ConversationDatasets::new(conf).await
995    }
996
997    async fn build_with_tracing(
998        conf: gaxi::options::ClientConfig,
999    ) -> gax::client_builder::Result<impl super::stub::ConversationDatasets> {
1000        Self::build_transport(conf)
1001            .await
1002            .map(super::tracing::ConversationDatasets::new)
1003    }
1004
1005    /// Creates a new conversation dataset.
1006    ///
1007    /// This method is a [long-running
1008    /// operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations).
1009    /// The returned `Operation` type has the following method-specific fields:
1010    ///
1011    /// - `metadata`:
1012    ///   [CreateConversationDatasetOperationMetadata][google.cloud.dialogflow.v2.CreateConversationDatasetOperationMetadata]
1013    /// - `response`:
1014    ///   [ConversationDataset][google.cloud.dialogflow.v2.ConversationDataset]
1015    ///
1016    /// [google.cloud.dialogflow.v2.ConversationDataset]: crate::model::ConversationDataset
1017    /// [google.cloud.dialogflow.v2.CreateConversationDatasetOperationMetadata]: crate::model::CreateConversationDatasetOperationMetadata
1018    ///
1019    /// # Long running operations
1020    ///
1021    /// This method is used to start, and/or poll a [long-running Operation].
1022    /// The [Working with long-running operations] chapter in the [user guide]
1023    /// covers these operations in detail.
1024    ///
1025    /// [long-running operation]: https://google.aip.dev/151
1026    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1027    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1028    pub fn create_conversation_dataset(
1029        &self,
1030    ) -> super::builder::conversation_datasets::CreateConversationDataset {
1031        super::builder::conversation_datasets::CreateConversationDataset::new(self.inner.clone())
1032    }
1033
1034    /// Retrieves the specified conversation dataset.
1035    pub fn get_conversation_dataset(
1036        &self,
1037    ) -> super::builder::conversation_datasets::GetConversationDataset {
1038        super::builder::conversation_datasets::GetConversationDataset::new(self.inner.clone())
1039    }
1040
1041    /// Returns the list of all conversation datasets in the specified
1042    /// project and location.
1043    pub fn list_conversation_datasets(
1044        &self,
1045    ) -> super::builder::conversation_datasets::ListConversationDatasets {
1046        super::builder::conversation_datasets::ListConversationDatasets::new(self.inner.clone())
1047    }
1048
1049    /// Deletes the specified conversation dataset.
1050    ///
1051    /// This method is a [long-running
1052    /// operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations).
1053    /// The returned `Operation` type has the following method-specific fields:
1054    ///
1055    /// - `metadata`:
1056    ///   [DeleteConversationDatasetOperationMetadata][google.cloud.dialogflow.v2.DeleteConversationDatasetOperationMetadata]
1057    /// - `response`: An [Empty
1058    ///   message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
1059    ///
1060    /// [google.cloud.dialogflow.v2.DeleteConversationDatasetOperationMetadata]: crate::model::DeleteConversationDatasetOperationMetadata
1061    ///
1062    /// # Long running operations
1063    ///
1064    /// This method is used to start, and/or poll a [long-running Operation].
1065    /// The [Working with long-running operations] chapter in the [user guide]
1066    /// covers these operations in detail.
1067    ///
1068    /// [long-running operation]: https://google.aip.dev/151
1069    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1070    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1071    pub fn delete_conversation_dataset(
1072        &self,
1073    ) -> super::builder::conversation_datasets::DeleteConversationDataset {
1074        super::builder::conversation_datasets::DeleteConversationDataset::new(self.inner.clone())
1075    }
1076
1077    /// Import data into the specified conversation dataset. Note that it
1078    /// is not allowed to import data to a conversation dataset that
1079    /// already has data in it.
1080    ///
1081    /// This method is a [long-running
1082    /// operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations).
1083    /// The returned `Operation` type has the following method-specific fields:
1084    ///
1085    /// - `metadata`:
1086    ///   [ImportConversationDataOperationMetadata][google.cloud.dialogflow.v2.ImportConversationDataOperationMetadata]
1087    /// - `response`:
1088    ///   [ImportConversationDataOperationResponse][google.cloud.dialogflow.v2.ImportConversationDataOperationResponse]
1089    ///
1090    /// [google.cloud.dialogflow.v2.ImportConversationDataOperationMetadata]: crate::model::ImportConversationDataOperationMetadata
1091    /// [google.cloud.dialogflow.v2.ImportConversationDataOperationResponse]: crate::model::ImportConversationDataOperationResponse
1092    ///
1093    /// # Long running operations
1094    ///
1095    /// This method is used to start, and/or poll a [long-running Operation].
1096    /// The [Working with long-running operations] chapter in the [user guide]
1097    /// covers these operations in detail.
1098    ///
1099    /// [long-running operation]: https://google.aip.dev/151
1100    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1101    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1102    pub fn import_conversation_data(
1103        &self,
1104    ) -> super::builder::conversation_datasets::ImportConversationData {
1105        super::builder::conversation_datasets::ImportConversationData::new(self.inner.clone())
1106    }
1107
1108    /// Lists information about the supported locations for this service.
1109    pub fn list_locations(&self) -> super::builder::conversation_datasets::ListLocations {
1110        super::builder::conversation_datasets::ListLocations::new(self.inner.clone())
1111    }
1112
1113    /// Gets information about a location.
1114    pub fn get_location(&self) -> super::builder::conversation_datasets::GetLocation {
1115        super::builder::conversation_datasets::GetLocation::new(self.inner.clone())
1116    }
1117
1118    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1119    ///
1120    /// [google.longrunning.Operations]: longrunning::client::Operations
1121    pub fn list_operations(&self) -> super::builder::conversation_datasets::ListOperations {
1122        super::builder::conversation_datasets::ListOperations::new(self.inner.clone())
1123    }
1124
1125    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1126    ///
1127    /// [google.longrunning.Operations]: longrunning::client::Operations
1128    pub fn get_operation(&self) -> super::builder::conversation_datasets::GetOperation {
1129        super::builder::conversation_datasets::GetOperation::new(self.inner.clone())
1130    }
1131
1132    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1133    ///
1134    /// [google.longrunning.Operations]: longrunning::client::Operations
1135    pub fn cancel_operation(&self) -> super::builder::conversation_datasets::CancelOperation {
1136        super::builder::conversation_datasets::CancelOperation::new(self.inner.clone())
1137    }
1138}
1139
1140/// Implements a client for the Dialogflow API.
1141///
1142/// # Example
1143/// ```
1144/// # async fn sample() -> gax::client_builder::Result<()> {
1145/// # use google_cloud_dialogflow_v2::client::ConversationModels;
1146/// let client = ConversationModels::builder().build().await?;
1147/// // use `client` to make requests to the Dialogflow API.
1148/// # Ok(()) }
1149/// ```
1150///
1151/// # Service Description
1152///
1153/// Manages a collection of models for human agent assistant.
1154///
1155/// # Configuration
1156///
1157/// To configure `ConversationModels` use the `with_*` methods in the type returned
1158/// by [builder()][ConversationModels::builder]. The default configuration should
1159/// work for most applications. Common configuration changes include
1160///
1161/// * [with_endpoint()]: by default this client uses the global default endpoint
1162///   (`https://dialogflow.googleapis.com`). Applications using regional
1163///   endpoints or running in restricted networks (e.g. a network configured
1164//    with [Private Google Access with VPC Service Controls]) may want to
1165///   override this default.
1166/// * [with_credentials()]: by default this client uses
1167///   [Application Default Credentials]. Applications using custom
1168///   authentication may need to override this default.
1169///
1170/// [with_endpoint()]: super::builder::conversation_models::ClientBuilder::with_endpoint
1171/// [with_credentials()]: super::builder::conversation_models::ClientBuilder::credentials
1172/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
1173/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
1174///
1175/// # Pooling and Cloning
1176///
1177/// `ConversationModels` holds a connection pool internally, it is advised to
1178/// create one and the reuse it.  You do not need to wrap `ConversationModels` in
1179/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
1180/// already uses an `Arc` internally.
1181#[cfg(feature = "conversation-models")]
1182#[cfg_attr(docsrs, doc(cfg(feature = "conversation-models")))]
1183#[derive(Clone, Debug)]
1184pub struct ConversationModels {
1185    inner: std::sync::Arc<dyn super::stub::dynamic::ConversationModels>,
1186}
1187
1188#[cfg(feature = "conversation-models")]
1189impl ConversationModels {
1190    /// Returns a builder for [ConversationModels].
1191    ///
1192    /// ```
1193    /// # async fn sample() -> gax::client_builder::Result<()> {
1194    /// # use google_cloud_dialogflow_v2::client::ConversationModels;
1195    /// let client = ConversationModels::builder().build().await?;
1196    /// # Ok(()) }
1197    /// ```
1198    pub fn builder() -> super::builder::conversation_models::ClientBuilder {
1199        gax::client_builder::internal::new_builder(
1200            super::builder::conversation_models::client::Factory,
1201        )
1202    }
1203
1204    /// Creates a new client from the provided stub.
1205    ///
1206    /// The most common case for calling this function is in tests mocking the
1207    /// client's behavior.
1208    pub fn from_stub<T>(stub: T) -> Self
1209    where
1210        T: super::stub::ConversationModels + 'static,
1211    {
1212        Self {
1213            inner: std::sync::Arc::new(stub),
1214        }
1215    }
1216
1217    pub(crate) async fn new(
1218        config: gaxi::options::ClientConfig,
1219    ) -> gax::client_builder::Result<Self> {
1220        let inner = Self::build_inner(config).await?;
1221        Ok(Self { inner })
1222    }
1223
1224    async fn build_inner(
1225        conf: gaxi::options::ClientConfig,
1226    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::ConversationModels>>
1227    {
1228        if gaxi::options::tracing_enabled(&conf) {
1229            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
1230        }
1231        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
1232    }
1233
1234    async fn build_transport(
1235        conf: gaxi::options::ClientConfig,
1236    ) -> gax::client_builder::Result<impl super::stub::ConversationModels> {
1237        super::transport::ConversationModels::new(conf).await
1238    }
1239
1240    async fn build_with_tracing(
1241        conf: gaxi::options::ClientConfig,
1242    ) -> gax::client_builder::Result<impl super::stub::ConversationModels> {
1243        Self::build_transport(conf)
1244            .await
1245            .map(super::tracing::ConversationModels::new)
1246    }
1247
1248    /// Creates a model.
1249    ///
1250    /// This method is a [long-running
1251    /// operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations).
1252    /// The returned `Operation` type has the following method-specific fields:
1253    ///
1254    /// - `metadata`:
1255    ///   [CreateConversationModelOperationMetadata][google.cloud.dialogflow.v2.CreateConversationModelOperationMetadata]
1256    /// - `response`:
1257    ///   [ConversationModel][google.cloud.dialogflow.v2.ConversationModel]
1258    ///
1259    /// [google.cloud.dialogflow.v2.ConversationModel]: crate::model::ConversationModel
1260    /// [google.cloud.dialogflow.v2.CreateConversationModelOperationMetadata]: crate::model::CreateConversationModelOperationMetadata
1261    ///
1262    /// # Long running operations
1263    ///
1264    /// This method is used to start, and/or poll a [long-running Operation].
1265    /// The [Working with long-running operations] chapter in the [user guide]
1266    /// covers these operations in detail.
1267    ///
1268    /// [long-running operation]: https://google.aip.dev/151
1269    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1270    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1271    pub fn create_conversation_model(
1272        &self,
1273    ) -> super::builder::conversation_models::CreateConversationModel {
1274        super::builder::conversation_models::CreateConversationModel::new(self.inner.clone())
1275    }
1276
1277    /// Gets conversation model.
1278    pub fn get_conversation_model(
1279        &self,
1280    ) -> super::builder::conversation_models::GetConversationModel {
1281        super::builder::conversation_models::GetConversationModel::new(self.inner.clone())
1282    }
1283
1284    /// Lists conversation models.
1285    pub fn list_conversation_models(
1286        &self,
1287    ) -> super::builder::conversation_models::ListConversationModels {
1288        super::builder::conversation_models::ListConversationModels::new(self.inner.clone())
1289    }
1290
1291    /// Deletes a model.
1292    ///
1293    /// This method is a [long-running
1294    /// operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations).
1295    /// The returned `Operation` type has the following method-specific fields:
1296    ///
1297    /// - `metadata`:
1298    ///   [DeleteConversationModelOperationMetadata][google.cloud.dialogflow.v2.DeleteConversationModelOperationMetadata]
1299    /// - `response`: An [Empty
1300    ///   message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
1301    ///
1302    /// [google.cloud.dialogflow.v2.DeleteConversationModelOperationMetadata]: crate::model::DeleteConversationModelOperationMetadata
1303    ///
1304    /// # Long running operations
1305    ///
1306    /// This method is used to start, and/or poll a [long-running Operation].
1307    /// The [Working with long-running operations] chapter in the [user guide]
1308    /// covers these operations in detail.
1309    ///
1310    /// [long-running operation]: https://google.aip.dev/151
1311    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1312    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1313    pub fn delete_conversation_model(
1314        &self,
1315    ) -> super::builder::conversation_models::DeleteConversationModel {
1316        super::builder::conversation_models::DeleteConversationModel::new(self.inner.clone())
1317    }
1318
1319    /// Deploys a model. If a model is already deployed, deploying it
1320    /// has no effect. A model can only serve prediction requests after it gets
1321    /// deployed. For article suggestion, custom model will not be used unless
1322    /// it is deployed.
1323    ///
1324    /// This method is a [long-running
1325    /// operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations).
1326    /// The returned `Operation` type has the following method-specific fields:
1327    ///
1328    /// - `metadata`:
1329    ///   [DeployConversationModelOperationMetadata][google.cloud.dialogflow.v2.DeployConversationModelOperationMetadata]
1330    /// - `response`: An [Empty
1331    ///   message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
1332    ///
1333    /// [google.cloud.dialogflow.v2.DeployConversationModelOperationMetadata]: crate::model::DeployConversationModelOperationMetadata
1334    ///
1335    /// # Long running operations
1336    ///
1337    /// This method is used to start, and/or poll a [long-running Operation].
1338    /// The [Working with long-running operations] chapter in the [user guide]
1339    /// covers these operations in detail.
1340    ///
1341    /// [long-running operation]: https://google.aip.dev/151
1342    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1343    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1344    pub fn deploy_conversation_model(
1345        &self,
1346    ) -> super::builder::conversation_models::DeployConversationModel {
1347        super::builder::conversation_models::DeployConversationModel::new(self.inner.clone())
1348    }
1349
1350    /// Undeploys a model. If the model is not deployed this method has no effect.
1351    /// If the model is currently being used:
1352    ///
1353    /// - For article suggestion, article suggestion will fallback to the default
1354    ///   model if model is undeployed.
1355    ///
1356    /// This method is a [long-running
1357    /// operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations).
1358    /// The returned `Operation` type has the following method-specific fields:
1359    ///
1360    /// - `metadata`:
1361    ///   [UndeployConversationModelOperationMetadata][google.cloud.dialogflow.v2.UndeployConversationModelOperationMetadata]
1362    /// - `response`: An [Empty
1363    ///   message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
1364    ///
1365    /// [google.cloud.dialogflow.v2.UndeployConversationModelOperationMetadata]: crate::model::UndeployConversationModelOperationMetadata
1366    ///
1367    /// # Long running operations
1368    ///
1369    /// This method is used to start, and/or poll a [long-running Operation].
1370    /// The [Working with long-running operations] chapter in the [user guide]
1371    /// covers these operations in detail.
1372    ///
1373    /// [long-running operation]: https://google.aip.dev/151
1374    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1375    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1376    pub fn undeploy_conversation_model(
1377        &self,
1378    ) -> super::builder::conversation_models::UndeployConversationModel {
1379        super::builder::conversation_models::UndeployConversationModel::new(self.inner.clone())
1380    }
1381
1382    /// Gets an evaluation of conversation model.
1383    pub fn get_conversation_model_evaluation(
1384        &self,
1385    ) -> super::builder::conversation_models::GetConversationModelEvaluation {
1386        super::builder::conversation_models::GetConversationModelEvaluation::new(self.inner.clone())
1387    }
1388
1389    /// Lists evaluations of a conversation model.
1390    pub fn list_conversation_model_evaluations(
1391        &self,
1392    ) -> super::builder::conversation_models::ListConversationModelEvaluations {
1393        super::builder::conversation_models::ListConversationModelEvaluations::new(
1394            self.inner.clone(),
1395        )
1396    }
1397
1398    /// Creates evaluation of a conversation model.
1399    ///
1400    /// # Long running operations
1401    ///
1402    /// This method is used to start, and/or poll a [long-running Operation].
1403    /// The [Working with long-running operations] chapter in the [user guide]
1404    /// covers these operations in detail.
1405    ///
1406    /// [long-running operation]: https://google.aip.dev/151
1407    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1408    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1409    pub fn create_conversation_model_evaluation(
1410        &self,
1411    ) -> super::builder::conversation_models::CreateConversationModelEvaluation {
1412        super::builder::conversation_models::CreateConversationModelEvaluation::new(
1413            self.inner.clone(),
1414        )
1415    }
1416
1417    /// Lists information about the supported locations for this service.
1418    pub fn list_locations(&self) -> super::builder::conversation_models::ListLocations {
1419        super::builder::conversation_models::ListLocations::new(self.inner.clone())
1420    }
1421
1422    /// Gets information about a location.
1423    pub fn get_location(&self) -> super::builder::conversation_models::GetLocation {
1424        super::builder::conversation_models::GetLocation::new(self.inner.clone())
1425    }
1426
1427    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1428    ///
1429    /// [google.longrunning.Operations]: longrunning::client::Operations
1430    pub fn list_operations(&self) -> super::builder::conversation_models::ListOperations {
1431        super::builder::conversation_models::ListOperations::new(self.inner.clone())
1432    }
1433
1434    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1435    ///
1436    /// [google.longrunning.Operations]: longrunning::client::Operations
1437    pub fn get_operation(&self) -> super::builder::conversation_models::GetOperation {
1438        super::builder::conversation_models::GetOperation::new(self.inner.clone())
1439    }
1440
1441    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1442    ///
1443    /// [google.longrunning.Operations]: longrunning::client::Operations
1444    pub fn cancel_operation(&self) -> super::builder::conversation_models::CancelOperation {
1445        super::builder::conversation_models::CancelOperation::new(self.inner.clone())
1446    }
1447}
1448
1449/// Implements a client for the Dialogflow API.
1450///
1451/// # Example
1452/// ```
1453/// # async fn sample() -> gax::client_builder::Result<()> {
1454/// # use google_cloud_dialogflow_v2::client::ConversationProfiles;
1455/// let client = ConversationProfiles::builder().build().await?;
1456/// // use `client` to make requests to the Dialogflow API.
1457/// # Ok(()) }
1458/// ```
1459///
1460/// # Service Description
1461///
1462/// Service for managing
1463/// [ConversationProfiles][google.cloud.dialogflow.v2.ConversationProfile].
1464///
1465/// [google.cloud.dialogflow.v2.ConversationProfile]: crate::model::ConversationProfile
1466///
1467/// # Configuration
1468///
1469/// To configure `ConversationProfiles` use the `with_*` methods in the type returned
1470/// by [builder()][ConversationProfiles::builder]. The default configuration should
1471/// work for most applications. Common configuration changes include
1472///
1473/// * [with_endpoint()]: by default this client uses the global default endpoint
1474///   (`https://dialogflow.googleapis.com`). Applications using regional
1475///   endpoints or running in restricted networks (e.g. a network configured
1476//    with [Private Google Access with VPC Service Controls]) may want to
1477///   override this default.
1478/// * [with_credentials()]: by default this client uses
1479///   [Application Default Credentials]. Applications using custom
1480///   authentication may need to override this default.
1481///
1482/// [with_endpoint()]: super::builder::conversation_profiles::ClientBuilder::with_endpoint
1483/// [with_credentials()]: super::builder::conversation_profiles::ClientBuilder::credentials
1484/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
1485/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
1486///
1487/// # Pooling and Cloning
1488///
1489/// `ConversationProfiles` holds a connection pool internally, it is advised to
1490/// create one and the reuse it.  You do not need to wrap `ConversationProfiles` in
1491/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
1492/// already uses an `Arc` internally.
1493#[cfg(feature = "conversation-profiles")]
1494#[cfg_attr(docsrs, doc(cfg(feature = "conversation-profiles")))]
1495#[derive(Clone, Debug)]
1496pub struct ConversationProfiles {
1497    inner: std::sync::Arc<dyn super::stub::dynamic::ConversationProfiles>,
1498}
1499
1500#[cfg(feature = "conversation-profiles")]
1501impl ConversationProfiles {
1502    /// Returns a builder for [ConversationProfiles].
1503    ///
1504    /// ```
1505    /// # async fn sample() -> gax::client_builder::Result<()> {
1506    /// # use google_cloud_dialogflow_v2::client::ConversationProfiles;
1507    /// let client = ConversationProfiles::builder().build().await?;
1508    /// # Ok(()) }
1509    /// ```
1510    pub fn builder() -> super::builder::conversation_profiles::ClientBuilder {
1511        gax::client_builder::internal::new_builder(
1512            super::builder::conversation_profiles::client::Factory,
1513        )
1514    }
1515
1516    /// Creates a new client from the provided stub.
1517    ///
1518    /// The most common case for calling this function is in tests mocking the
1519    /// client's behavior.
1520    pub fn from_stub<T>(stub: T) -> Self
1521    where
1522        T: super::stub::ConversationProfiles + 'static,
1523    {
1524        Self {
1525            inner: std::sync::Arc::new(stub),
1526        }
1527    }
1528
1529    pub(crate) async fn new(
1530        config: gaxi::options::ClientConfig,
1531    ) -> gax::client_builder::Result<Self> {
1532        let inner = Self::build_inner(config).await?;
1533        Ok(Self { inner })
1534    }
1535
1536    async fn build_inner(
1537        conf: gaxi::options::ClientConfig,
1538    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::ConversationProfiles>>
1539    {
1540        if gaxi::options::tracing_enabled(&conf) {
1541            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
1542        }
1543        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
1544    }
1545
1546    async fn build_transport(
1547        conf: gaxi::options::ClientConfig,
1548    ) -> gax::client_builder::Result<impl super::stub::ConversationProfiles> {
1549        super::transport::ConversationProfiles::new(conf).await
1550    }
1551
1552    async fn build_with_tracing(
1553        conf: gaxi::options::ClientConfig,
1554    ) -> gax::client_builder::Result<impl super::stub::ConversationProfiles> {
1555        Self::build_transport(conf)
1556            .await
1557            .map(super::tracing::ConversationProfiles::new)
1558    }
1559
1560    /// Returns the list of all conversation profiles in the specified project.
1561    pub fn list_conversation_profiles(
1562        &self,
1563    ) -> super::builder::conversation_profiles::ListConversationProfiles {
1564        super::builder::conversation_profiles::ListConversationProfiles::new(self.inner.clone())
1565    }
1566
1567    /// Retrieves the specified conversation profile.
1568    pub fn get_conversation_profile(
1569        &self,
1570    ) -> super::builder::conversation_profiles::GetConversationProfile {
1571        super::builder::conversation_profiles::GetConversationProfile::new(self.inner.clone())
1572    }
1573
1574    /// Creates a conversation profile in the specified project.
1575    ///
1576    /// [ConversationProfile.create_time][google.cloud.dialogflow.v2.ConversationProfile.create_time]
1577    /// and
1578    /// [ConversationProfile.update_time][google.cloud.dialogflow.v2.ConversationProfile.update_time]
1579    /// aren't populated in the response. You can retrieve them via
1580    /// [GetConversationProfile][google.cloud.dialogflow.v2.ConversationProfiles.GetConversationProfile]
1581    /// API.
1582    ///
1583    /// [google.cloud.dialogflow.v2.ConversationProfile.create_time]: crate::model::ConversationProfile::create_time
1584    /// [google.cloud.dialogflow.v2.ConversationProfile.update_time]: crate::model::ConversationProfile::update_time
1585    /// [google.cloud.dialogflow.v2.ConversationProfiles.GetConversationProfile]: crate::client::ConversationProfiles::get_conversation_profile
1586    pub fn create_conversation_profile(
1587        &self,
1588    ) -> super::builder::conversation_profiles::CreateConversationProfile {
1589        super::builder::conversation_profiles::CreateConversationProfile::new(self.inner.clone())
1590    }
1591
1592    /// Updates the specified conversation profile.
1593    ///
1594    /// [ConversationProfile.create_time][google.cloud.dialogflow.v2.ConversationProfile.create_time]
1595    /// and
1596    /// [ConversationProfile.update_time][google.cloud.dialogflow.v2.ConversationProfile.update_time]
1597    /// aren't populated in the response. You can retrieve them via
1598    /// [GetConversationProfile][google.cloud.dialogflow.v2.ConversationProfiles.GetConversationProfile]
1599    /// API.
1600    ///
1601    /// [google.cloud.dialogflow.v2.ConversationProfile.create_time]: crate::model::ConversationProfile::create_time
1602    /// [google.cloud.dialogflow.v2.ConversationProfile.update_time]: crate::model::ConversationProfile::update_time
1603    /// [google.cloud.dialogflow.v2.ConversationProfiles.GetConversationProfile]: crate::client::ConversationProfiles::get_conversation_profile
1604    pub fn update_conversation_profile(
1605        &self,
1606    ) -> super::builder::conversation_profiles::UpdateConversationProfile {
1607        super::builder::conversation_profiles::UpdateConversationProfile::new(self.inner.clone())
1608    }
1609
1610    /// Deletes the specified conversation profile.
1611    pub fn delete_conversation_profile(
1612        &self,
1613    ) -> super::builder::conversation_profiles::DeleteConversationProfile {
1614        super::builder::conversation_profiles::DeleteConversationProfile::new(self.inner.clone())
1615    }
1616
1617    /// Adds or updates a suggestion feature in a conversation profile.
1618    /// If the conversation profile contains the type of suggestion feature for
1619    /// the participant role, it will update it. Otherwise it will insert the
1620    /// suggestion feature.
1621    ///
1622    /// This method is a [long-running
1623    /// operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations).
1624    /// The returned `Operation` type has the following method-specific fields:
1625    ///
1626    /// - `metadata`:
1627    ///   [SetSuggestionFeatureConfigOperationMetadata][google.cloud.dialogflow.v2.SetSuggestionFeatureConfigOperationMetadata]
1628    /// - `response`:
1629    ///   [ConversationProfile][google.cloud.dialogflow.v2.ConversationProfile]
1630    ///
1631    /// If a long running operation to add or update suggestion feature
1632    /// config for the same conversation profile, participant role and suggestion
1633    /// feature type exists, please cancel the existing long running operation
1634    /// before sending such request, otherwise the request will be rejected.
1635    ///
1636    /// [google.cloud.dialogflow.v2.ConversationProfile]: crate::model::ConversationProfile
1637    /// [google.cloud.dialogflow.v2.SetSuggestionFeatureConfigOperationMetadata]: crate::model::SetSuggestionFeatureConfigOperationMetadata
1638    ///
1639    /// # Long running operations
1640    ///
1641    /// This method is used to start, and/or poll a [long-running Operation].
1642    /// The [Working with long-running operations] chapter in the [user guide]
1643    /// covers these operations in detail.
1644    ///
1645    /// [long-running operation]: https://google.aip.dev/151
1646    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1647    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1648    pub fn set_suggestion_feature_config(
1649        &self,
1650    ) -> super::builder::conversation_profiles::SetSuggestionFeatureConfig {
1651        super::builder::conversation_profiles::SetSuggestionFeatureConfig::new(self.inner.clone())
1652    }
1653
1654    /// Clears a suggestion feature from a conversation profile for the given
1655    /// participant role.
1656    ///
1657    /// This method is a [long-running
1658    /// operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations).
1659    /// The returned `Operation` type has the following method-specific fields:
1660    ///
1661    /// - `metadata`:
1662    ///   [ClearSuggestionFeatureConfigOperationMetadata][google.cloud.dialogflow.v2.ClearSuggestionFeatureConfigOperationMetadata]
1663    /// - `response`:
1664    ///   [ConversationProfile][google.cloud.dialogflow.v2.ConversationProfile]
1665    ///
1666    /// [google.cloud.dialogflow.v2.ClearSuggestionFeatureConfigOperationMetadata]: crate::model::ClearSuggestionFeatureConfigOperationMetadata
1667    /// [google.cloud.dialogflow.v2.ConversationProfile]: crate::model::ConversationProfile
1668    ///
1669    /// # Long running operations
1670    ///
1671    /// This method is used to start, and/or poll a [long-running Operation].
1672    /// The [Working with long-running operations] chapter in the [user guide]
1673    /// covers these operations in detail.
1674    ///
1675    /// [long-running operation]: https://google.aip.dev/151
1676    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1677    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1678    pub fn clear_suggestion_feature_config(
1679        &self,
1680    ) -> super::builder::conversation_profiles::ClearSuggestionFeatureConfig {
1681        super::builder::conversation_profiles::ClearSuggestionFeatureConfig::new(self.inner.clone())
1682    }
1683
1684    /// Lists information about the supported locations for this service.
1685    pub fn list_locations(&self) -> super::builder::conversation_profiles::ListLocations {
1686        super::builder::conversation_profiles::ListLocations::new(self.inner.clone())
1687    }
1688
1689    /// Gets information about a location.
1690    pub fn get_location(&self) -> super::builder::conversation_profiles::GetLocation {
1691        super::builder::conversation_profiles::GetLocation::new(self.inner.clone())
1692    }
1693
1694    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1695    ///
1696    /// [google.longrunning.Operations]: longrunning::client::Operations
1697    pub fn list_operations(&self) -> super::builder::conversation_profiles::ListOperations {
1698        super::builder::conversation_profiles::ListOperations::new(self.inner.clone())
1699    }
1700
1701    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1702    ///
1703    /// [google.longrunning.Operations]: longrunning::client::Operations
1704    pub fn get_operation(&self) -> super::builder::conversation_profiles::GetOperation {
1705        super::builder::conversation_profiles::GetOperation::new(self.inner.clone())
1706    }
1707
1708    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1709    ///
1710    /// [google.longrunning.Operations]: longrunning::client::Operations
1711    pub fn cancel_operation(&self) -> super::builder::conversation_profiles::CancelOperation {
1712        super::builder::conversation_profiles::CancelOperation::new(self.inner.clone())
1713    }
1714}
1715
1716/// Implements a client for the Dialogflow API.
1717///
1718/// # Example
1719/// ```
1720/// # async fn sample() -> gax::client_builder::Result<()> {
1721/// # use google_cloud_dialogflow_v2::client::Documents;
1722/// let client = Documents::builder().build().await?;
1723/// // use `client` to make requests to the Dialogflow API.
1724/// # Ok(()) }
1725/// ```
1726///
1727/// # Service Description
1728///
1729/// Service for managing knowledge
1730/// [Documents][google.cloud.dialogflow.v2.Document].
1731///
1732/// [google.cloud.dialogflow.v2.Document]: crate::model::Document
1733///
1734/// # Configuration
1735///
1736/// To configure `Documents` use the `with_*` methods in the type returned
1737/// by [builder()][Documents::builder]. The default configuration should
1738/// work for most applications. Common configuration changes include
1739///
1740/// * [with_endpoint()]: by default this client uses the global default endpoint
1741///   (`https://dialogflow.googleapis.com`). Applications using regional
1742///   endpoints or running in restricted networks (e.g. a network configured
1743//    with [Private Google Access with VPC Service Controls]) may want to
1744///   override this default.
1745/// * [with_credentials()]: by default this client uses
1746///   [Application Default Credentials]. Applications using custom
1747///   authentication may need to override this default.
1748///
1749/// [with_endpoint()]: super::builder::documents::ClientBuilder::with_endpoint
1750/// [with_credentials()]: super::builder::documents::ClientBuilder::credentials
1751/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
1752/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
1753///
1754/// # Pooling and Cloning
1755///
1756/// `Documents` holds a connection pool internally, it is advised to
1757/// create one and the reuse it.  You do not need to wrap `Documents` in
1758/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
1759/// already uses an `Arc` internally.
1760#[cfg(feature = "documents")]
1761#[cfg_attr(docsrs, doc(cfg(feature = "documents")))]
1762#[derive(Clone, Debug)]
1763pub struct Documents {
1764    inner: std::sync::Arc<dyn super::stub::dynamic::Documents>,
1765}
1766
1767#[cfg(feature = "documents")]
1768impl Documents {
1769    /// Returns a builder for [Documents].
1770    ///
1771    /// ```
1772    /// # async fn sample() -> gax::client_builder::Result<()> {
1773    /// # use google_cloud_dialogflow_v2::client::Documents;
1774    /// let client = Documents::builder().build().await?;
1775    /// # Ok(()) }
1776    /// ```
1777    pub fn builder() -> super::builder::documents::ClientBuilder {
1778        gax::client_builder::internal::new_builder(super::builder::documents::client::Factory)
1779    }
1780
1781    /// Creates a new client from the provided stub.
1782    ///
1783    /// The most common case for calling this function is in tests mocking the
1784    /// client's behavior.
1785    pub fn from_stub<T>(stub: T) -> Self
1786    where
1787        T: super::stub::Documents + 'static,
1788    {
1789        Self {
1790            inner: std::sync::Arc::new(stub),
1791        }
1792    }
1793
1794    pub(crate) async fn new(
1795        config: gaxi::options::ClientConfig,
1796    ) -> gax::client_builder::Result<Self> {
1797        let inner = Self::build_inner(config).await?;
1798        Ok(Self { inner })
1799    }
1800
1801    async fn build_inner(
1802        conf: gaxi::options::ClientConfig,
1803    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::Documents>> {
1804        if gaxi::options::tracing_enabled(&conf) {
1805            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
1806        }
1807        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
1808    }
1809
1810    async fn build_transport(
1811        conf: gaxi::options::ClientConfig,
1812    ) -> gax::client_builder::Result<impl super::stub::Documents> {
1813        super::transport::Documents::new(conf).await
1814    }
1815
1816    async fn build_with_tracing(
1817        conf: gaxi::options::ClientConfig,
1818    ) -> gax::client_builder::Result<impl super::stub::Documents> {
1819        Self::build_transport(conf)
1820            .await
1821            .map(super::tracing::Documents::new)
1822    }
1823
1824    /// Returns the list of all documents of the knowledge base.
1825    pub fn list_documents(&self) -> super::builder::documents::ListDocuments {
1826        super::builder::documents::ListDocuments::new(self.inner.clone())
1827    }
1828
1829    /// Retrieves the specified document.
1830    pub fn get_document(&self) -> super::builder::documents::GetDocument {
1831        super::builder::documents::GetDocument::new(self.inner.clone())
1832    }
1833
1834    /// Creates a new document.
1835    ///
1836    /// This method is a [long-running
1837    /// operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation).
1838    /// The returned `Operation` type has the following method-specific fields:
1839    ///
1840    /// - `metadata`:
1841    ///   [KnowledgeOperationMetadata][google.cloud.dialogflow.v2.KnowledgeOperationMetadata]
1842    /// - `response`: [Document][google.cloud.dialogflow.v2.Document]
1843    ///
1844    /// [google.cloud.dialogflow.v2.Document]: crate::model::Document
1845    /// [google.cloud.dialogflow.v2.KnowledgeOperationMetadata]: crate::model::KnowledgeOperationMetadata
1846    ///
1847    /// # Long running operations
1848    ///
1849    /// This method is used to start, and/or poll a [long-running Operation].
1850    /// The [Working with long-running operations] chapter in the [user guide]
1851    /// covers these operations in detail.
1852    ///
1853    /// [long-running operation]: https://google.aip.dev/151
1854    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1855    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1856    pub fn create_document(&self) -> super::builder::documents::CreateDocument {
1857        super::builder::documents::CreateDocument::new(self.inner.clone())
1858    }
1859
1860    /// Creates documents by importing data from external sources.
1861    /// Dialogflow supports up to 350 documents in each request. If you try to
1862    /// import more, Dialogflow will return an error.
1863    ///
1864    /// This method is a [long-running
1865    /// operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation).
1866    /// The returned `Operation` type has the following method-specific fields:
1867    ///
1868    /// - `metadata`:
1869    ///   [KnowledgeOperationMetadata][google.cloud.dialogflow.v2.KnowledgeOperationMetadata]
1870    /// - `response`:
1871    ///   [ImportDocumentsResponse][google.cloud.dialogflow.v2.ImportDocumentsResponse]
1872    ///
1873    /// [google.cloud.dialogflow.v2.ImportDocumentsResponse]: crate::model::ImportDocumentsResponse
1874    /// [google.cloud.dialogflow.v2.KnowledgeOperationMetadata]: crate::model::KnowledgeOperationMetadata
1875    ///
1876    /// # Long running operations
1877    ///
1878    /// This method is used to start, and/or poll a [long-running Operation].
1879    /// The [Working with long-running operations] chapter in the [user guide]
1880    /// covers these operations in detail.
1881    ///
1882    /// [long-running operation]: https://google.aip.dev/151
1883    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1884    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1885    pub fn import_documents(&self) -> super::builder::documents::ImportDocuments {
1886        super::builder::documents::ImportDocuments::new(self.inner.clone())
1887    }
1888
1889    /// Deletes the specified document.
1890    ///
1891    /// This method is a [long-running
1892    /// operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation).
1893    /// The returned `Operation` type has the following method-specific fields:
1894    ///
1895    /// - `metadata`:
1896    ///   [KnowledgeOperationMetadata][google.cloud.dialogflow.v2.KnowledgeOperationMetadata]
1897    /// - `response`: An [Empty
1898    ///   message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
1899    ///
1900    /// [google.cloud.dialogflow.v2.KnowledgeOperationMetadata]: crate::model::KnowledgeOperationMetadata
1901    ///
1902    /// # Long running operations
1903    ///
1904    /// This method is used to start, and/or poll a [long-running Operation].
1905    /// The [Working with long-running operations] chapter in the [user guide]
1906    /// covers these operations in detail.
1907    ///
1908    /// [long-running operation]: https://google.aip.dev/151
1909    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1910    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1911    pub fn delete_document(&self) -> super::builder::documents::DeleteDocument {
1912        super::builder::documents::DeleteDocument::new(self.inner.clone())
1913    }
1914
1915    /// Updates the specified document.
1916    ///
1917    /// This method is a [long-running
1918    /// operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation).
1919    /// The returned `Operation` type has the following method-specific fields:
1920    ///
1921    /// - `metadata`:
1922    ///   [KnowledgeOperationMetadata][google.cloud.dialogflow.v2.KnowledgeOperationMetadata]
1923    /// - `response`: [Document][google.cloud.dialogflow.v2.Document]
1924    ///
1925    /// [google.cloud.dialogflow.v2.Document]: crate::model::Document
1926    /// [google.cloud.dialogflow.v2.KnowledgeOperationMetadata]: crate::model::KnowledgeOperationMetadata
1927    ///
1928    /// # Long running operations
1929    ///
1930    /// This method is used to start, and/or poll a [long-running Operation].
1931    /// The [Working with long-running operations] chapter in the [user guide]
1932    /// covers these operations in detail.
1933    ///
1934    /// [long-running operation]: https://google.aip.dev/151
1935    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1936    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1937    pub fn update_document(&self) -> super::builder::documents::UpdateDocument {
1938        super::builder::documents::UpdateDocument::new(self.inner.clone())
1939    }
1940
1941    /// Reloads the specified document from its specified source, content_uri or
1942    /// content. The previously loaded content of the document will be deleted.
1943    /// Note: Even when the content of the document has not changed, there still
1944    /// may be side effects because of internal implementation changes.
1945    ///
1946    /// This method is a [long-running
1947    /// operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation).
1948    /// The returned `Operation` type has the following method-specific fields:
1949    ///
1950    /// - `metadata`:
1951    ///   [KnowledgeOperationMetadata][google.cloud.dialogflow.v2.KnowledgeOperationMetadata]
1952    /// - `response`: [Document][google.cloud.dialogflow.v2.Document]
1953    ///
1954    /// Note: The `projects.agent.knowledgeBases.documents` resource is deprecated;
1955    /// only use `projects.knowledgeBases.documents`.
1956    ///
1957    /// [google.cloud.dialogflow.v2.Document]: crate::model::Document
1958    /// [google.cloud.dialogflow.v2.KnowledgeOperationMetadata]: crate::model::KnowledgeOperationMetadata
1959    ///
1960    /// # Long running operations
1961    ///
1962    /// This method is used to start, and/or poll a [long-running Operation].
1963    /// The [Working with long-running operations] chapter in the [user guide]
1964    /// covers these operations in detail.
1965    ///
1966    /// [long-running operation]: https://google.aip.dev/151
1967    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1968    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1969    pub fn reload_document(&self) -> super::builder::documents::ReloadDocument {
1970        super::builder::documents::ReloadDocument::new(self.inner.clone())
1971    }
1972
1973    /// Exports a smart messaging candidate document into the specified
1974    /// destination.
1975    ///
1976    /// This method is a [long-running
1977    /// operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation).
1978    /// The returned `Operation` type has the following method-specific fields:
1979    ///
1980    /// - `metadata`:
1981    ///   [KnowledgeOperationMetadata][google.cloud.dialogflow.v2.KnowledgeOperationMetadata]
1982    /// - `response`: [Document][google.cloud.dialogflow.v2.Document]
1983    ///
1984    /// [google.cloud.dialogflow.v2.Document]: crate::model::Document
1985    /// [google.cloud.dialogflow.v2.KnowledgeOperationMetadata]: crate::model::KnowledgeOperationMetadata
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    pub fn export_document(&self) -> super::builder::documents::ExportDocument {
1997        super::builder::documents::ExportDocument::new(self.inner.clone())
1998    }
1999
2000    /// Lists information about the supported locations for this service.
2001    pub fn list_locations(&self) -> super::builder::documents::ListLocations {
2002        super::builder::documents::ListLocations::new(self.inner.clone())
2003    }
2004
2005    /// Gets information about a location.
2006    pub fn get_location(&self) -> super::builder::documents::GetLocation {
2007        super::builder::documents::GetLocation::new(self.inner.clone())
2008    }
2009
2010    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2011    ///
2012    /// [google.longrunning.Operations]: longrunning::client::Operations
2013    pub fn list_operations(&self) -> super::builder::documents::ListOperations {
2014        super::builder::documents::ListOperations::new(self.inner.clone())
2015    }
2016
2017    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2018    ///
2019    /// [google.longrunning.Operations]: longrunning::client::Operations
2020    pub fn get_operation(&self) -> super::builder::documents::GetOperation {
2021        super::builder::documents::GetOperation::new(self.inner.clone())
2022    }
2023
2024    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2025    ///
2026    /// [google.longrunning.Operations]: longrunning::client::Operations
2027    pub fn cancel_operation(&self) -> super::builder::documents::CancelOperation {
2028        super::builder::documents::CancelOperation::new(self.inner.clone())
2029    }
2030}
2031
2032/// Implements a client for the Dialogflow API.
2033///
2034/// # Example
2035/// ```
2036/// # async fn sample() -> gax::client_builder::Result<()> {
2037/// # use google_cloud_dialogflow_v2::client::EncryptionSpecService;
2038/// let client = EncryptionSpecService::builder().build().await?;
2039/// // use `client` to make requests to the Dialogflow API.
2040/// # Ok(()) }
2041/// ```
2042///
2043/// # Service Description
2044///
2045/// Manages encryption spec settings for Dialogflow and Agent Assist.
2046///
2047/// # Configuration
2048///
2049/// To configure `EncryptionSpecService` use the `with_*` methods in the type returned
2050/// by [builder()][EncryptionSpecService::builder]. The default configuration should
2051/// work for most applications. Common configuration changes include
2052///
2053/// * [with_endpoint()]: by default this client uses the global default endpoint
2054///   (`https://dialogflow.googleapis.com`). Applications using regional
2055///   endpoints or running in restricted networks (e.g. a network configured
2056//    with [Private Google Access with VPC Service Controls]) may want to
2057///   override this default.
2058/// * [with_credentials()]: by default this client uses
2059///   [Application Default Credentials]. Applications using custom
2060///   authentication may need to override this default.
2061///
2062/// [with_endpoint()]: super::builder::encryption_spec_service::ClientBuilder::with_endpoint
2063/// [with_credentials()]: super::builder::encryption_spec_service::ClientBuilder::credentials
2064/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
2065/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
2066///
2067/// # Pooling and Cloning
2068///
2069/// `EncryptionSpecService` holds a connection pool internally, it is advised to
2070/// create one and the reuse it.  You do not need to wrap `EncryptionSpecService` in
2071/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
2072/// already uses an `Arc` internally.
2073#[cfg(feature = "encryption-spec-service")]
2074#[cfg_attr(docsrs, doc(cfg(feature = "encryption-spec-service")))]
2075#[derive(Clone, Debug)]
2076pub struct EncryptionSpecService {
2077    inner: std::sync::Arc<dyn super::stub::dynamic::EncryptionSpecService>,
2078}
2079
2080#[cfg(feature = "encryption-spec-service")]
2081impl EncryptionSpecService {
2082    /// Returns a builder for [EncryptionSpecService].
2083    ///
2084    /// ```
2085    /// # async fn sample() -> gax::client_builder::Result<()> {
2086    /// # use google_cloud_dialogflow_v2::client::EncryptionSpecService;
2087    /// let client = EncryptionSpecService::builder().build().await?;
2088    /// # Ok(()) }
2089    /// ```
2090    pub fn builder() -> super::builder::encryption_spec_service::ClientBuilder {
2091        gax::client_builder::internal::new_builder(
2092            super::builder::encryption_spec_service::client::Factory,
2093        )
2094    }
2095
2096    /// Creates a new client from the provided stub.
2097    ///
2098    /// The most common case for calling this function is in tests mocking the
2099    /// client's behavior.
2100    pub fn from_stub<T>(stub: T) -> Self
2101    where
2102        T: super::stub::EncryptionSpecService + 'static,
2103    {
2104        Self {
2105            inner: std::sync::Arc::new(stub),
2106        }
2107    }
2108
2109    pub(crate) async fn new(
2110        config: gaxi::options::ClientConfig,
2111    ) -> gax::client_builder::Result<Self> {
2112        let inner = Self::build_inner(config).await?;
2113        Ok(Self { inner })
2114    }
2115
2116    async fn build_inner(
2117        conf: gaxi::options::ClientConfig,
2118    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::EncryptionSpecService>>
2119    {
2120        if gaxi::options::tracing_enabled(&conf) {
2121            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
2122        }
2123        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
2124    }
2125
2126    async fn build_transport(
2127        conf: gaxi::options::ClientConfig,
2128    ) -> gax::client_builder::Result<impl super::stub::EncryptionSpecService> {
2129        super::transport::EncryptionSpecService::new(conf).await
2130    }
2131
2132    async fn build_with_tracing(
2133        conf: gaxi::options::ClientConfig,
2134    ) -> gax::client_builder::Result<impl super::stub::EncryptionSpecService> {
2135        Self::build_transport(conf)
2136            .await
2137            .map(super::tracing::EncryptionSpecService::new)
2138    }
2139
2140    /// Gets location-level encryption key specification.
2141    pub fn get_encryption_spec(
2142        &self,
2143    ) -> super::builder::encryption_spec_service::GetEncryptionSpec {
2144        super::builder::encryption_spec_service::GetEncryptionSpec::new(self.inner.clone())
2145    }
2146
2147    /// Initializes a location-level encryption key specification.  An error will
2148    /// be thrown if the location has resources already created before the
2149    /// initialization. Once the encryption specification is initialized at a
2150    /// location, it is immutable and all newly created resources under the
2151    /// location will be encrypted with the existing specification.
2152    ///
2153    /// # Long running operations
2154    ///
2155    /// This method is used to start, and/or poll a [long-running Operation].
2156    /// The [Working with long-running operations] chapter in the [user guide]
2157    /// covers these operations in detail.
2158    ///
2159    /// [long-running operation]: https://google.aip.dev/151
2160    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2161    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2162    pub fn initialize_encryption_spec(
2163        &self,
2164    ) -> super::builder::encryption_spec_service::InitializeEncryptionSpec {
2165        super::builder::encryption_spec_service::InitializeEncryptionSpec::new(self.inner.clone())
2166    }
2167
2168    /// Lists information about the supported locations for this service.
2169    pub fn list_locations(&self) -> super::builder::encryption_spec_service::ListLocations {
2170        super::builder::encryption_spec_service::ListLocations::new(self.inner.clone())
2171    }
2172
2173    /// Gets information about a location.
2174    pub fn get_location(&self) -> super::builder::encryption_spec_service::GetLocation {
2175        super::builder::encryption_spec_service::GetLocation::new(self.inner.clone())
2176    }
2177
2178    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2179    ///
2180    /// [google.longrunning.Operations]: longrunning::client::Operations
2181    pub fn list_operations(&self) -> super::builder::encryption_spec_service::ListOperations {
2182        super::builder::encryption_spec_service::ListOperations::new(self.inner.clone())
2183    }
2184
2185    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2186    ///
2187    /// [google.longrunning.Operations]: longrunning::client::Operations
2188    pub fn get_operation(&self) -> super::builder::encryption_spec_service::GetOperation {
2189        super::builder::encryption_spec_service::GetOperation::new(self.inner.clone())
2190    }
2191
2192    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2193    ///
2194    /// [google.longrunning.Operations]: longrunning::client::Operations
2195    pub fn cancel_operation(&self) -> super::builder::encryption_spec_service::CancelOperation {
2196        super::builder::encryption_spec_service::CancelOperation::new(self.inner.clone())
2197    }
2198}
2199
2200/// Implements a client for the Dialogflow API.
2201///
2202/// # Example
2203/// ```
2204/// # async fn sample() -> gax::client_builder::Result<()> {
2205/// # use google_cloud_dialogflow_v2::client::EntityTypes;
2206/// let client = EntityTypes::builder().build().await?;
2207/// // use `client` to make requests to the Dialogflow API.
2208/// # Ok(()) }
2209/// ```
2210///
2211/// # Service Description
2212///
2213/// Service for managing [EntityTypes][google.cloud.dialogflow.v2.EntityType].
2214///
2215/// [google.cloud.dialogflow.v2.EntityType]: crate::model::EntityType
2216///
2217/// # Configuration
2218///
2219/// To configure `EntityTypes` use the `with_*` methods in the type returned
2220/// by [builder()][EntityTypes::builder]. The default configuration should
2221/// work for most applications. Common configuration changes include
2222///
2223/// * [with_endpoint()]: by default this client uses the global default endpoint
2224///   (`https://dialogflow.googleapis.com`). Applications using regional
2225///   endpoints or running in restricted networks (e.g. a network configured
2226//    with [Private Google Access with VPC Service Controls]) may want to
2227///   override this default.
2228/// * [with_credentials()]: by default this client uses
2229///   [Application Default Credentials]. Applications using custom
2230///   authentication may need to override this default.
2231///
2232/// [with_endpoint()]: super::builder::entity_types::ClientBuilder::with_endpoint
2233/// [with_credentials()]: super::builder::entity_types::ClientBuilder::credentials
2234/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
2235/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
2236///
2237/// # Pooling and Cloning
2238///
2239/// `EntityTypes` holds a connection pool internally, it is advised to
2240/// create one and the reuse it.  You do not need to wrap `EntityTypes` in
2241/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
2242/// already uses an `Arc` internally.
2243#[cfg(feature = "entity-types")]
2244#[cfg_attr(docsrs, doc(cfg(feature = "entity-types")))]
2245#[derive(Clone, Debug)]
2246pub struct EntityTypes {
2247    inner: std::sync::Arc<dyn super::stub::dynamic::EntityTypes>,
2248}
2249
2250#[cfg(feature = "entity-types")]
2251impl EntityTypes {
2252    /// Returns a builder for [EntityTypes].
2253    ///
2254    /// ```
2255    /// # async fn sample() -> gax::client_builder::Result<()> {
2256    /// # use google_cloud_dialogflow_v2::client::EntityTypes;
2257    /// let client = EntityTypes::builder().build().await?;
2258    /// # Ok(()) }
2259    /// ```
2260    pub fn builder() -> super::builder::entity_types::ClientBuilder {
2261        gax::client_builder::internal::new_builder(super::builder::entity_types::client::Factory)
2262    }
2263
2264    /// Creates a new client from the provided stub.
2265    ///
2266    /// The most common case for calling this function is in tests mocking the
2267    /// client's behavior.
2268    pub fn from_stub<T>(stub: T) -> Self
2269    where
2270        T: super::stub::EntityTypes + 'static,
2271    {
2272        Self {
2273            inner: std::sync::Arc::new(stub),
2274        }
2275    }
2276
2277    pub(crate) async fn new(
2278        config: gaxi::options::ClientConfig,
2279    ) -> gax::client_builder::Result<Self> {
2280        let inner = Self::build_inner(config).await?;
2281        Ok(Self { inner })
2282    }
2283
2284    async fn build_inner(
2285        conf: gaxi::options::ClientConfig,
2286    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::EntityTypes>> {
2287        if gaxi::options::tracing_enabled(&conf) {
2288            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
2289        }
2290        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
2291    }
2292
2293    async fn build_transport(
2294        conf: gaxi::options::ClientConfig,
2295    ) -> gax::client_builder::Result<impl super::stub::EntityTypes> {
2296        super::transport::EntityTypes::new(conf).await
2297    }
2298
2299    async fn build_with_tracing(
2300        conf: gaxi::options::ClientConfig,
2301    ) -> gax::client_builder::Result<impl super::stub::EntityTypes> {
2302        Self::build_transport(conf)
2303            .await
2304            .map(super::tracing::EntityTypes::new)
2305    }
2306
2307    /// Returns the list of all entity types in the specified agent.
2308    pub fn list_entity_types(&self) -> super::builder::entity_types::ListEntityTypes {
2309        super::builder::entity_types::ListEntityTypes::new(self.inner.clone())
2310    }
2311
2312    /// Retrieves the specified entity type.
2313    pub fn get_entity_type(&self) -> super::builder::entity_types::GetEntityType {
2314        super::builder::entity_types::GetEntityType::new(self.inner.clone())
2315    }
2316
2317    /// Creates an entity type in the specified agent.
2318    ///
2319    /// Note: You should always train an agent prior to sending it queries. See the
2320    /// [training
2321    /// documentation](https://cloud.google.com/dialogflow/es/docs/training).
2322    pub fn create_entity_type(&self) -> super::builder::entity_types::CreateEntityType {
2323        super::builder::entity_types::CreateEntityType::new(self.inner.clone())
2324    }
2325
2326    /// Updates the specified entity type.
2327    ///
2328    /// Note: You should always train an agent prior to sending it queries. See the
2329    /// [training
2330    /// documentation](https://cloud.google.com/dialogflow/es/docs/training).
2331    pub fn update_entity_type(&self) -> super::builder::entity_types::UpdateEntityType {
2332        super::builder::entity_types::UpdateEntityType::new(self.inner.clone())
2333    }
2334
2335    /// Deletes the specified entity type.
2336    ///
2337    /// Note: You should always train an agent prior to sending it queries. See the
2338    /// [training
2339    /// documentation](https://cloud.google.com/dialogflow/es/docs/training).
2340    pub fn delete_entity_type(&self) -> super::builder::entity_types::DeleteEntityType {
2341        super::builder::entity_types::DeleteEntityType::new(self.inner.clone())
2342    }
2343
2344    /// Updates/Creates multiple entity types in the specified agent.
2345    ///
2346    /// This method is a [long-running
2347    /// operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations).
2348    /// The returned `Operation` type has the following method-specific fields:
2349    ///
2350    /// - `metadata`: An empty [Struct
2351    ///   message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct)
2352    /// - `response`:
2353    ///   [BatchUpdateEntityTypesResponse][google.cloud.dialogflow.v2.BatchUpdateEntityTypesResponse]
2354    ///
2355    /// Note: You should always train an agent prior to sending it queries. See the
2356    /// [training
2357    /// documentation](https://cloud.google.com/dialogflow/es/docs/training).
2358    ///
2359    /// [google.cloud.dialogflow.v2.BatchUpdateEntityTypesResponse]: crate::model::BatchUpdateEntityTypesResponse
2360    ///
2361    /// # Long running operations
2362    ///
2363    /// This method is used to start, and/or poll a [long-running Operation].
2364    /// The [Working with long-running operations] chapter in the [user guide]
2365    /// covers these operations in detail.
2366    ///
2367    /// [long-running operation]: https://google.aip.dev/151
2368    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2369    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2370    pub fn batch_update_entity_types(
2371        &self,
2372    ) -> super::builder::entity_types::BatchUpdateEntityTypes {
2373        super::builder::entity_types::BatchUpdateEntityTypes::new(self.inner.clone())
2374    }
2375
2376    /// Deletes entity types in the specified agent.
2377    ///
2378    /// This method is a [long-running
2379    /// operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations).
2380    /// The returned `Operation` type has the following method-specific fields:
2381    ///
2382    /// - `metadata`: An empty [Struct
2383    ///   message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct)
2384    /// - `response`: An [Empty
2385    ///   message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
2386    ///
2387    /// Note: You should always train an agent prior to sending it queries. See the
2388    /// [training
2389    /// documentation](https://cloud.google.com/dialogflow/es/docs/training).
2390    ///
2391    /// # Long running operations
2392    ///
2393    /// This method is used to start, and/or poll a [long-running Operation].
2394    /// The [Working with long-running operations] chapter in the [user guide]
2395    /// covers these operations in detail.
2396    ///
2397    /// [long-running operation]: https://google.aip.dev/151
2398    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2399    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2400    pub fn batch_delete_entity_types(
2401        &self,
2402    ) -> super::builder::entity_types::BatchDeleteEntityTypes {
2403        super::builder::entity_types::BatchDeleteEntityTypes::new(self.inner.clone())
2404    }
2405
2406    /// Creates multiple new entities in the specified entity type.
2407    ///
2408    /// This method is a [long-running
2409    /// operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations).
2410    /// The returned `Operation` type has the following method-specific fields:
2411    ///
2412    /// - `metadata`: An empty [Struct
2413    ///   message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct)
2414    /// - `response`: An [Empty
2415    ///   message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
2416    ///
2417    /// Note: You should always train an agent prior to sending it queries. See the
2418    /// [training
2419    /// documentation](https://cloud.google.com/dialogflow/es/docs/training).
2420    ///
2421    /// # Long running operations
2422    ///
2423    /// This method is used to start, and/or poll a [long-running Operation].
2424    /// The [Working with long-running operations] chapter in the [user guide]
2425    /// covers these operations in detail.
2426    ///
2427    /// [long-running operation]: https://google.aip.dev/151
2428    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2429    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2430    pub fn batch_create_entities(&self) -> super::builder::entity_types::BatchCreateEntities {
2431        super::builder::entity_types::BatchCreateEntities::new(self.inner.clone())
2432    }
2433
2434    /// Updates or creates multiple entities in the specified entity type. This
2435    /// method does not affect entities in the entity type that aren't explicitly
2436    /// specified in the request.
2437    ///
2438    /// This method is a [long-running
2439    /// operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations).
2440    /// The returned `Operation` type has the following method-specific fields:
2441    ///
2442    /// - `metadata`: An empty [Struct
2443    ///   message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct)
2444    /// - `response`: An [Empty
2445    ///   message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
2446    ///
2447    /// Note: You should always train an agent prior to sending it queries. See the
2448    /// [training
2449    /// documentation](https://cloud.google.com/dialogflow/es/docs/training).
2450    ///
2451    /// # Long running operations
2452    ///
2453    /// This method is used to start, and/or poll a [long-running Operation].
2454    /// The [Working with long-running operations] chapter in the [user guide]
2455    /// covers these operations in detail.
2456    ///
2457    /// [long-running operation]: https://google.aip.dev/151
2458    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2459    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2460    pub fn batch_update_entities(&self) -> super::builder::entity_types::BatchUpdateEntities {
2461        super::builder::entity_types::BatchUpdateEntities::new(self.inner.clone())
2462    }
2463
2464    /// Deletes entities in the specified entity type.
2465    ///
2466    /// This method is a [long-running
2467    /// operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations).
2468    /// The returned `Operation` type has the following method-specific fields:
2469    ///
2470    /// - `metadata`: An empty [Struct
2471    ///   message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct)
2472    /// - `response`: An [Empty
2473    ///   message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
2474    ///
2475    /// Note: You should always train an agent prior to sending it queries. See the
2476    /// [training
2477    /// documentation](https://cloud.google.com/dialogflow/es/docs/training).
2478    ///
2479    /// # Long running operations
2480    ///
2481    /// This method is used to start, and/or poll a [long-running Operation].
2482    /// The [Working with long-running operations] chapter in the [user guide]
2483    /// covers these operations in detail.
2484    ///
2485    /// [long-running operation]: https://google.aip.dev/151
2486    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2487    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2488    pub fn batch_delete_entities(&self) -> super::builder::entity_types::BatchDeleteEntities {
2489        super::builder::entity_types::BatchDeleteEntities::new(self.inner.clone())
2490    }
2491
2492    /// Lists information about the supported locations for this service.
2493    pub fn list_locations(&self) -> super::builder::entity_types::ListLocations {
2494        super::builder::entity_types::ListLocations::new(self.inner.clone())
2495    }
2496
2497    /// Gets information about a location.
2498    pub fn get_location(&self) -> super::builder::entity_types::GetLocation {
2499        super::builder::entity_types::GetLocation::new(self.inner.clone())
2500    }
2501
2502    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2503    ///
2504    /// [google.longrunning.Operations]: longrunning::client::Operations
2505    pub fn list_operations(&self) -> super::builder::entity_types::ListOperations {
2506        super::builder::entity_types::ListOperations::new(self.inner.clone())
2507    }
2508
2509    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2510    ///
2511    /// [google.longrunning.Operations]: longrunning::client::Operations
2512    pub fn get_operation(&self) -> super::builder::entity_types::GetOperation {
2513        super::builder::entity_types::GetOperation::new(self.inner.clone())
2514    }
2515
2516    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2517    ///
2518    /// [google.longrunning.Operations]: longrunning::client::Operations
2519    pub fn cancel_operation(&self) -> super::builder::entity_types::CancelOperation {
2520        super::builder::entity_types::CancelOperation::new(self.inner.clone())
2521    }
2522}
2523
2524/// Implements a client for the Dialogflow API.
2525///
2526/// # Example
2527/// ```
2528/// # async fn sample() -> gax::client_builder::Result<()> {
2529/// # use google_cloud_dialogflow_v2::client::Environments;
2530/// let client = Environments::builder().build().await?;
2531/// // use `client` to make requests to the Dialogflow API.
2532/// # Ok(()) }
2533/// ```
2534///
2535/// # Service Description
2536///
2537/// Service for managing [Environments][google.cloud.dialogflow.v2.Environment].
2538///
2539/// [google.cloud.dialogflow.v2.Environment]: crate::model::Environment
2540///
2541/// # Configuration
2542///
2543/// To configure `Environments` use the `with_*` methods in the type returned
2544/// by [builder()][Environments::builder]. The default configuration should
2545/// work for most applications. Common configuration changes include
2546///
2547/// * [with_endpoint()]: by default this client uses the global default endpoint
2548///   (`https://dialogflow.googleapis.com`). Applications using regional
2549///   endpoints or running in restricted networks (e.g. a network configured
2550//    with [Private Google Access with VPC Service Controls]) may want to
2551///   override this default.
2552/// * [with_credentials()]: by default this client uses
2553///   [Application Default Credentials]. Applications using custom
2554///   authentication may need to override this default.
2555///
2556/// [with_endpoint()]: super::builder::environments::ClientBuilder::with_endpoint
2557/// [with_credentials()]: super::builder::environments::ClientBuilder::credentials
2558/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
2559/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
2560///
2561/// # Pooling and Cloning
2562///
2563/// `Environments` holds a connection pool internally, it is advised to
2564/// create one and the reuse it.  You do not need to wrap `Environments` in
2565/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
2566/// already uses an `Arc` internally.
2567#[cfg(feature = "environments")]
2568#[cfg_attr(docsrs, doc(cfg(feature = "environments")))]
2569#[derive(Clone, Debug)]
2570pub struct Environments {
2571    inner: std::sync::Arc<dyn super::stub::dynamic::Environments>,
2572}
2573
2574#[cfg(feature = "environments")]
2575impl Environments {
2576    /// Returns a builder for [Environments].
2577    ///
2578    /// ```
2579    /// # async fn sample() -> gax::client_builder::Result<()> {
2580    /// # use google_cloud_dialogflow_v2::client::Environments;
2581    /// let client = Environments::builder().build().await?;
2582    /// # Ok(()) }
2583    /// ```
2584    pub fn builder() -> super::builder::environments::ClientBuilder {
2585        gax::client_builder::internal::new_builder(super::builder::environments::client::Factory)
2586    }
2587
2588    /// Creates a new client from the provided stub.
2589    ///
2590    /// The most common case for calling this function is in tests mocking the
2591    /// client's behavior.
2592    pub fn from_stub<T>(stub: T) -> Self
2593    where
2594        T: super::stub::Environments + 'static,
2595    {
2596        Self {
2597            inner: std::sync::Arc::new(stub),
2598        }
2599    }
2600
2601    pub(crate) async fn new(
2602        config: gaxi::options::ClientConfig,
2603    ) -> gax::client_builder::Result<Self> {
2604        let inner = Self::build_inner(config).await?;
2605        Ok(Self { inner })
2606    }
2607
2608    async fn build_inner(
2609        conf: gaxi::options::ClientConfig,
2610    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::Environments>> {
2611        if gaxi::options::tracing_enabled(&conf) {
2612            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
2613        }
2614        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
2615    }
2616
2617    async fn build_transport(
2618        conf: gaxi::options::ClientConfig,
2619    ) -> gax::client_builder::Result<impl super::stub::Environments> {
2620        super::transport::Environments::new(conf).await
2621    }
2622
2623    async fn build_with_tracing(
2624        conf: gaxi::options::ClientConfig,
2625    ) -> gax::client_builder::Result<impl super::stub::Environments> {
2626        Self::build_transport(conf)
2627            .await
2628            .map(super::tracing::Environments::new)
2629    }
2630
2631    /// Returns the list of all non-default environments of the specified agent.
2632    pub fn list_environments(&self) -> super::builder::environments::ListEnvironments {
2633        super::builder::environments::ListEnvironments::new(self.inner.clone())
2634    }
2635
2636    /// Retrieves the specified agent environment.
2637    pub fn get_environment(&self) -> super::builder::environments::GetEnvironment {
2638        super::builder::environments::GetEnvironment::new(self.inner.clone())
2639    }
2640
2641    /// Creates an agent environment.
2642    pub fn create_environment(&self) -> super::builder::environments::CreateEnvironment {
2643        super::builder::environments::CreateEnvironment::new(self.inner.clone())
2644    }
2645
2646    /// Updates the specified agent environment.
2647    ///
2648    /// This method allows you to deploy new agent versions into the environment.
2649    /// When an environment is pointed to a new agent version by setting
2650    /// `environment.agent_version`, the environment is temporarily set to the
2651    /// `LOADING` state. During that time, the environment continues serving the
2652    /// previous version of the agent. After the new agent version is done loading,
2653    /// the environment is set back to the `RUNNING` state.
2654    /// You can use "-" as Environment ID in environment name to update an agent
2655    /// version in the default environment. WARNING: this will negate all recent
2656    /// changes to the draft agent and can't be undone. You may want to save the
2657    /// draft agent to a version before calling this method.
2658    pub fn update_environment(&self) -> super::builder::environments::UpdateEnvironment {
2659        super::builder::environments::UpdateEnvironment::new(self.inner.clone())
2660    }
2661
2662    /// Deletes the specified agent environment.
2663    pub fn delete_environment(&self) -> super::builder::environments::DeleteEnvironment {
2664        super::builder::environments::DeleteEnvironment::new(self.inner.clone())
2665    }
2666
2667    /// Gets the history of the specified environment.
2668    pub fn get_environment_history(&self) -> super::builder::environments::GetEnvironmentHistory {
2669        super::builder::environments::GetEnvironmentHistory::new(self.inner.clone())
2670    }
2671
2672    /// Lists information about the supported locations for this service.
2673    pub fn list_locations(&self) -> super::builder::environments::ListLocations {
2674        super::builder::environments::ListLocations::new(self.inner.clone())
2675    }
2676
2677    /// Gets information about a location.
2678    pub fn get_location(&self) -> super::builder::environments::GetLocation {
2679        super::builder::environments::GetLocation::new(self.inner.clone())
2680    }
2681
2682    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2683    ///
2684    /// [google.longrunning.Operations]: longrunning::client::Operations
2685    pub fn list_operations(&self) -> super::builder::environments::ListOperations {
2686        super::builder::environments::ListOperations::new(self.inner.clone())
2687    }
2688
2689    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2690    ///
2691    /// [google.longrunning.Operations]: longrunning::client::Operations
2692    pub fn get_operation(&self) -> super::builder::environments::GetOperation {
2693        super::builder::environments::GetOperation::new(self.inner.clone())
2694    }
2695
2696    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2697    ///
2698    /// [google.longrunning.Operations]: longrunning::client::Operations
2699    pub fn cancel_operation(&self) -> super::builder::environments::CancelOperation {
2700        super::builder::environments::CancelOperation::new(self.inner.clone())
2701    }
2702}
2703
2704/// Implements a client for the Dialogflow API.
2705///
2706/// # Example
2707/// ```
2708/// # async fn sample() -> gax::client_builder::Result<()> {
2709/// # use google_cloud_dialogflow_v2::client::Fulfillments;
2710/// let client = Fulfillments::builder().build().await?;
2711/// // use `client` to make requests to the Dialogflow API.
2712/// # Ok(()) }
2713/// ```
2714///
2715/// # Service Description
2716///
2717/// Service for managing [Fulfillments][google.cloud.dialogflow.v2.Fulfillment].
2718///
2719/// [google.cloud.dialogflow.v2.Fulfillment]: crate::model::Fulfillment
2720///
2721/// # Configuration
2722///
2723/// To configure `Fulfillments` use the `with_*` methods in the type returned
2724/// by [builder()][Fulfillments::builder]. The default configuration should
2725/// work for most applications. Common configuration changes include
2726///
2727/// * [with_endpoint()]: by default this client uses the global default endpoint
2728///   (`https://dialogflow.googleapis.com`). Applications using regional
2729///   endpoints or running in restricted networks (e.g. a network configured
2730//    with [Private Google Access with VPC Service Controls]) may want to
2731///   override this default.
2732/// * [with_credentials()]: by default this client uses
2733///   [Application Default Credentials]. Applications using custom
2734///   authentication may need to override this default.
2735///
2736/// [with_endpoint()]: super::builder::fulfillments::ClientBuilder::with_endpoint
2737/// [with_credentials()]: super::builder::fulfillments::ClientBuilder::credentials
2738/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
2739/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
2740///
2741/// # Pooling and Cloning
2742///
2743/// `Fulfillments` holds a connection pool internally, it is advised to
2744/// create one and the reuse it.  You do not need to wrap `Fulfillments` in
2745/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
2746/// already uses an `Arc` internally.
2747#[cfg(feature = "fulfillments")]
2748#[cfg_attr(docsrs, doc(cfg(feature = "fulfillments")))]
2749#[derive(Clone, Debug)]
2750pub struct Fulfillments {
2751    inner: std::sync::Arc<dyn super::stub::dynamic::Fulfillments>,
2752}
2753
2754#[cfg(feature = "fulfillments")]
2755impl Fulfillments {
2756    /// Returns a builder for [Fulfillments].
2757    ///
2758    /// ```
2759    /// # async fn sample() -> gax::client_builder::Result<()> {
2760    /// # use google_cloud_dialogflow_v2::client::Fulfillments;
2761    /// let client = Fulfillments::builder().build().await?;
2762    /// # Ok(()) }
2763    /// ```
2764    pub fn builder() -> super::builder::fulfillments::ClientBuilder {
2765        gax::client_builder::internal::new_builder(super::builder::fulfillments::client::Factory)
2766    }
2767
2768    /// Creates a new client from the provided stub.
2769    ///
2770    /// The most common case for calling this function is in tests mocking the
2771    /// client's behavior.
2772    pub fn from_stub<T>(stub: T) -> Self
2773    where
2774        T: super::stub::Fulfillments + 'static,
2775    {
2776        Self {
2777            inner: std::sync::Arc::new(stub),
2778        }
2779    }
2780
2781    pub(crate) async fn new(
2782        config: gaxi::options::ClientConfig,
2783    ) -> gax::client_builder::Result<Self> {
2784        let inner = Self::build_inner(config).await?;
2785        Ok(Self { inner })
2786    }
2787
2788    async fn build_inner(
2789        conf: gaxi::options::ClientConfig,
2790    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::Fulfillments>> {
2791        if gaxi::options::tracing_enabled(&conf) {
2792            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
2793        }
2794        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
2795    }
2796
2797    async fn build_transport(
2798        conf: gaxi::options::ClientConfig,
2799    ) -> gax::client_builder::Result<impl super::stub::Fulfillments> {
2800        super::transport::Fulfillments::new(conf).await
2801    }
2802
2803    async fn build_with_tracing(
2804        conf: gaxi::options::ClientConfig,
2805    ) -> gax::client_builder::Result<impl super::stub::Fulfillments> {
2806        Self::build_transport(conf)
2807            .await
2808            .map(super::tracing::Fulfillments::new)
2809    }
2810
2811    /// Retrieves the fulfillment.
2812    pub fn get_fulfillment(&self) -> super::builder::fulfillments::GetFulfillment {
2813        super::builder::fulfillments::GetFulfillment::new(self.inner.clone())
2814    }
2815
2816    /// Updates the fulfillment.
2817    pub fn update_fulfillment(&self) -> super::builder::fulfillments::UpdateFulfillment {
2818        super::builder::fulfillments::UpdateFulfillment::new(self.inner.clone())
2819    }
2820
2821    /// Lists information about the supported locations for this service.
2822    pub fn list_locations(&self) -> super::builder::fulfillments::ListLocations {
2823        super::builder::fulfillments::ListLocations::new(self.inner.clone())
2824    }
2825
2826    /// Gets information about a location.
2827    pub fn get_location(&self) -> super::builder::fulfillments::GetLocation {
2828        super::builder::fulfillments::GetLocation::new(self.inner.clone())
2829    }
2830
2831    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2832    ///
2833    /// [google.longrunning.Operations]: longrunning::client::Operations
2834    pub fn list_operations(&self) -> super::builder::fulfillments::ListOperations {
2835        super::builder::fulfillments::ListOperations::new(self.inner.clone())
2836    }
2837
2838    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2839    ///
2840    /// [google.longrunning.Operations]: longrunning::client::Operations
2841    pub fn get_operation(&self) -> super::builder::fulfillments::GetOperation {
2842        super::builder::fulfillments::GetOperation::new(self.inner.clone())
2843    }
2844
2845    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2846    ///
2847    /// [google.longrunning.Operations]: longrunning::client::Operations
2848    pub fn cancel_operation(&self) -> super::builder::fulfillments::CancelOperation {
2849        super::builder::fulfillments::CancelOperation::new(self.inner.clone())
2850    }
2851}
2852
2853/// Implements a client for the Dialogflow API.
2854///
2855/// # Example
2856/// ```
2857/// # async fn sample() -> gax::client_builder::Result<()> {
2858/// # use google_cloud_dialogflow_v2::client::Generators;
2859/// let client = Generators::builder().build().await?;
2860/// // use `client` to make requests to the Dialogflow API.
2861/// # Ok(()) }
2862/// ```
2863///
2864/// # Service Description
2865///
2866/// Generator Service for LLM powered Agent Assist. This service manages the
2867/// configurations of user owned Generators, such as description, context and
2868/// instruction, input/output format, etc. The generator resources will be used
2869/// inside a conversation and will be triggered by TriggerEvent to query LLM for
2870/// answers.
2871///
2872/// # Configuration
2873///
2874/// To configure `Generators` use the `with_*` methods in the type returned
2875/// by [builder()][Generators::builder]. The default configuration should
2876/// work for most applications. Common configuration changes include
2877///
2878/// * [with_endpoint()]: by default this client uses the global default endpoint
2879///   (`https://dialogflow.googleapis.com`). Applications using regional
2880///   endpoints or running in restricted networks (e.g. a network configured
2881//    with [Private Google Access with VPC Service Controls]) may want to
2882///   override this default.
2883/// * [with_credentials()]: by default this client uses
2884///   [Application Default Credentials]. Applications using custom
2885///   authentication may need to override this default.
2886///
2887/// [with_endpoint()]: super::builder::generators::ClientBuilder::with_endpoint
2888/// [with_credentials()]: super::builder::generators::ClientBuilder::credentials
2889/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
2890/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
2891///
2892/// # Pooling and Cloning
2893///
2894/// `Generators` holds a connection pool internally, it is advised to
2895/// create one and the reuse it.  You do not need to wrap `Generators` in
2896/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
2897/// already uses an `Arc` internally.
2898#[cfg(feature = "generators")]
2899#[cfg_attr(docsrs, doc(cfg(feature = "generators")))]
2900#[derive(Clone, Debug)]
2901pub struct Generators {
2902    inner: std::sync::Arc<dyn super::stub::dynamic::Generators>,
2903}
2904
2905#[cfg(feature = "generators")]
2906impl Generators {
2907    /// Returns a builder for [Generators].
2908    ///
2909    /// ```
2910    /// # async fn sample() -> gax::client_builder::Result<()> {
2911    /// # use google_cloud_dialogflow_v2::client::Generators;
2912    /// let client = Generators::builder().build().await?;
2913    /// # Ok(()) }
2914    /// ```
2915    pub fn builder() -> super::builder::generators::ClientBuilder {
2916        gax::client_builder::internal::new_builder(super::builder::generators::client::Factory)
2917    }
2918
2919    /// Creates a new client from the provided stub.
2920    ///
2921    /// The most common case for calling this function is in tests mocking the
2922    /// client's behavior.
2923    pub fn from_stub<T>(stub: T) -> Self
2924    where
2925        T: super::stub::Generators + 'static,
2926    {
2927        Self {
2928            inner: std::sync::Arc::new(stub),
2929        }
2930    }
2931
2932    pub(crate) async fn new(
2933        config: gaxi::options::ClientConfig,
2934    ) -> gax::client_builder::Result<Self> {
2935        let inner = Self::build_inner(config).await?;
2936        Ok(Self { inner })
2937    }
2938
2939    async fn build_inner(
2940        conf: gaxi::options::ClientConfig,
2941    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::Generators>> {
2942        if gaxi::options::tracing_enabled(&conf) {
2943            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
2944        }
2945        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
2946    }
2947
2948    async fn build_transport(
2949        conf: gaxi::options::ClientConfig,
2950    ) -> gax::client_builder::Result<impl super::stub::Generators> {
2951        super::transport::Generators::new(conf).await
2952    }
2953
2954    async fn build_with_tracing(
2955        conf: gaxi::options::ClientConfig,
2956    ) -> gax::client_builder::Result<impl super::stub::Generators> {
2957        Self::build_transport(conf)
2958            .await
2959            .map(super::tracing::Generators::new)
2960    }
2961
2962    /// Creates a generator.
2963    pub fn create_generator(&self) -> super::builder::generators::CreateGenerator {
2964        super::builder::generators::CreateGenerator::new(self.inner.clone())
2965    }
2966
2967    /// Retrieves a generator.
2968    pub fn get_generator(&self) -> super::builder::generators::GetGenerator {
2969        super::builder::generators::GetGenerator::new(self.inner.clone())
2970    }
2971
2972    /// Lists generators.
2973    pub fn list_generators(&self) -> super::builder::generators::ListGenerators {
2974        super::builder::generators::ListGenerators::new(self.inner.clone())
2975    }
2976
2977    /// Deletes a generator.
2978    pub fn delete_generator(&self) -> super::builder::generators::DeleteGenerator {
2979        super::builder::generators::DeleteGenerator::new(self.inner.clone())
2980    }
2981
2982    /// Updates a generator.
2983    pub fn update_generator(&self) -> super::builder::generators::UpdateGenerator {
2984        super::builder::generators::UpdateGenerator::new(self.inner.clone())
2985    }
2986
2987    /// Lists information about the supported locations for this service.
2988    pub fn list_locations(&self) -> super::builder::generators::ListLocations {
2989        super::builder::generators::ListLocations::new(self.inner.clone())
2990    }
2991
2992    /// Gets information about a location.
2993    pub fn get_location(&self) -> super::builder::generators::GetLocation {
2994        super::builder::generators::GetLocation::new(self.inner.clone())
2995    }
2996
2997    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2998    ///
2999    /// [google.longrunning.Operations]: longrunning::client::Operations
3000    pub fn list_operations(&self) -> super::builder::generators::ListOperations {
3001        super::builder::generators::ListOperations::new(self.inner.clone())
3002    }
3003
3004    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3005    ///
3006    /// [google.longrunning.Operations]: longrunning::client::Operations
3007    pub fn get_operation(&self) -> super::builder::generators::GetOperation {
3008        super::builder::generators::GetOperation::new(self.inner.clone())
3009    }
3010
3011    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3012    ///
3013    /// [google.longrunning.Operations]: longrunning::client::Operations
3014    pub fn cancel_operation(&self) -> super::builder::generators::CancelOperation {
3015        super::builder::generators::CancelOperation::new(self.inner.clone())
3016    }
3017}
3018
3019/// Implements a client for the Dialogflow API.
3020///
3021/// # Example
3022/// ```
3023/// # async fn sample() -> gax::client_builder::Result<()> {
3024/// # use google_cloud_dialogflow_v2::client::GeneratorEvaluations;
3025/// let client = GeneratorEvaluations::builder().build().await?;
3026/// // use `client` to make requests to the Dialogflow API.
3027/// # Ok(()) }
3028/// ```
3029///
3030/// # Service Description
3031///
3032/// Service for managing generator evaluations.
3033///
3034/// # Configuration
3035///
3036/// To configure `GeneratorEvaluations` use the `with_*` methods in the type returned
3037/// by [builder()][GeneratorEvaluations::builder]. The default configuration should
3038/// work for most applications. Common configuration changes include
3039///
3040/// * [with_endpoint()]: by default this client uses the global default endpoint
3041///   (`https://dialogflow.googleapis.com`). Applications using regional
3042///   endpoints or running in restricted networks (e.g. a network configured
3043//    with [Private Google Access with VPC Service Controls]) may want to
3044///   override this default.
3045/// * [with_credentials()]: by default this client uses
3046///   [Application Default Credentials]. Applications using custom
3047///   authentication may need to override this default.
3048///
3049/// [with_endpoint()]: super::builder::generator_evaluations::ClientBuilder::with_endpoint
3050/// [with_credentials()]: super::builder::generator_evaluations::ClientBuilder::credentials
3051/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
3052/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
3053///
3054/// # Pooling and Cloning
3055///
3056/// `GeneratorEvaluations` holds a connection pool internally, it is advised to
3057/// create one and the reuse it.  You do not need to wrap `GeneratorEvaluations` in
3058/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
3059/// already uses an `Arc` internally.
3060#[cfg(feature = "generator-evaluations")]
3061#[cfg_attr(docsrs, doc(cfg(feature = "generator-evaluations")))]
3062#[derive(Clone, Debug)]
3063pub struct GeneratorEvaluations {
3064    inner: std::sync::Arc<dyn super::stub::dynamic::GeneratorEvaluations>,
3065}
3066
3067#[cfg(feature = "generator-evaluations")]
3068impl GeneratorEvaluations {
3069    /// Returns a builder for [GeneratorEvaluations].
3070    ///
3071    /// ```
3072    /// # async fn sample() -> gax::client_builder::Result<()> {
3073    /// # use google_cloud_dialogflow_v2::client::GeneratorEvaluations;
3074    /// let client = GeneratorEvaluations::builder().build().await?;
3075    /// # Ok(()) }
3076    /// ```
3077    pub fn builder() -> super::builder::generator_evaluations::ClientBuilder {
3078        gax::client_builder::internal::new_builder(
3079            super::builder::generator_evaluations::client::Factory,
3080        )
3081    }
3082
3083    /// Creates a new client from the provided stub.
3084    ///
3085    /// The most common case for calling this function is in tests mocking the
3086    /// client's behavior.
3087    pub fn from_stub<T>(stub: T) -> Self
3088    where
3089        T: super::stub::GeneratorEvaluations + 'static,
3090    {
3091        Self {
3092            inner: std::sync::Arc::new(stub),
3093        }
3094    }
3095
3096    pub(crate) async fn new(
3097        config: gaxi::options::ClientConfig,
3098    ) -> gax::client_builder::Result<Self> {
3099        let inner = Self::build_inner(config).await?;
3100        Ok(Self { inner })
3101    }
3102
3103    async fn build_inner(
3104        conf: gaxi::options::ClientConfig,
3105    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::GeneratorEvaluations>>
3106    {
3107        if gaxi::options::tracing_enabled(&conf) {
3108            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
3109        }
3110        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
3111    }
3112
3113    async fn build_transport(
3114        conf: gaxi::options::ClientConfig,
3115    ) -> gax::client_builder::Result<impl super::stub::GeneratorEvaluations> {
3116        super::transport::GeneratorEvaluations::new(conf).await
3117    }
3118
3119    async fn build_with_tracing(
3120        conf: gaxi::options::ClientConfig,
3121    ) -> gax::client_builder::Result<impl super::stub::GeneratorEvaluations> {
3122        Self::build_transport(conf)
3123            .await
3124            .map(super::tracing::GeneratorEvaluations::new)
3125    }
3126
3127    /// Creates evaluation of a generator.
3128    ///
3129    /// # Long running operations
3130    ///
3131    /// This method is used to start, and/or poll a [long-running Operation].
3132    /// The [Working with long-running operations] chapter in the [user guide]
3133    /// covers these operations in detail.
3134    ///
3135    /// [long-running operation]: https://google.aip.dev/151
3136    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
3137    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
3138    pub fn create_generator_evaluation(
3139        &self,
3140    ) -> super::builder::generator_evaluations::CreateGeneratorEvaluation {
3141        super::builder::generator_evaluations::CreateGeneratorEvaluation::new(self.inner.clone())
3142    }
3143
3144    /// Gets an evaluation of generator.
3145    pub fn get_generator_evaluation(
3146        &self,
3147    ) -> super::builder::generator_evaluations::GetGeneratorEvaluation {
3148        super::builder::generator_evaluations::GetGeneratorEvaluation::new(self.inner.clone())
3149    }
3150
3151    /// Lists evaluations of generator.
3152    pub fn list_generator_evaluations(
3153        &self,
3154    ) -> super::builder::generator_evaluations::ListGeneratorEvaluations {
3155        super::builder::generator_evaluations::ListGeneratorEvaluations::new(self.inner.clone())
3156    }
3157
3158    /// Deletes an evaluation of generator.
3159    pub fn delete_generator_evaluation(
3160        &self,
3161    ) -> super::builder::generator_evaluations::DeleteGeneratorEvaluation {
3162        super::builder::generator_evaluations::DeleteGeneratorEvaluation::new(self.inner.clone())
3163    }
3164
3165    /// Lists information about the supported locations for this service.
3166    pub fn list_locations(&self) -> super::builder::generator_evaluations::ListLocations {
3167        super::builder::generator_evaluations::ListLocations::new(self.inner.clone())
3168    }
3169
3170    /// Gets information about a location.
3171    pub fn get_location(&self) -> super::builder::generator_evaluations::GetLocation {
3172        super::builder::generator_evaluations::GetLocation::new(self.inner.clone())
3173    }
3174
3175    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3176    ///
3177    /// [google.longrunning.Operations]: longrunning::client::Operations
3178    pub fn list_operations(&self) -> super::builder::generator_evaluations::ListOperations {
3179        super::builder::generator_evaluations::ListOperations::new(self.inner.clone())
3180    }
3181
3182    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3183    ///
3184    /// [google.longrunning.Operations]: longrunning::client::Operations
3185    pub fn get_operation(&self) -> super::builder::generator_evaluations::GetOperation {
3186        super::builder::generator_evaluations::GetOperation::new(self.inner.clone())
3187    }
3188
3189    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3190    ///
3191    /// [google.longrunning.Operations]: longrunning::client::Operations
3192    pub fn cancel_operation(&self) -> super::builder::generator_evaluations::CancelOperation {
3193        super::builder::generator_evaluations::CancelOperation::new(self.inner.clone())
3194    }
3195}
3196
3197/// Implements a client for the Dialogflow API.
3198///
3199/// # Example
3200/// ```
3201/// # async fn sample() -> gax::client_builder::Result<()> {
3202/// # use google_cloud_dialogflow_v2::client::Intents;
3203/// let client = Intents::builder().build().await?;
3204/// // use `client` to make requests to the Dialogflow API.
3205/// # Ok(()) }
3206/// ```
3207///
3208/// # Service Description
3209///
3210/// Service for managing [Intents][google.cloud.dialogflow.v2.Intent].
3211///
3212/// [google.cloud.dialogflow.v2.Intent]: crate::model::Intent
3213///
3214/// # Configuration
3215///
3216/// To configure `Intents` use the `with_*` methods in the type returned
3217/// by [builder()][Intents::builder]. The default configuration should
3218/// work for most applications. Common configuration changes include
3219///
3220/// * [with_endpoint()]: by default this client uses the global default endpoint
3221///   (`https://dialogflow.googleapis.com`). Applications using regional
3222///   endpoints or running in restricted networks (e.g. a network configured
3223//    with [Private Google Access with VPC Service Controls]) may want to
3224///   override this default.
3225/// * [with_credentials()]: by default this client uses
3226///   [Application Default Credentials]. Applications using custom
3227///   authentication may need to override this default.
3228///
3229/// [with_endpoint()]: super::builder::intents::ClientBuilder::with_endpoint
3230/// [with_credentials()]: super::builder::intents::ClientBuilder::credentials
3231/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
3232/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
3233///
3234/// # Pooling and Cloning
3235///
3236/// `Intents` holds a connection pool internally, it is advised to
3237/// create one and the reuse it.  You do not need to wrap `Intents` in
3238/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
3239/// already uses an `Arc` internally.
3240#[cfg(feature = "intents")]
3241#[cfg_attr(docsrs, doc(cfg(feature = "intents")))]
3242#[derive(Clone, Debug)]
3243pub struct Intents {
3244    inner: std::sync::Arc<dyn super::stub::dynamic::Intents>,
3245}
3246
3247#[cfg(feature = "intents")]
3248impl Intents {
3249    /// Returns a builder for [Intents].
3250    ///
3251    /// ```
3252    /// # async fn sample() -> gax::client_builder::Result<()> {
3253    /// # use google_cloud_dialogflow_v2::client::Intents;
3254    /// let client = Intents::builder().build().await?;
3255    /// # Ok(()) }
3256    /// ```
3257    pub fn builder() -> super::builder::intents::ClientBuilder {
3258        gax::client_builder::internal::new_builder(super::builder::intents::client::Factory)
3259    }
3260
3261    /// Creates a new client from the provided stub.
3262    ///
3263    /// The most common case for calling this function is in tests mocking the
3264    /// client's behavior.
3265    pub fn from_stub<T>(stub: T) -> Self
3266    where
3267        T: super::stub::Intents + 'static,
3268    {
3269        Self {
3270            inner: std::sync::Arc::new(stub),
3271        }
3272    }
3273
3274    pub(crate) async fn new(
3275        config: gaxi::options::ClientConfig,
3276    ) -> gax::client_builder::Result<Self> {
3277        let inner = Self::build_inner(config).await?;
3278        Ok(Self { inner })
3279    }
3280
3281    async fn build_inner(
3282        conf: gaxi::options::ClientConfig,
3283    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::Intents>> {
3284        if gaxi::options::tracing_enabled(&conf) {
3285            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
3286        }
3287        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
3288    }
3289
3290    async fn build_transport(
3291        conf: gaxi::options::ClientConfig,
3292    ) -> gax::client_builder::Result<impl super::stub::Intents> {
3293        super::transport::Intents::new(conf).await
3294    }
3295
3296    async fn build_with_tracing(
3297        conf: gaxi::options::ClientConfig,
3298    ) -> gax::client_builder::Result<impl super::stub::Intents> {
3299        Self::build_transport(conf)
3300            .await
3301            .map(super::tracing::Intents::new)
3302    }
3303
3304    /// Returns the list of all intents in the specified agent.
3305    pub fn list_intents(&self) -> super::builder::intents::ListIntents {
3306        super::builder::intents::ListIntents::new(self.inner.clone())
3307    }
3308
3309    /// Retrieves the specified intent.
3310    pub fn get_intent(&self) -> super::builder::intents::GetIntent {
3311        super::builder::intents::GetIntent::new(self.inner.clone())
3312    }
3313
3314    /// Creates an intent in the specified agent.
3315    ///
3316    /// Note: You should always train an agent prior to sending it queries. See the
3317    /// [training
3318    /// documentation](https://cloud.google.com/dialogflow/es/docs/training).
3319    pub fn create_intent(&self) -> super::builder::intents::CreateIntent {
3320        super::builder::intents::CreateIntent::new(self.inner.clone())
3321    }
3322
3323    /// Updates the specified intent.
3324    ///
3325    /// Note: You should always train an agent prior to sending it queries. See the
3326    /// [training
3327    /// documentation](https://cloud.google.com/dialogflow/es/docs/training).
3328    pub fn update_intent(&self) -> super::builder::intents::UpdateIntent {
3329        super::builder::intents::UpdateIntent::new(self.inner.clone())
3330    }
3331
3332    /// Deletes the specified intent and its direct or indirect followup intents.
3333    ///
3334    /// Note: You should always train an agent prior to sending it queries. See the
3335    /// [training
3336    /// documentation](https://cloud.google.com/dialogflow/es/docs/training).
3337    pub fn delete_intent(&self) -> super::builder::intents::DeleteIntent {
3338        super::builder::intents::DeleteIntent::new(self.inner.clone())
3339    }
3340
3341    /// Updates/Creates multiple intents in the specified agent.
3342    ///
3343    /// This method is a [long-running
3344    /// operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations).
3345    /// The returned `Operation` type has the following method-specific fields:
3346    ///
3347    /// - `metadata`: An empty [Struct
3348    ///   message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct)
3349    /// - `response`:
3350    ///   [BatchUpdateIntentsResponse][google.cloud.dialogflow.v2.BatchUpdateIntentsResponse]
3351    ///
3352    /// Note: You should always train an agent prior to sending it queries. See the
3353    /// [training
3354    /// documentation](https://cloud.google.com/dialogflow/es/docs/training).
3355    ///
3356    /// [google.cloud.dialogflow.v2.BatchUpdateIntentsResponse]: crate::model::BatchUpdateIntentsResponse
3357    ///
3358    /// # Long running operations
3359    ///
3360    /// This method is used to start, and/or poll a [long-running Operation].
3361    /// The [Working with long-running operations] chapter in the [user guide]
3362    /// covers these operations in detail.
3363    ///
3364    /// [long-running operation]: https://google.aip.dev/151
3365    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
3366    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
3367    pub fn batch_update_intents(&self) -> super::builder::intents::BatchUpdateIntents {
3368        super::builder::intents::BatchUpdateIntents::new(self.inner.clone())
3369    }
3370
3371    /// Deletes intents in the specified agent.
3372    ///
3373    /// This method is a [long-running
3374    /// operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations).
3375    /// The returned `Operation` type has the following method-specific fields:
3376    ///
3377    /// - `metadata`: An empty [Struct
3378    ///   message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct)
3379    /// - `response`: An [Empty
3380    ///   message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
3381    ///
3382    /// Note: You should always train an agent prior to sending it queries. See the
3383    /// [training
3384    /// documentation](https://cloud.google.com/dialogflow/es/docs/training).
3385    ///
3386    /// # Long running operations
3387    ///
3388    /// This method is used to start, and/or poll a [long-running Operation].
3389    /// The [Working with long-running operations] chapter in the [user guide]
3390    /// covers these operations in detail.
3391    ///
3392    /// [long-running operation]: https://google.aip.dev/151
3393    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
3394    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
3395    pub fn batch_delete_intents(&self) -> super::builder::intents::BatchDeleteIntents {
3396        super::builder::intents::BatchDeleteIntents::new(self.inner.clone())
3397    }
3398
3399    /// Lists information about the supported locations for this service.
3400    pub fn list_locations(&self) -> super::builder::intents::ListLocations {
3401        super::builder::intents::ListLocations::new(self.inner.clone())
3402    }
3403
3404    /// Gets information about a location.
3405    pub fn get_location(&self) -> super::builder::intents::GetLocation {
3406        super::builder::intents::GetLocation::new(self.inner.clone())
3407    }
3408
3409    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3410    ///
3411    /// [google.longrunning.Operations]: longrunning::client::Operations
3412    pub fn list_operations(&self) -> super::builder::intents::ListOperations {
3413        super::builder::intents::ListOperations::new(self.inner.clone())
3414    }
3415
3416    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3417    ///
3418    /// [google.longrunning.Operations]: longrunning::client::Operations
3419    pub fn get_operation(&self) -> super::builder::intents::GetOperation {
3420        super::builder::intents::GetOperation::new(self.inner.clone())
3421    }
3422
3423    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3424    ///
3425    /// [google.longrunning.Operations]: longrunning::client::Operations
3426    pub fn cancel_operation(&self) -> super::builder::intents::CancelOperation {
3427        super::builder::intents::CancelOperation::new(self.inner.clone())
3428    }
3429}
3430
3431/// Implements a client for the Dialogflow API.
3432///
3433/// # Example
3434/// ```
3435/// # async fn sample() -> gax::client_builder::Result<()> {
3436/// # use google_cloud_dialogflow_v2::client::KnowledgeBases;
3437/// let client = KnowledgeBases::builder().build().await?;
3438/// // use `client` to make requests to the Dialogflow API.
3439/// # Ok(()) }
3440/// ```
3441///
3442/// # Service Description
3443///
3444/// Service for managing
3445/// [KnowledgeBases][google.cloud.dialogflow.v2.KnowledgeBase].
3446///
3447/// [google.cloud.dialogflow.v2.KnowledgeBase]: crate::model::KnowledgeBase
3448///
3449/// # Configuration
3450///
3451/// To configure `KnowledgeBases` use the `with_*` methods in the type returned
3452/// by [builder()][KnowledgeBases::builder]. The default configuration should
3453/// work for most applications. Common configuration changes include
3454///
3455/// * [with_endpoint()]: by default this client uses the global default endpoint
3456///   (`https://dialogflow.googleapis.com`). Applications using regional
3457///   endpoints or running in restricted networks (e.g. a network configured
3458//    with [Private Google Access with VPC Service Controls]) may want to
3459///   override this default.
3460/// * [with_credentials()]: by default this client uses
3461///   [Application Default Credentials]. Applications using custom
3462///   authentication may need to override this default.
3463///
3464/// [with_endpoint()]: super::builder::knowledge_bases::ClientBuilder::with_endpoint
3465/// [with_credentials()]: super::builder::knowledge_bases::ClientBuilder::credentials
3466/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
3467/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
3468///
3469/// # Pooling and Cloning
3470///
3471/// `KnowledgeBases` holds a connection pool internally, it is advised to
3472/// create one and the reuse it.  You do not need to wrap `KnowledgeBases` in
3473/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
3474/// already uses an `Arc` internally.
3475#[cfg(feature = "knowledge-bases")]
3476#[cfg_attr(docsrs, doc(cfg(feature = "knowledge-bases")))]
3477#[derive(Clone, Debug)]
3478pub struct KnowledgeBases {
3479    inner: std::sync::Arc<dyn super::stub::dynamic::KnowledgeBases>,
3480}
3481
3482#[cfg(feature = "knowledge-bases")]
3483impl KnowledgeBases {
3484    /// Returns a builder for [KnowledgeBases].
3485    ///
3486    /// ```
3487    /// # async fn sample() -> gax::client_builder::Result<()> {
3488    /// # use google_cloud_dialogflow_v2::client::KnowledgeBases;
3489    /// let client = KnowledgeBases::builder().build().await?;
3490    /// # Ok(()) }
3491    /// ```
3492    pub fn builder() -> super::builder::knowledge_bases::ClientBuilder {
3493        gax::client_builder::internal::new_builder(super::builder::knowledge_bases::client::Factory)
3494    }
3495
3496    /// Creates a new client from the provided stub.
3497    ///
3498    /// The most common case for calling this function is in tests mocking the
3499    /// client's behavior.
3500    pub fn from_stub<T>(stub: T) -> Self
3501    where
3502        T: super::stub::KnowledgeBases + 'static,
3503    {
3504        Self {
3505            inner: std::sync::Arc::new(stub),
3506        }
3507    }
3508
3509    pub(crate) async fn new(
3510        config: gaxi::options::ClientConfig,
3511    ) -> gax::client_builder::Result<Self> {
3512        let inner = Self::build_inner(config).await?;
3513        Ok(Self { inner })
3514    }
3515
3516    async fn build_inner(
3517        conf: gaxi::options::ClientConfig,
3518    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::KnowledgeBases>> {
3519        if gaxi::options::tracing_enabled(&conf) {
3520            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
3521        }
3522        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
3523    }
3524
3525    async fn build_transport(
3526        conf: gaxi::options::ClientConfig,
3527    ) -> gax::client_builder::Result<impl super::stub::KnowledgeBases> {
3528        super::transport::KnowledgeBases::new(conf).await
3529    }
3530
3531    async fn build_with_tracing(
3532        conf: gaxi::options::ClientConfig,
3533    ) -> gax::client_builder::Result<impl super::stub::KnowledgeBases> {
3534        Self::build_transport(conf)
3535            .await
3536            .map(super::tracing::KnowledgeBases::new)
3537    }
3538
3539    /// Returns the list of all knowledge bases of the specified agent.
3540    pub fn list_knowledge_bases(&self) -> super::builder::knowledge_bases::ListKnowledgeBases {
3541        super::builder::knowledge_bases::ListKnowledgeBases::new(self.inner.clone())
3542    }
3543
3544    /// Retrieves the specified knowledge base.
3545    pub fn get_knowledge_base(&self) -> super::builder::knowledge_bases::GetKnowledgeBase {
3546        super::builder::knowledge_bases::GetKnowledgeBase::new(self.inner.clone())
3547    }
3548
3549    /// Creates a knowledge base.
3550    pub fn create_knowledge_base(&self) -> super::builder::knowledge_bases::CreateKnowledgeBase {
3551        super::builder::knowledge_bases::CreateKnowledgeBase::new(self.inner.clone())
3552    }
3553
3554    /// Deletes the specified knowledge base.
3555    pub fn delete_knowledge_base(&self) -> super::builder::knowledge_bases::DeleteKnowledgeBase {
3556        super::builder::knowledge_bases::DeleteKnowledgeBase::new(self.inner.clone())
3557    }
3558
3559    /// Updates the specified knowledge base.
3560    pub fn update_knowledge_base(&self) -> super::builder::knowledge_bases::UpdateKnowledgeBase {
3561        super::builder::knowledge_bases::UpdateKnowledgeBase::new(self.inner.clone())
3562    }
3563
3564    /// Lists information about the supported locations for this service.
3565    pub fn list_locations(&self) -> super::builder::knowledge_bases::ListLocations {
3566        super::builder::knowledge_bases::ListLocations::new(self.inner.clone())
3567    }
3568
3569    /// Gets information about a location.
3570    pub fn get_location(&self) -> super::builder::knowledge_bases::GetLocation {
3571        super::builder::knowledge_bases::GetLocation::new(self.inner.clone())
3572    }
3573
3574    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3575    ///
3576    /// [google.longrunning.Operations]: longrunning::client::Operations
3577    pub fn list_operations(&self) -> super::builder::knowledge_bases::ListOperations {
3578        super::builder::knowledge_bases::ListOperations::new(self.inner.clone())
3579    }
3580
3581    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3582    ///
3583    /// [google.longrunning.Operations]: longrunning::client::Operations
3584    pub fn get_operation(&self) -> super::builder::knowledge_bases::GetOperation {
3585        super::builder::knowledge_bases::GetOperation::new(self.inner.clone())
3586    }
3587
3588    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3589    ///
3590    /// [google.longrunning.Operations]: longrunning::client::Operations
3591    pub fn cancel_operation(&self) -> super::builder::knowledge_bases::CancelOperation {
3592        super::builder::knowledge_bases::CancelOperation::new(self.inner.clone())
3593    }
3594}
3595
3596/// Implements a client for the Dialogflow API.
3597///
3598/// # Example
3599/// ```
3600/// # async fn sample() -> gax::client_builder::Result<()> {
3601/// # use google_cloud_dialogflow_v2::client::Participants;
3602/// let client = Participants::builder().build().await?;
3603/// // use `client` to make requests to the Dialogflow API.
3604/// # Ok(()) }
3605/// ```
3606///
3607/// # Service Description
3608///
3609/// Service for managing [Participants][google.cloud.dialogflow.v2.Participant].
3610///
3611/// [google.cloud.dialogflow.v2.Participant]: crate::model::Participant
3612///
3613/// # Configuration
3614///
3615/// To configure `Participants` use the `with_*` methods in the type returned
3616/// by [builder()][Participants::builder]. The default configuration should
3617/// work for most applications. Common configuration changes include
3618///
3619/// * [with_endpoint()]: by default this client uses the global default endpoint
3620///   (`https://dialogflow.googleapis.com`). Applications using regional
3621///   endpoints or running in restricted networks (e.g. a network configured
3622//    with [Private Google Access with VPC Service Controls]) may want to
3623///   override this default.
3624/// * [with_credentials()]: by default this client uses
3625///   [Application Default Credentials]. Applications using custom
3626///   authentication may need to override this default.
3627///
3628/// [with_endpoint()]: super::builder::participants::ClientBuilder::with_endpoint
3629/// [with_credentials()]: super::builder::participants::ClientBuilder::credentials
3630/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
3631/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
3632///
3633/// # Pooling and Cloning
3634///
3635/// `Participants` holds a connection pool internally, it is advised to
3636/// create one and the reuse it.  You do not need to wrap `Participants` in
3637/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
3638/// already uses an `Arc` internally.
3639#[cfg(feature = "participants")]
3640#[cfg_attr(docsrs, doc(cfg(feature = "participants")))]
3641#[derive(Clone, Debug)]
3642pub struct Participants {
3643    inner: std::sync::Arc<dyn super::stub::dynamic::Participants>,
3644}
3645
3646#[cfg(feature = "participants")]
3647impl Participants {
3648    /// Returns a builder for [Participants].
3649    ///
3650    /// ```
3651    /// # async fn sample() -> gax::client_builder::Result<()> {
3652    /// # use google_cloud_dialogflow_v2::client::Participants;
3653    /// let client = Participants::builder().build().await?;
3654    /// # Ok(()) }
3655    /// ```
3656    pub fn builder() -> super::builder::participants::ClientBuilder {
3657        gax::client_builder::internal::new_builder(super::builder::participants::client::Factory)
3658    }
3659
3660    /// Creates a new client from the provided stub.
3661    ///
3662    /// The most common case for calling this function is in tests mocking the
3663    /// client's behavior.
3664    pub fn from_stub<T>(stub: T) -> Self
3665    where
3666        T: super::stub::Participants + 'static,
3667    {
3668        Self {
3669            inner: std::sync::Arc::new(stub),
3670        }
3671    }
3672
3673    pub(crate) async fn new(
3674        config: gaxi::options::ClientConfig,
3675    ) -> gax::client_builder::Result<Self> {
3676        let inner = Self::build_inner(config).await?;
3677        Ok(Self { inner })
3678    }
3679
3680    async fn build_inner(
3681        conf: gaxi::options::ClientConfig,
3682    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::Participants>> {
3683        if gaxi::options::tracing_enabled(&conf) {
3684            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
3685        }
3686        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
3687    }
3688
3689    async fn build_transport(
3690        conf: gaxi::options::ClientConfig,
3691    ) -> gax::client_builder::Result<impl super::stub::Participants> {
3692        super::transport::Participants::new(conf).await
3693    }
3694
3695    async fn build_with_tracing(
3696        conf: gaxi::options::ClientConfig,
3697    ) -> gax::client_builder::Result<impl super::stub::Participants> {
3698        Self::build_transport(conf)
3699            .await
3700            .map(super::tracing::Participants::new)
3701    }
3702
3703    /// Creates a new participant in a conversation.
3704    pub fn create_participant(&self) -> super::builder::participants::CreateParticipant {
3705        super::builder::participants::CreateParticipant::new(self.inner.clone())
3706    }
3707
3708    /// Retrieves a conversation participant.
3709    pub fn get_participant(&self) -> super::builder::participants::GetParticipant {
3710        super::builder::participants::GetParticipant::new(self.inner.clone())
3711    }
3712
3713    /// Returns the list of all participants in the specified conversation.
3714    pub fn list_participants(&self) -> super::builder::participants::ListParticipants {
3715        super::builder::participants::ListParticipants::new(self.inner.clone())
3716    }
3717
3718    /// Updates the specified participant.
3719    pub fn update_participant(&self) -> super::builder::participants::UpdateParticipant {
3720        super::builder::participants::UpdateParticipant::new(self.inner.clone())
3721    }
3722
3723    /// Adds a text (chat, for example), or audio (phone recording, for example)
3724    /// message from a participant into the conversation.
3725    ///
3726    /// Note: Always use agent versions for production traffic
3727    /// sent to virtual agents. See [Versions and
3728    /// environments](https://cloud.google.com/dialogflow/es/docs/agents-versions).
3729    pub fn analyze_content(&self) -> super::builder::participants::AnalyzeContent {
3730        super::builder::participants::AnalyzeContent::new(self.inner.clone())
3731    }
3732
3733    /// Gets suggested articles for a participant based on specific historical
3734    /// messages.
3735    pub fn suggest_articles(&self) -> super::builder::participants::SuggestArticles {
3736        super::builder::participants::SuggestArticles::new(self.inner.clone())
3737    }
3738
3739    /// Gets suggested faq answers for a participant based on specific historical
3740    /// messages.
3741    pub fn suggest_faq_answers(&self) -> super::builder::participants::SuggestFaqAnswers {
3742        super::builder::participants::SuggestFaqAnswers::new(self.inner.clone())
3743    }
3744
3745    /// Gets smart replies for a participant based on specific historical
3746    /// messages.
3747    pub fn suggest_smart_replies(&self) -> super::builder::participants::SuggestSmartReplies {
3748        super::builder::participants::SuggestSmartReplies::new(self.inner.clone())
3749    }
3750
3751    /// Gets knowledge assist suggestions based on historical messages.
3752    pub fn suggest_knowledge_assist(&self) -> super::builder::participants::SuggestKnowledgeAssist {
3753        super::builder::participants::SuggestKnowledgeAssist::new(self.inner.clone())
3754    }
3755
3756    /// Lists information about the supported locations for this service.
3757    pub fn list_locations(&self) -> super::builder::participants::ListLocations {
3758        super::builder::participants::ListLocations::new(self.inner.clone())
3759    }
3760
3761    /// Gets information about a location.
3762    pub fn get_location(&self) -> super::builder::participants::GetLocation {
3763        super::builder::participants::GetLocation::new(self.inner.clone())
3764    }
3765
3766    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3767    ///
3768    /// [google.longrunning.Operations]: longrunning::client::Operations
3769    pub fn list_operations(&self) -> super::builder::participants::ListOperations {
3770        super::builder::participants::ListOperations::new(self.inner.clone())
3771    }
3772
3773    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3774    ///
3775    /// [google.longrunning.Operations]: longrunning::client::Operations
3776    pub fn get_operation(&self) -> super::builder::participants::GetOperation {
3777        super::builder::participants::GetOperation::new(self.inner.clone())
3778    }
3779
3780    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3781    ///
3782    /// [google.longrunning.Operations]: longrunning::client::Operations
3783    pub fn cancel_operation(&self) -> super::builder::participants::CancelOperation {
3784        super::builder::participants::CancelOperation::new(self.inner.clone())
3785    }
3786}
3787
3788/// Implements a client for the Dialogflow API.
3789///
3790/// # Example
3791/// ```
3792/// # async fn sample() -> gax::client_builder::Result<()> {
3793/// # use google_cloud_dialogflow_v2::client::Sessions;
3794/// let client = Sessions::builder().build().await?;
3795/// // use `client` to make requests to the Dialogflow API.
3796/// # Ok(()) }
3797/// ```
3798///
3799/// # Service Description
3800///
3801/// A service used for session interactions.
3802///
3803/// For more information, see the [API interactions
3804/// guide](https://cloud.google.com/dialogflow/docs/api-overview).
3805///
3806/// # Configuration
3807///
3808/// To configure `Sessions` use the `with_*` methods in the type returned
3809/// by [builder()][Sessions::builder]. The default configuration should
3810/// work for most applications. Common configuration changes include
3811///
3812/// * [with_endpoint()]: by default this client uses the global default endpoint
3813///   (`https://dialogflow.googleapis.com`). Applications using regional
3814///   endpoints or running in restricted networks (e.g. a network configured
3815//    with [Private Google Access with VPC Service Controls]) may want to
3816///   override this default.
3817/// * [with_credentials()]: by default this client uses
3818///   [Application Default Credentials]. Applications using custom
3819///   authentication may need to override this default.
3820///
3821/// [with_endpoint()]: super::builder::sessions::ClientBuilder::with_endpoint
3822/// [with_credentials()]: super::builder::sessions::ClientBuilder::credentials
3823/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
3824/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
3825///
3826/// # Pooling and Cloning
3827///
3828/// `Sessions` holds a connection pool internally, it is advised to
3829/// create one and the reuse it.  You do not need to wrap `Sessions` in
3830/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
3831/// already uses an `Arc` internally.
3832#[cfg(feature = "sessions")]
3833#[cfg_attr(docsrs, doc(cfg(feature = "sessions")))]
3834#[derive(Clone, Debug)]
3835pub struct Sessions {
3836    inner: std::sync::Arc<dyn super::stub::dynamic::Sessions>,
3837}
3838
3839#[cfg(feature = "sessions")]
3840impl Sessions {
3841    /// Returns a builder for [Sessions].
3842    ///
3843    /// ```
3844    /// # async fn sample() -> gax::client_builder::Result<()> {
3845    /// # use google_cloud_dialogflow_v2::client::Sessions;
3846    /// let client = Sessions::builder().build().await?;
3847    /// # Ok(()) }
3848    /// ```
3849    pub fn builder() -> super::builder::sessions::ClientBuilder {
3850        gax::client_builder::internal::new_builder(super::builder::sessions::client::Factory)
3851    }
3852
3853    /// Creates a new client from the provided stub.
3854    ///
3855    /// The most common case for calling this function is in tests mocking the
3856    /// client's behavior.
3857    pub fn from_stub<T>(stub: T) -> Self
3858    where
3859        T: super::stub::Sessions + 'static,
3860    {
3861        Self {
3862            inner: std::sync::Arc::new(stub),
3863        }
3864    }
3865
3866    pub(crate) async fn new(
3867        config: gaxi::options::ClientConfig,
3868    ) -> gax::client_builder::Result<Self> {
3869        let inner = Self::build_inner(config).await?;
3870        Ok(Self { inner })
3871    }
3872
3873    async fn build_inner(
3874        conf: gaxi::options::ClientConfig,
3875    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::Sessions>> {
3876        if gaxi::options::tracing_enabled(&conf) {
3877            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
3878        }
3879        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
3880    }
3881
3882    async fn build_transport(
3883        conf: gaxi::options::ClientConfig,
3884    ) -> gax::client_builder::Result<impl super::stub::Sessions> {
3885        super::transport::Sessions::new(conf).await
3886    }
3887
3888    async fn build_with_tracing(
3889        conf: gaxi::options::ClientConfig,
3890    ) -> gax::client_builder::Result<impl super::stub::Sessions> {
3891        Self::build_transport(conf)
3892            .await
3893            .map(super::tracing::Sessions::new)
3894    }
3895
3896    /// Processes a natural language query and returns structured, actionable data
3897    /// as a result. This method is not idempotent, because it may cause contexts
3898    /// and session entity types to be updated, which in turn might affect
3899    /// results of future queries.
3900    ///
3901    /// If you might use
3902    /// [Agent Assist](https://cloud.google.com/dialogflow/docs/#aa)
3903    /// or other CCAI products now or in the future, consider using
3904    /// [AnalyzeContent][google.cloud.dialogflow.v2.Participants.AnalyzeContent]
3905    /// instead of `DetectIntent`. `AnalyzeContent` has additional
3906    /// functionality for Agent Assist and other CCAI products.
3907    ///
3908    /// Note: Always use agent versions for production traffic.
3909    /// See [Versions and
3910    /// environments](https://cloud.google.com/dialogflow/es/docs/agents-versions).
3911    ///
3912    /// [google.cloud.dialogflow.v2.Participants.AnalyzeContent]: crate::client::Participants::analyze_content
3913    pub fn detect_intent(&self) -> super::builder::sessions::DetectIntent {
3914        super::builder::sessions::DetectIntent::new(self.inner.clone())
3915    }
3916
3917    /// Lists information about the supported locations for this service.
3918    pub fn list_locations(&self) -> super::builder::sessions::ListLocations {
3919        super::builder::sessions::ListLocations::new(self.inner.clone())
3920    }
3921
3922    /// Gets information about a location.
3923    pub fn get_location(&self) -> super::builder::sessions::GetLocation {
3924        super::builder::sessions::GetLocation::new(self.inner.clone())
3925    }
3926
3927    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3928    ///
3929    /// [google.longrunning.Operations]: longrunning::client::Operations
3930    pub fn list_operations(&self) -> super::builder::sessions::ListOperations {
3931        super::builder::sessions::ListOperations::new(self.inner.clone())
3932    }
3933
3934    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3935    ///
3936    /// [google.longrunning.Operations]: longrunning::client::Operations
3937    pub fn get_operation(&self) -> super::builder::sessions::GetOperation {
3938        super::builder::sessions::GetOperation::new(self.inner.clone())
3939    }
3940
3941    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3942    ///
3943    /// [google.longrunning.Operations]: longrunning::client::Operations
3944    pub fn cancel_operation(&self) -> super::builder::sessions::CancelOperation {
3945        super::builder::sessions::CancelOperation::new(self.inner.clone())
3946    }
3947}
3948
3949/// Implements a client for the Dialogflow API.
3950///
3951/// # Example
3952/// ```
3953/// # async fn sample() -> gax::client_builder::Result<()> {
3954/// # use google_cloud_dialogflow_v2::client::SessionEntityTypes;
3955/// let client = SessionEntityTypes::builder().build().await?;
3956/// // use `client` to make requests to the Dialogflow API.
3957/// # Ok(()) }
3958/// ```
3959///
3960/// # Service Description
3961///
3962/// Service for managing
3963/// [SessionEntityTypes][google.cloud.dialogflow.v2.SessionEntityType].
3964///
3965/// [google.cloud.dialogflow.v2.SessionEntityType]: crate::model::SessionEntityType
3966///
3967/// # Configuration
3968///
3969/// To configure `SessionEntityTypes` use the `with_*` methods in the type returned
3970/// by [builder()][SessionEntityTypes::builder]. The default configuration should
3971/// work for most applications. Common configuration changes include
3972///
3973/// * [with_endpoint()]: by default this client uses the global default endpoint
3974///   (`https://dialogflow.googleapis.com`). Applications using regional
3975///   endpoints or running in restricted networks (e.g. a network configured
3976//    with [Private Google Access with VPC Service Controls]) may want to
3977///   override this default.
3978/// * [with_credentials()]: by default this client uses
3979///   [Application Default Credentials]. Applications using custom
3980///   authentication may need to override this default.
3981///
3982/// [with_endpoint()]: super::builder::session_entity_types::ClientBuilder::with_endpoint
3983/// [with_credentials()]: super::builder::session_entity_types::ClientBuilder::credentials
3984/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
3985/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
3986///
3987/// # Pooling and Cloning
3988///
3989/// `SessionEntityTypes` holds a connection pool internally, it is advised to
3990/// create one and the reuse it.  You do not need to wrap `SessionEntityTypes` in
3991/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
3992/// already uses an `Arc` internally.
3993#[cfg(feature = "session-entity-types")]
3994#[cfg_attr(docsrs, doc(cfg(feature = "session-entity-types")))]
3995#[derive(Clone, Debug)]
3996pub struct SessionEntityTypes {
3997    inner: std::sync::Arc<dyn super::stub::dynamic::SessionEntityTypes>,
3998}
3999
4000#[cfg(feature = "session-entity-types")]
4001impl SessionEntityTypes {
4002    /// Returns a builder for [SessionEntityTypes].
4003    ///
4004    /// ```
4005    /// # async fn sample() -> gax::client_builder::Result<()> {
4006    /// # use google_cloud_dialogflow_v2::client::SessionEntityTypes;
4007    /// let client = SessionEntityTypes::builder().build().await?;
4008    /// # Ok(()) }
4009    /// ```
4010    pub fn builder() -> super::builder::session_entity_types::ClientBuilder {
4011        gax::client_builder::internal::new_builder(
4012            super::builder::session_entity_types::client::Factory,
4013        )
4014    }
4015
4016    /// Creates a new client from the provided stub.
4017    ///
4018    /// The most common case for calling this function is in tests mocking the
4019    /// client's behavior.
4020    pub fn from_stub<T>(stub: T) -> Self
4021    where
4022        T: super::stub::SessionEntityTypes + 'static,
4023    {
4024        Self {
4025            inner: std::sync::Arc::new(stub),
4026        }
4027    }
4028
4029    pub(crate) async fn new(
4030        config: gaxi::options::ClientConfig,
4031    ) -> gax::client_builder::Result<Self> {
4032        let inner = Self::build_inner(config).await?;
4033        Ok(Self { inner })
4034    }
4035
4036    async fn build_inner(
4037        conf: gaxi::options::ClientConfig,
4038    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::SessionEntityTypes>>
4039    {
4040        if gaxi::options::tracing_enabled(&conf) {
4041            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
4042        }
4043        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
4044    }
4045
4046    async fn build_transport(
4047        conf: gaxi::options::ClientConfig,
4048    ) -> gax::client_builder::Result<impl super::stub::SessionEntityTypes> {
4049        super::transport::SessionEntityTypes::new(conf).await
4050    }
4051
4052    async fn build_with_tracing(
4053        conf: gaxi::options::ClientConfig,
4054    ) -> gax::client_builder::Result<impl super::stub::SessionEntityTypes> {
4055        Self::build_transport(conf)
4056            .await
4057            .map(super::tracing::SessionEntityTypes::new)
4058    }
4059
4060    /// Returns the list of all session entity types in the specified session.
4061    ///
4062    /// This method doesn't work with Google Assistant integration.
4063    /// Contact Dialogflow support if you need to use session entities
4064    /// with Google Assistant integration.
4065    pub fn list_session_entity_types(
4066        &self,
4067    ) -> super::builder::session_entity_types::ListSessionEntityTypes {
4068        super::builder::session_entity_types::ListSessionEntityTypes::new(self.inner.clone())
4069    }
4070
4071    /// Retrieves the specified session entity type.
4072    ///
4073    /// This method doesn't work with Google Assistant integration.
4074    /// Contact Dialogflow support if you need to use session entities
4075    /// with Google Assistant integration.
4076    pub fn get_session_entity_type(
4077        &self,
4078    ) -> super::builder::session_entity_types::GetSessionEntityType {
4079        super::builder::session_entity_types::GetSessionEntityType::new(self.inner.clone())
4080    }
4081
4082    /// Creates a session entity type.
4083    ///
4084    /// If the specified session entity type already exists, overrides the session
4085    /// entity type.
4086    ///
4087    /// This method doesn't work with Google Assistant integration.
4088    /// Contact Dialogflow support if you need to use session entities
4089    /// with Google Assistant integration.
4090    pub fn create_session_entity_type(
4091        &self,
4092    ) -> super::builder::session_entity_types::CreateSessionEntityType {
4093        super::builder::session_entity_types::CreateSessionEntityType::new(self.inner.clone())
4094    }
4095
4096    /// Updates the specified session entity type.
4097    ///
4098    /// This method doesn't work with Google Assistant integration.
4099    /// Contact Dialogflow support if you need to use session entities
4100    /// with Google Assistant integration.
4101    pub fn update_session_entity_type(
4102        &self,
4103    ) -> super::builder::session_entity_types::UpdateSessionEntityType {
4104        super::builder::session_entity_types::UpdateSessionEntityType::new(self.inner.clone())
4105    }
4106
4107    /// Deletes the specified session entity type.
4108    ///
4109    /// This method doesn't work with Google Assistant integration.
4110    /// Contact Dialogflow support if you need to use session entities
4111    /// with Google Assistant integration.
4112    pub fn delete_session_entity_type(
4113        &self,
4114    ) -> super::builder::session_entity_types::DeleteSessionEntityType {
4115        super::builder::session_entity_types::DeleteSessionEntityType::new(self.inner.clone())
4116    }
4117
4118    /// Lists information about the supported locations for this service.
4119    pub fn list_locations(&self) -> super::builder::session_entity_types::ListLocations {
4120        super::builder::session_entity_types::ListLocations::new(self.inner.clone())
4121    }
4122
4123    /// Gets information about a location.
4124    pub fn get_location(&self) -> super::builder::session_entity_types::GetLocation {
4125        super::builder::session_entity_types::GetLocation::new(self.inner.clone())
4126    }
4127
4128    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
4129    ///
4130    /// [google.longrunning.Operations]: longrunning::client::Operations
4131    pub fn list_operations(&self) -> super::builder::session_entity_types::ListOperations {
4132        super::builder::session_entity_types::ListOperations::new(self.inner.clone())
4133    }
4134
4135    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
4136    ///
4137    /// [google.longrunning.Operations]: longrunning::client::Operations
4138    pub fn get_operation(&self) -> super::builder::session_entity_types::GetOperation {
4139        super::builder::session_entity_types::GetOperation::new(self.inner.clone())
4140    }
4141
4142    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
4143    ///
4144    /// [google.longrunning.Operations]: longrunning::client::Operations
4145    pub fn cancel_operation(&self) -> super::builder::session_entity_types::CancelOperation {
4146        super::builder::session_entity_types::CancelOperation::new(self.inner.clone())
4147    }
4148}
4149
4150/// Implements a client for the Dialogflow API.
4151///
4152/// # Example
4153/// ```
4154/// # async fn sample() -> gax::client_builder::Result<()> {
4155/// # use google_cloud_dialogflow_v2::client::SipTrunks;
4156/// let client = SipTrunks::builder().build().await?;
4157/// // use `client` to make requests to the Dialogflow API.
4158/// # Ok(()) }
4159/// ```
4160///
4161/// # Service Description
4162///
4163/// Service for managing [SipTrunks][google.cloud.dialogflow.v2.SipTrunk].
4164///
4165/// [google.cloud.dialogflow.v2.SipTrunk]: crate::model::SipTrunk
4166///
4167/// # Configuration
4168///
4169/// To configure `SipTrunks` use the `with_*` methods in the type returned
4170/// by [builder()][SipTrunks::builder]. The default configuration should
4171/// work for most applications. Common configuration changes include
4172///
4173/// * [with_endpoint()]: by default this client uses the global default endpoint
4174///   (`https://dialogflow.googleapis.com`). Applications using regional
4175///   endpoints or running in restricted networks (e.g. a network configured
4176//    with [Private Google Access with VPC Service Controls]) may want to
4177///   override this default.
4178/// * [with_credentials()]: by default this client uses
4179///   [Application Default Credentials]. Applications using custom
4180///   authentication may need to override this default.
4181///
4182/// [with_endpoint()]: super::builder::sip_trunks::ClientBuilder::with_endpoint
4183/// [with_credentials()]: super::builder::sip_trunks::ClientBuilder::credentials
4184/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
4185/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
4186///
4187/// # Pooling and Cloning
4188///
4189/// `SipTrunks` holds a connection pool internally, it is advised to
4190/// create one and the reuse it.  You do not need to wrap `SipTrunks` in
4191/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
4192/// already uses an `Arc` internally.
4193#[cfg(feature = "sip-trunks")]
4194#[cfg_attr(docsrs, doc(cfg(feature = "sip-trunks")))]
4195#[derive(Clone, Debug)]
4196pub struct SipTrunks {
4197    inner: std::sync::Arc<dyn super::stub::dynamic::SipTrunks>,
4198}
4199
4200#[cfg(feature = "sip-trunks")]
4201impl SipTrunks {
4202    /// Returns a builder for [SipTrunks].
4203    ///
4204    /// ```
4205    /// # async fn sample() -> gax::client_builder::Result<()> {
4206    /// # use google_cloud_dialogflow_v2::client::SipTrunks;
4207    /// let client = SipTrunks::builder().build().await?;
4208    /// # Ok(()) }
4209    /// ```
4210    pub fn builder() -> super::builder::sip_trunks::ClientBuilder {
4211        gax::client_builder::internal::new_builder(super::builder::sip_trunks::client::Factory)
4212    }
4213
4214    /// Creates a new client from the provided stub.
4215    ///
4216    /// The most common case for calling this function is in tests mocking the
4217    /// client's behavior.
4218    pub fn from_stub<T>(stub: T) -> Self
4219    where
4220        T: super::stub::SipTrunks + 'static,
4221    {
4222        Self {
4223            inner: std::sync::Arc::new(stub),
4224        }
4225    }
4226
4227    pub(crate) async fn new(
4228        config: gaxi::options::ClientConfig,
4229    ) -> gax::client_builder::Result<Self> {
4230        let inner = Self::build_inner(config).await?;
4231        Ok(Self { inner })
4232    }
4233
4234    async fn build_inner(
4235        conf: gaxi::options::ClientConfig,
4236    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::SipTrunks>> {
4237        if gaxi::options::tracing_enabled(&conf) {
4238            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
4239        }
4240        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
4241    }
4242
4243    async fn build_transport(
4244        conf: gaxi::options::ClientConfig,
4245    ) -> gax::client_builder::Result<impl super::stub::SipTrunks> {
4246        super::transport::SipTrunks::new(conf).await
4247    }
4248
4249    async fn build_with_tracing(
4250        conf: gaxi::options::ClientConfig,
4251    ) -> gax::client_builder::Result<impl super::stub::SipTrunks> {
4252        Self::build_transport(conf)
4253            .await
4254            .map(super::tracing::SipTrunks::new)
4255    }
4256
4257    /// Creates a SipTrunk for a specified location.
4258    pub fn create_sip_trunk(&self) -> super::builder::sip_trunks::CreateSipTrunk {
4259        super::builder::sip_trunks::CreateSipTrunk::new(self.inner.clone())
4260    }
4261
4262    /// Deletes a specified SipTrunk.
4263    pub fn delete_sip_trunk(&self) -> super::builder::sip_trunks::DeleteSipTrunk {
4264        super::builder::sip_trunks::DeleteSipTrunk::new(self.inner.clone())
4265    }
4266
4267    /// Returns a list of SipTrunks in the specified location.
4268    pub fn list_sip_trunks(&self) -> super::builder::sip_trunks::ListSipTrunks {
4269        super::builder::sip_trunks::ListSipTrunks::new(self.inner.clone())
4270    }
4271
4272    /// Retrieves the specified SipTrunk.
4273    pub fn get_sip_trunk(&self) -> super::builder::sip_trunks::GetSipTrunk {
4274        super::builder::sip_trunks::GetSipTrunk::new(self.inner.clone())
4275    }
4276
4277    /// Updates the specified SipTrunk.
4278    pub fn update_sip_trunk(&self) -> super::builder::sip_trunks::UpdateSipTrunk {
4279        super::builder::sip_trunks::UpdateSipTrunk::new(self.inner.clone())
4280    }
4281
4282    /// Lists information about the supported locations for this service.
4283    pub fn list_locations(&self) -> super::builder::sip_trunks::ListLocations {
4284        super::builder::sip_trunks::ListLocations::new(self.inner.clone())
4285    }
4286
4287    /// Gets information about a location.
4288    pub fn get_location(&self) -> super::builder::sip_trunks::GetLocation {
4289        super::builder::sip_trunks::GetLocation::new(self.inner.clone())
4290    }
4291
4292    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
4293    ///
4294    /// [google.longrunning.Operations]: longrunning::client::Operations
4295    pub fn list_operations(&self) -> super::builder::sip_trunks::ListOperations {
4296        super::builder::sip_trunks::ListOperations::new(self.inner.clone())
4297    }
4298
4299    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
4300    ///
4301    /// [google.longrunning.Operations]: longrunning::client::Operations
4302    pub fn get_operation(&self) -> super::builder::sip_trunks::GetOperation {
4303        super::builder::sip_trunks::GetOperation::new(self.inner.clone())
4304    }
4305
4306    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
4307    ///
4308    /// [google.longrunning.Operations]: longrunning::client::Operations
4309    pub fn cancel_operation(&self) -> super::builder::sip_trunks::CancelOperation {
4310        super::builder::sip_trunks::CancelOperation::new(self.inner.clone())
4311    }
4312}
4313
4314/// Implements a client for the Dialogflow API.
4315///
4316/// # Example
4317/// ```
4318/// # async fn sample() -> gax::client_builder::Result<()> {
4319/// # use google_cloud_dialogflow_v2::client::Tools;
4320/// let client = Tools::builder().build().await?;
4321/// // use `client` to make requests to the Dialogflow API.
4322/// # Ok(()) }
4323/// ```
4324///
4325/// # Service Description
4326///
4327/// Tool Service for LLM powered Agent Assist. Tools can be used to interact with
4328/// remote APIs (e.g. fetching orders) to retrieve additional information as
4329/// input to LLM.
4330///
4331/// # Configuration
4332///
4333/// To configure `Tools` use the `with_*` methods in the type returned
4334/// by [builder()][Tools::builder]. The default configuration should
4335/// work for most applications. Common configuration changes include
4336///
4337/// * [with_endpoint()]: by default this client uses the global default endpoint
4338///   (`https://dialogflow.googleapis.com`). Applications using regional
4339///   endpoints or running in restricted networks (e.g. a network configured
4340//    with [Private Google Access with VPC Service Controls]) may want to
4341///   override this default.
4342/// * [with_credentials()]: by default this client uses
4343///   [Application Default Credentials]. Applications using custom
4344///   authentication may need to override this default.
4345///
4346/// [with_endpoint()]: super::builder::tools::ClientBuilder::with_endpoint
4347/// [with_credentials()]: super::builder::tools::ClientBuilder::credentials
4348/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
4349/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
4350///
4351/// # Pooling and Cloning
4352///
4353/// `Tools` holds a connection pool internally, it is advised to
4354/// create one and the reuse it.  You do not need to wrap `Tools` in
4355/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
4356/// already uses an `Arc` internally.
4357#[cfg(feature = "tools")]
4358#[cfg_attr(docsrs, doc(cfg(feature = "tools")))]
4359#[derive(Clone, Debug)]
4360pub struct Tools {
4361    inner: std::sync::Arc<dyn super::stub::dynamic::Tools>,
4362}
4363
4364#[cfg(feature = "tools")]
4365impl Tools {
4366    /// Returns a builder for [Tools].
4367    ///
4368    /// ```
4369    /// # async fn sample() -> gax::client_builder::Result<()> {
4370    /// # use google_cloud_dialogflow_v2::client::Tools;
4371    /// let client = Tools::builder().build().await?;
4372    /// # Ok(()) }
4373    /// ```
4374    pub fn builder() -> super::builder::tools::ClientBuilder {
4375        gax::client_builder::internal::new_builder(super::builder::tools::client::Factory)
4376    }
4377
4378    /// Creates a new client from the provided stub.
4379    ///
4380    /// The most common case for calling this function is in tests mocking the
4381    /// client's behavior.
4382    pub fn from_stub<T>(stub: T) -> Self
4383    where
4384        T: super::stub::Tools + 'static,
4385    {
4386        Self {
4387            inner: std::sync::Arc::new(stub),
4388        }
4389    }
4390
4391    pub(crate) async fn new(
4392        config: gaxi::options::ClientConfig,
4393    ) -> gax::client_builder::Result<Self> {
4394        let inner = Self::build_inner(config).await?;
4395        Ok(Self { inner })
4396    }
4397
4398    async fn build_inner(
4399        conf: gaxi::options::ClientConfig,
4400    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::Tools>> {
4401        if gaxi::options::tracing_enabled(&conf) {
4402            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
4403        }
4404        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
4405    }
4406
4407    async fn build_transport(
4408        conf: gaxi::options::ClientConfig,
4409    ) -> gax::client_builder::Result<impl super::stub::Tools> {
4410        super::transport::Tools::new(conf).await
4411    }
4412
4413    async fn build_with_tracing(
4414        conf: gaxi::options::ClientConfig,
4415    ) -> gax::client_builder::Result<impl super::stub::Tools> {
4416        Self::build_transport(conf)
4417            .await
4418            .map(super::tracing::Tools::new)
4419    }
4420
4421    /// Creates a tool.
4422    pub fn create_tool(&self) -> super::builder::tools::CreateTool {
4423        super::builder::tools::CreateTool::new(self.inner.clone())
4424    }
4425
4426    /// Retrieves a tool.
4427    pub fn get_tool(&self) -> super::builder::tools::GetTool {
4428        super::builder::tools::GetTool::new(self.inner.clone())
4429    }
4430
4431    /// Lists tools.
4432    pub fn list_tools(&self) -> super::builder::tools::ListTools {
4433        super::builder::tools::ListTools::new(self.inner.clone())
4434    }
4435
4436    /// Deletes a tool.
4437    pub fn delete_tool(&self) -> super::builder::tools::DeleteTool {
4438        super::builder::tools::DeleteTool::new(self.inner.clone())
4439    }
4440
4441    /// Updates a tool.
4442    pub fn update_tool(&self) -> super::builder::tools::UpdateTool {
4443        super::builder::tools::UpdateTool::new(self.inner.clone())
4444    }
4445
4446    /// Lists information about the supported locations for this service.
4447    pub fn list_locations(&self) -> super::builder::tools::ListLocations {
4448        super::builder::tools::ListLocations::new(self.inner.clone())
4449    }
4450
4451    /// Gets information about a location.
4452    pub fn get_location(&self) -> super::builder::tools::GetLocation {
4453        super::builder::tools::GetLocation::new(self.inner.clone())
4454    }
4455
4456    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
4457    ///
4458    /// [google.longrunning.Operations]: longrunning::client::Operations
4459    pub fn list_operations(&self) -> super::builder::tools::ListOperations {
4460        super::builder::tools::ListOperations::new(self.inner.clone())
4461    }
4462
4463    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
4464    ///
4465    /// [google.longrunning.Operations]: longrunning::client::Operations
4466    pub fn get_operation(&self) -> super::builder::tools::GetOperation {
4467        super::builder::tools::GetOperation::new(self.inner.clone())
4468    }
4469
4470    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
4471    ///
4472    /// [google.longrunning.Operations]: longrunning::client::Operations
4473    pub fn cancel_operation(&self) -> super::builder::tools::CancelOperation {
4474        super::builder::tools::CancelOperation::new(self.inner.clone())
4475    }
4476}
4477
4478/// Implements a client for the Dialogflow API.
4479///
4480/// # Example
4481/// ```
4482/// # async fn sample() -> gax::client_builder::Result<()> {
4483/// # use google_cloud_dialogflow_v2::client::Versions;
4484/// let client = Versions::builder().build().await?;
4485/// // use `client` to make requests to the Dialogflow API.
4486/// # Ok(()) }
4487/// ```
4488///
4489/// # Service Description
4490///
4491/// Service for managing [Versions][google.cloud.dialogflow.v2.Version].
4492///
4493/// [google.cloud.dialogflow.v2.Version]: crate::model::Version
4494///
4495/// # Configuration
4496///
4497/// To configure `Versions` use the `with_*` methods in the type returned
4498/// by [builder()][Versions::builder]. The default configuration should
4499/// work for most applications. Common configuration changes include
4500///
4501/// * [with_endpoint()]: by default this client uses the global default endpoint
4502///   (`https://dialogflow.googleapis.com`). Applications using regional
4503///   endpoints or running in restricted networks (e.g. a network configured
4504//    with [Private Google Access with VPC Service Controls]) may want to
4505///   override this default.
4506/// * [with_credentials()]: by default this client uses
4507///   [Application Default Credentials]. Applications using custom
4508///   authentication may need to override this default.
4509///
4510/// [with_endpoint()]: super::builder::versions::ClientBuilder::with_endpoint
4511/// [with_credentials()]: super::builder::versions::ClientBuilder::credentials
4512/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
4513/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
4514///
4515/// # Pooling and Cloning
4516///
4517/// `Versions` holds a connection pool internally, it is advised to
4518/// create one and the reuse it.  You do not need to wrap `Versions` in
4519/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
4520/// already uses an `Arc` internally.
4521#[cfg(feature = "versions")]
4522#[cfg_attr(docsrs, doc(cfg(feature = "versions")))]
4523#[derive(Clone, Debug)]
4524pub struct Versions {
4525    inner: std::sync::Arc<dyn super::stub::dynamic::Versions>,
4526}
4527
4528#[cfg(feature = "versions")]
4529impl Versions {
4530    /// Returns a builder for [Versions].
4531    ///
4532    /// ```
4533    /// # async fn sample() -> gax::client_builder::Result<()> {
4534    /// # use google_cloud_dialogflow_v2::client::Versions;
4535    /// let client = Versions::builder().build().await?;
4536    /// # Ok(()) }
4537    /// ```
4538    pub fn builder() -> super::builder::versions::ClientBuilder {
4539        gax::client_builder::internal::new_builder(super::builder::versions::client::Factory)
4540    }
4541
4542    /// Creates a new client from the provided stub.
4543    ///
4544    /// The most common case for calling this function is in tests mocking the
4545    /// client's behavior.
4546    pub fn from_stub<T>(stub: T) -> Self
4547    where
4548        T: super::stub::Versions + 'static,
4549    {
4550        Self {
4551            inner: std::sync::Arc::new(stub),
4552        }
4553    }
4554
4555    pub(crate) async fn new(
4556        config: gaxi::options::ClientConfig,
4557    ) -> gax::client_builder::Result<Self> {
4558        let inner = Self::build_inner(config).await?;
4559        Ok(Self { inner })
4560    }
4561
4562    async fn build_inner(
4563        conf: gaxi::options::ClientConfig,
4564    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::Versions>> {
4565        if gaxi::options::tracing_enabled(&conf) {
4566            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
4567        }
4568        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
4569    }
4570
4571    async fn build_transport(
4572        conf: gaxi::options::ClientConfig,
4573    ) -> gax::client_builder::Result<impl super::stub::Versions> {
4574        super::transport::Versions::new(conf).await
4575    }
4576
4577    async fn build_with_tracing(
4578        conf: gaxi::options::ClientConfig,
4579    ) -> gax::client_builder::Result<impl super::stub::Versions> {
4580        Self::build_transport(conf)
4581            .await
4582            .map(super::tracing::Versions::new)
4583    }
4584
4585    /// Returns the list of all versions of the specified agent.
4586    pub fn list_versions(&self) -> super::builder::versions::ListVersions {
4587        super::builder::versions::ListVersions::new(self.inner.clone())
4588    }
4589
4590    /// Retrieves the specified agent version.
4591    pub fn get_version(&self) -> super::builder::versions::GetVersion {
4592        super::builder::versions::GetVersion::new(self.inner.clone())
4593    }
4594
4595    /// Creates an agent version.
4596    ///
4597    /// The new version points to the agent instance in the "default" environment.
4598    pub fn create_version(&self) -> super::builder::versions::CreateVersion {
4599        super::builder::versions::CreateVersion::new(self.inner.clone())
4600    }
4601
4602    /// Updates the specified agent version.
4603    ///
4604    /// Note that this method does not allow you to update the state of the agent
4605    /// the given version points to. It allows you to update only mutable
4606    /// properties of the version resource.
4607    pub fn update_version(&self) -> super::builder::versions::UpdateVersion {
4608        super::builder::versions::UpdateVersion::new(self.inner.clone())
4609    }
4610
4611    /// Delete the specified agent version.
4612    pub fn delete_version(&self) -> super::builder::versions::DeleteVersion {
4613        super::builder::versions::DeleteVersion::new(self.inner.clone())
4614    }
4615
4616    /// Lists information about the supported locations for this service.
4617    pub fn list_locations(&self) -> super::builder::versions::ListLocations {
4618        super::builder::versions::ListLocations::new(self.inner.clone())
4619    }
4620
4621    /// Gets information about a location.
4622    pub fn get_location(&self) -> super::builder::versions::GetLocation {
4623        super::builder::versions::GetLocation::new(self.inner.clone())
4624    }
4625
4626    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
4627    ///
4628    /// [google.longrunning.Operations]: longrunning::client::Operations
4629    pub fn list_operations(&self) -> super::builder::versions::ListOperations {
4630        super::builder::versions::ListOperations::new(self.inner.clone())
4631    }
4632
4633    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
4634    ///
4635    /// [google.longrunning.Operations]: longrunning::client::Operations
4636    pub fn get_operation(&self) -> super::builder::versions::GetOperation {
4637        super::builder::versions::GetOperation::new(self.inner.clone())
4638    }
4639
4640    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
4641    ///
4642    /// [google.longrunning.Operations]: longrunning::client::Operations
4643    pub fn cancel_operation(&self) -> super::builder::versions::CancelOperation {
4644        super::builder::versions::CancelOperation::new(self.inner.clone())
4645    }
4646}