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/// # tokio_test::block_on(async {
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/// # gax::client_builder::Result::<()>::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    /// # tokio_test::block_on(async {
75    /// # use google_cloud_dialogflow_v2::client::Agents;
76    /// let client = Agents::builder().build().await?;
77    /// # gax::client_builder::Result::<()>::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/// # tokio_test::block_on(async {
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/// # gax::client_builder::Result::<()>::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    /// # tokio_test::block_on(async {
390    /// # use google_cloud_dialogflow_v2::client::AnswerRecords;
391    /// let client = AnswerRecords::builder().build().await?;
392    /// # gax::client_builder::Result::<()>::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/// # tokio_test::block_on(async {
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/// # gax::client_builder::Result::<()>::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    /// # tokio_test::block_on(async {
540    /// # use google_cloud_dialogflow_v2::client::Contexts;
541    /// let client = Contexts::builder().build().await?;
542    /// # gax::client_builder::Result::<()>::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/// # tokio_test::block_on(async {
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/// # gax::client_builder::Result::<()>::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    /// # tokio_test::block_on(async {
712    /// # use google_cloud_dialogflow_v2::client::Conversations;
713    /// let client = Conversations::builder().build().await?;
714    /// # gax::client_builder::Result::<()>::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/// # tokio_test::block_on(async {
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/// # gax::client_builder::Result::<()>::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    /// # tokio_test::block_on(async {
951    /// # use google_cloud_dialogflow_v2::client::ConversationDatasets;
952    /// let client = ConversationDatasets::builder().build().await?;
953    /// # gax::client_builder::Result::<()>::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/// # tokio_test::block_on(async {
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/// # gax::client_builder::Result::<()>::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    /// # tokio_test::block_on(async {
1194    /// # use google_cloud_dialogflow_v2::client::ConversationModels;
1195    /// let client = ConversationModels::builder().build().await?;
1196    /// # gax::client_builder::Result::<()>::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/// # tokio_test::block_on(async {
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/// # gax::client_builder::Result::<()>::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    /// # tokio_test::block_on(async {
1506    /// # use google_cloud_dialogflow_v2::client::ConversationProfiles;
1507    /// let client = ConversationProfiles::builder().build().await?;
1508    /// # gax::client_builder::Result::<()>::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/// # tokio_test::block_on(async {
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/// # gax::client_builder::Result::<()>::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    /// # tokio_test::block_on(async {
1773    /// # use google_cloud_dialogflow_v2::client::Documents;
1774    /// let client = Documents::builder().build().await?;
1775    /// # gax::client_builder::Result::<()>::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/// # tokio_test::block_on(async {
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/// # gax::client_builder::Result::<()>::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    /// # tokio_test::block_on(async {
2086    /// # use google_cloud_dialogflow_v2::client::EncryptionSpecService;
2087    /// let client = EncryptionSpecService::builder().build().await?;
2088    /// # gax::client_builder::Result::<()>::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/// # tokio_test::block_on(async {
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/// # gax::client_builder::Result::<()>::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    /// # tokio_test::block_on(async {
2256    /// # use google_cloud_dialogflow_v2::client::EntityTypes;
2257    /// let client = EntityTypes::builder().build().await?;
2258    /// # gax::client_builder::Result::<()>::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/// # tokio_test::block_on(async {
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/// # gax::client_builder::Result::<()>::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    /// # tokio_test::block_on(async {
2580    /// # use google_cloud_dialogflow_v2::client::Environments;
2581    /// let client = Environments::builder().build().await?;
2582    /// # gax::client_builder::Result::<()>::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/// # tokio_test::block_on(async {
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/// # gax::client_builder::Result::<()>::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    /// # tokio_test::block_on(async {
2760    /// # use google_cloud_dialogflow_v2::client::Fulfillments;
2761    /// let client = Fulfillments::builder().build().await?;
2762    /// # gax::client_builder::Result::<()>::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/// # tokio_test::block_on(async {
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/// # gax::client_builder::Result::<()>::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    /// # tokio_test::block_on(async {
2911    /// # use google_cloud_dialogflow_v2::client::Generators;
2912    /// let client = Generators::builder().build().await?;
2913    /// # gax::client_builder::Result::<()>::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/// # tokio_test::block_on(async {
3024/// # use google_cloud_dialogflow_v2::client::Intents;
3025/// let client = Intents::builder().build().await?;
3026/// // use `client` to make requests to the Dialogflow API.
3027/// # gax::client_builder::Result::<()>::Ok(()) });
3028/// ```
3029///
3030/// # Service Description
3031///
3032/// Service for managing [Intents][google.cloud.dialogflow.v2.Intent].
3033///
3034/// [google.cloud.dialogflow.v2.Intent]: crate::model::Intent
3035///
3036/// # Configuration
3037///
3038/// To configure `Intents` use the `with_*` methods in the type returned
3039/// by [builder()][Intents::builder]. The default configuration should
3040/// work for most applications. Common configuration changes include
3041///
3042/// * [with_endpoint()]: by default this client uses the global default endpoint
3043///   (`https://dialogflow.googleapis.com`). Applications using regional
3044///   endpoints or running in restricted networks (e.g. a network configured
3045//    with [Private Google Access with VPC Service Controls]) may want to
3046///   override this default.
3047/// * [with_credentials()]: by default this client uses
3048///   [Application Default Credentials]. Applications using custom
3049///   authentication may need to override this default.
3050///
3051/// [with_endpoint()]: super::builder::intents::ClientBuilder::with_endpoint
3052/// [with_credentials()]: super::builder::intents::ClientBuilder::credentials
3053/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
3054/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
3055///
3056/// # Pooling and Cloning
3057///
3058/// `Intents` holds a connection pool internally, it is advised to
3059/// create one and the reuse it.  You do not need to wrap `Intents` in
3060/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
3061/// already uses an `Arc` internally.
3062#[cfg(feature = "intents")]
3063#[cfg_attr(docsrs, doc(cfg(feature = "intents")))]
3064#[derive(Clone, Debug)]
3065pub struct Intents {
3066    inner: std::sync::Arc<dyn super::stub::dynamic::Intents>,
3067}
3068
3069#[cfg(feature = "intents")]
3070impl Intents {
3071    /// Returns a builder for [Intents].
3072    ///
3073    /// ```
3074    /// # tokio_test::block_on(async {
3075    /// # use google_cloud_dialogflow_v2::client::Intents;
3076    /// let client = Intents::builder().build().await?;
3077    /// # gax::client_builder::Result::<()>::Ok(()) });
3078    /// ```
3079    pub fn builder() -> super::builder::intents::ClientBuilder {
3080        gax::client_builder::internal::new_builder(super::builder::intents::client::Factory)
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::Intents + '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::Intents>> {
3106        if gaxi::options::tracing_enabled(&conf) {
3107            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
3108        }
3109        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
3110    }
3111
3112    async fn build_transport(
3113        conf: gaxi::options::ClientConfig,
3114    ) -> gax::client_builder::Result<impl super::stub::Intents> {
3115        super::transport::Intents::new(conf).await
3116    }
3117
3118    async fn build_with_tracing(
3119        conf: gaxi::options::ClientConfig,
3120    ) -> gax::client_builder::Result<impl super::stub::Intents> {
3121        Self::build_transport(conf)
3122            .await
3123            .map(super::tracing::Intents::new)
3124    }
3125
3126    /// Returns the list of all intents in the specified agent.
3127    pub fn list_intents(&self) -> super::builder::intents::ListIntents {
3128        super::builder::intents::ListIntents::new(self.inner.clone())
3129    }
3130
3131    /// Retrieves the specified intent.
3132    pub fn get_intent(&self) -> super::builder::intents::GetIntent {
3133        super::builder::intents::GetIntent::new(self.inner.clone())
3134    }
3135
3136    /// Creates an intent in the specified agent.
3137    ///
3138    /// Note: You should always train an agent prior to sending it queries. See the
3139    /// [training
3140    /// documentation](https://cloud.google.com/dialogflow/es/docs/training).
3141    pub fn create_intent(&self) -> super::builder::intents::CreateIntent {
3142        super::builder::intents::CreateIntent::new(self.inner.clone())
3143    }
3144
3145    /// Updates the specified intent.
3146    ///
3147    /// Note: You should always train an agent prior to sending it queries. See the
3148    /// [training
3149    /// documentation](https://cloud.google.com/dialogflow/es/docs/training).
3150    pub fn update_intent(&self) -> super::builder::intents::UpdateIntent {
3151        super::builder::intents::UpdateIntent::new(self.inner.clone())
3152    }
3153
3154    /// Deletes the specified intent and its direct or indirect followup intents.
3155    ///
3156    /// Note: You should always train an agent prior to sending it queries. See the
3157    /// [training
3158    /// documentation](https://cloud.google.com/dialogflow/es/docs/training).
3159    pub fn delete_intent(&self) -> super::builder::intents::DeleteIntent {
3160        super::builder::intents::DeleteIntent::new(self.inner.clone())
3161    }
3162
3163    /// Updates/Creates multiple intents in the specified agent.
3164    ///
3165    /// This method is a [long-running
3166    /// operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations).
3167    /// The returned `Operation` type has the following method-specific fields:
3168    ///
3169    /// - `metadata`: An empty [Struct
3170    ///   message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct)
3171    /// - `response`:
3172    ///   [BatchUpdateIntentsResponse][google.cloud.dialogflow.v2.BatchUpdateIntentsResponse]
3173    ///
3174    /// Note: You should always train an agent prior to sending it queries. See the
3175    /// [training
3176    /// documentation](https://cloud.google.com/dialogflow/es/docs/training).
3177    ///
3178    /// [google.cloud.dialogflow.v2.BatchUpdateIntentsResponse]: crate::model::BatchUpdateIntentsResponse
3179    ///
3180    /// # Long running operations
3181    ///
3182    /// This method is used to start, and/or poll a [long-running Operation].
3183    /// The [Working with long-running operations] chapter in the [user guide]
3184    /// covers these operations in detail.
3185    ///
3186    /// [long-running operation]: https://google.aip.dev/151
3187    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
3188    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
3189    pub fn batch_update_intents(&self) -> super::builder::intents::BatchUpdateIntents {
3190        super::builder::intents::BatchUpdateIntents::new(self.inner.clone())
3191    }
3192
3193    /// Deletes intents in the specified agent.
3194    ///
3195    /// This method is a [long-running
3196    /// operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations).
3197    /// The returned `Operation` type has the following method-specific fields:
3198    ///
3199    /// - `metadata`: An empty [Struct
3200    ///   message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct)
3201    /// - `response`: An [Empty
3202    ///   message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
3203    ///
3204    /// Note: You should always train an agent prior to sending it queries. See the
3205    /// [training
3206    /// documentation](https://cloud.google.com/dialogflow/es/docs/training).
3207    ///
3208    /// # Long running operations
3209    ///
3210    /// This method is used to start, and/or poll a [long-running Operation].
3211    /// The [Working with long-running operations] chapter in the [user guide]
3212    /// covers these operations in detail.
3213    ///
3214    /// [long-running operation]: https://google.aip.dev/151
3215    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
3216    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
3217    pub fn batch_delete_intents(&self) -> super::builder::intents::BatchDeleteIntents {
3218        super::builder::intents::BatchDeleteIntents::new(self.inner.clone())
3219    }
3220
3221    /// Lists information about the supported locations for this service.
3222    pub fn list_locations(&self) -> super::builder::intents::ListLocations {
3223        super::builder::intents::ListLocations::new(self.inner.clone())
3224    }
3225
3226    /// Gets information about a location.
3227    pub fn get_location(&self) -> super::builder::intents::GetLocation {
3228        super::builder::intents::GetLocation::new(self.inner.clone())
3229    }
3230
3231    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3232    ///
3233    /// [google.longrunning.Operations]: longrunning::client::Operations
3234    pub fn list_operations(&self) -> super::builder::intents::ListOperations {
3235        super::builder::intents::ListOperations::new(self.inner.clone())
3236    }
3237
3238    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3239    ///
3240    /// [google.longrunning.Operations]: longrunning::client::Operations
3241    pub fn get_operation(&self) -> super::builder::intents::GetOperation {
3242        super::builder::intents::GetOperation::new(self.inner.clone())
3243    }
3244
3245    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3246    ///
3247    /// [google.longrunning.Operations]: longrunning::client::Operations
3248    pub fn cancel_operation(&self) -> super::builder::intents::CancelOperation {
3249        super::builder::intents::CancelOperation::new(self.inner.clone())
3250    }
3251}
3252
3253/// Implements a client for the Dialogflow API.
3254///
3255/// # Example
3256/// ```
3257/// # tokio_test::block_on(async {
3258/// # use google_cloud_dialogflow_v2::client::KnowledgeBases;
3259/// let client = KnowledgeBases::builder().build().await?;
3260/// // use `client` to make requests to the Dialogflow API.
3261/// # gax::client_builder::Result::<()>::Ok(()) });
3262/// ```
3263///
3264/// # Service Description
3265///
3266/// Service for managing
3267/// [KnowledgeBases][google.cloud.dialogflow.v2.KnowledgeBase].
3268///
3269/// [google.cloud.dialogflow.v2.KnowledgeBase]: crate::model::KnowledgeBase
3270///
3271/// # Configuration
3272///
3273/// To configure `KnowledgeBases` use the `with_*` methods in the type returned
3274/// by [builder()][KnowledgeBases::builder]. The default configuration should
3275/// work for most applications. Common configuration changes include
3276///
3277/// * [with_endpoint()]: by default this client uses the global default endpoint
3278///   (`https://dialogflow.googleapis.com`). Applications using regional
3279///   endpoints or running in restricted networks (e.g. a network configured
3280//    with [Private Google Access with VPC Service Controls]) may want to
3281///   override this default.
3282/// * [with_credentials()]: by default this client uses
3283///   [Application Default Credentials]. Applications using custom
3284///   authentication may need to override this default.
3285///
3286/// [with_endpoint()]: super::builder::knowledge_bases::ClientBuilder::with_endpoint
3287/// [with_credentials()]: super::builder::knowledge_bases::ClientBuilder::credentials
3288/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
3289/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
3290///
3291/// # Pooling and Cloning
3292///
3293/// `KnowledgeBases` holds a connection pool internally, it is advised to
3294/// create one and the reuse it.  You do not need to wrap `KnowledgeBases` in
3295/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
3296/// already uses an `Arc` internally.
3297#[cfg(feature = "knowledge-bases")]
3298#[cfg_attr(docsrs, doc(cfg(feature = "knowledge-bases")))]
3299#[derive(Clone, Debug)]
3300pub struct KnowledgeBases {
3301    inner: std::sync::Arc<dyn super::stub::dynamic::KnowledgeBases>,
3302}
3303
3304#[cfg(feature = "knowledge-bases")]
3305impl KnowledgeBases {
3306    /// Returns a builder for [KnowledgeBases].
3307    ///
3308    /// ```
3309    /// # tokio_test::block_on(async {
3310    /// # use google_cloud_dialogflow_v2::client::KnowledgeBases;
3311    /// let client = KnowledgeBases::builder().build().await?;
3312    /// # gax::client_builder::Result::<()>::Ok(()) });
3313    /// ```
3314    pub fn builder() -> super::builder::knowledge_bases::ClientBuilder {
3315        gax::client_builder::internal::new_builder(super::builder::knowledge_bases::client::Factory)
3316    }
3317
3318    /// Creates a new client from the provided stub.
3319    ///
3320    /// The most common case for calling this function is in tests mocking the
3321    /// client's behavior.
3322    pub fn from_stub<T>(stub: T) -> Self
3323    where
3324        T: super::stub::KnowledgeBases + 'static,
3325    {
3326        Self {
3327            inner: std::sync::Arc::new(stub),
3328        }
3329    }
3330
3331    pub(crate) async fn new(
3332        config: gaxi::options::ClientConfig,
3333    ) -> gax::client_builder::Result<Self> {
3334        let inner = Self::build_inner(config).await?;
3335        Ok(Self { inner })
3336    }
3337
3338    async fn build_inner(
3339        conf: gaxi::options::ClientConfig,
3340    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::KnowledgeBases>> {
3341        if gaxi::options::tracing_enabled(&conf) {
3342            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
3343        }
3344        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
3345    }
3346
3347    async fn build_transport(
3348        conf: gaxi::options::ClientConfig,
3349    ) -> gax::client_builder::Result<impl super::stub::KnowledgeBases> {
3350        super::transport::KnowledgeBases::new(conf).await
3351    }
3352
3353    async fn build_with_tracing(
3354        conf: gaxi::options::ClientConfig,
3355    ) -> gax::client_builder::Result<impl super::stub::KnowledgeBases> {
3356        Self::build_transport(conf)
3357            .await
3358            .map(super::tracing::KnowledgeBases::new)
3359    }
3360
3361    /// Returns the list of all knowledge bases of the specified agent.
3362    pub fn list_knowledge_bases(&self) -> super::builder::knowledge_bases::ListKnowledgeBases {
3363        super::builder::knowledge_bases::ListKnowledgeBases::new(self.inner.clone())
3364    }
3365
3366    /// Retrieves the specified knowledge base.
3367    pub fn get_knowledge_base(&self) -> super::builder::knowledge_bases::GetKnowledgeBase {
3368        super::builder::knowledge_bases::GetKnowledgeBase::new(self.inner.clone())
3369    }
3370
3371    /// Creates a knowledge base.
3372    pub fn create_knowledge_base(&self) -> super::builder::knowledge_bases::CreateKnowledgeBase {
3373        super::builder::knowledge_bases::CreateKnowledgeBase::new(self.inner.clone())
3374    }
3375
3376    /// Deletes the specified knowledge base.
3377    pub fn delete_knowledge_base(&self) -> super::builder::knowledge_bases::DeleteKnowledgeBase {
3378        super::builder::knowledge_bases::DeleteKnowledgeBase::new(self.inner.clone())
3379    }
3380
3381    /// Updates the specified knowledge base.
3382    pub fn update_knowledge_base(&self) -> super::builder::knowledge_bases::UpdateKnowledgeBase {
3383        super::builder::knowledge_bases::UpdateKnowledgeBase::new(self.inner.clone())
3384    }
3385
3386    /// Lists information about the supported locations for this service.
3387    pub fn list_locations(&self) -> super::builder::knowledge_bases::ListLocations {
3388        super::builder::knowledge_bases::ListLocations::new(self.inner.clone())
3389    }
3390
3391    /// Gets information about a location.
3392    pub fn get_location(&self) -> super::builder::knowledge_bases::GetLocation {
3393        super::builder::knowledge_bases::GetLocation::new(self.inner.clone())
3394    }
3395
3396    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3397    ///
3398    /// [google.longrunning.Operations]: longrunning::client::Operations
3399    pub fn list_operations(&self) -> super::builder::knowledge_bases::ListOperations {
3400        super::builder::knowledge_bases::ListOperations::new(self.inner.clone())
3401    }
3402
3403    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3404    ///
3405    /// [google.longrunning.Operations]: longrunning::client::Operations
3406    pub fn get_operation(&self) -> super::builder::knowledge_bases::GetOperation {
3407        super::builder::knowledge_bases::GetOperation::new(self.inner.clone())
3408    }
3409
3410    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3411    ///
3412    /// [google.longrunning.Operations]: longrunning::client::Operations
3413    pub fn cancel_operation(&self) -> super::builder::knowledge_bases::CancelOperation {
3414        super::builder::knowledge_bases::CancelOperation::new(self.inner.clone())
3415    }
3416}
3417
3418/// Implements a client for the Dialogflow API.
3419///
3420/// # Example
3421/// ```
3422/// # tokio_test::block_on(async {
3423/// # use google_cloud_dialogflow_v2::client::Participants;
3424/// let client = Participants::builder().build().await?;
3425/// // use `client` to make requests to the Dialogflow API.
3426/// # gax::client_builder::Result::<()>::Ok(()) });
3427/// ```
3428///
3429/// # Service Description
3430///
3431/// Service for managing [Participants][google.cloud.dialogflow.v2.Participant].
3432///
3433/// [google.cloud.dialogflow.v2.Participant]: crate::model::Participant
3434///
3435/// # Configuration
3436///
3437/// To configure `Participants` use the `with_*` methods in the type returned
3438/// by [builder()][Participants::builder]. The default configuration should
3439/// work for most applications. Common configuration changes include
3440///
3441/// * [with_endpoint()]: by default this client uses the global default endpoint
3442///   (`https://dialogflow.googleapis.com`). Applications using regional
3443///   endpoints or running in restricted networks (e.g. a network configured
3444//    with [Private Google Access with VPC Service Controls]) may want to
3445///   override this default.
3446/// * [with_credentials()]: by default this client uses
3447///   [Application Default Credentials]. Applications using custom
3448///   authentication may need to override this default.
3449///
3450/// [with_endpoint()]: super::builder::participants::ClientBuilder::with_endpoint
3451/// [with_credentials()]: super::builder::participants::ClientBuilder::credentials
3452/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
3453/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
3454///
3455/// # Pooling and Cloning
3456///
3457/// `Participants` holds a connection pool internally, it is advised to
3458/// create one and the reuse it.  You do not need to wrap `Participants` in
3459/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
3460/// already uses an `Arc` internally.
3461#[cfg(feature = "participants")]
3462#[cfg_attr(docsrs, doc(cfg(feature = "participants")))]
3463#[derive(Clone, Debug)]
3464pub struct Participants {
3465    inner: std::sync::Arc<dyn super::stub::dynamic::Participants>,
3466}
3467
3468#[cfg(feature = "participants")]
3469impl Participants {
3470    /// Returns a builder for [Participants].
3471    ///
3472    /// ```
3473    /// # tokio_test::block_on(async {
3474    /// # use google_cloud_dialogflow_v2::client::Participants;
3475    /// let client = Participants::builder().build().await?;
3476    /// # gax::client_builder::Result::<()>::Ok(()) });
3477    /// ```
3478    pub fn builder() -> super::builder::participants::ClientBuilder {
3479        gax::client_builder::internal::new_builder(super::builder::participants::client::Factory)
3480    }
3481
3482    /// Creates a new client from the provided stub.
3483    ///
3484    /// The most common case for calling this function is in tests mocking the
3485    /// client's behavior.
3486    pub fn from_stub<T>(stub: T) -> Self
3487    where
3488        T: super::stub::Participants + 'static,
3489    {
3490        Self {
3491            inner: std::sync::Arc::new(stub),
3492        }
3493    }
3494
3495    pub(crate) async fn new(
3496        config: gaxi::options::ClientConfig,
3497    ) -> gax::client_builder::Result<Self> {
3498        let inner = Self::build_inner(config).await?;
3499        Ok(Self { inner })
3500    }
3501
3502    async fn build_inner(
3503        conf: gaxi::options::ClientConfig,
3504    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::Participants>> {
3505        if gaxi::options::tracing_enabled(&conf) {
3506            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
3507        }
3508        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
3509    }
3510
3511    async fn build_transport(
3512        conf: gaxi::options::ClientConfig,
3513    ) -> gax::client_builder::Result<impl super::stub::Participants> {
3514        super::transport::Participants::new(conf).await
3515    }
3516
3517    async fn build_with_tracing(
3518        conf: gaxi::options::ClientConfig,
3519    ) -> gax::client_builder::Result<impl super::stub::Participants> {
3520        Self::build_transport(conf)
3521            .await
3522            .map(super::tracing::Participants::new)
3523    }
3524
3525    /// Creates a new participant in a conversation.
3526    pub fn create_participant(&self) -> super::builder::participants::CreateParticipant {
3527        super::builder::participants::CreateParticipant::new(self.inner.clone())
3528    }
3529
3530    /// Retrieves a conversation participant.
3531    pub fn get_participant(&self) -> super::builder::participants::GetParticipant {
3532        super::builder::participants::GetParticipant::new(self.inner.clone())
3533    }
3534
3535    /// Returns the list of all participants in the specified conversation.
3536    pub fn list_participants(&self) -> super::builder::participants::ListParticipants {
3537        super::builder::participants::ListParticipants::new(self.inner.clone())
3538    }
3539
3540    /// Updates the specified participant.
3541    pub fn update_participant(&self) -> super::builder::participants::UpdateParticipant {
3542        super::builder::participants::UpdateParticipant::new(self.inner.clone())
3543    }
3544
3545    /// Adds a text (chat, for example), or audio (phone recording, for example)
3546    /// message from a participant into the conversation.
3547    ///
3548    /// Note: Always use agent versions for production traffic
3549    /// sent to virtual agents. See [Versions and
3550    /// environments](https://cloud.google.com/dialogflow/es/docs/agents-versions).
3551    pub fn analyze_content(&self) -> super::builder::participants::AnalyzeContent {
3552        super::builder::participants::AnalyzeContent::new(self.inner.clone())
3553    }
3554
3555    /// Gets suggested articles for a participant based on specific historical
3556    /// messages.
3557    pub fn suggest_articles(&self) -> super::builder::participants::SuggestArticles {
3558        super::builder::participants::SuggestArticles::new(self.inner.clone())
3559    }
3560
3561    /// Gets suggested faq answers for a participant based on specific historical
3562    /// messages.
3563    pub fn suggest_faq_answers(&self) -> super::builder::participants::SuggestFaqAnswers {
3564        super::builder::participants::SuggestFaqAnswers::new(self.inner.clone())
3565    }
3566
3567    /// Gets smart replies for a participant based on specific historical
3568    /// messages.
3569    pub fn suggest_smart_replies(&self) -> super::builder::participants::SuggestSmartReplies {
3570        super::builder::participants::SuggestSmartReplies::new(self.inner.clone())
3571    }
3572
3573    /// Gets knowledge assist suggestions based on historical messages.
3574    pub fn suggest_knowledge_assist(&self) -> super::builder::participants::SuggestKnowledgeAssist {
3575        super::builder::participants::SuggestKnowledgeAssist::new(self.inner.clone())
3576    }
3577
3578    /// Lists information about the supported locations for this service.
3579    pub fn list_locations(&self) -> super::builder::participants::ListLocations {
3580        super::builder::participants::ListLocations::new(self.inner.clone())
3581    }
3582
3583    /// Gets information about a location.
3584    pub fn get_location(&self) -> super::builder::participants::GetLocation {
3585        super::builder::participants::GetLocation::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 list_operations(&self) -> super::builder::participants::ListOperations {
3592        super::builder::participants::ListOperations::new(self.inner.clone())
3593    }
3594
3595    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3596    ///
3597    /// [google.longrunning.Operations]: longrunning::client::Operations
3598    pub fn get_operation(&self) -> super::builder::participants::GetOperation {
3599        super::builder::participants::GetOperation::new(self.inner.clone())
3600    }
3601
3602    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3603    ///
3604    /// [google.longrunning.Operations]: longrunning::client::Operations
3605    pub fn cancel_operation(&self) -> super::builder::participants::CancelOperation {
3606        super::builder::participants::CancelOperation::new(self.inner.clone())
3607    }
3608}
3609
3610/// Implements a client for the Dialogflow API.
3611///
3612/// # Example
3613/// ```
3614/// # tokio_test::block_on(async {
3615/// # use google_cloud_dialogflow_v2::client::Sessions;
3616/// let client = Sessions::builder().build().await?;
3617/// // use `client` to make requests to the Dialogflow API.
3618/// # gax::client_builder::Result::<()>::Ok(()) });
3619/// ```
3620///
3621/// # Service Description
3622///
3623/// A service used for session interactions.
3624///
3625/// For more information, see the [API interactions
3626/// guide](https://cloud.google.com/dialogflow/docs/api-overview).
3627///
3628/// # Configuration
3629///
3630/// To configure `Sessions` use the `with_*` methods in the type returned
3631/// by [builder()][Sessions::builder]. The default configuration should
3632/// work for most applications. Common configuration changes include
3633///
3634/// * [with_endpoint()]: by default this client uses the global default endpoint
3635///   (`https://dialogflow.googleapis.com`). Applications using regional
3636///   endpoints or running in restricted networks (e.g. a network configured
3637//    with [Private Google Access with VPC Service Controls]) may want to
3638///   override this default.
3639/// * [with_credentials()]: by default this client uses
3640///   [Application Default Credentials]. Applications using custom
3641///   authentication may need to override this default.
3642///
3643/// [with_endpoint()]: super::builder::sessions::ClientBuilder::with_endpoint
3644/// [with_credentials()]: super::builder::sessions::ClientBuilder::credentials
3645/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
3646/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
3647///
3648/// # Pooling and Cloning
3649///
3650/// `Sessions` holds a connection pool internally, it is advised to
3651/// create one and the reuse it.  You do not need to wrap `Sessions` in
3652/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
3653/// already uses an `Arc` internally.
3654#[cfg(feature = "sessions")]
3655#[cfg_attr(docsrs, doc(cfg(feature = "sessions")))]
3656#[derive(Clone, Debug)]
3657pub struct Sessions {
3658    inner: std::sync::Arc<dyn super::stub::dynamic::Sessions>,
3659}
3660
3661#[cfg(feature = "sessions")]
3662impl Sessions {
3663    /// Returns a builder for [Sessions].
3664    ///
3665    /// ```
3666    /// # tokio_test::block_on(async {
3667    /// # use google_cloud_dialogflow_v2::client::Sessions;
3668    /// let client = Sessions::builder().build().await?;
3669    /// # gax::client_builder::Result::<()>::Ok(()) });
3670    /// ```
3671    pub fn builder() -> super::builder::sessions::ClientBuilder {
3672        gax::client_builder::internal::new_builder(super::builder::sessions::client::Factory)
3673    }
3674
3675    /// Creates a new client from the provided stub.
3676    ///
3677    /// The most common case for calling this function is in tests mocking the
3678    /// client's behavior.
3679    pub fn from_stub<T>(stub: T) -> Self
3680    where
3681        T: super::stub::Sessions + 'static,
3682    {
3683        Self {
3684            inner: std::sync::Arc::new(stub),
3685        }
3686    }
3687
3688    pub(crate) async fn new(
3689        config: gaxi::options::ClientConfig,
3690    ) -> gax::client_builder::Result<Self> {
3691        let inner = Self::build_inner(config).await?;
3692        Ok(Self { inner })
3693    }
3694
3695    async fn build_inner(
3696        conf: gaxi::options::ClientConfig,
3697    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::Sessions>> {
3698        if gaxi::options::tracing_enabled(&conf) {
3699            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
3700        }
3701        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
3702    }
3703
3704    async fn build_transport(
3705        conf: gaxi::options::ClientConfig,
3706    ) -> gax::client_builder::Result<impl super::stub::Sessions> {
3707        super::transport::Sessions::new(conf).await
3708    }
3709
3710    async fn build_with_tracing(
3711        conf: gaxi::options::ClientConfig,
3712    ) -> gax::client_builder::Result<impl super::stub::Sessions> {
3713        Self::build_transport(conf)
3714            .await
3715            .map(super::tracing::Sessions::new)
3716    }
3717
3718    /// Processes a natural language query and returns structured, actionable data
3719    /// as a result. This method is not idempotent, because it may cause contexts
3720    /// and session entity types to be updated, which in turn might affect
3721    /// results of future queries.
3722    ///
3723    /// If you might use
3724    /// [Agent Assist](https://cloud.google.com/dialogflow/docs/#aa)
3725    /// or other CCAI products now or in the future, consider using
3726    /// [AnalyzeContent][google.cloud.dialogflow.v2.Participants.AnalyzeContent]
3727    /// instead of `DetectIntent`. `AnalyzeContent` has additional
3728    /// functionality for Agent Assist and other CCAI products.
3729    ///
3730    /// Note: Always use agent versions for production traffic.
3731    /// See [Versions and
3732    /// environments](https://cloud.google.com/dialogflow/es/docs/agents-versions).
3733    ///
3734    /// [google.cloud.dialogflow.v2.Participants.AnalyzeContent]: crate::client::Participants::analyze_content
3735    pub fn detect_intent(&self) -> super::builder::sessions::DetectIntent {
3736        super::builder::sessions::DetectIntent::new(self.inner.clone())
3737    }
3738
3739    /// Lists information about the supported locations for this service.
3740    pub fn list_locations(&self) -> super::builder::sessions::ListLocations {
3741        super::builder::sessions::ListLocations::new(self.inner.clone())
3742    }
3743
3744    /// Gets information about a location.
3745    pub fn get_location(&self) -> super::builder::sessions::GetLocation {
3746        super::builder::sessions::GetLocation::new(self.inner.clone())
3747    }
3748
3749    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3750    ///
3751    /// [google.longrunning.Operations]: longrunning::client::Operations
3752    pub fn list_operations(&self) -> super::builder::sessions::ListOperations {
3753        super::builder::sessions::ListOperations::new(self.inner.clone())
3754    }
3755
3756    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3757    ///
3758    /// [google.longrunning.Operations]: longrunning::client::Operations
3759    pub fn get_operation(&self) -> super::builder::sessions::GetOperation {
3760        super::builder::sessions::GetOperation::new(self.inner.clone())
3761    }
3762
3763    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3764    ///
3765    /// [google.longrunning.Operations]: longrunning::client::Operations
3766    pub fn cancel_operation(&self) -> super::builder::sessions::CancelOperation {
3767        super::builder::sessions::CancelOperation::new(self.inner.clone())
3768    }
3769}
3770
3771/// Implements a client for the Dialogflow API.
3772///
3773/// # Example
3774/// ```
3775/// # tokio_test::block_on(async {
3776/// # use google_cloud_dialogflow_v2::client::SessionEntityTypes;
3777/// let client = SessionEntityTypes::builder().build().await?;
3778/// // use `client` to make requests to the Dialogflow API.
3779/// # gax::client_builder::Result::<()>::Ok(()) });
3780/// ```
3781///
3782/// # Service Description
3783///
3784/// Service for managing
3785/// [SessionEntityTypes][google.cloud.dialogflow.v2.SessionEntityType].
3786///
3787/// [google.cloud.dialogflow.v2.SessionEntityType]: crate::model::SessionEntityType
3788///
3789/// # Configuration
3790///
3791/// To configure `SessionEntityTypes` use the `with_*` methods in the type returned
3792/// by [builder()][SessionEntityTypes::builder]. The default configuration should
3793/// work for most applications. Common configuration changes include
3794///
3795/// * [with_endpoint()]: by default this client uses the global default endpoint
3796///   (`https://dialogflow.googleapis.com`). Applications using regional
3797///   endpoints or running in restricted networks (e.g. a network configured
3798//    with [Private Google Access with VPC Service Controls]) may want to
3799///   override this default.
3800/// * [with_credentials()]: by default this client uses
3801///   [Application Default Credentials]. Applications using custom
3802///   authentication may need to override this default.
3803///
3804/// [with_endpoint()]: super::builder::session_entity_types::ClientBuilder::with_endpoint
3805/// [with_credentials()]: super::builder::session_entity_types::ClientBuilder::credentials
3806/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
3807/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
3808///
3809/// # Pooling and Cloning
3810///
3811/// `SessionEntityTypes` holds a connection pool internally, it is advised to
3812/// create one and the reuse it.  You do not need to wrap `SessionEntityTypes` in
3813/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
3814/// already uses an `Arc` internally.
3815#[cfg(feature = "session-entity-types")]
3816#[cfg_attr(docsrs, doc(cfg(feature = "session-entity-types")))]
3817#[derive(Clone, Debug)]
3818pub struct SessionEntityTypes {
3819    inner: std::sync::Arc<dyn super::stub::dynamic::SessionEntityTypes>,
3820}
3821
3822#[cfg(feature = "session-entity-types")]
3823impl SessionEntityTypes {
3824    /// Returns a builder for [SessionEntityTypes].
3825    ///
3826    /// ```
3827    /// # tokio_test::block_on(async {
3828    /// # use google_cloud_dialogflow_v2::client::SessionEntityTypes;
3829    /// let client = SessionEntityTypes::builder().build().await?;
3830    /// # gax::client_builder::Result::<()>::Ok(()) });
3831    /// ```
3832    pub fn builder() -> super::builder::session_entity_types::ClientBuilder {
3833        gax::client_builder::internal::new_builder(
3834            super::builder::session_entity_types::client::Factory,
3835        )
3836    }
3837
3838    /// Creates a new client from the provided stub.
3839    ///
3840    /// The most common case for calling this function is in tests mocking the
3841    /// client's behavior.
3842    pub fn from_stub<T>(stub: T) -> Self
3843    where
3844        T: super::stub::SessionEntityTypes + 'static,
3845    {
3846        Self {
3847            inner: std::sync::Arc::new(stub),
3848        }
3849    }
3850
3851    pub(crate) async fn new(
3852        config: gaxi::options::ClientConfig,
3853    ) -> gax::client_builder::Result<Self> {
3854        let inner = Self::build_inner(config).await?;
3855        Ok(Self { inner })
3856    }
3857
3858    async fn build_inner(
3859        conf: gaxi::options::ClientConfig,
3860    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::SessionEntityTypes>>
3861    {
3862        if gaxi::options::tracing_enabled(&conf) {
3863            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
3864        }
3865        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
3866    }
3867
3868    async fn build_transport(
3869        conf: gaxi::options::ClientConfig,
3870    ) -> gax::client_builder::Result<impl super::stub::SessionEntityTypes> {
3871        super::transport::SessionEntityTypes::new(conf).await
3872    }
3873
3874    async fn build_with_tracing(
3875        conf: gaxi::options::ClientConfig,
3876    ) -> gax::client_builder::Result<impl super::stub::SessionEntityTypes> {
3877        Self::build_transport(conf)
3878            .await
3879            .map(super::tracing::SessionEntityTypes::new)
3880    }
3881
3882    /// Returns the list of all session entity types in the specified session.
3883    ///
3884    /// This method doesn't work with Google Assistant integration.
3885    /// Contact Dialogflow support if you need to use session entities
3886    /// with Google Assistant integration.
3887    pub fn list_session_entity_types(
3888        &self,
3889    ) -> super::builder::session_entity_types::ListSessionEntityTypes {
3890        super::builder::session_entity_types::ListSessionEntityTypes::new(self.inner.clone())
3891    }
3892
3893    /// Retrieves the specified session entity type.
3894    ///
3895    /// This method doesn't work with Google Assistant integration.
3896    /// Contact Dialogflow support if you need to use session entities
3897    /// with Google Assistant integration.
3898    pub fn get_session_entity_type(
3899        &self,
3900    ) -> super::builder::session_entity_types::GetSessionEntityType {
3901        super::builder::session_entity_types::GetSessionEntityType::new(self.inner.clone())
3902    }
3903
3904    /// Creates a session entity type.
3905    ///
3906    /// If the specified session entity type already exists, overrides the session
3907    /// entity type.
3908    ///
3909    /// This method doesn't work with Google Assistant integration.
3910    /// Contact Dialogflow support if you need to use session entities
3911    /// with Google Assistant integration.
3912    pub fn create_session_entity_type(
3913        &self,
3914    ) -> super::builder::session_entity_types::CreateSessionEntityType {
3915        super::builder::session_entity_types::CreateSessionEntityType::new(self.inner.clone())
3916    }
3917
3918    /// Updates the specified session entity type.
3919    ///
3920    /// This method doesn't work with Google Assistant integration.
3921    /// Contact Dialogflow support if you need to use session entities
3922    /// with Google Assistant integration.
3923    pub fn update_session_entity_type(
3924        &self,
3925    ) -> super::builder::session_entity_types::UpdateSessionEntityType {
3926        super::builder::session_entity_types::UpdateSessionEntityType::new(self.inner.clone())
3927    }
3928
3929    /// Deletes the specified session entity type.
3930    ///
3931    /// This method doesn't work with Google Assistant integration.
3932    /// Contact Dialogflow support if you need to use session entities
3933    /// with Google Assistant integration.
3934    pub fn delete_session_entity_type(
3935        &self,
3936    ) -> super::builder::session_entity_types::DeleteSessionEntityType {
3937        super::builder::session_entity_types::DeleteSessionEntityType::new(self.inner.clone())
3938    }
3939
3940    /// Lists information about the supported locations for this service.
3941    pub fn list_locations(&self) -> super::builder::session_entity_types::ListLocations {
3942        super::builder::session_entity_types::ListLocations::new(self.inner.clone())
3943    }
3944
3945    /// Gets information about a location.
3946    pub fn get_location(&self) -> super::builder::session_entity_types::GetLocation {
3947        super::builder::session_entity_types::GetLocation::new(self.inner.clone())
3948    }
3949
3950    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3951    ///
3952    /// [google.longrunning.Operations]: longrunning::client::Operations
3953    pub fn list_operations(&self) -> super::builder::session_entity_types::ListOperations {
3954        super::builder::session_entity_types::ListOperations::new(self.inner.clone())
3955    }
3956
3957    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3958    ///
3959    /// [google.longrunning.Operations]: longrunning::client::Operations
3960    pub fn get_operation(&self) -> super::builder::session_entity_types::GetOperation {
3961        super::builder::session_entity_types::GetOperation::new(self.inner.clone())
3962    }
3963
3964    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3965    ///
3966    /// [google.longrunning.Operations]: longrunning::client::Operations
3967    pub fn cancel_operation(&self) -> super::builder::session_entity_types::CancelOperation {
3968        super::builder::session_entity_types::CancelOperation::new(self.inner.clone())
3969    }
3970}
3971
3972/// Implements a client for the Dialogflow API.
3973///
3974/// # Example
3975/// ```
3976/// # tokio_test::block_on(async {
3977/// # use google_cloud_dialogflow_v2::client::Versions;
3978/// let client = Versions::builder().build().await?;
3979/// // use `client` to make requests to the Dialogflow API.
3980/// # gax::client_builder::Result::<()>::Ok(()) });
3981/// ```
3982///
3983/// # Service Description
3984///
3985/// Service for managing [Versions][google.cloud.dialogflow.v2.Version].
3986///
3987/// [google.cloud.dialogflow.v2.Version]: crate::model::Version
3988///
3989/// # Configuration
3990///
3991/// To configure `Versions` use the `with_*` methods in the type returned
3992/// by [builder()][Versions::builder]. The default configuration should
3993/// work for most applications. Common configuration changes include
3994///
3995/// * [with_endpoint()]: by default this client uses the global default endpoint
3996///   (`https://dialogflow.googleapis.com`). Applications using regional
3997///   endpoints or running in restricted networks (e.g. a network configured
3998//    with [Private Google Access with VPC Service Controls]) may want to
3999///   override this default.
4000/// * [with_credentials()]: by default this client uses
4001///   [Application Default Credentials]. Applications using custom
4002///   authentication may need to override this default.
4003///
4004/// [with_endpoint()]: super::builder::versions::ClientBuilder::with_endpoint
4005/// [with_credentials()]: super::builder::versions::ClientBuilder::credentials
4006/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
4007/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
4008///
4009/// # Pooling and Cloning
4010///
4011/// `Versions` holds a connection pool internally, it is advised to
4012/// create one and the reuse it.  You do not need to wrap `Versions` in
4013/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
4014/// already uses an `Arc` internally.
4015#[cfg(feature = "versions")]
4016#[cfg_attr(docsrs, doc(cfg(feature = "versions")))]
4017#[derive(Clone, Debug)]
4018pub struct Versions {
4019    inner: std::sync::Arc<dyn super::stub::dynamic::Versions>,
4020}
4021
4022#[cfg(feature = "versions")]
4023impl Versions {
4024    /// Returns a builder for [Versions].
4025    ///
4026    /// ```
4027    /// # tokio_test::block_on(async {
4028    /// # use google_cloud_dialogflow_v2::client::Versions;
4029    /// let client = Versions::builder().build().await?;
4030    /// # gax::client_builder::Result::<()>::Ok(()) });
4031    /// ```
4032    pub fn builder() -> super::builder::versions::ClientBuilder {
4033        gax::client_builder::internal::new_builder(super::builder::versions::client::Factory)
4034    }
4035
4036    /// Creates a new client from the provided stub.
4037    ///
4038    /// The most common case for calling this function is in tests mocking the
4039    /// client's behavior.
4040    pub fn from_stub<T>(stub: T) -> Self
4041    where
4042        T: super::stub::Versions + 'static,
4043    {
4044        Self {
4045            inner: std::sync::Arc::new(stub),
4046        }
4047    }
4048
4049    pub(crate) async fn new(
4050        config: gaxi::options::ClientConfig,
4051    ) -> gax::client_builder::Result<Self> {
4052        let inner = Self::build_inner(config).await?;
4053        Ok(Self { inner })
4054    }
4055
4056    async fn build_inner(
4057        conf: gaxi::options::ClientConfig,
4058    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::Versions>> {
4059        if gaxi::options::tracing_enabled(&conf) {
4060            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
4061        }
4062        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
4063    }
4064
4065    async fn build_transport(
4066        conf: gaxi::options::ClientConfig,
4067    ) -> gax::client_builder::Result<impl super::stub::Versions> {
4068        super::transport::Versions::new(conf).await
4069    }
4070
4071    async fn build_with_tracing(
4072        conf: gaxi::options::ClientConfig,
4073    ) -> gax::client_builder::Result<impl super::stub::Versions> {
4074        Self::build_transport(conf)
4075            .await
4076            .map(super::tracing::Versions::new)
4077    }
4078
4079    /// Returns the list of all versions of the specified agent.
4080    pub fn list_versions(&self) -> super::builder::versions::ListVersions {
4081        super::builder::versions::ListVersions::new(self.inner.clone())
4082    }
4083
4084    /// Retrieves the specified agent version.
4085    pub fn get_version(&self) -> super::builder::versions::GetVersion {
4086        super::builder::versions::GetVersion::new(self.inner.clone())
4087    }
4088
4089    /// Creates an agent version.
4090    ///
4091    /// The new version points to the agent instance in the "default" environment.
4092    pub fn create_version(&self) -> super::builder::versions::CreateVersion {
4093        super::builder::versions::CreateVersion::new(self.inner.clone())
4094    }
4095
4096    /// Updates the specified agent version.
4097    ///
4098    /// Note that this method does not allow you to update the state of the agent
4099    /// the given version points to. It allows you to update only mutable
4100    /// properties of the version resource.
4101    pub fn update_version(&self) -> super::builder::versions::UpdateVersion {
4102        super::builder::versions::UpdateVersion::new(self.inner.clone())
4103    }
4104
4105    /// Delete the specified agent version.
4106    pub fn delete_version(&self) -> super::builder::versions::DeleteVersion {
4107        super::builder::versions::DeleteVersion::new(self.inner.clone())
4108    }
4109
4110    /// Lists information about the supported locations for this service.
4111    pub fn list_locations(&self) -> super::builder::versions::ListLocations {
4112        super::builder::versions::ListLocations::new(self.inner.clone())
4113    }
4114
4115    /// Gets information about a location.
4116    pub fn get_location(&self) -> super::builder::versions::GetLocation {
4117        super::builder::versions::GetLocation::new(self.inner.clone())
4118    }
4119
4120    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
4121    ///
4122    /// [google.longrunning.Operations]: longrunning::client::Operations
4123    pub fn list_operations(&self) -> super::builder::versions::ListOperations {
4124        super::builder::versions::ListOperations::new(self.inner.clone())
4125    }
4126
4127    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
4128    ///
4129    /// [google.longrunning.Operations]: longrunning::client::Operations
4130    pub fn get_operation(&self) -> super::builder::versions::GetOperation {
4131        super::builder::versions::GetOperation::new(self.inner.clone())
4132    }
4133
4134    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
4135    ///
4136    /// [google.longrunning.Operations]: longrunning::client::Operations
4137    pub fn cancel_operation(&self) -> super::builder::versions::CancelOperation {
4138        super::builder::versions::CancelOperation::new(self.inner.clone())
4139    }
4140}