Skip to main content

google_cloud_dialogflow_v2/
client.rs

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