Skip to main content

google_cloud_discoveryengine_v1/
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 Discovery Engine API.
20///
21/// # Example
22/// ```
23/// # use google_cloud_discoveryengine_v1::client::AssistantService;
24/// use google_cloud_gax::paginator::ItemPaginator as _;
25/// async fn sample(
26/// ) -> anyhow::Result<()> {
27///     let client = AssistantService::builder().build().await?;
28///     let mut list = client.list_operations()
29///         /* set fields */
30///         .by_item();
31///     while let Some(item) = list.next().await.transpose()? {
32///         println!("{:?}", item);
33///     }
34///     Ok(())
35/// }
36/// ```
37///
38/// # Service Description
39///
40/// Service for managing Assistant configuration and assisting users.
41///
42/// # Configuration
43///
44/// To configure `AssistantService` use the `with_*` methods in the type returned
45/// by [builder()][AssistantService::builder]. The default configuration should
46/// work for most applications. Common configuration changes include
47///
48/// * [with_endpoint()]: by default this client uses the global default endpoint
49///   (`https://discoveryengine.googleapis.com`). Applications using regional
50///   endpoints or running in restricted networks (e.g. a network configured
51//    with [Private Google Access with VPC Service Controls]) may want to
52///   override this default.
53/// * [with_credentials()]: by default this client uses
54///   [Application Default Credentials]. Applications using custom
55///   authentication may need to override this default.
56///
57/// [with_endpoint()]: super::builder::assistant_service::ClientBuilder::with_endpoint
58/// [with_credentials()]: super::builder::assistant_service::ClientBuilder::with_credentials
59/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
60/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
61///
62/// # Pooling and Cloning
63///
64/// `AssistantService` holds a connection pool internally, it is advised to
65/// create one and reuse it. You do not need to wrap `AssistantService` in
66/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
67/// already uses an `Arc` internally.
68#[cfg(feature = "assistant-service")]
69#[cfg_attr(docsrs, doc(cfg(feature = "assistant-service")))]
70#[derive(Clone, Debug)]
71pub struct AssistantService {
72    inner: std::sync::Arc<dyn super::stub::dynamic::AssistantService>,
73}
74
75#[cfg(feature = "assistant-service")]
76impl AssistantService {
77    /// Returns a builder for [AssistantService].
78    ///
79    /// ```
80    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
81    /// # use google_cloud_discoveryengine_v1::client::AssistantService;
82    /// let client = AssistantService::builder().build().await?;
83    /// # Ok(()) }
84    /// ```
85    pub fn builder() -> super::builder::assistant_service::ClientBuilder {
86        crate::new_client_builder(super::builder::assistant_service::client::Factory)
87    }
88
89    /// Creates a new client from the provided stub.
90    ///
91    /// The most common case for calling this function is in tests mocking the
92    /// client's behavior.
93    pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
94    where
95        T: super::stub::AssistantService + 'static,
96    {
97        Self { inner: stub.into() }
98    }
99
100    pub(crate) async fn new(
101        config: gaxi::options::ClientConfig,
102    ) -> crate::ClientBuilderResult<Self> {
103        let inner = Self::build_inner(config).await?;
104        Ok(Self { inner })
105    }
106
107    async fn build_inner(
108        conf: gaxi::options::ClientConfig,
109    ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::AssistantService>>
110    {
111        if gaxi::options::tracing_enabled(&conf) {
112            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
113        }
114        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
115    }
116
117    async fn build_transport(
118        conf: gaxi::options::ClientConfig,
119    ) -> crate::ClientBuilderResult<impl super::stub::AssistantService> {
120        super::transport::AssistantService::new(conf).await
121    }
122
123    async fn build_with_tracing(
124        conf: gaxi::options::ClientConfig,
125    ) -> crate::ClientBuilderResult<impl super::stub::AssistantService> {
126        Self::build_transport(conf)
127            .await
128            .map(super::tracing::AssistantService::new)
129    }
130
131    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
132    ///
133    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
134    ///
135    /// # Example
136    /// ```
137    /// # use google_cloud_discoveryengine_v1::client::AssistantService;
138    /// use google_cloud_gax::paginator::ItemPaginator as _;
139    /// use google_cloud_discoveryengine_v1::Result;
140    /// async fn sample(
141    ///    client: &AssistantService
142    /// ) -> Result<()> {
143    ///     let mut list = client.list_operations()
144    ///         /* set fields */
145    ///         .by_item();
146    ///     while let Some(item) = list.next().await.transpose()? {
147    ///         println!("{:?}", item);
148    ///     }
149    ///     Ok(())
150    /// }
151    /// ```
152    pub fn list_operations(&self) -> super::builder::assistant_service::ListOperations {
153        super::builder::assistant_service::ListOperations::new(self.inner.clone())
154    }
155
156    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
157    ///
158    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
159    ///
160    /// # Example
161    /// ```
162    /// # use google_cloud_discoveryengine_v1::client::AssistantService;
163    /// use google_cloud_discoveryengine_v1::Result;
164    /// async fn sample(
165    ///    client: &AssistantService
166    /// ) -> Result<()> {
167    ///     let response = client.get_operation()
168    ///         /* set fields */
169    ///         .send().await?;
170    ///     println!("response {:?}", response);
171    ///     Ok(())
172    /// }
173    /// ```
174    pub fn get_operation(&self) -> super::builder::assistant_service::GetOperation {
175        super::builder::assistant_service::GetOperation::new(self.inner.clone())
176    }
177
178    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
179    ///
180    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
181    ///
182    /// # Example
183    /// ```
184    /// # use google_cloud_discoveryengine_v1::client::AssistantService;
185    /// use google_cloud_discoveryengine_v1::Result;
186    /// async fn sample(
187    ///    client: &AssistantService
188    /// ) -> Result<()> {
189    ///     client.cancel_operation()
190    ///         /* set fields */
191    ///         .send().await?;
192    ///     Ok(())
193    /// }
194    /// ```
195    pub fn cancel_operation(&self) -> super::builder::assistant_service::CancelOperation {
196        super::builder::assistant_service::CancelOperation::new(self.inner.clone())
197    }
198}
199
200/// Implements a client for the Discovery Engine API.
201///
202/// # Example
203/// ```
204/// # use google_cloud_discoveryengine_v1::client::CmekConfigService;
205/// async fn sample(
206///    project_id: &str,
207///    location_id: &str,
208/// ) -> anyhow::Result<()> {
209///     let client = CmekConfigService::builder().build().await?;
210///     let response = client.get_cmek_config()
211///         .set_name(format!("projects/{project_id}/locations/{location_id}/cmekConfig"))
212///         .send().await?;
213///     println!("response {:?}", response);
214///     Ok(())
215/// }
216/// ```
217///
218/// # Service Description
219///
220/// Service for managing CMEK related tasks
221///
222/// # Configuration
223///
224/// To configure `CmekConfigService` use the `with_*` methods in the type returned
225/// by [builder()][CmekConfigService::builder]. The default configuration should
226/// work for most applications. Common configuration changes include
227///
228/// * [with_endpoint()]: by default this client uses the global default endpoint
229///   (`https://discoveryengine.googleapis.com`). Applications using regional
230///   endpoints or running in restricted networks (e.g. a network configured
231//    with [Private Google Access with VPC Service Controls]) may want to
232///   override this default.
233/// * [with_credentials()]: by default this client uses
234///   [Application Default Credentials]. Applications using custom
235///   authentication may need to override this default.
236///
237/// [with_endpoint()]: super::builder::cmek_config_service::ClientBuilder::with_endpoint
238/// [with_credentials()]: super::builder::cmek_config_service::ClientBuilder::with_credentials
239/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
240/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
241///
242/// # Pooling and Cloning
243///
244/// `CmekConfigService` holds a connection pool internally, it is advised to
245/// create one and reuse it. You do not need to wrap `CmekConfigService` in
246/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
247/// already uses an `Arc` internally.
248#[cfg(feature = "cmek-config-service")]
249#[cfg_attr(docsrs, doc(cfg(feature = "cmek-config-service")))]
250#[derive(Clone, Debug)]
251pub struct CmekConfigService {
252    inner: std::sync::Arc<dyn super::stub::dynamic::CmekConfigService>,
253}
254
255#[cfg(feature = "cmek-config-service")]
256impl CmekConfigService {
257    /// Returns a builder for [CmekConfigService].
258    ///
259    /// ```
260    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
261    /// # use google_cloud_discoveryengine_v1::client::CmekConfigService;
262    /// let client = CmekConfigService::builder().build().await?;
263    /// # Ok(()) }
264    /// ```
265    pub fn builder() -> super::builder::cmek_config_service::ClientBuilder {
266        crate::new_client_builder(super::builder::cmek_config_service::client::Factory)
267    }
268
269    /// Creates a new client from the provided stub.
270    ///
271    /// The most common case for calling this function is in tests mocking the
272    /// client's behavior.
273    pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
274    where
275        T: super::stub::CmekConfigService + 'static,
276    {
277        Self { inner: stub.into() }
278    }
279
280    pub(crate) async fn new(
281        config: gaxi::options::ClientConfig,
282    ) -> crate::ClientBuilderResult<Self> {
283        let inner = Self::build_inner(config).await?;
284        Ok(Self { inner })
285    }
286
287    async fn build_inner(
288        conf: gaxi::options::ClientConfig,
289    ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::CmekConfigService>>
290    {
291        if gaxi::options::tracing_enabled(&conf) {
292            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
293        }
294        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
295    }
296
297    async fn build_transport(
298        conf: gaxi::options::ClientConfig,
299    ) -> crate::ClientBuilderResult<impl super::stub::CmekConfigService> {
300        super::transport::CmekConfigService::new(conf).await
301    }
302
303    async fn build_with_tracing(
304        conf: gaxi::options::ClientConfig,
305    ) -> crate::ClientBuilderResult<impl super::stub::CmekConfigService> {
306        Self::build_transport(conf)
307            .await
308            .map(super::tracing::CmekConfigService::new)
309    }
310
311    /// Provisions a CMEK key for use in a location of a customer's project.
312    /// This method will also conduct location validation on the provided
313    /// cmekConfig to make sure the key is valid and can be used in the
314    /// selected location.
315    ///
316    /// # Long running operations
317    ///
318    /// This method is used to start, and/or poll a [long-running Operation].
319    /// The [Working with long-running operations] chapter in the [user guide]
320    /// covers these operations in detail.
321    ///
322    /// [long-running operation]: https://google.aip.dev/151
323    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
324    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
325    ///
326    /// # Example
327    /// ```
328    /// # use google_cloud_discoveryengine_v1::client::CmekConfigService;
329    /// use google_cloud_lro::Poller;
330    /// use google_cloud_discoveryengine_v1::model::CmekConfig;
331    /// use google_cloud_discoveryengine_v1::Result;
332    /// async fn sample(
333    ///    client: &CmekConfigService, project_id: &str, location_id: &str
334    /// ) -> Result<()> {
335    ///     let response = client.update_cmek_config()
336    ///         .set_config(
337    ///             CmekConfig::new().set_name(format!("projects/{project_id}/locations/{location_id}/cmekConfig"))/* set fields */
338    ///         )
339    ///         .poller().until_done().await?;
340    ///     println!("response {:?}", response);
341    ///     Ok(())
342    /// }
343    /// ```
344    pub fn update_cmek_config(&self) -> super::builder::cmek_config_service::UpdateCmekConfig {
345        super::builder::cmek_config_service::UpdateCmekConfig::new(self.inner.clone())
346    }
347
348    /// Gets the [CmekConfig][google.cloud.discoveryengine.v1.CmekConfig].
349    ///
350    /// [google.cloud.discoveryengine.v1.CmekConfig]: crate::model::CmekConfig
351    ///
352    /// # Example
353    /// ```
354    /// # use google_cloud_discoveryengine_v1::client::CmekConfigService;
355    /// use google_cloud_discoveryengine_v1::Result;
356    /// async fn sample(
357    ///    client: &CmekConfigService, project_id: &str, location_id: &str
358    /// ) -> Result<()> {
359    ///     let response = client.get_cmek_config()
360    ///         .set_name(format!("projects/{project_id}/locations/{location_id}/cmekConfig"))
361    ///         .send().await?;
362    ///     println!("response {:?}", response);
363    ///     Ok(())
364    /// }
365    /// ```
366    pub fn get_cmek_config(&self) -> super::builder::cmek_config_service::GetCmekConfig {
367        super::builder::cmek_config_service::GetCmekConfig::new(self.inner.clone())
368    }
369
370    /// Lists all the [CmekConfig][google.cloud.discoveryengine.v1.CmekConfig]s
371    /// with the project.
372    ///
373    /// [google.cloud.discoveryengine.v1.CmekConfig]: crate::model::CmekConfig
374    ///
375    /// # Example
376    /// ```
377    /// # use google_cloud_discoveryengine_v1::client::CmekConfigService;
378    /// use google_cloud_discoveryengine_v1::Result;
379    /// async fn sample(
380    ///    client: &CmekConfigService
381    /// ) -> Result<()> {
382    ///     let response = client.list_cmek_configs()
383    ///         /* set fields */
384    ///         .send().await?;
385    ///     println!("response {:?}", response);
386    ///     Ok(())
387    /// }
388    /// ```
389    pub fn list_cmek_configs(&self) -> super::builder::cmek_config_service::ListCmekConfigs {
390        super::builder::cmek_config_service::ListCmekConfigs::new(self.inner.clone())
391    }
392
393    /// De-provisions a CmekConfig.
394    ///
395    /// # Long running operations
396    ///
397    /// This method is used to start, and/or poll a [long-running Operation].
398    /// The [Working with long-running operations] chapter in the [user guide]
399    /// covers these operations in detail.
400    ///
401    /// [long-running operation]: https://google.aip.dev/151
402    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
403    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
404    ///
405    /// # Example
406    /// ```
407    /// # use google_cloud_discoveryengine_v1::client::CmekConfigService;
408    /// use google_cloud_lro::Poller;
409    /// use google_cloud_discoveryengine_v1::Result;
410    /// async fn sample(
411    ///    client: &CmekConfigService, project_id: &str, location_id: &str
412    /// ) -> Result<()> {
413    ///     client.delete_cmek_config()
414    ///         .set_name(format!("projects/{project_id}/locations/{location_id}/cmekConfig"))
415    ///         .poller().until_done().await?;
416    ///     Ok(())
417    /// }
418    /// ```
419    pub fn delete_cmek_config(&self) -> super::builder::cmek_config_service::DeleteCmekConfig {
420        super::builder::cmek_config_service::DeleteCmekConfig::new(self.inner.clone())
421    }
422
423    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
424    ///
425    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
426    ///
427    /// # Example
428    /// ```
429    /// # use google_cloud_discoveryengine_v1::client::CmekConfigService;
430    /// use google_cloud_gax::paginator::ItemPaginator as _;
431    /// use google_cloud_discoveryengine_v1::Result;
432    /// async fn sample(
433    ///    client: &CmekConfigService
434    /// ) -> Result<()> {
435    ///     let mut list = client.list_operations()
436    ///         /* set fields */
437    ///         .by_item();
438    ///     while let Some(item) = list.next().await.transpose()? {
439    ///         println!("{:?}", item);
440    ///     }
441    ///     Ok(())
442    /// }
443    /// ```
444    pub fn list_operations(&self) -> super::builder::cmek_config_service::ListOperations {
445        super::builder::cmek_config_service::ListOperations::new(self.inner.clone())
446    }
447
448    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
449    ///
450    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
451    ///
452    /// # Example
453    /// ```
454    /// # use google_cloud_discoveryengine_v1::client::CmekConfigService;
455    /// use google_cloud_discoveryengine_v1::Result;
456    /// async fn sample(
457    ///    client: &CmekConfigService
458    /// ) -> Result<()> {
459    ///     let response = client.get_operation()
460    ///         /* set fields */
461    ///         .send().await?;
462    ///     println!("response {:?}", response);
463    ///     Ok(())
464    /// }
465    /// ```
466    pub fn get_operation(&self) -> super::builder::cmek_config_service::GetOperation {
467        super::builder::cmek_config_service::GetOperation::new(self.inner.clone())
468    }
469
470    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
471    ///
472    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
473    ///
474    /// # Example
475    /// ```
476    /// # use google_cloud_discoveryengine_v1::client::CmekConfigService;
477    /// use google_cloud_discoveryengine_v1::Result;
478    /// async fn sample(
479    ///    client: &CmekConfigService
480    /// ) -> Result<()> {
481    ///     client.cancel_operation()
482    ///         /* set fields */
483    ///         .send().await?;
484    ///     Ok(())
485    /// }
486    /// ```
487    pub fn cancel_operation(&self) -> super::builder::cmek_config_service::CancelOperation {
488        super::builder::cmek_config_service::CancelOperation::new(self.inner.clone())
489    }
490}
491
492/// Implements a client for the Discovery Engine API.
493///
494/// # Example
495/// ```
496/// # use google_cloud_discoveryengine_v1::client::CompletionService;
497/// use google_cloud_lro::Poller;
498/// async fn sample(
499/// ) -> anyhow::Result<()> {
500///     let client = CompletionService::builder().build().await?;
501///     let response = client.import_completion_suggestions()
502///         /* set fields */
503///         .poller().until_done().await?;
504///     println!("response {:?}", response);
505///     Ok(())
506/// }
507/// ```
508///
509/// # Service Description
510///
511/// Service for Auto-Completion.
512///
513/// # Configuration
514///
515/// To configure `CompletionService` use the `with_*` methods in the type returned
516/// by [builder()][CompletionService::builder]. The default configuration should
517/// work for most applications. Common configuration changes include
518///
519/// * [with_endpoint()]: by default this client uses the global default endpoint
520///   (`https://discoveryengine.googleapis.com`). Applications using regional
521///   endpoints or running in restricted networks (e.g. a network configured
522//    with [Private Google Access with VPC Service Controls]) may want to
523///   override this default.
524/// * [with_credentials()]: by default this client uses
525///   [Application Default Credentials]. Applications using custom
526///   authentication may need to override this default.
527///
528/// [with_endpoint()]: super::builder::completion_service::ClientBuilder::with_endpoint
529/// [with_credentials()]: super::builder::completion_service::ClientBuilder::with_credentials
530/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
531/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
532///
533/// # Pooling and Cloning
534///
535/// `CompletionService` holds a connection pool internally, it is advised to
536/// create one and reuse it. You do not need to wrap `CompletionService` in
537/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
538/// already uses an `Arc` internally.
539#[cfg(feature = "completion-service")]
540#[cfg_attr(docsrs, doc(cfg(feature = "completion-service")))]
541#[derive(Clone, Debug)]
542pub struct CompletionService {
543    inner: std::sync::Arc<dyn super::stub::dynamic::CompletionService>,
544}
545
546#[cfg(feature = "completion-service")]
547impl CompletionService {
548    /// Returns a builder for [CompletionService].
549    ///
550    /// ```
551    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
552    /// # use google_cloud_discoveryengine_v1::client::CompletionService;
553    /// let client = CompletionService::builder().build().await?;
554    /// # Ok(()) }
555    /// ```
556    pub fn builder() -> super::builder::completion_service::ClientBuilder {
557        crate::new_client_builder(super::builder::completion_service::client::Factory)
558    }
559
560    /// Creates a new client from the provided stub.
561    ///
562    /// The most common case for calling this function is in tests mocking the
563    /// client's behavior.
564    pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
565    where
566        T: super::stub::CompletionService + 'static,
567    {
568        Self { inner: stub.into() }
569    }
570
571    pub(crate) async fn new(
572        config: gaxi::options::ClientConfig,
573    ) -> crate::ClientBuilderResult<Self> {
574        let inner = Self::build_inner(config).await?;
575        Ok(Self { inner })
576    }
577
578    async fn build_inner(
579        conf: gaxi::options::ClientConfig,
580    ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::CompletionService>>
581    {
582        if gaxi::options::tracing_enabled(&conf) {
583            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
584        }
585        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
586    }
587
588    async fn build_transport(
589        conf: gaxi::options::ClientConfig,
590    ) -> crate::ClientBuilderResult<impl super::stub::CompletionService> {
591        super::transport::CompletionService::new(conf).await
592    }
593
594    async fn build_with_tracing(
595        conf: gaxi::options::ClientConfig,
596    ) -> crate::ClientBuilderResult<impl super::stub::CompletionService> {
597        Self::build_transport(conf)
598            .await
599            .map(super::tracing::CompletionService::new)
600    }
601
602    /// Completes the specified user input with keyword suggestions.
603    ///
604    /// # Example
605    /// ```
606    /// # use google_cloud_discoveryengine_v1::client::CompletionService;
607    /// use google_cloud_discoveryengine_v1::Result;
608    /// async fn sample(
609    ///    client: &CompletionService
610    /// ) -> Result<()> {
611    ///     let response = client.complete_query()
612    ///         /* set fields */
613    ///         .send().await?;
614    ///     println!("response {:?}", response);
615    ///     Ok(())
616    /// }
617    /// ```
618    pub fn complete_query(&self) -> super::builder::completion_service::CompleteQuery {
619        super::builder::completion_service::CompleteQuery::new(self.inner.clone())
620    }
621
622    /// Imports all
623    /// [SuggestionDenyListEntry][google.cloud.discoveryengine.v1.SuggestionDenyListEntry]
624    /// for a DataStore.
625    ///
626    /// [google.cloud.discoveryengine.v1.SuggestionDenyListEntry]: crate::model::SuggestionDenyListEntry
627    ///
628    /// # Long running operations
629    ///
630    /// This method is used to start, and/or poll a [long-running Operation].
631    /// The [Working with long-running operations] chapter in the [user guide]
632    /// covers these operations in detail.
633    ///
634    /// [long-running operation]: https://google.aip.dev/151
635    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
636    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
637    ///
638    /// # Example
639    /// ```
640    /// # use google_cloud_discoveryengine_v1::client::CompletionService;
641    /// use google_cloud_lro::Poller;
642    /// use google_cloud_discoveryengine_v1::Result;
643    /// async fn sample(
644    ///    client: &CompletionService
645    /// ) -> Result<()> {
646    ///     let response = client.import_suggestion_deny_list_entries()
647    ///         /* set fields */
648    ///         .poller().until_done().await?;
649    ///     println!("response {:?}", response);
650    ///     Ok(())
651    /// }
652    /// ```
653    pub fn import_suggestion_deny_list_entries(
654        &self,
655    ) -> super::builder::completion_service::ImportSuggestionDenyListEntries {
656        super::builder::completion_service::ImportSuggestionDenyListEntries::new(self.inner.clone())
657    }
658
659    /// Permanently deletes all
660    /// [SuggestionDenyListEntry][google.cloud.discoveryengine.v1.SuggestionDenyListEntry]
661    /// for a DataStore.
662    ///
663    /// [google.cloud.discoveryengine.v1.SuggestionDenyListEntry]: crate::model::SuggestionDenyListEntry
664    ///
665    /// # Long running operations
666    ///
667    /// This method is used to start, and/or poll a [long-running Operation].
668    /// The [Working with long-running operations] chapter in the [user guide]
669    /// covers these operations in detail.
670    ///
671    /// [long-running operation]: https://google.aip.dev/151
672    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
673    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
674    ///
675    /// # Example
676    /// ```
677    /// # use google_cloud_discoveryengine_v1::client::CompletionService;
678    /// use google_cloud_lro::Poller;
679    /// use google_cloud_discoveryengine_v1::Result;
680    /// async fn sample(
681    ///    client: &CompletionService
682    /// ) -> Result<()> {
683    ///     let response = client.purge_suggestion_deny_list_entries()
684    ///         /* set fields */
685    ///         .poller().until_done().await?;
686    ///     println!("response {:?}", response);
687    ///     Ok(())
688    /// }
689    /// ```
690    pub fn purge_suggestion_deny_list_entries(
691        &self,
692    ) -> super::builder::completion_service::PurgeSuggestionDenyListEntries {
693        super::builder::completion_service::PurgeSuggestionDenyListEntries::new(self.inner.clone())
694    }
695
696    /// Imports
697    /// [CompletionSuggestion][google.cloud.discoveryengine.v1.CompletionSuggestion]s
698    /// for a DataStore.
699    ///
700    /// [google.cloud.discoveryengine.v1.CompletionSuggestion]: crate::model::CompletionSuggestion
701    ///
702    /// # Long running operations
703    ///
704    /// This method is used to start, and/or poll a [long-running Operation].
705    /// The [Working with long-running operations] chapter in the [user guide]
706    /// covers these operations in detail.
707    ///
708    /// [long-running operation]: https://google.aip.dev/151
709    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
710    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
711    ///
712    /// # Example
713    /// ```
714    /// # use google_cloud_discoveryengine_v1::client::CompletionService;
715    /// use google_cloud_lro::Poller;
716    /// use google_cloud_discoveryengine_v1::Result;
717    /// async fn sample(
718    ///    client: &CompletionService
719    /// ) -> Result<()> {
720    ///     let response = client.import_completion_suggestions()
721    ///         /* set fields */
722    ///         .poller().until_done().await?;
723    ///     println!("response {:?}", response);
724    ///     Ok(())
725    /// }
726    /// ```
727    pub fn import_completion_suggestions(
728        &self,
729    ) -> super::builder::completion_service::ImportCompletionSuggestions {
730        super::builder::completion_service::ImportCompletionSuggestions::new(self.inner.clone())
731    }
732
733    /// Permanently deletes all
734    /// [CompletionSuggestion][google.cloud.discoveryengine.v1.CompletionSuggestion]s
735    /// for a DataStore.
736    ///
737    /// [google.cloud.discoveryengine.v1.CompletionSuggestion]: crate::model::CompletionSuggestion
738    ///
739    /// # Long running operations
740    ///
741    /// This method is used to start, and/or poll a [long-running Operation].
742    /// The [Working with long-running operations] chapter in the [user guide]
743    /// covers these operations in detail.
744    ///
745    /// [long-running operation]: https://google.aip.dev/151
746    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
747    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
748    ///
749    /// # Example
750    /// ```
751    /// # use google_cloud_discoveryengine_v1::client::CompletionService;
752    /// use google_cloud_lro::Poller;
753    /// use google_cloud_discoveryengine_v1::Result;
754    /// async fn sample(
755    ///    client: &CompletionService
756    /// ) -> Result<()> {
757    ///     let response = client.purge_completion_suggestions()
758    ///         /* set fields */
759    ///         .poller().until_done().await?;
760    ///     println!("response {:?}", response);
761    ///     Ok(())
762    /// }
763    /// ```
764    pub fn purge_completion_suggestions(
765        &self,
766    ) -> super::builder::completion_service::PurgeCompletionSuggestions {
767        super::builder::completion_service::PurgeCompletionSuggestions::new(self.inner.clone())
768    }
769
770    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
771    ///
772    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
773    ///
774    /// # Example
775    /// ```
776    /// # use google_cloud_discoveryengine_v1::client::CompletionService;
777    /// use google_cloud_gax::paginator::ItemPaginator as _;
778    /// use google_cloud_discoveryengine_v1::Result;
779    /// async fn sample(
780    ///    client: &CompletionService
781    /// ) -> Result<()> {
782    ///     let mut list = client.list_operations()
783    ///         /* set fields */
784    ///         .by_item();
785    ///     while let Some(item) = list.next().await.transpose()? {
786    ///         println!("{:?}", item);
787    ///     }
788    ///     Ok(())
789    /// }
790    /// ```
791    pub fn list_operations(&self) -> super::builder::completion_service::ListOperations {
792        super::builder::completion_service::ListOperations::new(self.inner.clone())
793    }
794
795    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
796    ///
797    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
798    ///
799    /// # Example
800    /// ```
801    /// # use google_cloud_discoveryengine_v1::client::CompletionService;
802    /// use google_cloud_discoveryengine_v1::Result;
803    /// async fn sample(
804    ///    client: &CompletionService
805    /// ) -> Result<()> {
806    ///     let response = client.get_operation()
807    ///         /* set fields */
808    ///         .send().await?;
809    ///     println!("response {:?}", response);
810    ///     Ok(())
811    /// }
812    /// ```
813    pub fn get_operation(&self) -> super::builder::completion_service::GetOperation {
814        super::builder::completion_service::GetOperation::new(self.inner.clone())
815    }
816
817    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
818    ///
819    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
820    ///
821    /// # Example
822    /// ```
823    /// # use google_cloud_discoveryengine_v1::client::CompletionService;
824    /// use google_cloud_discoveryengine_v1::Result;
825    /// async fn sample(
826    ///    client: &CompletionService
827    /// ) -> Result<()> {
828    ///     client.cancel_operation()
829    ///         /* set fields */
830    ///         .send().await?;
831    ///     Ok(())
832    /// }
833    /// ```
834    pub fn cancel_operation(&self) -> super::builder::completion_service::CancelOperation {
835        super::builder::completion_service::CancelOperation::new(self.inner.clone())
836    }
837}
838
839/// Implements a client for the Discovery Engine API.
840///
841/// # Example
842/// ```
843/// # use google_cloud_discoveryengine_v1::client::ControlService;
844/// use google_cloud_gax::paginator::ItemPaginator as _;
845/// async fn sample(
846///    project_id: &str,
847///    location_id: &str,
848///    data_store_id: &str,
849/// ) -> anyhow::Result<()> {
850///     let client = ControlService::builder().build().await?;
851///     let mut list = client.list_controls()
852///         .set_parent(format!("projects/{project_id}/locations/{location_id}/dataStores/{data_store_id}"))
853///         .by_item();
854///     while let Some(item) = list.next().await.transpose()? {
855///         println!("{:?}", item);
856///     }
857///     Ok(())
858/// }
859/// ```
860///
861/// # Service Description
862///
863/// Service for performing CRUD operations on Controls.
864/// Controls allow for custom logic to be implemented in the serving path.
865/// Controls need to be attached to a Serving Config to be considered during a
866/// request.
867///
868/// # Configuration
869///
870/// To configure `ControlService` use the `with_*` methods in the type returned
871/// by [builder()][ControlService::builder]. The default configuration should
872/// work for most applications. Common configuration changes include
873///
874/// * [with_endpoint()]: by default this client uses the global default endpoint
875///   (`https://discoveryengine.googleapis.com`). Applications using regional
876///   endpoints or running in restricted networks (e.g. a network configured
877//    with [Private Google Access with VPC Service Controls]) may want to
878///   override this default.
879/// * [with_credentials()]: by default this client uses
880///   [Application Default Credentials]. Applications using custom
881///   authentication may need to override this default.
882///
883/// [with_endpoint()]: super::builder::control_service::ClientBuilder::with_endpoint
884/// [with_credentials()]: super::builder::control_service::ClientBuilder::with_credentials
885/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
886/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
887///
888/// # Pooling and Cloning
889///
890/// `ControlService` holds a connection pool internally, it is advised to
891/// create one and reuse it. You do not need to wrap `ControlService` in
892/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
893/// already uses an `Arc` internally.
894#[cfg(feature = "control-service")]
895#[cfg_attr(docsrs, doc(cfg(feature = "control-service")))]
896#[derive(Clone, Debug)]
897pub struct ControlService {
898    inner: std::sync::Arc<dyn super::stub::dynamic::ControlService>,
899}
900
901#[cfg(feature = "control-service")]
902impl ControlService {
903    /// Returns a builder for [ControlService].
904    ///
905    /// ```
906    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
907    /// # use google_cloud_discoveryengine_v1::client::ControlService;
908    /// let client = ControlService::builder().build().await?;
909    /// # Ok(()) }
910    /// ```
911    pub fn builder() -> super::builder::control_service::ClientBuilder {
912        crate::new_client_builder(super::builder::control_service::client::Factory)
913    }
914
915    /// Creates a new client from the provided stub.
916    ///
917    /// The most common case for calling this function is in tests mocking the
918    /// client's behavior.
919    pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
920    where
921        T: super::stub::ControlService + 'static,
922    {
923        Self { inner: stub.into() }
924    }
925
926    pub(crate) async fn new(
927        config: gaxi::options::ClientConfig,
928    ) -> crate::ClientBuilderResult<Self> {
929        let inner = Self::build_inner(config).await?;
930        Ok(Self { inner })
931    }
932
933    async fn build_inner(
934        conf: gaxi::options::ClientConfig,
935    ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::ControlService>> {
936        if gaxi::options::tracing_enabled(&conf) {
937            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
938        }
939        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
940    }
941
942    async fn build_transport(
943        conf: gaxi::options::ClientConfig,
944    ) -> crate::ClientBuilderResult<impl super::stub::ControlService> {
945        super::transport::ControlService::new(conf).await
946    }
947
948    async fn build_with_tracing(
949        conf: gaxi::options::ClientConfig,
950    ) -> crate::ClientBuilderResult<impl super::stub::ControlService> {
951        Self::build_transport(conf)
952            .await
953            .map(super::tracing::ControlService::new)
954    }
955
956    /// Creates a Control.
957    ///
958    /// By default 1000 controls are allowed for a data store.
959    /// A request can be submitted to adjust this limit.
960    /// If the [Control][google.cloud.discoveryengine.v1.Control] to create already
961    /// exists, an ALREADY_EXISTS error is returned.
962    ///
963    /// [google.cloud.discoveryengine.v1.Control]: crate::model::Control
964    ///
965    /// # Example
966    /// ```
967    /// # use google_cloud_discoveryengine_v1::client::ControlService;
968    /// use google_cloud_discoveryengine_v1::model::Control;
969    /// use google_cloud_discoveryengine_v1::Result;
970    /// async fn sample(
971    ///    client: &ControlService, project_id: &str, location_id: &str, data_store_id: &str
972    /// ) -> Result<()> {
973    ///     let response = client.create_control()
974    ///         .set_parent(format!("projects/{project_id}/locations/{location_id}/dataStores/{data_store_id}"))
975    ///         .set_control_id("control_id_value")
976    ///         .set_control(
977    ///             Control::new()/* set fields */
978    ///         )
979    ///         .send().await?;
980    ///     println!("response {:?}", response);
981    ///     Ok(())
982    /// }
983    /// ```
984    pub fn create_control(&self) -> super::builder::control_service::CreateControl {
985        super::builder::control_service::CreateControl::new(self.inner.clone())
986    }
987
988    /// Deletes a Control.
989    ///
990    /// If the [Control][google.cloud.discoveryengine.v1.Control] to delete does
991    /// not exist, a NOT_FOUND error is returned.
992    ///
993    /// [google.cloud.discoveryengine.v1.Control]: crate::model::Control
994    ///
995    /// # Example
996    /// ```
997    /// # use google_cloud_discoveryengine_v1::client::ControlService;
998    /// use google_cloud_discoveryengine_v1::Result;
999    /// async fn sample(
1000    ///    client: &ControlService, project_id: &str, location_id: &str, data_store_id: &str, control_id: &str
1001    /// ) -> Result<()> {
1002    ///     client.delete_control()
1003    ///         .set_name(format!("projects/{project_id}/locations/{location_id}/dataStores/{data_store_id}/controls/{control_id}"))
1004    ///         .send().await?;
1005    ///     Ok(())
1006    /// }
1007    /// ```
1008    pub fn delete_control(&self) -> super::builder::control_service::DeleteControl {
1009        super::builder::control_service::DeleteControl::new(self.inner.clone())
1010    }
1011
1012    /// Updates a Control.
1013    ///
1014    /// [Control][google.cloud.discoveryengine.v1.Control] action type cannot be
1015    /// changed. If the [Control][google.cloud.discoveryengine.v1.Control] to
1016    /// update does not exist, a NOT_FOUND error is returned.
1017    ///
1018    /// [google.cloud.discoveryengine.v1.Control]: crate::model::Control
1019    ///
1020    /// # Example
1021    /// ```
1022    /// # use google_cloud_discoveryengine_v1::client::ControlService;
1023    /// # extern crate wkt as google_cloud_wkt;
1024    /// use google_cloud_wkt::FieldMask;
1025    /// use google_cloud_discoveryengine_v1::model::Control;
1026    /// use google_cloud_discoveryengine_v1::Result;
1027    /// async fn sample(
1028    ///    client: &ControlService, project_id: &str, location_id: &str, data_store_id: &str, control_id: &str
1029    /// ) -> Result<()> {
1030    ///     let response = client.update_control()
1031    ///         .set_control(
1032    ///             Control::new().set_name(format!("projects/{project_id}/locations/{location_id}/dataStores/{data_store_id}/controls/{control_id}"))/* set fields */
1033    ///         )
1034    ///         .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
1035    ///         .send().await?;
1036    ///     println!("response {:?}", response);
1037    ///     Ok(())
1038    /// }
1039    /// ```
1040    pub fn update_control(&self) -> super::builder::control_service::UpdateControl {
1041        super::builder::control_service::UpdateControl::new(self.inner.clone())
1042    }
1043
1044    /// Gets a Control.
1045    ///
1046    /// # Example
1047    /// ```
1048    /// # use google_cloud_discoveryengine_v1::client::ControlService;
1049    /// use google_cloud_discoveryengine_v1::Result;
1050    /// async fn sample(
1051    ///    client: &ControlService, project_id: &str, location_id: &str, data_store_id: &str, control_id: &str
1052    /// ) -> Result<()> {
1053    ///     let response = client.get_control()
1054    ///         .set_name(format!("projects/{project_id}/locations/{location_id}/dataStores/{data_store_id}/controls/{control_id}"))
1055    ///         .send().await?;
1056    ///     println!("response {:?}", response);
1057    ///     Ok(())
1058    /// }
1059    /// ```
1060    pub fn get_control(&self) -> super::builder::control_service::GetControl {
1061        super::builder::control_service::GetControl::new(self.inner.clone())
1062    }
1063
1064    /// Lists all Controls by their parent
1065    /// [DataStore][google.cloud.discoveryengine.v1.DataStore].
1066    ///
1067    /// [google.cloud.discoveryengine.v1.DataStore]: crate::model::DataStore
1068    ///
1069    /// # Example
1070    /// ```
1071    /// # use google_cloud_discoveryengine_v1::client::ControlService;
1072    /// use google_cloud_gax::paginator::ItemPaginator as _;
1073    /// use google_cloud_discoveryengine_v1::Result;
1074    /// async fn sample(
1075    ///    client: &ControlService, project_id: &str, location_id: &str, data_store_id: &str
1076    /// ) -> Result<()> {
1077    ///     let mut list = client.list_controls()
1078    ///         .set_parent(format!("projects/{project_id}/locations/{location_id}/dataStores/{data_store_id}"))
1079    ///         .by_item();
1080    ///     while let Some(item) = list.next().await.transpose()? {
1081    ///         println!("{:?}", item);
1082    ///     }
1083    ///     Ok(())
1084    /// }
1085    /// ```
1086    pub fn list_controls(&self) -> super::builder::control_service::ListControls {
1087        super::builder::control_service::ListControls::new(self.inner.clone())
1088    }
1089
1090    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1091    ///
1092    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1093    ///
1094    /// # Example
1095    /// ```
1096    /// # use google_cloud_discoveryengine_v1::client::ControlService;
1097    /// use google_cloud_gax::paginator::ItemPaginator as _;
1098    /// use google_cloud_discoveryengine_v1::Result;
1099    /// async fn sample(
1100    ///    client: &ControlService
1101    /// ) -> Result<()> {
1102    ///     let mut list = client.list_operations()
1103    ///         /* set fields */
1104    ///         .by_item();
1105    ///     while let Some(item) = list.next().await.transpose()? {
1106    ///         println!("{:?}", item);
1107    ///     }
1108    ///     Ok(())
1109    /// }
1110    /// ```
1111    pub fn list_operations(&self) -> super::builder::control_service::ListOperations {
1112        super::builder::control_service::ListOperations::new(self.inner.clone())
1113    }
1114
1115    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1116    ///
1117    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1118    ///
1119    /// # Example
1120    /// ```
1121    /// # use google_cloud_discoveryengine_v1::client::ControlService;
1122    /// use google_cloud_discoveryengine_v1::Result;
1123    /// async fn sample(
1124    ///    client: &ControlService
1125    /// ) -> Result<()> {
1126    ///     let response = client.get_operation()
1127    ///         /* set fields */
1128    ///         .send().await?;
1129    ///     println!("response {:?}", response);
1130    ///     Ok(())
1131    /// }
1132    /// ```
1133    pub fn get_operation(&self) -> super::builder::control_service::GetOperation {
1134        super::builder::control_service::GetOperation::new(self.inner.clone())
1135    }
1136
1137    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1138    ///
1139    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1140    ///
1141    /// # Example
1142    /// ```
1143    /// # use google_cloud_discoveryengine_v1::client::ControlService;
1144    /// use google_cloud_discoveryengine_v1::Result;
1145    /// async fn sample(
1146    ///    client: &ControlService
1147    /// ) -> Result<()> {
1148    ///     client.cancel_operation()
1149    ///         /* set fields */
1150    ///         .send().await?;
1151    ///     Ok(())
1152    /// }
1153    /// ```
1154    pub fn cancel_operation(&self) -> super::builder::control_service::CancelOperation {
1155        super::builder::control_service::CancelOperation::new(self.inner.clone())
1156    }
1157}
1158
1159/// Implements a client for the Discovery Engine API.
1160///
1161/// # Example
1162/// ```
1163/// # use google_cloud_discoveryengine_v1::client::ConversationalSearchService;
1164/// use google_cloud_gax::paginator::ItemPaginator as _;
1165/// async fn sample(
1166///    project_id: &str,
1167///    location_id: &str,
1168///    data_store_id: &str,
1169/// ) -> anyhow::Result<()> {
1170///     let client = ConversationalSearchService::builder().build().await?;
1171///     let mut list = client.list_conversations()
1172///         .set_parent(format!("projects/{project_id}/locations/{location_id}/dataStores/{data_store_id}"))
1173///         .by_item();
1174///     while let Some(item) = list.next().await.transpose()? {
1175///         println!("{:?}", item);
1176///     }
1177///     Ok(())
1178/// }
1179/// ```
1180///
1181/// # Service Description
1182///
1183/// Service for conversational search.
1184///
1185/// # Configuration
1186///
1187/// To configure `ConversationalSearchService` use the `with_*` methods in the type returned
1188/// by [builder()][ConversationalSearchService::builder]. The default configuration should
1189/// work for most applications. Common configuration changes include
1190///
1191/// * [with_endpoint()]: by default this client uses the global default endpoint
1192///   (`https://discoveryengine.googleapis.com`). Applications using regional
1193///   endpoints or running in restricted networks (e.g. a network configured
1194//    with [Private Google Access with VPC Service Controls]) may want to
1195///   override this default.
1196/// * [with_credentials()]: by default this client uses
1197///   [Application Default Credentials]. Applications using custom
1198///   authentication may need to override this default.
1199///
1200/// [with_endpoint()]: super::builder::conversational_search_service::ClientBuilder::with_endpoint
1201/// [with_credentials()]: super::builder::conversational_search_service::ClientBuilder::with_credentials
1202/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
1203/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
1204///
1205/// # Pooling and Cloning
1206///
1207/// `ConversationalSearchService` holds a connection pool internally, it is advised to
1208/// create one and reuse it. You do not need to wrap `ConversationalSearchService` in
1209/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
1210/// already uses an `Arc` internally.
1211#[cfg(feature = "conversational-search-service")]
1212#[cfg_attr(docsrs, doc(cfg(feature = "conversational-search-service")))]
1213#[derive(Clone, Debug)]
1214pub struct ConversationalSearchService {
1215    inner: std::sync::Arc<dyn super::stub::dynamic::ConversationalSearchService>,
1216}
1217
1218#[cfg(feature = "conversational-search-service")]
1219impl ConversationalSearchService {
1220    /// Returns a builder for [ConversationalSearchService].
1221    ///
1222    /// ```
1223    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
1224    /// # use google_cloud_discoveryengine_v1::client::ConversationalSearchService;
1225    /// let client = ConversationalSearchService::builder().build().await?;
1226    /// # Ok(()) }
1227    /// ```
1228    pub fn builder() -> super::builder::conversational_search_service::ClientBuilder {
1229        crate::new_client_builder(super::builder::conversational_search_service::client::Factory)
1230    }
1231
1232    /// Creates a new client from the provided stub.
1233    ///
1234    /// The most common case for calling this function is in tests mocking the
1235    /// client's behavior.
1236    pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
1237    where
1238        T: super::stub::ConversationalSearchService + 'static,
1239    {
1240        Self { inner: stub.into() }
1241    }
1242
1243    pub(crate) async fn new(
1244        config: gaxi::options::ClientConfig,
1245    ) -> crate::ClientBuilderResult<Self> {
1246        let inner = Self::build_inner(config).await?;
1247        Ok(Self { inner })
1248    }
1249
1250    async fn build_inner(
1251        conf: gaxi::options::ClientConfig,
1252    ) -> crate::ClientBuilderResult<
1253        std::sync::Arc<dyn super::stub::dynamic::ConversationalSearchService>,
1254    > {
1255        if gaxi::options::tracing_enabled(&conf) {
1256            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
1257        }
1258        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
1259    }
1260
1261    async fn build_transport(
1262        conf: gaxi::options::ClientConfig,
1263    ) -> crate::ClientBuilderResult<impl super::stub::ConversationalSearchService> {
1264        super::transport::ConversationalSearchService::new(conf).await
1265    }
1266
1267    async fn build_with_tracing(
1268        conf: gaxi::options::ClientConfig,
1269    ) -> crate::ClientBuilderResult<impl super::stub::ConversationalSearchService> {
1270        Self::build_transport(conf)
1271            .await
1272            .map(super::tracing::ConversationalSearchService::new)
1273    }
1274
1275    /// Converses a conversation.
1276    ///
1277    /// # Example
1278    /// ```
1279    /// # use google_cloud_discoveryengine_v1::client::ConversationalSearchService;
1280    /// use google_cloud_discoveryengine_v1::Result;
1281    /// async fn sample(
1282    ///    client: &ConversationalSearchService
1283    /// ) -> Result<()> {
1284    ///     let response = client.converse_conversation()
1285    ///         /* set fields */
1286    ///         .send().await?;
1287    ///     println!("response {:?}", response);
1288    ///     Ok(())
1289    /// }
1290    /// ```
1291    pub fn converse_conversation(
1292        &self,
1293    ) -> super::builder::conversational_search_service::ConverseConversation {
1294        super::builder::conversational_search_service::ConverseConversation::new(self.inner.clone())
1295    }
1296
1297    /// Creates a Conversation.
1298    ///
1299    /// If the [Conversation][google.cloud.discoveryengine.v1.Conversation] to
1300    /// create already exists, an ALREADY_EXISTS error is returned.
1301    ///
1302    /// [google.cloud.discoveryengine.v1.Conversation]: crate::model::Conversation
1303    ///
1304    /// # Example
1305    /// ```
1306    /// # use google_cloud_discoveryengine_v1::client::ConversationalSearchService;
1307    /// use google_cloud_discoveryengine_v1::model::Conversation;
1308    /// use google_cloud_discoveryengine_v1::Result;
1309    /// async fn sample(
1310    ///    client: &ConversationalSearchService, project_id: &str, location_id: &str, data_store_id: &str
1311    /// ) -> Result<()> {
1312    ///     let response = client.create_conversation()
1313    ///         .set_parent(format!("projects/{project_id}/locations/{location_id}/dataStores/{data_store_id}"))
1314    ///         .set_conversation(
1315    ///             Conversation::new()/* set fields */
1316    ///         )
1317    ///         .send().await?;
1318    ///     println!("response {:?}", response);
1319    ///     Ok(())
1320    /// }
1321    /// ```
1322    pub fn create_conversation(
1323        &self,
1324    ) -> super::builder::conversational_search_service::CreateConversation {
1325        super::builder::conversational_search_service::CreateConversation::new(self.inner.clone())
1326    }
1327
1328    /// Deletes a Conversation.
1329    ///
1330    /// If the [Conversation][google.cloud.discoveryengine.v1.Conversation] to
1331    /// delete does not exist, a NOT_FOUND error is returned.
1332    ///
1333    /// [google.cloud.discoveryengine.v1.Conversation]: crate::model::Conversation
1334    ///
1335    /// # Example
1336    /// ```
1337    /// # use google_cloud_discoveryengine_v1::client::ConversationalSearchService;
1338    /// use google_cloud_discoveryengine_v1::Result;
1339    /// async fn sample(
1340    ///    client: &ConversationalSearchService, project_id: &str, location_id: &str, data_store_id: &str, conversation_id: &str
1341    /// ) -> Result<()> {
1342    ///     client.delete_conversation()
1343    ///         .set_name(format!("projects/{project_id}/locations/{location_id}/dataStores/{data_store_id}/conversations/{conversation_id}"))
1344    ///         .send().await?;
1345    ///     Ok(())
1346    /// }
1347    /// ```
1348    pub fn delete_conversation(
1349        &self,
1350    ) -> super::builder::conversational_search_service::DeleteConversation {
1351        super::builder::conversational_search_service::DeleteConversation::new(self.inner.clone())
1352    }
1353
1354    /// Updates a Conversation.
1355    ///
1356    /// [Conversation][google.cloud.discoveryengine.v1.Conversation] action type
1357    /// cannot be changed. If the
1358    /// [Conversation][google.cloud.discoveryengine.v1.Conversation] to update does
1359    /// not exist, a NOT_FOUND error is returned.
1360    ///
1361    /// [google.cloud.discoveryengine.v1.Conversation]: crate::model::Conversation
1362    ///
1363    /// # Example
1364    /// ```
1365    /// # use google_cloud_discoveryengine_v1::client::ConversationalSearchService;
1366    /// # extern crate wkt as google_cloud_wkt;
1367    /// use google_cloud_wkt::FieldMask;
1368    /// use google_cloud_discoveryengine_v1::model::Conversation;
1369    /// use google_cloud_discoveryengine_v1::Result;
1370    /// async fn sample(
1371    ///    client: &ConversationalSearchService, project_id: &str, location_id: &str, data_store_id: &str, conversation_id: &str
1372    /// ) -> Result<()> {
1373    ///     let response = client.update_conversation()
1374    ///         .set_conversation(
1375    ///             Conversation::new().set_name(format!("projects/{project_id}/locations/{location_id}/dataStores/{data_store_id}/conversations/{conversation_id}"))/* set fields */
1376    ///         )
1377    ///         .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
1378    ///         .send().await?;
1379    ///     println!("response {:?}", response);
1380    ///     Ok(())
1381    /// }
1382    /// ```
1383    pub fn update_conversation(
1384        &self,
1385    ) -> super::builder::conversational_search_service::UpdateConversation {
1386        super::builder::conversational_search_service::UpdateConversation::new(self.inner.clone())
1387    }
1388
1389    /// Gets a Conversation.
1390    ///
1391    /// # Example
1392    /// ```
1393    /// # use google_cloud_discoveryengine_v1::client::ConversationalSearchService;
1394    /// use google_cloud_discoveryengine_v1::Result;
1395    /// async fn sample(
1396    ///    client: &ConversationalSearchService, project_id: &str, location_id: &str, data_store_id: &str, conversation_id: &str
1397    /// ) -> Result<()> {
1398    ///     let response = client.get_conversation()
1399    ///         .set_name(format!("projects/{project_id}/locations/{location_id}/dataStores/{data_store_id}/conversations/{conversation_id}"))
1400    ///         .send().await?;
1401    ///     println!("response {:?}", response);
1402    ///     Ok(())
1403    /// }
1404    /// ```
1405    pub fn get_conversation(
1406        &self,
1407    ) -> super::builder::conversational_search_service::GetConversation {
1408        super::builder::conversational_search_service::GetConversation::new(self.inner.clone())
1409    }
1410
1411    /// Lists all Conversations by their parent
1412    /// [DataStore][google.cloud.discoveryengine.v1.DataStore].
1413    ///
1414    /// [google.cloud.discoveryengine.v1.DataStore]: crate::model::DataStore
1415    ///
1416    /// # Example
1417    /// ```
1418    /// # use google_cloud_discoveryengine_v1::client::ConversationalSearchService;
1419    /// use google_cloud_gax::paginator::ItemPaginator as _;
1420    /// use google_cloud_discoveryengine_v1::Result;
1421    /// async fn sample(
1422    ///    client: &ConversationalSearchService, project_id: &str, location_id: &str, data_store_id: &str
1423    /// ) -> Result<()> {
1424    ///     let mut list = client.list_conversations()
1425    ///         .set_parent(format!("projects/{project_id}/locations/{location_id}/dataStores/{data_store_id}"))
1426    ///         .by_item();
1427    ///     while let Some(item) = list.next().await.transpose()? {
1428    ///         println!("{:?}", item);
1429    ///     }
1430    ///     Ok(())
1431    /// }
1432    /// ```
1433    pub fn list_conversations(
1434        &self,
1435    ) -> super::builder::conversational_search_service::ListConversations {
1436        super::builder::conversational_search_service::ListConversations::new(self.inner.clone())
1437    }
1438
1439    /// Answer query method.
1440    ///
1441    /// # Example
1442    /// ```
1443    /// # use google_cloud_discoveryengine_v1::client::ConversationalSearchService;
1444    /// use google_cloud_discoveryengine_v1::Result;
1445    /// async fn sample(
1446    ///    client: &ConversationalSearchService
1447    /// ) -> Result<()> {
1448    ///     let response = client.answer_query()
1449    ///         /* set fields */
1450    ///         .send().await?;
1451    ///     println!("response {:?}", response);
1452    ///     Ok(())
1453    /// }
1454    /// ```
1455    pub fn answer_query(&self) -> super::builder::conversational_search_service::AnswerQuery {
1456        super::builder::conversational_search_service::AnswerQuery::new(self.inner.clone())
1457    }
1458
1459    /// Gets a Answer.
1460    ///
1461    /// # Example
1462    /// ```
1463    /// # use google_cloud_discoveryengine_v1::client::ConversationalSearchService;
1464    /// use google_cloud_discoveryengine_v1::Result;
1465    /// async fn sample(
1466    ///    client: &ConversationalSearchService, project_id: &str, location_id: &str, data_store_id: &str, session_id: &str, answer_id: &str
1467    /// ) -> Result<()> {
1468    ///     let response = client.get_answer()
1469    ///         .set_name(format!("projects/{project_id}/locations/{location_id}/dataStores/{data_store_id}/sessions/{session_id}/answers/{answer_id}"))
1470    ///         .send().await?;
1471    ///     println!("response {:?}", response);
1472    ///     Ok(())
1473    /// }
1474    /// ```
1475    pub fn get_answer(&self) -> super::builder::conversational_search_service::GetAnswer {
1476        super::builder::conversational_search_service::GetAnswer::new(self.inner.clone())
1477    }
1478
1479    /// Creates a Session.
1480    ///
1481    /// If the [Session][google.cloud.discoveryengine.v1.Session] to create already
1482    /// exists, an ALREADY_EXISTS error is returned.
1483    ///
1484    /// [google.cloud.discoveryengine.v1.Session]: crate::model::Session
1485    ///
1486    /// # Example
1487    /// ```
1488    /// # use google_cloud_discoveryengine_v1::client::ConversationalSearchService;
1489    /// use google_cloud_discoveryengine_v1::model::Session;
1490    /// use google_cloud_discoveryengine_v1::Result;
1491    /// async fn sample(
1492    ///    client: &ConversationalSearchService, project_id: &str, location_id: &str, data_store_id: &str
1493    /// ) -> Result<()> {
1494    ///     let response = client.create_session()
1495    ///         .set_parent(format!("projects/{project_id}/locations/{location_id}/dataStores/{data_store_id}"))
1496    ///         .set_session(
1497    ///             Session::new()/* set fields */
1498    ///         )
1499    ///         .send().await?;
1500    ///     println!("response {:?}", response);
1501    ///     Ok(())
1502    /// }
1503    /// ```
1504    pub fn create_session(&self) -> super::builder::conversational_search_service::CreateSession {
1505        super::builder::conversational_search_service::CreateSession::new(self.inner.clone())
1506    }
1507
1508    /// Deletes a Session.
1509    ///
1510    /// If the [Session][google.cloud.discoveryengine.v1.Session] to delete does
1511    /// not exist, a NOT_FOUND error is returned.
1512    ///
1513    /// [google.cloud.discoveryengine.v1.Session]: crate::model::Session
1514    ///
1515    /// # Example
1516    /// ```
1517    /// # use google_cloud_discoveryengine_v1::client::ConversationalSearchService;
1518    /// use google_cloud_discoveryengine_v1::Result;
1519    /// async fn sample(
1520    ///    client: &ConversationalSearchService, project_id: &str, location_id: &str, data_store_id: &str, session_id: &str
1521    /// ) -> Result<()> {
1522    ///     client.delete_session()
1523    ///         .set_name(format!("projects/{project_id}/locations/{location_id}/dataStores/{data_store_id}/sessions/{session_id}"))
1524    ///         .send().await?;
1525    ///     Ok(())
1526    /// }
1527    /// ```
1528    pub fn delete_session(&self) -> super::builder::conversational_search_service::DeleteSession {
1529        super::builder::conversational_search_service::DeleteSession::new(self.inner.clone())
1530    }
1531
1532    /// Updates a Session.
1533    ///
1534    /// [Session][google.cloud.discoveryengine.v1.Session] action type cannot be
1535    /// changed. If the [Session][google.cloud.discoveryengine.v1.Session] to
1536    /// update does not exist, a NOT_FOUND error is returned.
1537    ///
1538    /// [google.cloud.discoveryengine.v1.Session]: crate::model::Session
1539    ///
1540    /// # Example
1541    /// ```
1542    /// # use google_cloud_discoveryengine_v1::client::ConversationalSearchService;
1543    /// # extern crate wkt as google_cloud_wkt;
1544    /// use google_cloud_wkt::FieldMask;
1545    /// use google_cloud_discoveryengine_v1::model::Session;
1546    /// use google_cloud_discoveryengine_v1::Result;
1547    /// async fn sample(
1548    ///    client: &ConversationalSearchService, project_id: &str, location_id: &str, data_store_id: &str, session_id: &str
1549    /// ) -> Result<()> {
1550    ///     let response = client.update_session()
1551    ///         .set_session(
1552    ///             Session::new().set_name(format!("projects/{project_id}/locations/{location_id}/dataStores/{data_store_id}/sessions/{session_id}"))/* set fields */
1553    ///         )
1554    ///         .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
1555    ///         .send().await?;
1556    ///     println!("response {:?}", response);
1557    ///     Ok(())
1558    /// }
1559    /// ```
1560    pub fn update_session(&self) -> super::builder::conversational_search_service::UpdateSession {
1561        super::builder::conversational_search_service::UpdateSession::new(self.inner.clone())
1562    }
1563
1564    /// Gets a Session.
1565    ///
1566    /// # Example
1567    /// ```
1568    /// # use google_cloud_discoveryengine_v1::client::ConversationalSearchService;
1569    /// use google_cloud_discoveryengine_v1::Result;
1570    /// async fn sample(
1571    ///    client: &ConversationalSearchService, project_id: &str, location_id: &str, data_store_id: &str, session_id: &str
1572    /// ) -> Result<()> {
1573    ///     let response = client.get_session()
1574    ///         .set_name(format!("projects/{project_id}/locations/{location_id}/dataStores/{data_store_id}/sessions/{session_id}"))
1575    ///         .send().await?;
1576    ///     println!("response {:?}", response);
1577    ///     Ok(())
1578    /// }
1579    /// ```
1580    pub fn get_session(&self) -> super::builder::conversational_search_service::GetSession {
1581        super::builder::conversational_search_service::GetSession::new(self.inner.clone())
1582    }
1583
1584    /// Lists all Sessions by their parent
1585    /// [DataStore][google.cloud.discoveryengine.v1.DataStore].
1586    ///
1587    /// [google.cloud.discoveryengine.v1.DataStore]: crate::model::DataStore
1588    ///
1589    /// # Example
1590    /// ```
1591    /// # use google_cloud_discoveryengine_v1::client::ConversationalSearchService;
1592    /// use google_cloud_gax::paginator::ItemPaginator as _;
1593    /// use google_cloud_discoveryengine_v1::Result;
1594    /// async fn sample(
1595    ///    client: &ConversationalSearchService, project_id: &str, location_id: &str, data_store_id: &str
1596    /// ) -> Result<()> {
1597    ///     let mut list = client.list_sessions()
1598    ///         .set_parent(format!("projects/{project_id}/locations/{location_id}/dataStores/{data_store_id}"))
1599    ///         .by_item();
1600    ///     while let Some(item) = list.next().await.transpose()? {
1601    ///         println!("{:?}", item);
1602    ///     }
1603    ///     Ok(())
1604    /// }
1605    /// ```
1606    pub fn list_sessions(&self) -> super::builder::conversational_search_service::ListSessions {
1607        super::builder::conversational_search_service::ListSessions::new(self.inner.clone())
1608    }
1609
1610    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1611    ///
1612    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1613    ///
1614    /// # Example
1615    /// ```
1616    /// # use google_cloud_discoveryengine_v1::client::ConversationalSearchService;
1617    /// use google_cloud_gax::paginator::ItemPaginator as _;
1618    /// use google_cloud_discoveryengine_v1::Result;
1619    /// async fn sample(
1620    ///    client: &ConversationalSearchService
1621    /// ) -> Result<()> {
1622    ///     let mut list = client.list_operations()
1623    ///         /* set fields */
1624    ///         .by_item();
1625    ///     while let Some(item) = list.next().await.transpose()? {
1626    ///         println!("{:?}", item);
1627    ///     }
1628    ///     Ok(())
1629    /// }
1630    /// ```
1631    pub fn list_operations(&self) -> super::builder::conversational_search_service::ListOperations {
1632        super::builder::conversational_search_service::ListOperations::new(self.inner.clone())
1633    }
1634
1635    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1636    ///
1637    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1638    ///
1639    /// # Example
1640    /// ```
1641    /// # use google_cloud_discoveryengine_v1::client::ConversationalSearchService;
1642    /// use google_cloud_discoveryengine_v1::Result;
1643    /// async fn sample(
1644    ///    client: &ConversationalSearchService
1645    /// ) -> Result<()> {
1646    ///     let response = client.get_operation()
1647    ///         /* set fields */
1648    ///         .send().await?;
1649    ///     println!("response {:?}", response);
1650    ///     Ok(())
1651    /// }
1652    /// ```
1653    pub fn get_operation(&self) -> super::builder::conversational_search_service::GetOperation {
1654        super::builder::conversational_search_service::GetOperation::new(self.inner.clone())
1655    }
1656
1657    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1658    ///
1659    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1660    ///
1661    /// # Example
1662    /// ```
1663    /// # use google_cloud_discoveryengine_v1::client::ConversationalSearchService;
1664    /// use google_cloud_discoveryengine_v1::Result;
1665    /// async fn sample(
1666    ///    client: &ConversationalSearchService
1667    /// ) -> Result<()> {
1668    ///     client.cancel_operation()
1669    ///         /* set fields */
1670    ///         .send().await?;
1671    ///     Ok(())
1672    /// }
1673    /// ```
1674    pub fn cancel_operation(
1675        &self,
1676    ) -> super::builder::conversational_search_service::CancelOperation {
1677        super::builder::conversational_search_service::CancelOperation::new(self.inner.clone())
1678    }
1679}
1680
1681/// Implements a client for the Discovery Engine API.
1682///
1683/// # Example
1684/// ```
1685/// # use google_cloud_discoveryengine_v1::client::DataStoreService;
1686/// use google_cloud_gax::paginator::ItemPaginator as _;
1687/// async fn sample(
1688///    parent: &str,
1689/// ) -> anyhow::Result<()> {
1690///     let client = DataStoreService::builder().build().await?;
1691///     let mut list = client.list_data_stores()
1692///         .set_parent(parent)
1693///         .by_item();
1694///     while let Some(item) = list.next().await.transpose()? {
1695///         println!("{:?}", item);
1696///     }
1697///     Ok(())
1698/// }
1699/// ```
1700///
1701/// # Service Description
1702///
1703/// Service for managing [DataStore][google.cloud.discoveryengine.v1.DataStore]
1704/// configuration.
1705///
1706/// [google.cloud.discoveryengine.v1.DataStore]: crate::model::DataStore
1707///
1708/// # Configuration
1709///
1710/// To configure `DataStoreService` use the `with_*` methods in the type returned
1711/// by [builder()][DataStoreService::builder]. The default configuration should
1712/// work for most applications. Common configuration changes include
1713///
1714/// * [with_endpoint()]: by default this client uses the global default endpoint
1715///   (`https://discoveryengine.googleapis.com`). Applications using regional
1716///   endpoints or running in restricted networks (e.g. a network configured
1717//    with [Private Google Access with VPC Service Controls]) may want to
1718///   override this default.
1719/// * [with_credentials()]: by default this client uses
1720///   [Application Default Credentials]. Applications using custom
1721///   authentication may need to override this default.
1722///
1723/// [with_endpoint()]: super::builder::data_store_service::ClientBuilder::with_endpoint
1724/// [with_credentials()]: super::builder::data_store_service::ClientBuilder::with_credentials
1725/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
1726/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
1727///
1728/// # Pooling and Cloning
1729///
1730/// `DataStoreService` holds a connection pool internally, it is advised to
1731/// create one and reuse it. You do not need to wrap `DataStoreService` in
1732/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
1733/// already uses an `Arc` internally.
1734#[cfg(feature = "data-store-service")]
1735#[cfg_attr(docsrs, doc(cfg(feature = "data-store-service")))]
1736#[derive(Clone, Debug)]
1737pub struct DataStoreService {
1738    inner: std::sync::Arc<dyn super::stub::dynamic::DataStoreService>,
1739}
1740
1741#[cfg(feature = "data-store-service")]
1742impl DataStoreService {
1743    /// Returns a builder for [DataStoreService].
1744    ///
1745    /// ```
1746    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
1747    /// # use google_cloud_discoveryengine_v1::client::DataStoreService;
1748    /// let client = DataStoreService::builder().build().await?;
1749    /// # Ok(()) }
1750    /// ```
1751    pub fn builder() -> super::builder::data_store_service::ClientBuilder {
1752        crate::new_client_builder(super::builder::data_store_service::client::Factory)
1753    }
1754
1755    /// Creates a new client from the provided stub.
1756    ///
1757    /// The most common case for calling this function is in tests mocking the
1758    /// client's behavior.
1759    pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
1760    where
1761        T: super::stub::DataStoreService + 'static,
1762    {
1763        Self { inner: stub.into() }
1764    }
1765
1766    pub(crate) async fn new(
1767        config: gaxi::options::ClientConfig,
1768    ) -> crate::ClientBuilderResult<Self> {
1769        let inner = Self::build_inner(config).await?;
1770        Ok(Self { inner })
1771    }
1772
1773    async fn build_inner(
1774        conf: gaxi::options::ClientConfig,
1775    ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::DataStoreService>>
1776    {
1777        if gaxi::options::tracing_enabled(&conf) {
1778            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
1779        }
1780        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
1781    }
1782
1783    async fn build_transport(
1784        conf: gaxi::options::ClientConfig,
1785    ) -> crate::ClientBuilderResult<impl super::stub::DataStoreService> {
1786        super::transport::DataStoreService::new(conf).await
1787    }
1788
1789    async fn build_with_tracing(
1790        conf: gaxi::options::ClientConfig,
1791    ) -> crate::ClientBuilderResult<impl super::stub::DataStoreService> {
1792        Self::build_transport(conf)
1793            .await
1794            .map(super::tracing::DataStoreService::new)
1795    }
1796
1797    /// Creates a [DataStore][google.cloud.discoveryengine.v1.DataStore].
1798    ///
1799    /// DataStore is for storing
1800    /// [Documents][google.cloud.discoveryengine.v1.Document]. To serve these
1801    /// documents for Search, or Recommendation use case, an
1802    /// [Engine][google.cloud.discoveryengine.v1.Engine] needs to be created
1803    /// separately.
1804    ///
1805    /// [google.cloud.discoveryengine.v1.DataStore]: crate::model::DataStore
1806    /// [google.cloud.discoveryengine.v1.Document]: crate::model::Document
1807    /// [google.cloud.discoveryengine.v1.Engine]: crate::model::Engine
1808    ///
1809    /// # Long running operations
1810    ///
1811    /// This method is used to start, and/or poll a [long-running Operation].
1812    /// The [Working with long-running operations] chapter in the [user guide]
1813    /// covers these operations in detail.
1814    ///
1815    /// [long-running operation]: https://google.aip.dev/151
1816    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1817    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1818    ///
1819    /// # Example
1820    /// ```
1821    /// # use google_cloud_discoveryengine_v1::client::DataStoreService;
1822    /// use google_cloud_lro::Poller;
1823    /// use google_cloud_discoveryengine_v1::model::DataStore;
1824    /// use google_cloud_discoveryengine_v1::Result;
1825    /// async fn sample(
1826    ///    client: &DataStoreService, parent: &str
1827    /// ) -> Result<()> {
1828    ///     let response = client.create_data_store()
1829    ///         .set_parent(parent)
1830    ///         .set_data_store(
1831    ///             DataStore::new()/* set fields */
1832    ///         )
1833    ///         .poller().until_done().await?;
1834    ///     println!("response {:?}", response);
1835    ///     Ok(())
1836    /// }
1837    /// ```
1838    pub fn create_data_store(&self) -> super::builder::data_store_service::CreateDataStore {
1839        super::builder::data_store_service::CreateDataStore::new(self.inner.clone())
1840    }
1841
1842    /// Gets a [DataStore][google.cloud.discoveryengine.v1.DataStore].
1843    ///
1844    /// [google.cloud.discoveryengine.v1.DataStore]: crate::model::DataStore
1845    ///
1846    /// # Example
1847    /// ```
1848    /// # use google_cloud_discoveryengine_v1::client::DataStoreService;
1849    /// use google_cloud_discoveryengine_v1::Result;
1850    /// async fn sample(
1851    ///    client: &DataStoreService, project_id: &str, location_id: &str, data_store_id: &str
1852    /// ) -> Result<()> {
1853    ///     let response = client.get_data_store()
1854    ///         .set_name(format!("projects/{project_id}/locations/{location_id}/dataStores/{data_store_id}"))
1855    ///         .send().await?;
1856    ///     println!("response {:?}", response);
1857    ///     Ok(())
1858    /// }
1859    /// ```
1860    pub fn get_data_store(&self) -> super::builder::data_store_service::GetDataStore {
1861        super::builder::data_store_service::GetDataStore::new(self.inner.clone())
1862    }
1863
1864    /// Lists all the [DataStore][google.cloud.discoveryengine.v1.DataStore]s
1865    /// associated with the project.
1866    ///
1867    /// [google.cloud.discoveryengine.v1.DataStore]: crate::model::DataStore
1868    ///
1869    /// # Example
1870    /// ```
1871    /// # use google_cloud_discoveryengine_v1::client::DataStoreService;
1872    /// use google_cloud_gax::paginator::ItemPaginator as _;
1873    /// use google_cloud_discoveryengine_v1::Result;
1874    /// async fn sample(
1875    ///    client: &DataStoreService, parent: &str
1876    /// ) -> Result<()> {
1877    ///     let mut list = client.list_data_stores()
1878    ///         .set_parent(parent)
1879    ///         .by_item();
1880    ///     while let Some(item) = list.next().await.transpose()? {
1881    ///         println!("{:?}", item);
1882    ///     }
1883    ///     Ok(())
1884    /// }
1885    /// ```
1886    pub fn list_data_stores(&self) -> super::builder::data_store_service::ListDataStores {
1887        super::builder::data_store_service::ListDataStores::new(self.inner.clone())
1888    }
1889
1890    /// Deletes a [DataStore][google.cloud.discoveryengine.v1.DataStore].
1891    ///
1892    /// [google.cloud.discoveryengine.v1.DataStore]: crate::model::DataStore
1893    ///
1894    /// # Long running operations
1895    ///
1896    /// This method is used to start, and/or poll a [long-running Operation].
1897    /// The [Working with long-running operations] chapter in the [user guide]
1898    /// covers these operations in detail.
1899    ///
1900    /// [long-running operation]: https://google.aip.dev/151
1901    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1902    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1903    ///
1904    /// # Example
1905    /// ```
1906    /// # use google_cloud_discoveryengine_v1::client::DataStoreService;
1907    /// use google_cloud_lro::Poller;
1908    /// use google_cloud_discoveryengine_v1::Result;
1909    /// async fn sample(
1910    ///    client: &DataStoreService, project_id: &str, location_id: &str, data_store_id: &str
1911    /// ) -> Result<()> {
1912    ///     client.delete_data_store()
1913    ///         .set_name(format!("projects/{project_id}/locations/{location_id}/dataStores/{data_store_id}"))
1914    ///         .poller().until_done().await?;
1915    ///     Ok(())
1916    /// }
1917    /// ```
1918    pub fn delete_data_store(&self) -> super::builder::data_store_service::DeleteDataStore {
1919        super::builder::data_store_service::DeleteDataStore::new(self.inner.clone())
1920    }
1921
1922    /// Updates a [DataStore][google.cloud.discoveryengine.v1.DataStore]
1923    ///
1924    /// [google.cloud.discoveryengine.v1.DataStore]: crate::model::DataStore
1925    ///
1926    /// # Example
1927    /// ```
1928    /// # use google_cloud_discoveryengine_v1::client::DataStoreService;
1929    /// # extern crate wkt as google_cloud_wkt;
1930    /// use google_cloud_wkt::FieldMask;
1931    /// use google_cloud_discoveryengine_v1::model::DataStore;
1932    /// use google_cloud_discoveryengine_v1::Result;
1933    /// async fn sample(
1934    ///    client: &DataStoreService, project_id: &str, location_id: &str, data_store_id: &str
1935    /// ) -> Result<()> {
1936    ///     let response = client.update_data_store()
1937    ///         .set_data_store(
1938    ///             DataStore::new().set_name(format!("projects/{project_id}/locations/{location_id}/dataStores/{data_store_id}"))/* set fields */
1939    ///         )
1940    ///         .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
1941    ///         .send().await?;
1942    ///     println!("response {:?}", response);
1943    ///     Ok(())
1944    /// }
1945    /// ```
1946    pub fn update_data_store(&self) -> super::builder::data_store_service::UpdateDataStore {
1947        super::builder::data_store_service::UpdateDataStore::new(self.inner.clone())
1948    }
1949
1950    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1951    ///
1952    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1953    ///
1954    /// # Example
1955    /// ```
1956    /// # use google_cloud_discoveryengine_v1::client::DataStoreService;
1957    /// use google_cloud_gax::paginator::ItemPaginator as _;
1958    /// use google_cloud_discoveryengine_v1::Result;
1959    /// async fn sample(
1960    ///    client: &DataStoreService
1961    /// ) -> Result<()> {
1962    ///     let mut list = client.list_operations()
1963    ///         /* set fields */
1964    ///         .by_item();
1965    ///     while let Some(item) = list.next().await.transpose()? {
1966    ///         println!("{:?}", item);
1967    ///     }
1968    ///     Ok(())
1969    /// }
1970    /// ```
1971    pub fn list_operations(&self) -> super::builder::data_store_service::ListOperations {
1972        super::builder::data_store_service::ListOperations::new(self.inner.clone())
1973    }
1974
1975    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1976    ///
1977    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1978    ///
1979    /// # Example
1980    /// ```
1981    /// # use google_cloud_discoveryengine_v1::client::DataStoreService;
1982    /// use google_cloud_discoveryengine_v1::Result;
1983    /// async fn sample(
1984    ///    client: &DataStoreService
1985    /// ) -> Result<()> {
1986    ///     let response = client.get_operation()
1987    ///         /* set fields */
1988    ///         .send().await?;
1989    ///     println!("response {:?}", response);
1990    ///     Ok(())
1991    /// }
1992    /// ```
1993    pub fn get_operation(&self) -> super::builder::data_store_service::GetOperation {
1994        super::builder::data_store_service::GetOperation::new(self.inner.clone())
1995    }
1996
1997    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1998    ///
1999    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
2000    ///
2001    /// # Example
2002    /// ```
2003    /// # use google_cloud_discoveryengine_v1::client::DataStoreService;
2004    /// use google_cloud_discoveryengine_v1::Result;
2005    /// async fn sample(
2006    ///    client: &DataStoreService
2007    /// ) -> Result<()> {
2008    ///     client.cancel_operation()
2009    ///         /* set fields */
2010    ///         .send().await?;
2011    ///     Ok(())
2012    /// }
2013    /// ```
2014    pub fn cancel_operation(&self) -> super::builder::data_store_service::CancelOperation {
2015        super::builder::data_store_service::CancelOperation::new(self.inner.clone())
2016    }
2017}
2018
2019/// Implements a client for the Discovery Engine API.
2020///
2021/// # Example
2022/// ```
2023/// # use google_cloud_discoveryengine_v1::client::DocumentService;
2024/// use google_cloud_gax::paginator::ItemPaginator as _;
2025/// async fn sample(
2026///    parent: &str,
2027/// ) -> anyhow::Result<()> {
2028///     let client = DocumentService::builder().build().await?;
2029///     let mut list = client.list_documents()
2030///         .set_parent(parent)
2031///         .by_item();
2032///     while let Some(item) = list.next().await.transpose()? {
2033///         println!("{:?}", item);
2034///     }
2035///     Ok(())
2036/// }
2037/// ```
2038///
2039/// # Service Description
2040///
2041/// Service for ingesting [Document][google.cloud.discoveryengine.v1.Document]
2042/// information of the customer's website.
2043///
2044/// [google.cloud.discoveryengine.v1.Document]: crate::model::Document
2045///
2046/// # Configuration
2047///
2048/// To configure `DocumentService` use the `with_*` methods in the type returned
2049/// by [builder()][DocumentService::builder]. The default configuration should
2050/// work for most applications. Common configuration changes include
2051///
2052/// * [with_endpoint()]: by default this client uses the global default endpoint
2053///   (`https://discoveryengine.googleapis.com`). Applications using regional
2054///   endpoints or running in restricted networks (e.g. a network configured
2055//    with [Private Google Access with VPC Service Controls]) may want to
2056///   override this default.
2057/// * [with_credentials()]: by default this client uses
2058///   [Application Default Credentials]. Applications using custom
2059///   authentication may need to override this default.
2060///
2061/// [with_endpoint()]: super::builder::document_service::ClientBuilder::with_endpoint
2062/// [with_credentials()]: super::builder::document_service::ClientBuilder::with_credentials
2063/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
2064/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
2065///
2066/// # Pooling and Cloning
2067///
2068/// `DocumentService` holds a connection pool internally, it is advised to
2069/// create one and reuse it. You do not need to wrap `DocumentService` in
2070/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
2071/// already uses an `Arc` internally.
2072#[cfg(feature = "document-service")]
2073#[cfg_attr(docsrs, doc(cfg(feature = "document-service")))]
2074#[derive(Clone, Debug)]
2075pub struct DocumentService {
2076    inner: std::sync::Arc<dyn super::stub::dynamic::DocumentService>,
2077}
2078
2079#[cfg(feature = "document-service")]
2080impl DocumentService {
2081    /// Returns a builder for [DocumentService].
2082    ///
2083    /// ```
2084    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
2085    /// # use google_cloud_discoveryengine_v1::client::DocumentService;
2086    /// let client = DocumentService::builder().build().await?;
2087    /// # Ok(()) }
2088    /// ```
2089    pub fn builder() -> super::builder::document_service::ClientBuilder {
2090        crate::new_client_builder(super::builder::document_service::client::Factory)
2091    }
2092
2093    /// Creates a new client from the provided stub.
2094    ///
2095    /// The most common case for calling this function is in tests mocking the
2096    /// client's behavior.
2097    pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
2098    where
2099        T: super::stub::DocumentService + 'static,
2100    {
2101        Self { inner: stub.into() }
2102    }
2103
2104    pub(crate) async fn new(
2105        config: gaxi::options::ClientConfig,
2106    ) -> crate::ClientBuilderResult<Self> {
2107        let inner = Self::build_inner(config).await?;
2108        Ok(Self { inner })
2109    }
2110
2111    async fn build_inner(
2112        conf: gaxi::options::ClientConfig,
2113    ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::DocumentService>> {
2114        if gaxi::options::tracing_enabled(&conf) {
2115            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
2116        }
2117        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
2118    }
2119
2120    async fn build_transport(
2121        conf: gaxi::options::ClientConfig,
2122    ) -> crate::ClientBuilderResult<impl super::stub::DocumentService> {
2123        super::transport::DocumentService::new(conf).await
2124    }
2125
2126    async fn build_with_tracing(
2127        conf: gaxi::options::ClientConfig,
2128    ) -> crate::ClientBuilderResult<impl super::stub::DocumentService> {
2129        Self::build_transport(conf)
2130            .await
2131            .map(super::tracing::DocumentService::new)
2132    }
2133
2134    /// Gets a [Document][google.cloud.discoveryengine.v1.Document].
2135    ///
2136    /// [google.cloud.discoveryengine.v1.Document]: crate::model::Document
2137    ///
2138    /// # Example
2139    /// ```
2140    /// # use google_cloud_discoveryengine_v1::client::DocumentService;
2141    /// use google_cloud_discoveryengine_v1::Result;
2142    /// async fn sample(
2143    ///    client: &DocumentService, project_id: &str, location_id: &str, data_store_id: &str, branch_id: &str, document_id: &str
2144    /// ) -> Result<()> {
2145    ///     let response = client.get_document()
2146    ///         .set_name(format!("projects/{project_id}/locations/{location_id}/dataStores/{data_store_id}/branches/{branch_id}/documents/{document_id}"))
2147    ///         .send().await?;
2148    ///     println!("response {:?}", response);
2149    ///     Ok(())
2150    /// }
2151    /// ```
2152    pub fn get_document(&self) -> super::builder::document_service::GetDocument {
2153        super::builder::document_service::GetDocument::new(self.inner.clone())
2154    }
2155
2156    /// Gets a list of [Document][google.cloud.discoveryengine.v1.Document]s.
2157    ///
2158    /// [google.cloud.discoveryengine.v1.Document]: crate::model::Document
2159    ///
2160    /// # Example
2161    /// ```
2162    /// # use google_cloud_discoveryengine_v1::client::DocumentService;
2163    /// use google_cloud_gax::paginator::ItemPaginator as _;
2164    /// use google_cloud_discoveryengine_v1::Result;
2165    /// async fn sample(
2166    ///    client: &DocumentService, parent: &str
2167    /// ) -> Result<()> {
2168    ///     let mut list = client.list_documents()
2169    ///         .set_parent(parent)
2170    ///         .by_item();
2171    ///     while let Some(item) = list.next().await.transpose()? {
2172    ///         println!("{:?}", item);
2173    ///     }
2174    ///     Ok(())
2175    /// }
2176    /// ```
2177    pub fn list_documents(&self) -> super::builder::document_service::ListDocuments {
2178        super::builder::document_service::ListDocuments::new(self.inner.clone())
2179    }
2180
2181    /// Creates a [Document][google.cloud.discoveryengine.v1.Document].
2182    ///
2183    /// [google.cloud.discoveryengine.v1.Document]: crate::model::Document
2184    ///
2185    /// # Example
2186    /// ```
2187    /// # use google_cloud_discoveryengine_v1::client::DocumentService;
2188    /// use google_cloud_discoveryengine_v1::model::Document;
2189    /// use google_cloud_discoveryengine_v1::Result;
2190    /// async fn sample(
2191    ///    client: &DocumentService, parent: &str
2192    /// ) -> Result<()> {
2193    ///     let response = client.create_document()
2194    ///         .set_parent(parent)
2195    ///         .set_document_id("document_id_value")
2196    ///         .set_document(
2197    ///             Document::new()/* set fields */
2198    ///         )
2199    ///         .send().await?;
2200    ///     println!("response {:?}", response);
2201    ///     Ok(())
2202    /// }
2203    /// ```
2204    pub fn create_document(&self) -> super::builder::document_service::CreateDocument {
2205        super::builder::document_service::CreateDocument::new(self.inner.clone())
2206    }
2207
2208    /// Updates a [Document][google.cloud.discoveryengine.v1.Document].
2209    ///
2210    /// [google.cloud.discoveryengine.v1.Document]: crate::model::Document
2211    ///
2212    /// # Example
2213    /// ```
2214    /// # use google_cloud_discoveryengine_v1::client::DocumentService;
2215    /// # extern crate wkt as google_cloud_wkt;
2216    /// use google_cloud_wkt::FieldMask;
2217    /// use google_cloud_discoveryengine_v1::model::Document;
2218    /// use google_cloud_discoveryengine_v1::Result;
2219    /// async fn sample(
2220    ///    client: &DocumentService, project_id: &str, location_id: &str, data_store_id: &str, branch_id: &str, document_id: &str
2221    /// ) -> Result<()> {
2222    ///     let response = client.update_document()
2223    ///         .set_document(
2224    ///             Document::new().set_name(format!("projects/{project_id}/locations/{location_id}/dataStores/{data_store_id}/branches/{branch_id}/documents/{document_id}"))/* set fields */
2225    ///         )
2226    ///         .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
2227    ///         .send().await?;
2228    ///     println!("response {:?}", response);
2229    ///     Ok(())
2230    /// }
2231    /// ```
2232    pub fn update_document(&self) -> super::builder::document_service::UpdateDocument {
2233        super::builder::document_service::UpdateDocument::new(self.inner.clone())
2234    }
2235
2236    /// Deletes a [Document][google.cloud.discoveryengine.v1.Document].
2237    ///
2238    /// [google.cloud.discoveryengine.v1.Document]: crate::model::Document
2239    ///
2240    /// # Example
2241    /// ```
2242    /// # use google_cloud_discoveryengine_v1::client::DocumentService;
2243    /// use google_cloud_discoveryengine_v1::Result;
2244    /// async fn sample(
2245    ///    client: &DocumentService, project_id: &str, location_id: &str, data_store_id: &str, branch_id: &str, document_id: &str
2246    /// ) -> Result<()> {
2247    ///     client.delete_document()
2248    ///         .set_name(format!("projects/{project_id}/locations/{location_id}/dataStores/{data_store_id}/branches/{branch_id}/documents/{document_id}"))
2249    ///         .send().await?;
2250    ///     Ok(())
2251    /// }
2252    /// ```
2253    pub fn delete_document(&self) -> super::builder::document_service::DeleteDocument {
2254        super::builder::document_service::DeleteDocument::new(self.inner.clone())
2255    }
2256
2257    /// Bulk import of multiple
2258    /// [Document][google.cloud.discoveryengine.v1.Document]s. Request processing
2259    /// may be synchronous. Non-existing items are created.
2260    ///
2261    /// Note: It is possible for a subset of the
2262    /// [Document][google.cloud.discoveryengine.v1.Document]s to be successfully
2263    /// updated.
2264    ///
2265    /// [google.cloud.discoveryengine.v1.Document]: crate::model::Document
2266    ///
2267    /// # Long running operations
2268    ///
2269    /// This method is used to start, and/or poll a [long-running Operation].
2270    /// The [Working with long-running operations] chapter in the [user guide]
2271    /// covers these operations in detail.
2272    ///
2273    /// [long-running operation]: https://google.aip.dev/151
2274    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2275    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2276    ///
2277    /// # Example
2278    /// ```
2279    /// # use google_cloud_discoveryengine_v1::client::DocumentService;
2280    /// use google_cloud_lro::Poller;
2281    /// use google_cloud_discoveryengine_v1::Result;
2282    /// async fn sample(
2283    ///    client: &DocumentService
2284    /// ) -> Result<()> {
2285    ///     let response = client.import_documents()
2286    ///         /* set fields */
2287    ///         .poller().until_done().await?;
2288    ///     println!("response {:?}", response);
2289    ///     Ok(())
2290    /// }
2291    /// ```
2292    pub fn import_documents(&self) -> super::builder::document_service::ImportDocuments {
2293        super::builder::document_service::ImportDocuments::new(self.inner.clone())
2294    }
2295
2296    /// Permanently deletes all selected
2297    /// [Document][google.cloud.discoveryengine.v1.Document]s in a branch.
2298    ///
2299    /// This process is asynchronous. Depending on the number of
2300    /// [Document][google.cloud.discoveryengine.v1.Document]s to be deleted, this
2301    /// operation can take hours to complete. Before the delete operation
2302    /// completes, some [Document][google.cloud.discoveryengine.v1.Document]s might
2303    /// still be returned by
2304    /// [DocumentService.GetDocument][google.cloud.discoveryengine.v1.DocumentService.GetDocument]
2305    /// or
2306    /// [DocumentService.ListDocuments][google.cloud.discoveryengine.v1.DocumentService.ListDocuments].
2307    ///
2308    /// To get a list of the [Document][google.cloud.discoveryengine.v1.Document]s
2309    /// to be deleted, set
2310    /// [PurgeDocumentsRequest.force][google.cloud.discoveryengine.v1.PurgeDocumentsRequest.force]
2311    /// to false.
2312    ///
2313    /// [google.cloud.discoveryengine.v1.Document]: crate::model::Document
2314    /// [google.cloud.discoveryengine.v1.DocumentService.GetDocument]: crate::client::DocumentService::get_document
2315    /// [google.cloud.discoveryengine.v1.DocumentService.ListDocuments]: crate::client::DocumentService::list_documents
2316    /// [google.cloud.discoveryengine.v1.PurgeDocumentsRequest.force]: crate::model::PurgeDocumentsRequest::force
2317    ///
2318    /// # Long running operations
2319    ///
2320    /// This method is used to start, and/or poll a [long-running Operation].
2321    /// The [Working with long-running operations] chapter in the [user guide]
2322    /// covers these operations in detail.
2323    ///
2324    /// [long-running operation]: https://google.aip.dev/151
2325    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2326    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2327    ///
2328    /// # Example
2329    /// ```
2330    /// # use google_cloud_discoveryengine_v1::client::DocumentService;
2331    /// use google_cloud_lro::Poller;
2332    /// use google_cloud_discoveryengine_v1::Result;
2333    /// async fn sample(
2334    ///    client: &DocumentService
2335    /// ) -> Result<()> {
2336    ///     let response = client.purge_documents()
2337    ///         /* set fields */
2338    ///         .poller().until_done().await?;
2339    ///     println!("response {:?}", response);
2340    ///     Ok(())
2341    /// }
2342    /// ```
2343    pub fn purge_documents(&self) -> super::builder::document_service::PurgeDocuments {
2344        super::builder::document_service::PurgeDocuments::new(self.inner.clone())
2345    }
2346
2347    /// Gets index freshness metadata for
2348    /// [Document][google.cloud.discoveryengine.v1.Document]s. Supported for
2349    /// website search only.
2350    ///
2351    /// [google.cloud.discoveryengine.v1.Document]: crate::model::Document
2352    ///
2353    /// # Example
2354    /// ```
2355    /// # use google_cloud_discoveryengine_v1::client::DocumentService;
2356    /// use google_cloud_discoveryengine_v1::Result;
2357    /// async fn sample(
2358    ///    client: &DocumentService
2359    /// ) -> Result<()> {
2360    ///     let response = client.batch_get_documents_metadata()
2361    ///         /* set fields */
2362    ///         .send().await?;
2363    ///     println!("response {:?}", response);
2364    ///     Ok(())
2365    /// }
2366    /// ```
2367    pub fn batch_get_documents_metadata(
2368        &self,
2369    ) -> super::builder::document_service::BatchGetDocumentsMetadata {
2370        super::builder::document_service::BatchGetDocumentsMetadata::new(self.inner.clone())
2371    }
2372
2373    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2374    ///
2375    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
2376    ///
2377    /// # Example
2378    /// ```
2379    /// # use google_cloud_discoveryengine_v1::client::DocumentService;
2380    /// use google_cloud_gax::paginator::ItemPaginator as _;
2381    /// use google_cloud_discoveryengine_v1::Result;
2382    /// async fn sample(
2383    ///    client: &DocumentService
2384    /// ) -> Result<()> {
2385    ///     let mut list = client.list_operations()
2386    ///         /* set fields */
2387    ///         .by_item();
2388    ///     while let Some(item) = list.next().await.transpose()? {
2389    ///         println!("{:?}", item);
2390    ///     }
2391    ///     Ok(())
2392    /// }
2393    /// ```
2394    pub fn list_operations(&self) -> super::builder::document_service::ListOperations {
2395        super::builder::document_service::ListOperations::new(self.inner.clone())
2396    }
2397
2398    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2399    ///
2400    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
2401    ///
2402    /// # Example
2403    /// ```
2404    /// # use google_cloud_discoveryengine_v1::client::DocumentService;
2405    /// use google_cloud_discoveryengine_v1::Result;
2406    /// async fn sample(
2407    ///    client: &DocumentService
2408    /// ) -> Result<()> {
2409    ///     let response = client.get_operation()
2410    ///         /* set fields */
2411    ///         .send().await?;
2412    ///     println!("response {:?}", response);
2413    ///     Ok(())
2414    /// }
2415    /// ```
2416    pub fn get_operation(&self) -> super::builder::document_service::GetOperation {
2417        super::builder::document_service::GetOperation::new(self.inner.clone())
2418    }
2419
2420    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2421    ///
2422    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
2423    ///
2424    /// # Example
2425    /// ```
2426    /// # use google_cloud_discoveryengine_v1::client::DocumentService;
2427    /// use google_cloud_discoveryengine_v1::Result;
2428    /// async fn sample(
2429    ///    client: &DocumentService
2430    /// ) -> Result<()> {
2431    ///     client.cancel_operation()
2432    ///         /* set fields */
2433    ///         .send().await?;
2434    ///     Ok(())
2435    /// }
2436    /// ```
2437    pub fn cancel_operation(&self) -> super::builder::document_service::CancelOperation {
2438        super::builder::document_service::CancelOperation::new(self.inner.clone())
2439    }
2440}
2441
2442/// Implements a client for the Discovery Engine API.
2443///
2444/// # Example
2445/// ```
2446/// # use google_cloud_discoveryengine_v1::client::EngineService;
2447/// use google_cloud_gax::paginator::ItemPaginator as _;
2448/// async fn sample(
2449///    parent: &str,
2450/// ) -> anyhow::Result<()> {
2451///     let client = EngineService::builder().build().await?;
2452///     let mut list = client.list_engines()
2453///         .set_parent(parent)
2454///         .by_item();
2455///     while let Some(item) = list.next().await.transpose()? {
2456///         println!("{:?}", item);
2457///     }
2458///     Ok(())
2459/// }
2460/// ```
2461///
2462/// # Service Description
2463///
2464/// Service for managing [Engine][google.cloud.discoveryengine.v1.Engine]
2465/// configuration.
2466///
2467/// [google.cloud.discoveryengine.v1.Engine]: crate::model::Engine
2468///
2469/// # Configuration
2470///
2471/// To configure `EngineService` use the `with_*` methods in the type returned
2472/// by [builder()][EngineService::builder]. The default configuration should
2473/// work for most applications. Common configuration changes include
2474///
2475/// * [with_endpoint()]: by default this client uses the global default endpoint
2476///   (`https://discoveryengine.googleapis.com`). Applications using regional
2477///   endpoints or running in restricted networks (e.g. a network configured
2478//    with [Private Google Access with VPC Service Controls]) may want to
2479///   override this default.
2480/// * [with_credentials()]: by default this client uses
2481///   [Application Default Credentials]. Applications using custom
2482///   authentication may need to override this default.
2483///
2484/// [with_endpoint()]: super::builder::engine_service::ClientBuilder::with_endpoint
2485/// [with_credentials()]: super::builder::engine_service::ClientBuilder::with_credentials
2486/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
2487/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
2488///
2489/// # Pooling and Cloning
2490///
2491/// `EngineService` holds a connection pool internally, it is advised to
2492/// create one and reuse it. You do not need to wrap `EngineService` in
2493/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
2494/// already uses an `Arc` internally.
2495#[cfg(feature = "engine-service")]
2496#[cfg_attr(docsrs, doc(cfg(feature = "engine-service")))]
2497#[derive(Clone, Debug)]
2498pub struct EngineService {
2499    inner: std::sync::Arc<dyn super::stub::dynamic::EngineService>,
2500}
2501
2502#[cfg(feature = "engine-service")]
2503impl EngineService {
2504    /// Returns a builder for [EngineService].
2505    ///
2506    /// ```
2507    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
2508    /// # use google_cloud_discoveryengine_v1::client::EngineService;
2509    /// let client = EngineService::builder().build().await?;
2510    /// # Ok(()) }
2511    /// ```
2512    pub fn builder() -> super::builder::engine_service::ClientBuilder {
2513        crate::new_client_builder(super::builder::engine_service::client::Factory)
2514    }
2515
2516    /// Creates a new client from the provided stub.
2517    ///
2518    /// The most common case for calling this function is in tests mocking the
2519    /// client's behavior.
2520    pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
2521    where
2522        T: super::stub::EngineService + 'static,
2523    {
2524        Self { inner: stub.into() }
2525    }
2526
2527    pub(crate) async fn new(
2528        config: gaxi::options::ClientConfig,
2529    ) -> crate::ClientBuilderResult<Self> {
2530        let inner = Self::build_inner(config).await?;
2531        Ok(Self { inner })
2532    }
2533
2534    async fn build_inner(
2535        conf: gaxi::options::ClientConfig,
2536    ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::EngineService>> {
2537        if gaxi::options::tracing_enabled(&conf) {
2538            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
2539        }
2540        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
2541    }
2542
2543    async fn build_transport(
2544        conf: gaxi::options::ClientConfig,
2545    ) -> crate::ClientBuilderResult<impl super::stub::EngineService> {
2546        super::transport::EngineService::new(conf).await
2547    }
2548
2549    async fn build_with_tracing(
2550        conf: gaxi::options::ClientConfig,
2551    ) -> crate::ClientBuilderResult<impl super::stub::EngineService> {
2552        Self::build_transport(conf)
2553            .await
2554            .map(super::tracing::EngineService::new)
2555    }
2556
2557    /// Creates a [Engine][google.cloud.discoveryengine.v1.Engine].
2558    ///
2559    /// [google.cloud.discoveryengine.v1.Engine]: crate::model::Engine
2560    ///
2561    /// # Long running operations
2562    ///
2563    /// This method is used to start, and/or poll a [long-running Operation].
2564    /// The [Working with long-running operations] chapter in the [user guide]
2565    /// covers these operations in detail.
2566    ///
2567    /// [long-running operation]: https://google.aip.dev/151
2568    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2569    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2570    ///
2571    /// # Example
2572    /// ```
2573    /// # use google_cloud_discoveryengine_v1::client::EngineService;
2574    /// use google_cloud_lro::Poller;
2575    /// use google_cloud_discoveryengine_v1::model::Engine;
2576    /// use google_cloud_discoveryengine_v1::Result;
2577    /// async fn sample(
2578    ///    client: &EngineService, parent: &str
2579    /// ) -> Result<()> {
2580    ///     let response = client.create_engine()
2581    ///         .set_parent(parent)
2582    ///         .set_engine_id("engine_id_value")
2583    ///         .set_engine(
2584    ///             Engine::new()/* set fields */
2585    ///         )
2586    ///         .poller().until_done().await?;
2587    ///     println!("response {:?}", response);
2588    ///     Ok(())
2589    /// }
2590    /// ```
2591    pub fn create_engine(&self) -> super::builder::engine_service::CreateEngine {
2592        super::builder::engine_service::CreateEngine::new(self.inner.clone())
2593    }
2594
2595    /// Deletes a [Engine][google.cloud.discoveryengine.v1.Engine].
2596    ///
2597    /// [google.cloud.discoveryengine.v1.Engine]: crate::model::Engine
2598    ///
2599    /// # Long running operations
2600    ///
2601    /// This method is used to start, and/or poll a [long-running Operation].
2602    /// The [Working with long-running operations] chapter in the [user guide]
2603    /// covers these operations in detail.
2604    ///
2605    /// [long-running operation]: https://google.aip.dev/151
2606    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2607    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2608    ///
2609    /// # Example
2610    /// ```
2611    /// # use google_cloud_discoveryengine_v1::client::EngineService;
2612    /// use google_cloud_lro::Poller;
2613    /// use google_cloud_discoveryengine_v1::Result;
2614    /// async fn sample(
2615    ///    client: &EngineService, project_id: &str, location_id: &str, collection_id: &str, engine_id: &str
2616    /// ) -> Result<()> {
2617    ///     client.delete_engine()
2618    ///         .set_name(format!("projects/{project_id}/locations/{location_id}/collections/{collection_id}/engines/{engine_id}"))
2619    ///         .poller().until_done().await?;
2620    ///     Ok(())
2621    /// }
2622    /// ```
2623    pub fn delete_engine(&self) -> super::builder::engine_service::DeleteEngine {
2624        super::builder::engine_service::DeleteEngine::new(self.inner.clone())
2625    }
2626
2627    /// Updates an [Engine][google.cloud.discoveryengine.v1.Engine]
2628    ///
2629    /// [google.cloud.discoveryengine.v1.Engine]: crate::model::Engine
2630    ///
2631    /// # Example
2632    /// ```
2633    /// # use google_cloud_discoveryengine_v1::client::EngineService;
2634    /// # extern crate wkt as google_cloud_wkt;
2635    /// use google_cloud_wkt::FieldMask;
2636    /// use google_cloud_discoveryengine_v1::model::Engine;
2637    /// use google_cloud_discoveryengine_v1::Result;
2638    /// async fn sample(
2639    ///    client: &EngineService, project_id: &str, location_id: &str, collection_id: &str, engine_id: &str
2640    /// ) -> Result<()> {
2641    ///     let response = client.update_engine()
2642    ///         .set_engine(
2643    ///             Engine::new().set_name(format!("projects/{project_id}/locations/{location_id}/collections/{collection_id}/engines/{engine_id}"))/* set fields */
2644    ///         )
2645    ///         .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
2646    ///         .send().await?;
2647    ///     println!("response {:?}", response);
2648    ///     Ok(())
2649    /// }
2650    /// ```
2651    pub fn update_engine(&self) -> super::builder::engine_service::UpdateEngine {
2652        super::builder::engine_service::UpdateEngine::new(self.inner.clone())
2653    }
2654
2655    /// Gets a [Engine][google.cloud.discoveryengine.v1.Engine].
2656    ///
2657    /// [google.cloud.discoveryengine.v1.Engine]: crate::model::Engine
2658    ///
2659    /// # Example
2660    /// ```
2661    /// # use google_cloud_discoveryengine_v1::client::EngineService;
2662    /// use google_cloud_discoveryengine_v1::Result;
2663    /// async fn sample(
2664    ///    client: &EngineService, project_id: &str, location_id: &str, collection_id: &str, engine_id: &str
2665    /// ) -> Result<()> {
2666    ///     let response = client.get_engine()
2667    ///         .set_name(format!("projects/{project_id}/locations/{location_id}/collections/{collection_id}/engines/{engine_id}"))
2668    ///         .send().await?;
2669    ///     println!("response {:?}", response);
2670    ///     Ok(())
2671    /// }
2672    /// ```
2673    pub fn get_engine(&self) -> super::builder::engine_service::GetEngine {
2674        super::builder::engine_service::GetEngine::new(self.inner.clone())
2675    }
2676
2677    /// Lists all the [Engine][google.cloud.discoveryengine.v1.Engine]s associated
2678    /// with the project.
2679    ///
2680    /// [google.cloud.discoveryengine.v1.Engine]: crate::model::Engine
2681    ///
2682    /// # Example
2683    /// ```
2684    /// # use google_cloud_discoveryengine_v1::client::EngineService;
2685    /// use google_cloud_gax::paginator::ItemPaginator as _;
2686    /// use google_cloud_discoveryengine_v1::Result;
2687    /// async fn sample(
2688    ///    client: &EngineService, parent: &str
2689    /// ) -> Result<()> {
2690    ///     let mut list = client.list_engines()
2691    ///         .set_parent(parent)
2692    ///         .by_item();
2693    ///     while let Some(item) = list.next().await.transpose()? {
2694    ///         println!("{:?}", item);
2695    ///     }
2696    ///     Ok(())
2697    /// }
2698    /// ```
2699    pub fn list_engines(&self) -> super::builder::engine_service::ListEngines {
2700        super::builder::engine_service::ListEngines::new(self.inner.clone())
2701    }
2702
2703    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2704    ///
2705    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
2706    ///
2707    /// # Example
2708    /// ```
2709    /// # use google_cloud_discoveryengine_v1::client::EngineService;
2710    /// use google_cloud_gax::paginator::ItemPaginator as _;
2711    /// use google_cloud_discoveryengine_v1::Result;
2712    /// async fn sample(
2713    ///    client: &EngineService
2714    /// ) -> Result<()> {
2715    ///     let mut list = client.list_operations()
2716    ///         /* set fields */
2717    ///         .by_item();
2718    ///     while let Some(item) = list.next().await.transpose()? {
2719    ///         println!("{:?}", item);
2720    ///     }
2721    ///     Ok(())
2722    /// }
2723    /// ```
2724    pub fn list_operations(&self) -> super::builder::engine_service::ListOperations {
2725        super::builder::engine_service::ListOperations::new(self.inner.clone())
2726    }
2727
2728    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2729    ///
2730    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
2731    ///
2732    /// # Example
2733    /// ```
2734    /// # use google_cloud_discoveryengine_v1::client::EngineService;
2735    /// use google_cloud_discoveryengine_v1::Result;
2736    /// async fn sample(
2737    ///    client: &EngineService
2738    /// ) -> Result<()> {
2739    ///     let response = client.get_operation()
2740    ///         /* set fields */
2741    ///         .send().await?;
2742    ///     println!("response {:?}", response);
2743    ///     Ok(())
2744    /// }
2745    /// ```
2746    pub fn get_operation(&self) -> super::builder::engine_service::GetOperation {
2747        super::builder::engine_service::GetOperation::new(self.inner.clone())
2748    }
2749
2750    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2751    ///
2752    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
2753    ///
2754    /// # Example
2755    /// ```
2756    /// # use google_cloud_discoveryengine_v1::client::EngineService;
2757    /// use google_cloud_discoveryengine_v1::Result;
2758    /// async fn sample(
2759    ///    client: &EngineService
2760    /// ) -> Result<()> {
2761    ///     client.cancel_operation()
2762    ///         /* set fields */
2763    ///         .send().await?;
2764    ///     Ok(())
2765    /// }
2766    /// ```
2767    pub fn cancel_operation(&self) -> super::builder::engine_service::CancelOperation {
2768        super::builder::engine_service::CancelOperation::new(self.inner.clone())
2769    }
2770}
2771
2772/// Implements a client for the Discovery Engine API.
2773///
2774/// # Example
2775/// ```
2776/// # use google_cloud_discoveryengine_v1::client::GroundedGenerationService;
2777/// async fn sample(
2778/// ) -> anyhow::Result<()> {
2779///     let client = GroundedGenerationService::builder().build().await?;
2780///     let response = client.generate_grounded_content()
2781///         /* set fields */
2782///         .send().await?;
2783///     println!("response {:?}", response);
2784///     Ok(())
2785/// }
2786/// ```
2787///
2788/// # Service Description
2789///
2790/// Service for grounded generation.
2791///
2792/// # Configuration
2793///
2794/// To configure `GroundedGenerationService` use the `with_*` methods in the type returned
2795/// by [builder()][GroundedGenerationService::builder]. The default configuration should
2796/// work for most applications. Common configuration changes include
2797///
2798/// * [with_endpoint()]: by default this client uses the global default endpoint
2799///   (`https://discoveryengine.googleapis.com`). Applications using regional
2800///   endpoints or running in restricted networks (e.g. a network configured
2801//    with [Private Google Access with VPC Service Controls]) may want to
2802///   override this default.
2803/// * [with_credentials()]: by default this client uses
2804///   [Application Default Credentials]. Applications using custom
2805///   authentication may need to override this default.
2806///
2807/// [with_endpoint()]: super::builder::grounded_generation_service::ClientBuilder::with_endpoint
2808/// [with_credentials()]: super::builder::grounded_generation_service::ClientBuilder::with_credentials
2809/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
2810/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
2811///
2812/// # Pooling and Cloning
2813///
2814/// `GroundedGenerationService` holds a connection pool internally, it is advised to
2815/// create one and reuse it. You do not need to wrap `GroundedGenerationService` in
2816/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
2817/// already uses an `Arc` internally.
2818#[cfg(feature = "grounded-generation-service")]
2819#[cfg_attr(docsrs, doc(cfg(feature = "grounded-generation-service")))]
2820#[derive(Clone, Debug)]
2821pub struct GroundedGenerationService {
2822    inner: std::sync::Arc<dyn super::stub::dynamic::GroundedGenerationService>,
2823}
2824
2825#[cfg(feature = "grounded-generation-service")]
2826impl GroundedGenerationService {
2827    /// Returns a builder for [GroundedGenerationService].
2828    ///
2829    /// ```
2830    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
2831    /// # use google_cloud_discoveryengine_v1::client::GroundedGenerationService;
2832    /// let client = GroundedGenerationService::builder().build().await?;
2833    /// # Ok(()) }
2834    /// ```
2835    pub fn builder() -> super::builder::grounded_generation_service::ClientBuilder {
2836        crate::new_client_builder(super::builder::grounded_generation_service::client::Factory)
2837    }
2838
2839    /// Creates a new client from the provided stub.
2840    ///
2841    /// The most common case for calling this function is in tests mocking the
2842    /// client's behavior.
2843    pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
2844    where
2845        T: super::stub::GroundedGenerationService + 'static,
2846    {
2847        Self { inner: stub.into() }
2848    }
2849
2850    pub(crate) async fn new(
2851        config: gaxi::options::ClientConfig,
2852    ) -> crate::ClientBuilderResult<Self> {
2853        let inner = Self::build_inner(config).await?;
2854        Ok(Self { inner })
2855    }
2856
2857    async fn build_inner(
2858        conf: gaxi::options::ClientConfig,
2859    ) -> crate::ClientBuilderResult<
2860        std::sync::Arc<dyn super::stub::dynamic::GroundedGenerationService>,
2861    > {
2862        if gaxi::options::tracing_enabled(&conf) {
2863            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
2864        }
2865        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
2866    }
2867
2868    async fn build_transport(
2869        conf: gaxi::options::ClientConfig,
2870    ) -> crate::ClientBuilderResult<impl super::stub::GroundedGenerationService> {
2871        super::transport::GroundedGenerationService::new(conf).await
2872    }
2873
2874    async fn build_with_tracing(
2875        conf: gaxi::options::ClientConfig,
2876    ) -> crate::ClientBuilderResult<impl super::stub::GroundedGenerationService> {
2877        Self::build_transport(conf)
2878            .await
2879            .map(super::tracing::GroundedGenerationService::new)
2880    }
2881
2882    /// Generates grounded content.
2883    ///
2884    /// # Example
2885    /// ```
2886    /// # use google_cloud_discoveryengine_v1::client::GroundedGenerationService;
2887    /// use google_cloud_discoveryengine_v1::Result;
2888    /// async fn sample(
2889    ///    client: &GroundedGenerationService
2890    /// ) -> Result<()> {
2891    ///     let response = client.generate_grounded_content()
2892    ///         /* set fields */
2893    ///         .send().await?;
2894    ///     println!("response {:?}", response);
2895    ///     Ok(())
2896    /// }
2897    /// ```
2898    pub fn generate_grounded_content(
2899        &self,
2900    ) -> super::builder::grounded_generation_service::GenerateGroundedContent {
2901        super::builder::grounded_generation_service::GenerateGroundedContent::new(
2902            self.inner.clone(),
2903        )
2904    }
2905
2906    /// Performs a grounding check.
2907    ///
2908    /// # Example
2909    /// ```
2910    /// # use google_cloud_discoveryengine_v1::client::GroundedGenerationService;
2911    /// use google_cloud_discoveryengine_v1::Result;
2912    /// async fn sample(
2913    ///    client: &GroundedGenerationService
2914    /// ) -> Result<()> {
2915    ///     let response = client.check_grounding()
2916    ///         /* set fields */
2917    ///         .send().await?;
2918    ///     println!("response {:?}", response);
2919    ///     Ok(())
2920    /// }
2921    /// ```
2922    pub fn check_grounding(&self) -> super::builder::grounded_generation_service::CheckGrounding {
2923        super::builder::grounded_generation_service::CheckGrounding::new(self.inner.clone())
2924    }
2925
2926    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2927    ///
2928    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
2929    ///
2930    /// # Example
2931    /// ```
2932    /// # use google_cloud_discoveryengine_v1::client::GroundedGenerationService;
2933    /// use google_cloud_gax::paginator::ItemPaginator as _;
2934    /// use google_cloud_discoveryengine_v1::Result;
2935    /// async fn sample(
2936    ///    client: &GroundedGenerationService
2937    /// ) -> Result<()> {
2938    ///     let mut list = client.list_operations()
2939    ///         /* set fields */
2940    ///         .by_item();
2941    ///     while let Some(item) = list.next().await.transpose()? {
2942    ///         println!("{:?}", item);
2943    ///     }
2944    ///     Ok(())
2945    /// }
2946    /// ```
2947    pub fn list_operations(&self) -> super::builder::grounded_generation_service::ListOperations {
2948        super::builder::grounded_generation_service::ListOperations::new(self.inner.clone())
2949    }
2950
2951    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2952    ///
2953    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
2954    ///
2955    /// # Example
2956    /// ```
2957    /// # use google_cloud_discoveryengine_v1::client::GroundedGenerationService;
2958    /// use google_cloud_discoveryengine_v1::Result;
2959    /// async fn sample(
2960    ///    client: &GroundedGenerationService
2961    /// ) -> Result<()> {
2962    ///     let response = client.get_operation()
2963    ///         /* set fields */
2964    ///         .send().await?;
2965    ///     println!("response {:?}", response);
2966    ///     Ok(())
2967    /// }
2968    /// ```
2969    pub fn get_operation(&self) -> super::builder::grounded_generation_service::GetOperation {
2970        super::builder::grounded_generation_service::GetOperation::new(self.inner.clone())
2971    }
2972
2973    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2974    ///
2975    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
2976    ///
2977    /// # Example
2978    /// ```
2979    /// # use google_cloud_discoveryengine_v1::client::GroundedGenerationService;
2980    /// use google_cloud_discoveryengine_v1::Result;
2981    /// async fn sample(
2982    ///    client: &GroundedGenerationService
2983    /// ) -> Result<()> {
2984    ///     client.cancel_operation()
2985    ///         /* set fields */
2986    ///         .send().await?;
2987    ///     Ok(())
2988    /// }
2989    /// ```
2990    pub fn cancel_operation(&self) -> super::builder::grounded_generation_service::CancelOperation {
2991        super::builder::grounded_generation_service::CancelOperation::new(self.inner.clone())
2992    }
2993}
2994
2995/// Implements a client for the Discovery Engine API.
2996///
2997/// # Example
2998/// ```
2999/// # use google_cloud_discoveryengine_v1::client::IdentityMappingStoreService;
3000/// use google_cloud_gax::paginator::ItemPaginator as _;
3001/// async fn sample(
3002///    parent: &str,
3003/// ) -> anyhow::Result<()> {
3004///     let client = IdentityMappingStoreService::builder().build().await?;
3005///     let mut list = client.list_identity_mapping_stores()
3006///         .set_parent(parent)
3007///         .by_item();
3008///     while let Some(item) = list.next().await.transpose()? {
3009///         println!("{:?}", item);
3010///     }
3011///     Ok(())
3012/// }
3013/// ```
3014///
3015/// # Service Description
3016///
3017/// Service for managing Identity Mapping Stores.
3018///
3019/// # Configuration
3020///
3021/// To configure `IdentityMappingStoreService` use the `with_*` methods in the type returned
3022/// by [builder()][IdentityMappingStoreService::builder]. The default configuration should
3023/// work for most applications. Common configuration changes include
3024///
3025/// * [with_endpoint()]: by default this client uses the global default endpoint
3026///   (`https://discoveryengine.googleapis.com`). Applications using regional
3027///   endpoints or running in restricted networks (e.g. a network configured
3028//    with [Private Google Access with VPC Service Controls]) may want to
3029///   override this default.
3030/// * [with_credentials()]: by default this client uses
3031///   [Application Default Credentials]. Applications using custom
3032///   authentication may need to override this default.
3033///
3034/// [with_endpoint()]: super::builder::identity_mapping_store_service::ClientBuilder::with_endpoint
3035/// [with_credentials()]: super::builder::identity_mapping_store_service::ClientBuilder::with_credentials
3036/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
3037/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
3038///
3039/// # Pooling and Cloning
3040///
3041/// `IdentityMappingStoreService` holds a connection pool internally, it is advised to
3042/// create one and reuse it. You do not need to wrap `IdentityMappingStoreService` in
3043/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
3044/// already uses an `Arc` internally.
3045#[cfg(feature = "identity-mapping-store-service")]
3046#[cfg_attr(docsrs, doc(cfg(feature = "identity-mapping-store-service")))]
3047#[derive(Clone, Debug)]
3048pub struct IdentityMappingStoreService {
3049    inner: std::sync::Arc<dyn super::stub::dynamic::IdentityMappingStoreService>,
3050}
3051
3052#[cfg(feature = "identity-mapping-store-service")]
3053impl IdentityMappingStoreService {
3054    /// Returns a builder for [IdentityMappingStoreService].
3055    ///
3056    /// ```
3057    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
3058    /// # use google_cloud_discoveryengine_v1::client::IdentityMappingStoreService;
3059    /// let client = IdentityMappingStoreService::builder().build().await?;
3060    /// # Ok(()) }
3061    /// ```
3062    pub fn builder() -> super::builder::identity_mapping_store_service::ClientBuilder {
3063        crate::new_client_builder(super::builder::identity_mapping_store_service::client::Factory)
3064    }
3065
3066    /// Creates a new client from the provided stub.
3067    ///
3068    /// The most common case for calling this function is in tests mocking the
3069    /// client's behavior.
3070    pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
3071    where
3072        T: super::stub::IdentityMappingStoreService + 'static,
3073    {
3074        Self { inner: stub.into() }
3075    }
3076
3077    pub(crate) async fn new(
3078        config: gaxi::options::ClientConfig,
3079    ) -> crate::ClientBuilderResult<Self> {
3080        let inner = Self::build_inner(config).await?;
3081        Ok(Self { inner })
3082    }
3083
3084    async fn build_inner(
3085        conf: gaxi::options::ClientConfig,
3086    ) -> crate::ClientBuilderResult<
3087        std::sync::Arc<dyn super::stub::dynamic::IdentityMappingStoreService>,
3088    > {
3089        if gaxi::options::tracing_enabled(&conf) {
3090            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
3091        }
3092        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
3093    }
3094
3095    async fn build_transport(
3096        conf: gaxi::options::ClientConfig,
3097    ) -> crate::ClientBuilderResult<impl super::stub::IdentityMappingStoreService> {
3098        super::transport::IdentityMappingStoreService::new(conf).await
3099    }
3100
3101    async fn build_with_tracing(
3102        conf: gaxi::options::ClientConfig,
3103    ) -> crate::ClientBuilderResult<impl super::stub::IdentityMappingStoreService> {
3104        Self::build_transport(conf)
3105            .await
3106            .map(super::tracing::IdentityMappingStoreService::new)
3107    }
3108
3109    /// Creates a new Identity Mapping Store.
3110    ///
3111    /// # Example
3112    /// ```
3113    /// # use google_cloud_discoveryengine_v1::client::IdentityMappingStoreService;
3114    /// use google_cloud_discoveryengine_v1::model::IdentityMappingStore;
3115    /// use google_cloud_discoveryengine_v1::Result;
3116    /// async fn sample(
3117    ///    client: &IdentityMappingStoreService, parent: &str
3118    /// ) -> Result<()> {
3119    ///     let response = client.create_identity_mapping_store()
3120    ///         .set_parent(parent)
3121    ///         .set_identity_mapping_store(
3122    ///             IdentityMappingStore::new()/* set fields */
3123    ///         )
3124    ///         .send().await?;
3125    ///     println!("response {:?}", response);
3126    ///     Ok(())
3127    /// }
3128    /// ```
3129    pub fn create_identity_mapping_store(
3130        &self,
3131    ) -> super::builder::identity_mapping_store_service::CreateIdentityMappingStore {
3132        super::builder::identity_mapping_store_service::CreateIdentityMappingStore::new(
3133            self.inner.clone(),
3134        )
3135    }
3136
3137    /// Gets the Identity Mapping Store.
3138    ///
3139    /// # Example
3140    /// ```
3141    /// # use google_cloud_discoveryengine_v1::client::IdentityMappingStoreService;
3142    /// use google_cloud_discoveryengine_v1::Result;
3143    /// async fn sample(
3144    ///    client: &IdentityMappingStoreService, project_id: &str, location_id: &str, identity_mapping_store_id: &str
3145    /// ) -> Result<()> {
3146    ///     let response = client.get_identity_mapping_store()
3147    ///         .set_name(format!("projects/{project_id}/locations/{location_id}/identityMappingStores/{identity_mapping_store_id}"))
3148    ///         .send().await?;
3149    ///     println!("response {:?}", response);
3150    ///     Ok(())
3151    /// }
3152    /// ```
3153    pub fn get_identity_mapping_store(
3154        &self,
3155    ) -> super::builder::identity_mapping_store_service::GetIdentityMappingStore {
3156        super::builder::identity_mapping_store_service::GetIdentityMappingStore::new(
3157            self.inner.clone(),
3158        )
3159    }
3160
3161    /// Deletes the Identity Mapping Store.
3162    ///
3163    /// # Long running operations
3164    ///
3165    /// This method is used to start, and/or poll a [long-running Operation].
3166    /// The [Working with long-running operations] chapter in the [user guide]
3167    /// covers these operations in detail.
3168    ///
3169    /// [long-running operation]: https://google.aip.dev/151
3170    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
3171    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
3172    ///
3173    /// # Example
3174    /// ```
3175    /// # use google_cloud_discoveryengine_v1::client::IdentityMappingStoreService;
3176    /// use google_cloud_lro::Poller;
3177    /// use google_cloud_discoveryengine_v1::Result;
3178    /// async fn sample(
3179    ///    client: &IdentityMappingStoreService, project_id: &str, location_id: &str, identity_mapping_store_id: &str
3180    /// ) -> Result<()> {
3181    ///     client.delete_identity_mapping_store()
3182    ///         .set_name(format!("projects/{project_id}/locations/{location_id}/identityMappingStores/{identity_mapping_store_id}"))
3183    ///         .poller().until_done().await?;
3184    ///     Ok(())
3185    /// }
3186    /// ```
3187    pub fn delete_identity_mapping_store(
3188        &self,
3189    ) -> super::builder::identity_mapping_store_service::DeleteIdentityMappingStore {
3190        super::builder::identity_mapping_store_service::DeleteIdentityMappingStore::new(
3191            self.inner.clone(),
3192        )
3193    }
3194
3195    /// Imports a list of Identity Mapping Entries to an Identity Mapping Store.
3196    ///
3197    /// # Long running operations
3198    ///
3199    /// This method is used to start, and/or poll a [long-running Operation].
3200    /// The [Working with long-running operations] chapter in the [user guide]
3201    /// covers these operations in detail.
3202    ///
3203    /// [long-running operation]: https://google.aip.dev/151
3204    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
3205    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
3206    ///
3207    /// # Example
3208    /// ```
3209    /// # use google_cloud_discoveryengine_v1::client::IdentityMappingStoreService;
3210    /// use google_cloud_lro::Poller;
3211    /// use google_cloud_discoveryengine_v1::Result;
3212    /// async fn sample(
3213    ///    client: &IdentityMappingStoreService
3214    /// ) -> Result<()> {
3215    ///     let response = client.import_identity_mappings()
3216    ///         /* set fields */
3217    ///         .poller().until_done().await?;
3218    ///     println!("response {:?}", response);
3219    ///     Ok(())
3220    /// }
3221    /// ```
3222    pub fn import_identity_mappings(
3223        &self,
3224    ) -> super::builder::identity_mapping_store_service::ImportIdentityMappings {
3225        super::builder::identity_mapping_store_service::ImportIdentityMappings::new(
3226            self.inner.clone(),
3227        )
3228    }
3229
3230    /// Purges specified or all Identity Mapping Entries from an Identity Mapping
3231    /// Store.
3232    ///
3233    /// # Long running operations
3234    ///
3235    /// This method is used to start, and/or poll a [long-running Operation].
3236    /// The [Working with long-running operations] chapter in the [user guide]
3237    /// covers these operations in detail.
3238    ///
3239    /// [long-running operation]: https://google.aip.dev/151
3240    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
3241    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
3242    ///
3243    /// # Example
3244    /// ```
3245    /// # use google_cloud_discoveryengine_v1::client::IdentityMappingStoreService;
3246    /// use google_cloud_lro::Poller;
3247    /// use google_cloud_discoveryengine_v1::Result;
3248    /// async fn sample(
3249    ///    client: &IdentityMappingStoreService
3250    /// ) -> Result<()> {
3251    ///     client.purge_identity_mappings()
3252    ///         /* set fields */
3253    ///         .poller().until_done().await?;
3254    ///     Ok(())
3255    /// }
3256    /// ```
3257    pub fn purge_identity_mappings(
3258        &self,
3259    ) -> super::builder::identity_mapping_store_service::PurgeIdentityMappings {
3260        super::builder::identity_mapping_store_service::PurgeIdentityMappings::new(
3261            self.inner.clone(),
3262        )
3263    }
3264
3265    /// Lists Identity Mappings in an Identity Mapping Store.
3266    ///
3267    /// # Example
3268    /// ```
3269    /// # use google_cloud_discoveryengine_v1::client::IdentityMappingStoreService;
3270    /// use google_cloud_gax::paginator::ItemPaginator as _;
3271    /// use google_cloud_discoveryengine_v1::Result;
3272    /// async fn sample(
3273    ///    client: &IdentityMappingStoreService
3274    /// ) -> Result<()> {
3275    ///     let mut list = client.list_identity_mappings()
3276    ///         /* set fields */
3277    ///         .by_item();
3278    ///     while let Some(item) = list.next().await.transpose()? {
3279    ///         println!("{:?}", item);
3280    ///     }
3281    ///     Ok(())
3282    /// }
3283    /// ```
3284    pub fn list_identity_mappings(
3285        &self,
3286    ) -> super::builder::identity_mapping_store_service::ListIdentityMappings {
3287        super::builder::identity_mapping_store_service::ListIdentityMappings::new(
3288            self.inner.clone(),
3289        )
3290    }
3291
3292    /// Lists all Identity Mapping Stores.
3293    ///
3294    /// # Example
3295    /// ```
3296    /// # use google_cloud_discoveryengine_v1::client::IdentityMappingStoreService;
3297    /// use google_cloud_gax::paginator::ItemPaginator as _;
3298    /// use google_cloud_discoveryengine_v1::Result;
3299    /// async fn sample(
3300    ///    client: &IdentityMappingStoreService, parent: &str
3301    /// ) -> Result<()> {
3302    ///     let mut list = client.list_identity_mapping_stores()
3303    ///         .set_parent(parent)
3304    ///         .by_item();
3305    ///     while let Some(item) = list.next().await.transpose()? {
3306    ///         println!("{:?}", item);
3307    ///     }
3308    ///     Ok(())
3309    /// }
3310    /// ```
3311    pub fn list_identity_mapping_stores(
3312        &self,
3313    ) -> super::builder::identity_mapping_store_service::ListIdentityMappingStores {
3314        super::builder::identity_mapping_store_service::ListIdentityMappingStores::new(
3315            self.inner.clone(),
3316        )
3317    }
3318
3319    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3320    ///
3321    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
3322    ///
3323    /// # Example
3324    /// ```
3325    /// # use google_cloud_discoveryengine_v1::client::IdentityMappingStoreService;
3326    /// use google_cloud_gax::paginator::ItemPaginator as _;
3327    /// use google_cloud_discoveryengine_v1::Result;
3328    /// async fn sample(
3329    ///    client: &IdentityMappingStoreService
3330    /// ) -> Result<()> {
3331    ///     let mut list = client.list_operations()
3332    ///         /* set fields */
3333    ///         .by_item();
3334    ///     while let Some(item) = list.next().await.transpose()? {
3335    ///         println!("{:?}", item);
3336    ///     }
3337    ///     Ok(())
3338    /// }
3339    /// ```
3340    pub fn list_operations(
3341        &self,
3342    ) -> super::builder::identity_mapping_store_service::ListOperations {
3343        super::builder::identity_mapping_store_service::ListOperations::new(self.inner.clone())
3344    }
3345
3346    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3347    ///
3348    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
3349    ///
3350    /// # Example
3351    /// ```
3352    /// # use google_cloud_discoveryengine_v1::client::IdentityMappingStoreService;
3353    /// use google_cloud_discoveryengine_v1::Result;
3354    /// async fn sample(
3355    ///    client: &IdentityMappingStoreService
3356    /// ) -> Result<()> {
3357    ///     let response = client.get_operation()
3358    ///         /* set fields */
3359    ///         .send().await?;
3360    ///     println!("response {:?}", response);
3361    ///     Ok(())
3362    /// }
3363    /// ```
3364    pub fn get_operation(&self) -> super::builder::identity_mapping_store_service::GetOperation {
3365        super::builder::identity_mapping_store_service::GetOperation::new(self.inner.clone())
3366    }
3367
3368    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3369    ///
3370    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
3371    ///
3372    /// # Example
3373    /// ```
3374    /// # use google_cloud_discoveryengine_v1::client::IdentityMappingStoreService;
3375    /// use google_cloud_discoveryengine_v1::Result;
3376    /// async fn sample(
3377    ///    client: &IdentityMappingStoreService
3378    /// ) -> Result<()> {
3379    ///     client.cancel_operation()
3380    ///         /* set fields */
3381    ///         .send().await?;
3382    ///     Ok(())
3383    /// }
3384    /// ```
3385    pub fn cancel_operation(
3386        &self,
3387    ) -> super::builder::identity_mapping_store_service::CancelOperation {
3388        super::builder::identity_mapping_store_service::CancelOperation::new(self.inner.clone())
3389    }
3390}
3391
3392/// Implements a client for the Discovery Engine API.
3393///
3394/// # Example
3395/// ```
3396/// # use google_cloud_discoveryengine_v1::client::ProjectService;
3397/// use google_cloud_lro::Poller;
3398/// async fn sample(
3399/// ) -> anyhow::Result<()> {
3400///     let client = ProjectService::builder().build().await?;
3401///     let response = client.provision_project()
3402///         /* set fields */
3403///         .poller().until_done().await?;
3404///     println!("response {:?}", response);
3405///     Ok(())
3406/// }
3407/// ```
3408///
3409/// # Service Description
3410///
3411/// Service for operations on the
3412/// [Project][google.cloud.discoveryengine.v1.Project].
3413///
3414/// [google.cloud.discoveryengine.v1.Project]: crate::model::Project
3415///
3416/// # Configuration
3417///
3418/// To configure `ProjectService` use the `with_*` methods in the type returned
3419/// by [builder()][ProjectService::builder]. The default configuration should
3420/// work for most applications. Common configuration changes include
3421///
3422/// * [with_endpoint()]: by default this client uses the global default endpoint
3423///   (`https://discoveryengine.googleapis.com`). Applications using regional
3424///   endpoints or running in restricted networks (e.g. a network configured
3425//    with [Private Google Access with VPC Service Controls]) may want to
3426///   override this default.
3427/// * [with_credentials()]: by default this client uses
3428///   [Application Default Credentials]. Applications using custom
3429///   authentication may need to override this default.
3430///
3431/// [with_endpoint()]: super::builder::project_service::ClientBuilder::with_endpoint
3432/// [with_credentials()]: super::builder::project_service::ClientBuilder::with_credentials
3433/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
3434/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
3435///
3436/// # Pooling and Cloning
3437///
3438/// `ProjectService` holds a connection pool internally, it is advised to
3439/// create one and reuse it. You do not need to wrap `ProjectService` in
3440/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
3441/// already uses an `Arc` internally.
3442#[cfg(feature = "project-service")]
3443#[cfg_attr(docsrs, doc(cfg(feature = "project-service")))]
3444#[derive(Clone, Debug)]
3445pub struct ProjectService {
3446    inner: std::sync::Arc<dyn super::stub::dynamic::ProjectService>,
3447}
3448
3449#[cfg(feature = "project-service")]
3450impl ProjectService {
3451    /// Returns a builder for [ProjectService].
3452    ///
3453    /// ```
3454    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
3455    /// # use google_cloud_discoveryengine_v1::client::ProjectService;
3456    /// let client = ProjectService::builder().build().await?;
3457    /// # Ok(()) }
3458    /// ```
3459    pub fn builder() -> super::builder::project_service::ClientBuilder {
3460        crate::new_client_builder(super::builder::project_service::client::Factory)
3461    }
3462
3463    /// Creates a new client from the provided stub.
3464    ///
3465    /// The most common case for calling this function is in tests mocking the
3466    /// client's behavior.
3467    pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
3468    where
3469        T: super::stub::ProjectService + 'static,
3470    {
3471        Self { inner: stub.into() }
3472    }
3473
3474    pub(crate) async fn new(
3475        config: gaxi::options::ClientConfig,
3476    ) -> crate::ClientBuilderResult<Self> {
3477        let inner = Self::build_inner(config).await?;
3478        Ok(Self { inner })
3479    }
3480
3481    async fn build_inner(
3482        conf: gaxi::options::ClientConfig,
3483    ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::ProjectService>> {
3484        if gaxi::options::tracing_enabled(&conf) {
3485            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
3486        }
3487        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
3488    }
3489
3490    async fn build_transport(
3491        conf: gaxi::options::ClientConfig,
3492    ) -> crate::ClientBuilderResult<impl super::stub::ProjectService> {
3493        super::transport::ProjectService::new(conf).await
3494    }
3495
3496    async fn build_with_tracing(
3497        conf: gaxi::options::ClientConfig,
3498    ) -> crate::ClientBuilderResult<impl super::stub::ProjectService> {
3499        Self::build_transport(conf)
3500            .await
3501            .map(super::tracing::ProjectService::new)
3502    }
3503
3504    /// Provisions the project resource. During the
3505    /// process, related systems will get prepared and initialized.
3506    ///
3507    /// Caller must read the [Terms for data
3508    /// use](https://cloud.google.com/retail/data-use-terms), and optionally
3509    /// specify in request to provide consent to that service terms.
3510    ///
3511    /// # Long running operations
3512    ///
3513    /// This method is used to start, and/or poll a [long-running Operation].
3514    /// The [Working with long-running operations] chapter in the [user guide]
3515    /// covers these operations in detail.
3516    ///
3517    /// [long-running operation]: https://google.aip.dev/151
3518    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
3519    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
3520    ///
3521    /// # Example
3522    /// ```
3523    /// # use google_cloud_discoveryengine_v1::client::ProjectService;
3524    /// use google_cloud_lro::Poller;
3525    /// use google_cloud_discoveryengine_v1::Result;
3526    /// async fn sample(
3527    ///    client: &ProjectService
3528    /// ) -> Result<()> {
3529    ///     let response = client.provision_project()
3530    ///         /* set fields */
3531    ///         .poller().until_done().await?;
3532    ///     println!("response {:?}", response);
3533    ///     Ok(())
3534    /// }
3535    /// ```
3536    pub fn provision_project(&self) -> super::builder::project_service::ProvisionProject {
3537        super::builder::project_service::ProvisionProject::new(self.inner.clone())
3538    }
3539
3540    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3541    ///
3542    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
3543    ///
3544    /// # Example
3545    /// ```
3546    /// # use google_cloud_discoveryengine_v1::client::ProjectService;
3547    /// use google_cloud_gax::paginator::ItemPaginator as _;
3548    /// use google_cloud_discoveryengine_v1::Result;
3549    /// async fn sample(
3550    ///    client: &ProjectService
3551    /// ) -> Result<()> {
3552    ///     let mut list = client.list_operations()
3553    ///         /* set fields */
3554    ///         .by_item();
3555    ///     while let Some(item) = list.next().await.transpose()? {
3556    ///         println!("{:?}", item);
3557    ///     }
3558    ///     Ok(())
3559    /// }
3560    /// ```
3561    pub fn list_operations(&self) -> super::builder::project_service::ListOperations {
3562        super::builder::project_service::ListOperations::new(self.inner.clone())
3563    }
3564
3565    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3566    ///
3567    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
3568    ///
3569    /// # Example
3570    /// ```
3571    /// # use google_cloud_discoveryengine_v1::client::ProjectService;
3572    /// use google_cloud_discoveryengine_v1::Result;
3573    /// async fn sample(
3574    ///    client: &ProjectService
3575    /// ) -> Result<()> {
3576    ///     let response = client.get_operation()
3577    ///         /* set fields */
3578    ///         .send().await?;
3579    ///     println!("response {:?}", response);
3580    ///     Ok(())
3581    /// }
3582    /// ```
3583    pub fn get_operation(&self) -> super::builder::project_service::GetOperation {
3584        super::builder::project_service::GetOperation::new(self.inner.clone())
3585    }
3586
3587    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3588    ///
3589    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
3590    ///
3591    /// # Example
3592    /// ```
3593    /// # use google_cloud_discoveryengine_v1::client::ProjectService;
3594    /// use google_cloud_discoveryengine_v1::Result;
3595    /// async fn sample(
3596    ///    client: &ProjectService
3597    /// ) -> Result<()> {
3598    ///     client.cancel_operation()
3599    ///         /* set fields */
3600    ///         .send().await?;
3601    ///     Ok(())
3602    /// }
3603    /// ```
3604    pub fn cancel_operation(&self) -> super::builder::project_service::CancelOperation {
3605        super::builder::project_service::CancelOperation::new(self.inner.clone())
3606    }
3607}
3608
3609/// Implements a client for the Discovery Engine API.
3610///
3611/// # Example
3612/// ```
3613/// # use google_cloud_discoveryengine_v1::client::RankService;
3614/// async fn sample(
3615/// ) -> anyhow::Result<()> {
3616///     let client = RankService::builder().build().await?;
3617///     let response = client.rank()
3618///         /* set fields */
3619///         .send().await?;
3620///     println!("response {:?}", response);
3621///     Ok(())
3622/// }
3623/// ```
3624///
3625/// # Service Description
3626///
3627/// Service for ranking text records.
3628///
3629/// # Configuration
3630///
3631/// To configure `RankService` use the `with_*` methods in the type returned
3632/// by [builder()][RankService::builder]. The default configuration should
3633/// work for most applications. Common configuration changes include
3634///
3635/// * [with_endpoint()]: by default this client uses the global default endpoint
3636///   (`https://discoveryengine.googleapis.com`). Applications using regional
3637///   endpoints or running in restricted networks (e.g. a network configured
3638//    with [Private Google Access with VPC Service Controls]) may want to
3639///   override this default.
3640/// * [with_credentials()]: by default this client uses
3641///   [Application Default Credentials]. Applications using custom
3642///   authentication may need to override this default.
3643///
3644/// [with_endpoint()]: super::builder::rank_service::ClientBuilder::with_endpoint
3645/// [with_credentials()]: super::builder::rank_service::ClientBuilder::with_credentials
3646/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
3647/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
3648///
3649/// # Pooling and Cloning
3650///
3651/// `RankService` holds a connection pool internally, it is advised to
3652/// create one and reuse it. You do not need to wrap `RankService` in
3653/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
3654/// already uses an `Arc` internally.
3655#[cfg(feature = "rank-service")]
3656#[cfg_attr(docsrs, doc(cfg(feature = "rank-service")))]
3657#[derive(Clone, Debug)]
3658pub struct RankService {
3659    inner: std::sync::Arc<dyn super::stub::dynamic::RankService>,
3660}
3661
3662#[cfg(feature = "rank-service")]
3663impl RankService {
3664    /// Returns a builder for [RankService].
3665    ///
3666    /// ```
3667    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
3668    /// # use google_cloud_discoveryengine_v1::client::RankService;
3669    /// let client = RankService::builder().build().await?;
3670    /// # Ok(()) }
3671    /// ```
3672    pub fn builder() -> super::builder::rank_service::ClientBuilder {
3673        crate::new_client_builder(super::builder::rank_service::client::Factory)
3674    }
3675
3676    /// Creates a new client from the provided stub.
3677    ///
3678    /// The most common case for calling this function is in tests mocking the
3679    /// client's behavior.
3680    pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
3681    where
3682        T: super::stub::RankService + 'static,
3683    {
3684        Self { inner: stub.into() }
3685    }
3686
3687    pub(crate) async fn new(
3688        config: gaxi::options::ClientConfig,
3689    ) -> crate::ClientBuilderResult<Self> {
3690        let inner = Self::build_inner(config).await?;
3691        Ok(Self { inner })
3692    }
3693
3694    async fn build_inner(
3695        conf: gaxi::options::ClientConfig,
3696    ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::RankService>> {
3697        if gaxi::options::tracing_enabled(&conf) {
3698            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
3699        }
3700        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
3701    }
3702
3703    async fn build_transport(
3704        conf: gaxi::options::ClientConfig,
3705    ) -> crate::ClientBuilderResult<impl super::stub::RankService> {
3706        super::transport::RankService::new(conf).await
3707    }
3708
3709    async fn build_with_tracing(
3710        conf: gaxi::options::ClientConfig,
3711    ) -> crate::ClientBuilderResult<impl super::stub::RankService> {
3712        Self::build_transport(conf)
3713            .await
3714            .map(super::tracing::RankService::new)
3715    }
3716
3717    /// Ranks a list of text records based on the given input query.
3718    ///
3719    /// # Example
3720    /// ```
3721    /// # use google_cloud_discoveryengine_v1::client::RankService;
3722    /// use google_cloud_discoveryengine_v1::Result;
3723    /// async fn sample(
3724    ///    client: &RankService
3725    /// ) -> Result<()> {
3726    ///     let response = client.rank()
3727    ///         /* set fields */
3728    ///         .send().await?;
3729    ///     println!("response {:?}", response);
3730    ///     Ok(())
3731    /// }
3732    /// ```
3733    pub fn rank(&self) -> super::builder::rank_service::Rank {
3734        super::builder::rank_service::Rank::new(self.inner.clone())
3735    }
3736
3737    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3738    ///
3739    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
3740    ///
3741    /// # Example
3742    /// ```
3743    /// # use google_cloud_discoveryengine_v1::client::RankService;
3744    /// use google_cloud_gax::paginator::ItemPaginator as _;
3745    /// use google_cloud_discoveryengine_v1::Result;
3746    /// async fn sample(
3747    ///    client: &RankService
3748    /// ) -> Result<()> {
3749    ///     let mut list = client.list_operations()
3750    ///         /* set fields */
3751    ///         .by_item();
3752    ///     while let Some(item) = list.next().await.transpose()? {
3753    ///         println!("{:?}", item);
3754    ///     }
3755    ///     Ok(())
3756    /// }
3757    /// ```
3758    pub fn list_operations(&self) -> super::builder::rank_service::ListOperations {
3759        super::builder::rank_service::ListOperations::new(self.inner.clone())
3760    }
3761
3762    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3763    ///
3764    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
3765    ///
3766    /// # Example
3767    /// ```
3768    /// # use google_cloud_discoveryengine_v1::client::RankService;
3769    /// use google_cloud_discoveryengine_v1::Result;
3770    /// async fn sample(
3771    ///    client: &RankService
3772    /// ) -> Result<()> {
3773    ///     let response = client.get_operation()
3774    ///         /* set fields */
3775    ///         .send().await?;
3776    ///     println!("response {:?}", response);
3777    ///     Ok(())
3778    /// }
3779    /// ```
3780    pub fn get_operation(&self) -> super::builder::rank_service::GetOperation {
3781        super::builder::rank_service::GetOperation::new(self.inner.clone())
3782    }
3783
3784    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3785    ///
3786    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
3787    ///
3788    /// # Example
3789    /// ```
3790    /// # use google_cloud_discoveryengine_v1::client::RankService;
3791    /// use google_cloud_discoveryengine_v1::Result;
3792    /// async fn sample(
3793    ///    client: &RankService
3794    /// ) -> Result<()> {
3795    ///     client.cancel_operation()
3796    ///         /* set fields */
3797    ///         .send().await?;
3798    ///     Ok(())
3799    /// }
3800    /// ```
3801    pub fn cancel_operation(&self) -> super::builder::rank_service::CancelOperation {
3802        super::builder::rank_service::CancelOperation::new(self.inner.clone())
3803    }
3804}
3805
3806/// Implements a client for the Discovery Engine API.
3807///
3808/// # Example
3809/// ```
3810/// # use google_cloud_discoveryengine_v1::client::RecommendationService;
3811/// async fn sample(
3812/// ) -> anyhow::Result<()> {
3813///     let client = RecommendationService::builder().build().await?;
3814///     let response = client.recommend()
3815///         /* set fields */
3816///         .send().await?;
3817///     println!("response {:?}", response);
3818///     Ok(())
3819/// }
3820/// ```
3821///
3822/// # Service Description
3823///
3824/// Service for making recommendations.
3825///
3826/// # Configuration
3827///
3828/// To configure `RecommendationService` use the `with_*` methods in the type returned
3829/// by [builder()][RecommendationService::builder]. The default configuration should
3830/// work for most applications. Common configuration changes include
3831///
3832/// * [with_endpoint()]: by default this client uses the global default endpoint
3833///   (`https://discoveryengine.googleapis.com`). Applications using regional
3834///   endpoints or running in restricted networks (e.g. a network configured
3835//    with [Private Google Access with VPC Service Controls]) may want to
3836///   override this default.
3837/// * [with_credentials()]: by default this client uses
3838///   [Application Default Credentials]. Applications using custom
3839///   authentication may need to override this default.
3840///
3841/// [with_endpoint()]: super::builder::recommendation_service::ClientBuilder::with_endpoint
3842/// [with_credentials()]: super::builder::recommendation_service::ClientBuilder::with_credentials
3843/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
3844/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
3845///
3846/// # Pooling and Cloning
3847///
3848/// `RecommendationService` holds a connection pool internally, it is advised to
3849/// create one and reuse it. You do not need to wrap `RecommendationService` in
3850/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
3851/// already uses an `Arc` internally.
3852#[cfg(feature = "recommendation-service")]
3853#[cfg_attr(docsrs, doc(cfg(feature = "recommendation-service")))]
3854#[derive(Clone, Debug)]
3855pub struct RecommendationService {
3856    inner: std::sync::Arc<dyn super::stub::dynamic::RecommendationService>,
3857}
3858
3859#[cfg(feature = "recommendation-service")]
3860impl RecommendationService {
3861    /// Returns a builder for [RecommendationService].
3862    ///
3863    /// ```
3864    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
3865    /// # use google_cloud_discoveryengine_v1::client::RecommendationService;
3866    /// let client = RecommendationService::builder().build().await?;
3867    /// # Ok(()) }
3868    /// ```
3869    pub fn builder() -> super::builder::recommendation_service::ClientBuilder {
3870        crate::new_client_builder(super::builder::recommendation_service::client::Factory)
3871    }
3872
3873    /// Creates a new client from the provided stub.
3874    ///
3875    /// The most common case for calling this function is in tests mocking the
3876    /// client's behavior.
3877    pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
3878    where
3879        T: super::stub::RecommendationService + 'static,
3880    {
3881        Self { inner: stub.into() }
3882    }
3883
3884    pub(crate) async fn new(
3885        config: gaxi::options::ClientConfig,
3886    ) -> crate::ClientBuilderResult<Self> {
3887        let inner = Self::build_inner(config).await?;
3888        Ok(Self { inner })
3889    }
3890
3891    async fn build_inner(
3892        conf: gaxi::options::ClientConfig,
3893    ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::RecommendationService>>
3894    {
3895        if gaxi::options::tracing_enabled(&conf) {
3896            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
3897        }
3898        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
3899    }
3900
3901    async fn build_transport(
3902        conf: gaxi::options::ClientConfig,
3903    ) -> crate::ClientBuilderResult<impl super::stub::RecommendationService> {
3904        super::transport::RecommendationService::new(conf).await
3905    }
3906
3907    async fn build_with_tracing(
3908        conf: gaxi::options::ClientConfig,
3909    ) -> crate::ClientBuilderResult<impl super::stub::RecommendationService> {
3910        Self::build_transport(conf)
3911            .await
3912            .map(super::tracing::RecommendationService::new)
3913    }
3914
3915    /// Makes a recommendation, which requires a contextual user event.
3916    ///
3917    /// # Example
3918    /// ```
3919    /// # use google_cloud_discoveryengine_v1::client::RecommendationService;
3920    /// use google_cloud_discoveryengine_v1::Result;
3921    /// async fn sample(
3922    ///    client: &RecommendationService
3923    /// ) -> Result<()> {
3924    ///     let response = client.recommend()
3925    ///         /* set fields */
3926    ///         .send().await?;
3927    ///     println!("response {:?}", response);
3928    ///     Ok(())
3929    /// }
3930    /// ```
3931    pub fn recommend(&self) -> super::builder::recommendation_service::Recommend {
3932        super::builder::recommendation_service::Recommend::new(self.inner.clone())
3933    }
3934
3935    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3936    ///
3937    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
3938    ///
3939    /// # Example
3940    /// ```
3941    /// # use google_cloud_discoveryengine_v1::client::RecommendationService;
3942    /// use google_cloud_gax::paginator::ItemPaginator as _;
3943    /// use google_cloud_discoveryengine_v1::Result;
3944    /// async fn sample(
3945    ///    client: &RecommendationService
3946    /// ) -> Result<()> {
3947    ///     let mut list = client.list_operations()
3948    ///         /* set fields */
3949    ///         .by_item();
3950    ///     while let Some(item) = list.next().await.transpose()? {
3951    ///         println!("{:?}", item);
3952    ///     }
3953    ///     Ok(())
3954    /// }
3955    /// ```
3956    pub fn list_operations(&self) -> super::builder::recommendation_service::ListOperations {
3957        super::builder::recommendation_service::ListOperations::new(self.inner.clone())
3958    }
3959
3960    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3961    ///
3962    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
3963    ///
3964    /// # Example
3965    /// ```
3966    /// # use google_cloud_discoveryengine_v1::client::RecommendationService;
3967    /// use google_cloud_discoveryengine_v1::Result;
3968    /// async fn sample(
3969    ///    client: &RecommendationService
3970    /// ) -> Result<()> {
3971    ///     let response = client.get_operation()
3972    ///         /* set fields */
3973    ///         .send().await?;
3974    ///     println!("response {:?}", response);
3975    ///     Ok(())
3976    /// }
3977    /// ```
3978    pub fn get_operation(&self) -> super::builder::recommendation_service::GetOperation {
3979        super::builder::recommendation_service::GetOperation::new(self.inner.clone())
3980    }
3981
3982    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3983    ///
3984    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
3985    ///
3986    /// # Example
3987    /// ```
3988    /// # use google_cloud_discoveryengine_v1::client::RecommendationService;
3989    /// use google_cloud_discoveryengine_v1::Result;
3990    /// async fn sample(
3991    ///    client: &RecommendationService
3992    /// ) -> Result<()> {
3993    ///     client.cancel_operation()
3994    ///         /* set fields */
3995    ///         .send().await?;
3996    ///     Ok(())
3997    /// }
3998    /// ```
3999    pub fn cancel_operation(&self) -> super::builder::recommendation_service::CancelOperation {
4000        super::builder::recommendation_service::CancelOperation::new(self.inner.clone())
4001    }
4002}
4003
4004/// Implements a client for the Discovery Engine API.
4005///
4006/// # Example
4007/// ```
4008/// # use google_cloud_discoveryengine_v1::client::SchemaService;
4009/// use google_cloud_gax::paginator::ItemPaginator as _;
4010/// async fn sample(
4011///    project_id: &str,
4012///    location_id: &str,
4013///    data_store_id: &str,
4014/// ) -> anyhow::Result<()> {
4015///     let client = SchemaService::builder().build().await?;
4016///     let mut list = client.list_schemas()
4017///         .set_parent(format!("projects/{project_id}/locations/{location_id}/dataStores/{data_store_id}"))
4018///         .by_item();
4019///     while let Some(item) = list.next().await.transpose()? {
4020///         println!("{:?}", item);
4021///     }
4022///     Ok(())
4023/// }
4024/// ```
4025///
4026/// # Service Description
4027///
4028/// Service for managing [Schema][google.cloud.discoveryengine.v1.Schema]s.
4029///
4030/// [google.cloud.discoveryengine.v1.Schema]: crate::model::Schema
4031///
4032/// # Configuration
4033///
4034/// To configure `SchemaService` use the `with_*` methods in the type returned
4035/// by [builder()][SchemaService::builder]. The default configuration should
4036/// work for most applications. Common configuration changes include
4037///
4038/// * [with_endpoint()]: by default this client uses the global default endpoint
4039///   (`https://discoveryengine.googleapis.com`). Applications using regional
4040///   endpoints or running in restricted networks (e.g. a network configured
4041//    with [Private Google Access with VPC Service Controls]) may want to
4042///   override this default.
4043/// * [with_credentials()]: by default this client uses
4044///   [Application Default Credentials]. Applications using custom
4045///   authentication may need to override this default.
4046///
4047/// [with_endpoint()]: super::builder::schema_service::ClientBuilder::with_endpoint
4048/// [with_credentials()]: super::builder::schema_service::ClientBuilder::with_credentials
4049/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
4050/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
4051///
4052/// # Pooling and Cloning
4053///
4054/// `SchemaService` holds a connection pool internally, it is advised to
4055/// create one and reuse it. You do not need to wrap `SchemaService` in
4056/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
4057/// already uses an `Arc` internally.
4058#[cfg(feature = "schema-service")]
4059#[cfg_attr(docsrs, doc(cfg(feature = "schema-service")))]
4060#[derive(Clone, Debug)]
4061pub struct SchemaService {
4062    inner: std::sync::Arc<dyn super::stub::dynamic::SchemaService>,
4063}
4064
4065#[cfg(feature = "schema-service")]
4066impl SchemaService {
4067    /// Returns a builder for [SchemaService].
4068    ///
4069    /// ```
4070    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
4071    /// # use google_cloud_discoveryengine_v1::client::SchemaService;
4072    /// let client = SchemaService::builder().build().await?;
4073    /// # Ok(()) }
4074    /// ```
4075    pub fn builder() -> super::builder::schema_service::ClientBuilder {
4076        crate::new_client_builder(super::builder::schema_service::client::Factory)
4077    }
4078
4079    /// Creates a new client from the provided stub.
4080    ///
4081    /// The most common case for calling this function is in tests mocking the
4082    /// client's behavior.
4083    pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
4084    where
4085        T: super::stub::SchemaService + 'static,
4086    {
4087        Self { inner: stub.into() }
4088    }
4089
4090    pub(crate) async fn new(
4091        config: gaxi::options::ClientConfig,
4092    ) -> crate::ClientBuilderResult<Self> {
4093        let inner = Self::build_inner(config).await?;
4094        Ok(Self { inner })
4095    }
4096
4097    async fn build_inner(
4098        conf: gaxi::options::ClientConfig,
4099    ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::SchemaService>> {
4100        if gaxi::options::tracing_enabled(&conf) {
4101            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
4102        }
4103        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
4104    }
4105
4106    async fn build_transport(
4107        conf: gaxi::options::ClientConfig,
4108    ) -> crate::ClientBuilderResult<impl super::stub::SchemaService> {
4109        super::transport::SchemaService::new(conf).await
4110    }
4111
4112    async fn build_with_tracing(
4113        conf: gaxi::options::ClientConfig,
4114    ) -> crate::ClientBuilderResult<impl super::stub::SchemaService> {
4115        Self::build_transport(conf)
4116            .await
4117            .map(super::tracing::SchemaService::new)
4118    }
4119
4120    /// Gets a [Schema][google.cloud.discoveryengine.v1.Schema].
4121    ///
4122    /// [google.cloud.discoveryengine.v1.Schema]: crate::model::Schema
4123    ///
4124    /// # Example
4125    /// ```
4126    /// # use google_cloud_discoveryengine_v1::client::SchemaService;
4127    /// use google_cloud_discoveryengine_v1::Result;
4128    /// async fn sample(
4129    ///    client: &SchemaService, project_id: &str, location_id: &str, data_store_id: &str, schema_id: &str
4130    /// ) -> Result<()> {
4131    ///     let response = client.get_schema()
4132    ///         .set_name(format!("projects/{project_id}/locations/{location_id}/dataStores/{data_store_id}/schemas/{schema_id}"))
4133    ///         .send().await?;
4134    ///     println!("response {:?}", response);
4135    ///     Ok(())
4136    /// }
4137    /// ```
4138    pub fn get_schema(&self) -> super::builder::schema_service::GetSchema {
4139        super::builder::schema_service::GetSchema::new(self.inner.clone())
4140    }
4141
4142    /// Gets a list of [Schema][google.cloud.discoveryengine.v1.Schema]s.
4143    ///
4144    /// [google.cloud.discoveryengine.v1.Schema]: crate::model::Schema
4145    ///
4146    /// # Example
4147    /// ```
4148    /// # use google_cloud_discoveryengine_v1::client::SchemaService;
4149    /// use google_cloud_gax::paginator::ItemPaginator as _;
4150    /// use google_cloud_discoveryengine_v1::Result;
4151    /// async fn sample(
4152    ///    client: &SchemaService, project_id: &str, location_id: &str, data_store_id: &str
4153    /// ) -> Result<()> {
4154    ///     let mut list = client.list_schemas()
4155    ///         .set_parent(format!("projects/{project_id}/locations/{location_id}/dataStores/{data_store_id}"))
4156    ///         .by_item();
4157    ///     while let Some(item) = list.next().await.transpose()? {
4158    ///         println!("{:?}", item);
4159    ///     }
4160    ///     Ok(())
4161    /// }
4162    /// ```
4163    pub fn list_schemas(&self) -> super::builder::schema_service::ListSchemas {
4164        super::builder::schema_service::ListSchemas::new(self.inner.clone())
4165    }
4166
4167    /// Creates a [Schema][google.cloud.discoveryengine.v1.Schema].
4168    ///
4169    /// [google.cloud.discoveryengine.v1.Schema]: crate::model::Schema
4170    ///
4171    /// # Long running operations
4172    ///
4173    /// This method is used to start, and/or poll a [long-running Operation].
4174    /// The [Working with long-running operations] chapter in the [user guide]
4175    /// covers these operations in detail.
4176    ///
4177    /// [long-running operation]: https://google.aip.dev/151
4178    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
4179    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
4180    ///
4181    /// # Example
4182    /// ```
4183    /// # use google_cloud_discoveryengine_v1::client::SchemaService;
4184    /// use google_cloud_lro::Poller;
4185    /// use google_cloud_discoveryengine_v1::model::Schema;
4186    /// use google_cloud_discoveryengine_v1::Result;
4187    /// async fn sample(
4188    ///    client: &SchemaService, project_id: &str, location_id: &str, data_store_id: &str
4189    /// ) -> Result<()> {
4190    ///     let response = client.create_schema()
4191    ///         .set_parent(format!("projects/{project_id}/locations/{location_id}/dataStores/{data_store_id}"))
4192    ///         .set_schema_id("schema_id_value")
4193    ///         .set_schema(
4194    ///             Schema::new()/* set fields */
4195    ///         )
4196    ///         .poller().until_done().await?;
4197    ///     println!("response {:?}", response);
4198    ///     Ok(())
4199    /// }
4200    /// ```
4201    pub fn create_schema(&self) -> super::builder::schema_service::CreateSchema {
4202        super::builder::schema_service::CreateSchema::new(self.inner.clone())
4203    }
4204
4205    /// Updates a [Schema][google.cloud.discoveryengine.v1.Schema].
4206    ///
4207    /// [google.cloud.discoveryengine.v1.Schema]: crate::model::Schema
4208    ///
4209    /// # Long running operations
4210    ///
4211    /// This method is used to start, and/or poll a [long-running Operation].
4212    /// The [Working with long-running operations] chapter in the [user guide]
4213    /// covers these operations in detail.
4214    ///
4215    /// [long-running operation]: https://google.aip.dev/151
4216    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
4217    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
4218    ///
4219    /// # Example
4220    /// ```
4221    /// # use google_cloud_discoveryengine_v1::client::SchemaService;
4222    /// use google_cloud_lro::Poller;
4223    /// use google_cloud_discoveryengine_v1::model::Schema;
4224    /// use google_cloud_discoveryengine_v1::Result;
4225    /// async fn sample(
4226    ///    client: &SchemaService, project_id: &str, location_id: &str, data_store_id: &str, schema_id: &str
4227    /// ) -> Result<()> {
4228    ///     let response = client.update_schema()
4229    ///         .set_schema(
4230    ///             Schema::new().set_name(format!("projects/{project_id}/locations/{location_id}/dataStores/{data_store_id}/schemas/{schema_id}"))/* set fields */
4231    ///         )
4232    ///         .poller().until_done().await?;
4233    ///     println!("response {:?}", response);
4234    ///     Ok(())
4235    /// }
4236    /// ```
4237    pub fn update_schema(&self) -> super::builder::schema_service::UpdateSchema {
4238        super::builder::schema_service::UpdateSchema::new(self.inner.clone())
4239    }
4240
4241    /// Deletes a [Schema][google.cloud.discoveryengine.v1.Schema].
4242    ///
4243    /// [google.cloud.discoveryengine.v1.Schema]: crate::model::Schema
4244    ///
4245    /// # Long running operations
4246    ///
4247    /// This method is used to start, and/or poll a [long-running Operation].
4248    /// The [Working with long-running operations] chapter in the [user guide]
4249    /// covers these operations in detail.
4250    ///
4251    /// [long-running operation]: https://google.aip.dev/151
4252    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
4253    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
4254    ///
4255    /// # Example
4256    /// ```
4257    /// # use google_cloud_discoveryengine_v1::client::SchemaService;
4258    /// use google_cloud_lro::Poller;
4259    /// use google_cloud_discoveryengine_v1::Result;
4260    /// async fn sample(
4261    ///    client: &SchemaService, project_id: &str, location_id: &str, data_store_id: &str, schema_id: &str
4262    /// ) -> Result<()> {
4263    ///     client.delete_schema()
4264    ///         .set_name(format!("projects/{project_id}/locations/{location_id}/dataStores/{data_store_id}/schemas/{schema_id}"))
4265    ///         .poller().until_done().await?;
4266    ///     Ok(())
4267    /// }
4268    /// ```
4269    pub fn delete_schema(&self) -> super::builder::schema_service::DeleteSchema {
4270        super::builder::schema_service::DeleteSchema::new(self.inner.clone())
4271    }
4272
4273    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
4274    ///
4275    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
4276    ///
4277    /// # Example
4278    /// ```
4279    /// # use google_cloud_discoveryengine_v1::client::SchemaService;
4280    /// use google_cloud_gax::paginator::ItemPaginator as _;
4281    /// use google_cloud_discoveryengine_v1::Result;
4282    /// async fn sample(
4283    ///    client: &SchemaService
4284    /// ) -> Result<()> {
4285    ///     let mut list = client.list_operations()
4286    ///         /* set fields */
4287    ///         .by_item();
4288    ///     while let Some(item) = list.next().await.transpose()? {
4289    ///         println!("{:?}", item);
4290    ///     }
4291    ///     Ok(())
4292    /// }
4293    /// ```
4294    pub fn list_operations(&self) -> super::builder::schema_service::ListOperations {
4295        super::builder::schema_service::ListOperations::new(self.inner.clone())
4296    }
4297
4298    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
4299    ///
4300    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
4301    ///
4302    /// # Example
4303    /// ```
4304    /// # use google_cloud_discoveryengine_v1::client::SchemaService;
4305    /// use google_cloud_discoveryengine_v1::Result;
4306    /// async fn sample(
4307    ///    client: &SchemaService
4308    /// ) -> Result<()> {
4309    ///     let response = client.get_operation()
4310    ///         /* set fields */
4311    ///         .send().await?;
4312    ///     println!("response {:?}", response);
4313    ///     Ok(())
4314    /// }
4315    /// ```
4316    pub fn get_operation(&self) -> super::builder::schema_service::GetOperation {
4317        super::builder::schema_service::GetOperation::new(self.inner.clone())
4318    }
4319
4320    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
4321    ///
4322    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
4323    ///
4324    /// # Example
4325    /// ```
4326    /// # use google_cloud_discoveryengine_v1::client::SchemaService;
4327    /// use google_cloud_discoveryengine_v1::Result;
4328    /// async fn sample(
4329    ///    client: &SchemaService
4330    /// ) -> Result<()> {
4331    ///     client.cancel_operation()
4332    ///         /* set fields */
4333    ///         .send().await?;
4334    ///     Ok(())
4335    /// }
4336    /// ```
4337    pub fn cancel_operation(&self) -> super::builder::schema_service::CancelOperation {
4338        super::builder::schema_service::CancelOperation::new(self.inner.clone())
4339    }
4340}
4341
4342/// Implements a client for the Discovery Engine API.
4343///
4344/// # Example
4345/// ```
4346/// # use google_cloud_discoveryengine_v1::client::SearchService;
4347/// use google_cloud_gax::paginator::ItemPaginator as _;
4348/// async fn sample(
4349/// ) -> anyhow::Result<()> {
4350///     let client = SearchService::builder().build().await?;
4351///     let mut list = client.search()
4352///         /* set fields */
4353///         .by_item();
4354///     while let Some(item) = list.next().await.transpose()? {
4355///         println!("{:?}", item);
4356///     }
4357///     Ok(())
4358/// }
4359/// ```
4360///
4361/// # Service Description
4362///
4363/// Service for search.
4364///
4365/// # Configuration
4366///
4367/// To configure `SearchService` use the `with_*` methods in the type returned
4368/// by [builder()][SearchService::builder]. The default configuration should
4369/// work for most applications. Common configuration changes include
4370///
4371/// * [with_endpoint()]: by default this client uses the global default endpoint
4372///   (`https://discoveryengine.googleapis.com`). Applications using regional
4373///   endpoints or running in restricted networks (e.g. a network configured
4374//    with [Private Google Access with VPC Service Controls]) may want to
4375///   override this default.
4376/// * [with_credentials()]: by default this client uses
4377///   [Application Default Credentials]. Applications using custom
4378///   authentication may need to override this default.
4379///
4380/// [with_endpoint()]: super::builder::search_service::ClientBuilder::with_endpoint
4381/// [with_credentials()]: super::builder::search_service::ClientBuilder::with_credentials
4382/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
4383/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
4384///
4385/// # Pooling and Cloning
4386///
4387/// `SearchService` holds a connection pool internally, it is advised to
4388/// create one and reuse it. You do not need to wrap `SearchService` in
4389/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
4390/// already uses an `Arc` internally.
4391#[cfg(feature = "search-service")]
4392#[cfg_attr(docsrs, doc(cfg(feature = "search-service")))]
4393#[derive(Clone, Debug)]
4394pub struct SearchService {
4395    inner: std::sync::Arc<dyn super::stub::dynamic::SearchService>,
4396}
4397
4398#[cfg(feature = "search-service")]
4399impl SearchService {
4400    /// Returns a builder for [SearchService].
4401    ///
4402    /// ```
4403    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
4404    /// # use google_cloud_discoveryengine_v1::client::SearchService;
4405    /// let client = SearchService::builder().build().await?;
4406    /// # Ok(()) }
4407    /// ```
4408    pub fn builder() -> super::builder::search_service::ClientBuilder {
4409        crate::new_client_builder(super::builder::search_service::client::Factory)
4410    }
4411
4412    /// Creates a new client from the provided stub.
4413    ///
4414    /// The most common case for calling this function is in tests mocking the
4415    /// client's behavior.
4416    pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
4417    where
4418        T: super::stub::SearchService + 'static,
4419    {
4420        Self { inner: stub.into() }
4421    }
4422
4423    pub(crate) async fn new(
4424        config: gaxi::options::ClientConfig,
4425    ) -> crate::ClientBuilderResult<Self> {
4426        let inner = Self::build_inner(config).await?;
4427        Ok(Self { inner })
4428    }
4429
4430    async fn build_inner(
4431        conf: gaxi::options::ClientConfig,
4432    ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::SearchService>> {
4433        if gaxi::options::tracing_enabled(&conf) {
4434            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
4435        }
4436        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
4437    }
4438
4439    async fn build_transport(
4440        conf: gaxi::options::ClientConfig,
4441    ) -> crate::ClientBuilderResult<impl super::stub::SearchService> {
4442        super::transport::SearchService::new(conf).await
4443    }
4444
4445    async fn build_with_tracing(
4446        conf: gaxi::options::ClientConfig,
4447    ) -> crate::ClientBuilderResult<impl super::stub::SearchService> {
4448        Self::build_transport(conf)
4449            .await
4450            .map(super::tracing::SearchService::new)
4451    }
4452
4453    /// Performs a search.
4454    ///
4455    /// # Example
4456    /// ```
4457    /// # use google_cloud_discoveryengine_v1::client::SearchService;
4458    /// use google_cloud_gax::paginator::ItemPaginator as _;
4459    /// use google_cloud_discoveryengine_v1::Result;
4460    /// async fn sample(
4461    ///    client: &SearchService
4462    /// ) -> Result<()> {
4463    ///     let mut list = client.search()
4464    ///         /* set fields */
4465    ///         .by_item();
4466    ///     while let Some(item) = list.next().await.transpose()? {
4467    ///         println!("{:?}", item);
4468    ///     }
4469    ///     Ok(())
4470    /// }
4471    /// ```
4472    pub fn search(&self) -> super::builder::search_service::Search {
4473        super::builder::search_service::Search::new(self.inner.clone())
4474    }
4475
4476    /// Performs a search. Similar to the
4477    /// [SearchService.Search][google.cloud.discoveryengine.v1.SearchService.Search]
4478    /// method, but a lite version that allows API key for authentication, where
4479    /// OAuth and IAM checks are not required.
4480    ///
4481    /// Only public website search is supported by this method. If data stores and
4482    /// engines not associated with public website search are specified, a
4483    /// `FAILED_PRECONDITION` error is returned.
4484    ///
4485    /// This method can be used for easy onboarding without having to implement an
4486    /// authentication backend. However, it is strongly recommended to use
4487    /// [SearchService.Search][google.cloud.discoveryengine.v1.SearchService.Search]
4488    /// instead with required OAuth and IAM checks to provide better data security.
4489    ///
4490    /// [google.cloud.discoveryengine.v1.SearchService.Search]: crate::client::SearchService::search
4491    ///
4492    /// # Example
4493    /// ```
4494    /// # use google_cloud_discoveryengine_v1::client::SearchService;
4495    /// use google_cloud_gax::paginator::ItemPaginator as _;
4496    /// use google_cloud_discoveryengine_v1::Result;
4497    /// async fn sample(
4498    ///    client: &SearchService
4499    /// ) -> Result<()> {
4500    ///     let mut list = client.search_lite()
4501    ///         /* set fields */
4502    ///         .by_item();
4503    ///     while let Some(item) = list.next().await.transpose()? {
4504    ///         println!("{:?}", item);
4505    ///     }
4506    ///     Ok(())
4507    /// }
4508    /// ```
4509    pub fn search_lite(&self) -> super::builder::search_service::SearchLite {
4510        super::builder::search_service::SearchLite::new(self.inner.clone())
4511    }
4512
4513    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
4514    ///
4515    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
4516    ///
4517    /// # Example
4518    /// ```
4519    /// # use google_cloud_discoveryengine_v1::client::SearchService;
4520    /// use google_cloud_gax::paginator::ItemPaginator as _;
4521    /// use google_cloud_discoveryengine_v1::Result;
4522    /// async fn sample(
4523    ///    client: &SearchService
4524    /// ) -> Result<()> {
4525    ///     let mut list = client.list_operations()
4526    ///         /* set fields */
4527    ///         .by_item();
4528    ///     while let Some(item) = list.next().await.transpose()? {
4529    ///         println!("{:?}", item);
4530    ///     }
4531    ///     Ok(())
4532    /// }
4533    /// ```
4534    pub fn list_operations(&self) -> super::builder::search_service::ListOperations {
4535        super::builder::search_service::ListOperations::new(self.inner.clone())
4536    }
4537
4538    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
4539    ///
4540    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
4541    ///
4542    /// # Example
4543    /// ```
4544    /// # use google_cloud_discoveryengine_v1::client::SearchService;
4545    /// use google_cloud_discoveryengine_v1::Result;
4546    /// async fn sample(
4547    ///    client: &SearchService
4548    /// ) -> Result<()> {
4549    ///     let response = client.get_operation()
4550    ///         /* set fields */
4551    ///         .send().await?;
4552    ///     println!("response {:?}", response);
4553    ///     Ok(())
4554    /// }
4555    /// ```
4556    pub fn get_operation(&self) -> super::builder::search_service::GetOperation {
4557        super::builder::search_service::GetOperation::new(self.inner.clone())
4558    }
4559
4560    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
4561    ///
4562    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
4563    ///
4564    /// # Example
4565    /// ```
4566    /// # use google_cloud_discoveryengine_v1::client::SearchService;
4567    /// use google_cloud_discoveryengine_v1::Result;
4568    /// async fn sample(
4569    ///    client: &SearchService
4570    /// ) -> Result<()> {
4571    ///     client.cancel_operation()
4572    ///         /* set fields */
4573    ///         .send().await?;
4574    ///     Ok(())
4575    /// }
4576    /// ```
4577    pub fn cancel_operation(&self) -> super::builder::search_service::CancelOperation {
4578        super::builder::search_service::CancelOperation::new(self.inner.clone())
4579    }
4580}
4581
4582/// Implements a client for the Discovery Engine API.
4583///
4584/// # Example
4585/// ```
4586/// # use google_cloud_discoveryengine_v1::client::SearchTuningService;
4587/// use google_cloud_lro::Poller;
4588/// async fn sample(
4589/// ) -> anyhow::Result<()> {
4590///     let client = SearchTuningService::builder().build().await?;
4591///     let response = client.train_custom_model()
4592///         /* set fields */
4593///         .poller().until_done().await?;
4594///     println!("response {:?}", response);
4595///     Ok(())
4596/// }
4597/// ```
4598///
4599/// # Service Description
4600///
4601/// Service for search tuning.
4602///
4603/// # Configuration
4604///
4605/// To configure `SearchTuningService` use the `with_*` methods in the type returned
4606/// by [builder()][SearchTuningService::builder]. The default configuration should
4607/// work for most applications. Common configuration changes include
4608///
4609/// * [with_endpoint()]: by default this client uses the global default endpoint
4610///   (`https://discoveryengine.googleapis.com`). Applications using regional
4611///   endpoints or running in restricted networks (e.g. a network configured
4612//    with [Private Google Access with VPC Service Controls]) may want to
4613///   override this default.
4614/// * [with_credentials()]: by default this client uses
4615///   [Application Default Credentials]. Applications using custom
4616///   authentication may need to override this default.
4617///
4618/// [with_endpoint()]: super::builder::search_tuning_service::ClientBuilder::with_endpoint
4619/// [with_credentials()]: super::builder::search_tuning_service::ClientBuilder::with_credentials
4620/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
4621/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
4622///
4623/// # Pooling and Cloning
4624///
4625/// `SearchTuningService` holds a connection pool internally, it is advised to
4626/// create one and reuse it. You do not need to wrap `SearchTuningService` in
4627/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
4628/// already uses an `Arc` internally.
4629#[cfg(feature = "search-tuning-service")]
4630#[cfg_attr(docsrs, doc(cfg(feature = "search-tuning-service")))]
4631#[derive(Clone, Debug)]
4632pub struct SearchTuningService {
4633    inner: std::sync::Arc<dyn super::stub::dynamic::SearchTuningService>,
4634}
4635
4636#[cfg(feature = "search-tuning-service")]
4637impl SearchTuningService {
4638    /// Returns a builder for [SearchTuningService].
4639    ///
4640    /// ```
4641    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
4642    /// # use google_cloud_discoveryengine_v1::client::SearchTuningService;
4643    /// let client = SearchTuningService::builder().build().await?;
4644    /// # Ok(()) }
4645    /// ```
4646    pub fn builder() -> super::builder::search_tuning_service::ClientBuilder {
4647        crate::new_client_builder(super::builder::search_tuning_service::client::Factory)
4648    }
4649
4650    /// Creates a new client from the provided stub.
4651    ///
4652    /// The most common case for calling this function is in tests mocking the
4653    /// client's behavior.
4654    pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
4655    where
4656        T: super::stub::SearchTuningService + 'static,
4657    {
4658        Self { inner: stub.into() }
4659    }
4660
4661    pub(crate) async fn new(
4662        config: gaxi::options::ClientConfig,
4663    ) -> crate::ClientBuilderResult<Self> {
4664        let inner = Self::build_inner(config).await?;
4665        Ok(Self { inner })
4666    }
4667
4668    async fn build_inner(
4669        conf: gaxi::options::ClientConfig,
4670    ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::SearchTuningService>>
4671    {
4672        if gaxi::options::tracing_enabled(&conf) {
4673            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
4674        }
4675        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
4676    }
4677
4678    async fn build_transport(
4679        conf: gaxi::options::ClientConfig,
4680    ) -> crate::ClientBuilderResult<impl super::stub::SearchTuningService> {
4681        super::transport::SearchTuningService::new(conf).await
4682    }
4683
4684    async fn build_with_tracing(
4685        conf: gaxi::options::ClientConfig,
4686    ) -> crate::ClientBuilderResult<impl super::stub::SearchTuningService> {
4687        Self::build_transport(conf)
4688            .await
4689            .map(super::tracing::SearchTuningService::new)
4690    }
4691
4692    /// Trains a custom model.
4693    ///
4694    /// # Long running operations
4695    ///
4696    /// This method is used to start, and/or poll a [long-running Operation].
4697    /// The [Working with long-running operations] chapter in the [user guide]
4698    /// covers these operations in detail.
4699    ///
4700    /// [long-running operation]: https://google.aip.dev/151
4701    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
4702    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
4703    ///
4704    /// # Example
4705    /// ```
4706    /// # use google_cloud_discoveryengine_v1::client::SearchTuningService;
4707    /// use google_cloud_lro::Poller;
4708    /// use google_cloud_discoveryengine_v1::Result;
4709    /// async fn sample(
4710    ///    client: &SearchTuningService
4711    /// ) -> Result<()> {
4712    ///     let response = client.train_custom_model()
4713    ///         /* set fields */
4714    ///         .poller().until_done().await?;
4715    ///     println!("response {:?}", response);
4716    ///     Ok(())
4717    /// }
4718    /// ```
4719    pub fn train_custom_model(&self) -> super::builder::search_tuning_service::TrainCustomModel {
4720        super::builder::search_tuning_service::TrainCustomModel::new(self.inner.clone())
4721    }
4722
4723    /// Gets a list of all the custom models.
4724    ///
4725    /// # Example
4726    /// ```
4727    /// # use google_cloud_discoveryengine_v1::client::SearchTuningService;
4728    /// use google_cloud_discoveryengine_v1::Result;
4729    /// async fn sample(
4730    ///    client: &SearchTuningService
4731    /// ) -> Result<()> {
4732    ///     let response = client.list_custom_models()
4733    ///         /* set fields */
4734    ///         .send().await?;
4735    ///     println!("response {:?}", response);
4736    ///     Ok(())
4737    /// }
4738    /// ```
4739    pub fn list_custom_models(&self) -> super::builder::search_tuning_service::ListCustomModels {
4740        super::builder::search_tuning_service::ListCustomModels::new(self.inner.clone())
4741    }
4742
4743    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
4744    ///
4745    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
4746    ///
4747    /// # Example
4748    /// ```
4749    /// # use google_cloud_discoveryengine_v1::client::SearchTuningService;
4750    /// use google_cloud_gax::paginator::ItemPaginator as _;
4751    /// use google_cloud_discoveryengine_v1::Result;
4752    /// async fn sample(
4753    ///    client: &SearchTuningService
4754    /// ) -> Result<()> {
4755    ///     let mut list = client.list_operations()
4756    ///         /* set fields */
4757    ///         .by_item();
4758    ///     while let Some(item) = list.next().await.transpose()? {
4759    ///         println!("{:?}", item);
4760    ///     }
4761    ///     Ok(())
4762    /// }
4763    /// ```
4764    pub fn list_operations(&self) -> super::builder::search_tuning_service::ListOperations {
4765        super::builder::search_tuning_service::ListOperations::new(self.inner.clone())
4766    }
4767
4768    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
4769    ///
4770    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
4771    ///
4772    /// # Example
4773    /// ```
4774    /// # use google_cloud_discoveryengine_v1::client::SearchTuningService;
4775    /// use google_cloud_discoveryengine_v1::Result;
4776    /// async fn sample(
4777    ///    client: &SearchTuningService
4778    /// ) -> Result<()> {
4779    ///     let response = client.get_operation()
4780    ///         /* set fields */
4781    ///         .send().await?;
4782    ///     println!("response {:?}", response);
4783    ///     Ok(())
4784    /// }
4785    /// ```
4786    pub fn get_operation(&self) -> super::builder::search_tuning_service::GetOperation {
4787        super::builder::search_tuning_service::GetOperation::new(self.inner.clone())
4788    }
4789
4790    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
4791    ///
4792    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
4793    ///
4794    /// # Example
4795    /// ```
4796    /// # use google_cloud_discoveryengine_v1::client::SearchTuningService;
4797    /// use google_cloud_discoveryengine_v1::Result;
4798    /// async fn sample(
4799    ///    client: &SearchTuningService
4800    /// ) -> Result<()> {
4801    ///     client.cancel_operation()
4802    ///         /* set fields */
4803    ///         .send().await?;
4804    ///     Ok(())
4805    /// }
4806    /// ```
4807    pub fn cancel_operation(&self) -> super::builder::search_tuning_service::CancelOperation {
4808        super::builder::search_tuning_service::CancelOperation::new(self.inner.clone())
4809    }
4810}
4811
4812/// Implements a client for the Discovery Engine API.
4813///
4814/// # Example
4815/// ```
4816/// # use google_cloud_discoveryengine_v1::client::ServingConfigService;
4817/// # extern crate wkt as google_cloud_wkt;
4818/// use google_cloud_wkt::FieldMask;
4819/// use google_cloud_discoveryengine_v1::model::ServingConfig;
4820/// async fn sample(
4821///    project_id: &str,
4822///    location_id: &str,
4823///    data_store_id: &str,
4824///    serving_config_id: &str,
4825/// ) -> anyhow::Result<()> {
4826///     let client = ServingConfigService::builder().build().await?;
4827///     let response = client.update_serving_config()
4828///         .set_serving_config(
4829///             ServingConfig::new().set_name(format!("projects/{project_id}/locations/{location_id}/dataStores/{data_store_id}/servingConfigs/{serving_config_id}"))/* set fields */
4830///         )
4831///         .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
4832///         .send().await?;
4833///     println!("response {:?}", response);
4834///     Ok(())
4835/// }
4836/// ```
4837///
4838/// # Service Description
4839///
4840/// Service for operations related to
4841/// [ServingConfig][google.cloud.discoveryengine.v1.ServingConfig].
4842///
4843/// [google.cloud.discoveryengine.v1.ServingConfig]: crate::model::ServingConfig
4844///
4845/// # Configuration
4846///
4847/// To configure `ServingConfigService` use the `with_*` methods in the type returned
4848/// by [builder()][ServingConfigService::builder]. The default configuration should
4849/// work for most applications. Common configuration changes include
4850///
4851/// * [with_endpoint()]: by default this client uses the global default endpoint
4852///   (`https://discoveryengine.googleapis.com`). Applications using regional
4853///   endpoints or running in restricted networks (e.g. a network configured
4854//    with [Private Google Access with VPC Service Controls]) may want to
4855///   override this default.
4856/// * [with_credentials()]: by default this client uses
4857///   [Application Default Credentials]. Applications using custom
4858///   authentication may need to override this default.
4859///
4860/// [with_endpoint()]: super::builder::serving_config_service::ClientBuilder::with_endpoint
4861/// [with_credentials()]: super::builder::serving_config_service::ClientBuilder::with_credentials
4862/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
4863/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
4864///
4865/// # Pooling and Cloning
4866///
4867/// `ServingConfigService` holds a connection pool internally, it is advised to
4868/// create one and reuse it. You do not need to wrap `ServingConfigService` in
4869/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
4870/// already uses an `Arc` internally.
4871#[cfg(feature = "serving-config-service")]
4872#[cfg_attr(docsrs, doc(cfg(feature = "serving-config-service")))]
4873#[derive(Clone, Debug)]
4874pub struct ServingConfigService {
4875    inner: std::sync::Arc<dyn super::stub::dynamic::ServingConfigService>,
4876}
4877
4878#[cfg(feature = "serving-config-service")]
4879impl ServingConfigService {
4880    /// Returns a builder for [ServingConfigService].
4881    ///
4882    /// ```
4883    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
4884    /// # use google_cloud_discoveryengine_v1::client::ServingConfigService;
4885    /// let client = ServingConfigService::builder().build().await?;
4886    /// # Ok(()) }
4887    /// ```
4888    pub fn builder() -> super::builder::serving_config_service::ClientBuilder {
4889        crate::new_client_builder(super::builder::serving_config_service::client::Factory)
4890    }
4891
4892    /// Creates a new client from the provided stub.
4893    ///
4894    /// The most common case for calling this function is in tests mocking the
4895    /// client's behavior.
4896    pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
4897    where
4898        T: super::stub::ServingConfigService + 'static,
4899    {
4900        Self { inner: stub.into() }
4901    }
4902
4903    pub(crate) async fn new(
4904        config: gaxi::options::ClientConfig,
4905    ) -> crate::ClientBuilderResult<Self> {
4906        let inner = Self::build_inner(config).await?;
4907        Ok(Self { inner })
4908    }
4909
4910    async fn build_inner(
4911        conf: gaxi::options::ClientConfig,
4912    ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::ServingConfigService>>
4913    {
4914        if gaxi::options::tracing_enabled(&conf) {
4915            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
4916        }
4917        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
4918    }
4919
4920    async fn build_transport(
4921        conf: gaxi::options::ClientConfig,
4922    ) -> crate::ClientBuilderResult<impl super::stub::ServingConfigService> {
4923        super::transport::ServingConfigService::new(conf).await
4924    }
4925
4926    async fn build_with_tracing(
4927        conf: gaxi::options::ClientConfig,
4928    ) -> crate::ClientBuilderResult<impl super::stub::ServingConfigService> {
4929        Self::build_transport(conf)
4930            .await
4931            .map(super::tracing::ServingConfigService::new)
4932    }
4933
4934    /// Updates a ServingConfig.
4935    ///
4936    /// Returns a NOT_FOUND error if the ServingConfig does not exist.
4937    ///
4938    /// # Example
4939    /// ```
4940    /// # use google_cloud_discoveryengine_v1::client::ServingConfigService;
4941    /// # extern crate wkt as google_cloud_wkt;
4942    /// use google_cloud_wkt::FieldMask;
4943    /// use google_cloud_discoveryengine_v1::model::ServingConfig;
4944    /// use google_cloud_discoveryengine_v1::Result;
4945    /// async fn sample(
4946    ///    client: &ServingConfigService, project_id: &str, location_id: &str, data_store_id: &str, serving_config_id: &str
4947    /// ) -> Result<()> {
4948    ///     let response = client.update_serving_config()
4949    ///         .set_serving_config(
4950    ///             ServingConfig::new().set_name(format!("projects/{project_id}/locations/{location_id}/dataStores/{data_store_id}/servingConfigs/{serving_config_id}"))/* set fields */
4951    ///         )
4952    ///         .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
4953    ///         .send().await?;
4954    ///     println!("response {:?}", response);
4955    ///     Ok(())
4956    /// }
4957    /// ```
4958    pub fn update_serving_config(
4959        &self,
4960    ) -> super::builder::serving_config_service::UpdateServingConfig {
4961        super::builder::serving_config_service::UpdateServingConfig::new(self.inner.clone())
4962    }
4963
4964    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
4965    ///
4966    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
4967    ///
4968    /// # Example
4969    /// ```
4970    /// # use google_cloud_discoveryengine_v1::client::ServingConfigService;
4971    /// use google_cloud_gax::paginator::ItemPaginator as _;
4972    /// use google_cloud_discoveryengine_v1::Result;
4973    /// async fn sample(
4974    ///    client: &ServingConfigService
4975    /// ) -> Result<()> {
4976    ///     let mut list = client.list_operations()
4977    ///         /* set fields */
4978    ///         .by_item();
4979    ///     while let Some(item) = list.next().await.transpose()? {
4980    ///         println!("{:?}", item);
4981    ///     }
4982    ///     Ok(())
4983    /// }
4984    /// ```
4985    pub fn list_operations(&self) -> super::builder::serving_config_service::ListOperations {
4986        super::builder::serving_config_service::ListOperations::new(self.inner.clone())
4987    }
4988
4989    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
4990    ///
4991    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
4992    ///
4993    /// # Example
4994    /// ```
4995    /// # use google_cloud_discoveryengine_v1::client::ServingConfigService;
4996    /// use google_cloud_discoveryengine_v1::Result;
4997    /// async fn sample(
4998    ///    client: &ServingConfigService
4999    /// ) -> Result<()> {
5000    ///     let response = client.get_operation()
5001    ///         /* set fields */
5002    ///         .send().await?;
5003    ///     println!("response {:?}", response);
5004    ///     Ok(())
5005    /// }
5006    /// ```
5007    pub fn get_operation(&self) -> super::builder::serving_config_service::GetOperation {
5008        super::builder::serving_config_service::GetOperation::new(self.inner.clone())
5009    }
5010
5011    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
5012    ///
5013    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
5014    ///
5015    /// # Example
5016    /// ```
5017    /// # use google_cloud_discoveryengine_v1::client::ServingConfigService;
5018    /// use google_cloud_discoveryengine_v1::Result;
5019    /// async fn sample(
5020    ///    client: &ServingConfigService
5021    /// ) -> Result<()> {
5022    ///     client.cancel_operation()
5023    ///         /* set fields */
5024    ///         .send().await?;
5025    ///     Ok(())
5026    /// }
5027    /// ```
5028    pub fn cancel_operation(&self) -> super::builder::serving_config_service::CancelOperation {
5029        super::builder::serving_config_service::CancelOperation::new(self.inner.clone())
5030    }
5031}
5032
5033/// Implements a client for the Discovery Engine API.
5034///
5035/// # Example
5036/// ```
5037/// # use google_cloud_discoveryengine_v1::client::SessionService;
5038/// use google_cloud_gax::paginator::ItemPaginator as _;
5039/// async fn sample(
5040///    project_id: &str,
5041///    location_id: &str,
5042///    data_store_id: &str,
5043/// ) -> anyhow::Result<()> {
5044///     let client = SessionService::builder().build().await?;
5045///     let mut list = client.list_sessions()
5046///         .set_parent(format!("projects/{project_id}/locations/{location_id}/dataStores/{data_store_id}"))
5047///         .by_item();
5048///     while let Some(item) = list.next().await.transpose()? {
5049///         println!("{:?}", item);
5050///     }
5051///     Ok(())
5052/// }
5053/// ```
5054///
5055/// # Service Description
5056///
5057/// Service for managing Sessions and Session-related resources.
5058///
5059/// # Configuration
5060///
5061/// To configure `SessionService` use the `with_*` methods in the type returned
5062/// by [builder()][SessionService::builder]. The default configuration should
5063/// work for most applications. Common configuration changes include
5064///
5065/// * [with_endpoint()]: by default this client uses the global default endpoint
5066///   (`https://discoveryengine.googleapis.com`). Applications using regional
5067///   endpoints or running in restricted networks (e.g. a network configured
5068//    with [Private Google Access with VPC Service Controls]) may want to
5069///   override this default.
5070/// * [with_credentials()]: by default this client uses
5071///   [Application Default Credentials]. Applications using custom
5072///   authentication may need to override this default.
5073///
5074/// [with_endpoint()]: super::builder::session_service::ClientBuilder::with_endpoint
5075/// [with_credentials()]: super::builder::session_service::ClientBuilder::with_credentials
5076/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
5077/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
5078///
5079/// # Pooling and Cloning
5080///
5081/// `SessionService` holds a connection pool internally, it is advised to
5082/// create one and reuse it. You do not need to wrap `SessionService` in
5083/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
5084/// already uses an `Arc` internally.
5085#[cfg(feature = "session-service")]
5086#[cfg_attr(docsrs, doc(cfg(feature = "session-service")))]
5087#[derive(Clone, Debug)]
5088pub struct SessionService {
5089    inner: std::sync::Arc<dyn super::stub::dynamic::SessionService>,
5090}
5091
5092#[cfg(feature = "session-service")]
5093impl SessionService {
5094    /// Returns a builder for [SessionService].
5095    ///
5096    /// ```
5097    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
5098    /// # use google_cloud_discoveryengine_v1::client::SessionService;
5099    /// let client = SessionService::builder().build().await?;
5100    /// # Ok(()) }
5101    /// ```
5102    pub fn builder() -> super::builder::session_service::ClientBuilder {
5103        crate::new_client_builder(super::builder::session_service::client::Factory)
5104    }
5105
5106    /// Creates a new client from the provided stub.
5107    ///
5108    /// The most common case for calling this function is in tests mocking the
5109    /// client's behavior.
5110    pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
5111    where
5112        T: super::stub::SessionService + 'static,
5113    {
5114        Self { inner: stub.into() }
5115    }
5116
5117    pub(crate) async fn new(
5118        config: gaxi::options::ClientConfig,
5119    ) -> crate::ClientBuilderResult<Self> {
5120        let inner = Self::build_inner(config).await?;
5121        Ok(Self { inner })
5122    }
5123
5124    async fn build_inner(
5125        conf: gaxi::options::ClientConfig,
5126    ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::SessionService>> {
5127        if gaxi::options::tracing_enabled(&conf) {
5128            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
5129        }
5130        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
5131    }
5132
5133    async fn build_transport(
5134        conf: gaxi::options::ClientConfig,
5135    ) -> crate::ClientBuilderResult<impl super::stub::SessionService> {
5136        super::transport::SessionService::new(conf).await
5137    }
5138
5139    async fn build_with_tracing(
5140        conf: gaxi::options::ClientConfig,
5141    ) -> crate::ClientBuilderResult<impl super::stub::SessionService> {
5142        Self::build_transport(conf)
5143            .await
5144            .map(super::tracing::SessionService::new)
5145    }
5146
5147    /// Creates a Session.
5148    ///
5149    /// If the [Session][google.cloud.discoveryengine.v1.Session] to create already
5150    /// exists, an ALREADY_EXISTS error is returned.
5151    ///
5152    /// [google.cloud.discoveryengine.v1.Session]: crate::model::Session
5153    ///
5154    /// # Example
5155    /// ```
5156    /// # use google_cloud_discoveryengine_v1::client::SessionService;
5157    /// use google_cloud_discoveryengine_v1::model::Session;
5158    /// use google_cloud_discoveryengine_v1::Result;
5159    /// async fn sample(
5160    ///    client: &SessionService, project_id: &str, location_id: &str, data_store_id: &str
5161    /// ) -> Result<()> {
5162    ///     let response = client.create_session()
5163    ///         .set_parent(format!("projects/{project_id}/locations/{location_id}/dataStores/{data_store_id}"))
5164    ///         .set_session(
5165    ///             Session::new()/* set fields */
5166    ///         )
5167    ///         .send().await?;
5168    ///     println!("response {:?}", response);
5169    ///     Ok(())
5170    /// }
5171    /// ```
5172    pub fn create_session(&self) -> super::builder::session_service::CreateSession {
5173        super::builder::session_service::CreateSession::new(self.inner.clone())
5174    }
5175
5176    /// Deletes a Session.
5177    ///
5178    /// If the [Session][google.cloud.discoveryengine.v1.Session] to delete does
5179    /// not exist, a NOT_FOUND error is returned.
5180    ///
5181    /// [google.cloud.discoveryengine.v1.Session]: crate::model::Session
5182    ///
5183    /// # Example
5184    /// ```
5185    /// # use google_cloud_discoveryengine_v1::client::SessionService;
5186    /// use google_cloud_discoveryengine_v1::Result;
5187    /// async fn sample(
5188    ///    client: &SessionService, project_id: &str, location_id: &str, data_store_id: &str, session_id: &str
5189    /// ) -> Result<()> {
5190    ///     client.delete_session()
5191    ///         .set_name(format!("projects/{project_id}/locations/{location_id}/dataStores/{data_store_id}/sessions/{session_id}"))
5192    ///         .send().await?;
5193    ///     Ok(())
5194    /// }
5195    /// ```
5196    pub fn delete_session(&self) -> super::builder::session_service::DeleteSession {
5197        super::builder::session_service::DeleteSession::new(self.inner.clone())
5198    }
5199
5200    /// Updates a Session.
5201    ///
5202    /// [Session][google.cloud.discoveryengine.v1.Session] action type cannot be
5203    /// changed. If the [Session][google.cloud.discoveryengine.v1.Session] to
5204    /// update does not exist, a NOT_FOUND error is returned.
5205    ///
5206    /// [google.cloud.discoveryengine.v1.Session]: crate::model::Session
5207    ///
5208    /// # Example
5209    /// ```
5210    /// # use google_cloud_discoveryengine_v1::client::SessionService;
5211    /// # extern crate wkt as google_cloud_wkt;
5212    /// use google_cloud_wkt::FieldMask;
5213    /// use google_cloud_discoveryengine_v1::model::Session;
5214    /// use google_cloud_discoveryengine_v1::Result;
5215    /// async fn sample(
5216    ///    client: &SessionService, project_id: &str, location_id: &str, data_store_id: &str, session_id: &str
5217    /// ) -> Result<()> {
5218    ///     let response = client.update_session()
5219    ///         .set_session(
5220    ///             Session::new().set_name(format!("projects/{project_id}/locations/{location_id}/dataStores/{data_store_id}/sessions/{session_id}"))/* set fields */
5221    ///         )
5222    ///         .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
5223    ///         .send().await?;
5224    ///     println!("response {:?}", response);
5225    ///     Ok(())
5226    /// }
5227    /// ```
5228    pub fn update_session(&self) -> super::builder::session_service::UpdateSession {
5229        super::builder::session_service::UpdateSession::new(self.inner.clone())
5230    }
5231
5232    /// Gets a Session.
5233    ///
5234    /// # Example
5235    /// ```
5236    /// # use google_cloud_discoveryengine_v1::client::SessionService;
5237    /// use google_cloud_discoveryengine_v1::Result;
5238    /// async fn sample(
5239    ///    client: &SessionService, project_id: &str, location_id: &str, data_store_id: &str, session_id: &str
5240    /// ) -> Result<()> {
5241    ///     let response = client.get_session()
5242    ///         .set_name(format!("projects/{project_id}/locations/{location_id}/dataStores/{data_store_id}/sessions/{session_id}"))
5243    ///         .send().await?;
5244    ///     println!("response {:?}", response);
5245    ///     Ok(())
5246    /// }
5247    /// ```
5248    pub fn get_session(&self) -> super::builder::session_service::GetSession {
5249        super::builder::session_service::GetSession::new(self.inner.clone())
5250    }
5251
5252    /// Lists all Sessions by their parent
5253    /// [DataStore][google.cloud.discoveryengine.v1.DataStore].
5254    ///
5255    /// [google.cloud.discoveryengine.v1.DataStore]: crate::model::DataStore
5256    ///
5257    /// # Example
5258    /// ```
5259    /// # use google_cloud_discoveryengine_v1::client::SessionService;
5260    /// use google_cloud_gax::paginator::ItemPaginator as _;
5261    /// use google_cloud_discoveryengine_v1::Result;
5262    /// async fn sample(
5263    ///    client: &SessionService, project_id: &str, location_id: &str, data_store_id: &str
5264    /// ) -> Result<()> {
5265    ///     let mut list = client.list_sessions()
5266    ///         .set_parent(format!("projects/{project_id}/locations/{location_id}/dataStores/{data_store_id}"))
5267    ///         .by_item();
5268    ///     while let Some(item) = list.next().await.transpose()? {
5269    ///         println!("{:?}", item);
5270    ///     }
5271    ///     Ok(())
5272    /// }
5273    /// ```
5274    pub fn list_sessions(&self) -> super::builder::session_service::ListSessions {
5275        super::builder::session_service::ListSessions::new(self.inner.clone())
5276    }
5277
5278    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
5279    ///
5280    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
5281    ///
5282    /// # Example
5283    /// ```
5284    /// # use google_cloud_discoveryengine_v1::client::SessionService;
5285    /// use google_cloud_gax::paginator::ItemPaginator as _;
5286    /// use google_cloud_discoveryengine_v1::Result;
5287    /// async fn sample(
5288    ///    client: &SessionService
5289    /// ) -> Result<()> {
5290    ///     let mut list = client.list_operations()
5291    ///         /* set fields */
5292    ///         .by_item();
5293    ///     while let Some(item) = list.next().await.transpose()? {
5294    ///         println!("{:?}", item);
5295    ///     }
5296    ///     Ok(())
5297    /// }
5298    /// ```
5299    pub fn list_operations(&self) -> super::builder::session_service::ListOperations {
5300        super::builder::session_service::ListOperations::new(self.inner.clone())
5301    }
5302
5303    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
5304    ///
5305    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
5306    ///
5307    /// # Example
5308    /// ```
5309    /// # use google_cloud_discoveryengine_v1::client::SessionService;
5310    /// use google_cloud_discoveryengine_v1::Result;
5311    /// async fn sample(
5312    ///    client: &SessionService
5313    /// ) -> Result<()> {
5314    ///     let response = client.get_operation()
5315    ///         /* set fields */
5316    ///         .send().await?;
5317    ///     println!("response {:?}", response);
5318    ///     Ok(())
5319    /// }
5320    /// ```
5321    pub fn get_operation(&self) -> super::builder::session_service::GetOperation {
5322        super::builder::session_service::GetOperation::new(self.inner.clone())
5323    }
5324
5325    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
5326    ///
5327    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
5328    ///
5329    /// # Example
5330    /// ```
5331    /// # use google_cloud_discoveryengine_v1::client::SessionService;
5332    /// use google_cloud_discoveryengine_v1::Result;
5333    /// async fn sample(
5334    ///    client: &SessionService
5335    /// ) -> Result<()> {
5336    ///     client.cancel_operation()
5337    ///         /* set fields */
5338    ///         .send().await?;
5339    ///     Ok(())
5340    /// }
5341    /// ```
5342    pub fn cancel_operation(&self) -> super::builder::session_service::CancelOperation {
5343        super::builder::session_service::CancelOperation::new(self.inner.clone())
5344    }
5345}
5346
5347/// Implements a client for the Discovery Engine API.
5348///
5349/// # Example
5350/// ```
5351/// # use google_cloud_discoveryengine_v1::client::SiteSearchEngineService;
5352/// use google_cloud_gax::paginator::ItemPaginator as _;
5353/// async fn sample(
5354///    project_id: &str,
5355///    location_id: &str,
5356///    data_store_id: &str,
5357/// ) -> anyhow::Result<()> {
5358///     let client = SiteSearchEngineService::builder().build().await?;
5359///     let mut list = client.list_target_sites()
5360///         .set_parent(format!("projects/{project_id}/locations/{location_id}/dataStores/{data_store_id}/siteSearchEngine"))
5361///         .by_item();
5362///     while let Some(item) = list.next().await.transpose()? {
5363///         println!("{:?}", item);
5364///     }
5365///     Ok(())
5366/// }
5367/// ```
5368///
5369/// # Service Description
5370///
5371/// Service for managing site search related resources.
5372///
5373/// # Configuration
5374///
5375/// To configure `SiteSearchEngineService` use the `with_*` methods in the type returned
5376/// by [builder()][SiteSearchEngineService::builder]. The default configuration should
5377/// work for most applications. Common configuration changes include
5378///
5379/// * [with_endpoint()]: by default this client uses the global default endpoint
5380///   (`https://discoveryengine.googleapis.com`). Applications using regional
5381///   endpoints or running in restricted networks (e.g. a network configured
5382//    with [Private Google Access with VPC Service Controls]) may want to
5383///   override this default.
5384/// * [with_credentials()]: by default this client uses
5385///   [Application Default Credentials]. Applications using custom
5386///   authentication may need to override this default.
5387///
5388/// [with_endpoint()]: super::builder::site_search_engine_service::ClientBuilder::with_endpoint
5389/// [with_credentials()]: super::builder::site_search_engine_service::ClientBuilder::with_credentials
5390/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
5391/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
5392///
5393/// # Pooling and Cloning
5394///
5395/// `SiteSearchEngineService` holds a connection pool internally, it is advised to
5396/// create one and reuse it. You do not need to wrap `SiteSearchEngineService` in
5397/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
5398/// already uses an `Arc` internally.
5399#[cfg(feature = "site-search-engine-service")]
5400#[cfg_attr(docsrs, doc(cfg(feature = "site-search-engine-service")))]
5401#[derive(Clone, Debug)]
5402pub struct SiteSearchEngineService {
5403    inner: std::sync::Arc<dyn super::stub::dynamic::SiteSearchEngineService>,
5404}
5405
5406#[cfg(feature = "site-search-engine-service")]
5407impl SiteSearchEngineService {
5408    /// Returns a builder for [SiteSearchEngineService].
5409    ///
5410    /// ```
5411    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
5412    /// # use google_cloud_discoveryengine_v1::client::SiteSearchEngineService;
5413    /// let client = SiteSearchEngineService::builder().build().await?;
5414    /// # Ok(()) }
5415    /// ```
5416    pub fn builder() -> super::builder::site_search_engine_service::ClientBuilder {
5417        crate::new_client_builder(super::builder::site_search_engine_service::client::Factory)
5418    }
5419
5420    /// Creates a new client from the provided stub.
5421    ///
5422    /// The most common case for calling this function is in tests mocking the
5423    /// client's behavior.
5424    pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
5425    where
5426        T: super::stub::SiteSearchEngineService + 'static,
5427    {
5428        Self { inner: stub.into() }
5429    }
5430
5431    pub(crate) async fn new(
5432        config: gaxi::options::ClientConfig,
5433    ) -> crate::ClientBuilderResult<Self> {
5434        let inner = Self::build_inner(config).await?;
5435        Ok(Self { inner })
5436    }
5437
5438    async fn build_inner(
5439        conf: gaxi::options::ClientConfig,
5440    ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::SiteSearchEngineService>>
5441    {
5442        if gaxi::options::tracing_enabled(&conf) {
5443            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
5444        }
5445        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
5446    }
5447
5448    async fn build_transport(
5449        conf: gaxi::options::ClientConfig,
5450    ) -> crate::ClientBuilderResult<impl super::stub::SiteSearchEngineService> {
5451        super::transport::SiteSearchEngineService::new(conf).await
5452    }
5453
5454    async fn build_with_tracing(
5455        conf: gaxi::options::ClientConfig,
5456    ) -> crate::ClientBuilderResult<impl super::stub::SiteSearchEngineService> {
5457        Self::build_transport(conf)
5458            .await
5459            .map(super::tracing::SiteSearchEngineService::new)
5460    }
5461
5462    /// Gets the
5463    /// [SiteSearchEngine][google.cloud.discoveryengine.v1.SiteSearchEngine].
5464    ///
5465    /// [google.cloud.discoveryengine.v1.SiteSearchEngine]: crate::model::SiteSearchEngine
5466    ///
5467    /// # Example
5468    /// ```
5469    /// # use google_cloud_discoveryengine_v1::client::SiteSearchEngineService;
5470    /// use google_cloud_discoveryengine_v1::Result;
5471    /// async fn sample(
5472    ///    client: &SiteSearchEngineService, project_id: &str, location_id: &str, data_store_id: &str
5473    /// ) -> Result<()> {
5474    ///     let response = client.get_site_search_engine()
5475    ///         .set_name(format!("projects/{project_id}/locations/{location_id}/dataStores/{data_store_id}/siteSearchEngine"))
5476    ///         .send().await?;
5477    ///     println!("response {:?}", response);
5478    ///     Ok(())
5479    /// }
5480    /// ```
5481    pub fn get_site_search_engine(
5482        &self,
5483    ) -> super::builder::site_search_engine_service::GetSiteSearchEngine {
5484        super::builder::site_search_engine_service::GetSiteSearchEngine::new(self.inner.clone())
5485    }
5486
5487    /// Creates a [TargetSite][google.cloud.discoveryengine.v1.TargetSite].
5488    ///
5489    /// [google.cloud.discoveryengine.v1.TargetSite]: crate::model::TargetSite
5490    ///
5491    /// # Long running operations
5492    ///
5493    /// This method is used to start, and/or poll a [long-running Operation].
5494    /// The [Working with long-running operations] chapter in the [user guide]
5495    /// covers these operations in detail.
5496    ///
5497    /// [long-running operation]: https://google.aip.dev/151
5498    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
5499    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
5500    ///
5501    /// # Example
5502    /// ```
5503    /// # use google_cloud_discoveryengine_v1::client::SiteSearchEngineService;
5504    /// use google_cloud_lro::Poller;
5505    /// use google_cloud_discoveryengine_v1::model::TargetSite;
5506    /// use google_cloud_discoveryengine_v1::Result;
5507    /// async fn sample(
5508    ///    client: &SiteSearchEngineService, project_id: &str, location_id: &str, data_store_id: &str
5509    /// ) -> Result<()> {
5510    ///     let response = client.create_target_site()
5511    ///         .set_parent(format!("projects/{project_id}/locations/{location_id}/dataStores/{data_store_id}/siteSearchEngine"))
5512    ///         .set_target_site(
5513    ///             TargetSite::new()/* set fields */
5514    ///         )
5515    ///         .poller().until_done().await?;
5516    ///     println!("response {:?}", response);
5517    ///     Ok(())
5518    /// }
5519    /// ```
5520    pub fn create_target_site(
5521        &self,
5522    ) -> super::builder::site_search_engine_service::CreateTargetSite {
5523        super::builder::site_search_engine_service::CreateTargetSite::new(self.inner.clone())
5524    }
5525
5526    /// Creates [TargetSite][google.cloud.discoveryengine.v1.TargetSite] in a
5527    /// batch.
5528    ///
5529    /// [google.cloud.discoveryengine.v1.TargetSite]: crate::model::TargetSite
5530    ///
5531    /// # Long running operations
5532    ///
5533    /// This method is used to start, and/or poll a [long-running Operation].
5534    /// The [Working with long-running operations] chapter in the [user guide]
5535    /// covers these operations in detail.
5536    ///
5537    /// [long-running operation]: https://google.aip.dev/151
5538    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
5539    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
5540    ///
5541    /// # Example
5542    /// ```
5543    /// # use google_cloud_discoveryengine_v1::client::SiteSearchEngineService;
5544    /// use google_cloud_lro::Poller;
5545    /// use google_cloud_discoveryengine_v1::Result;
5546    /// async fn sample(
5547    ///    client: &SiteSearchEngineService
5548    /// ) -> Result<()> {
5549    ///     let response = client.batch_create_target_sites()
5550    ///         /* set fields */
5551    ///         .poller().until_done().await?;
5552    ///     println!("response {:?}", response);
5553    ///     Ok(())
5554    /// }
5555    /// ```
5556    pub fn batch_create_target_sites(
5557        &self,
5558    ) -> super::builder::site_search_engine_service::BatchCreateTargetSites {
5559        super::builder::site_search_engine_service::BatchCreateTargetSites::new(self.inner.clone())
5560    }
5561
5562    /// Gets a [TargetSite][google.cloud.discoveryengine.v1.TargetSite].
5563    ///
5564    /// [google.cloud.discoveryengine.v1.TargetSite]: crate::model::TargetSite
5565    ///
5566    /// # Example
5567    /// ```
5568    /// # use google_cloud_discoveryengine_v1::client::SiteSearchEngineService;
5569    /// use google_cloud_discoveryengine_v1::Result;
5570    /// async fn sample(
5571    ///    client: &SiteSearchEngineService, project_id: &str, location_id: &str, data_store_id: &str, target_site_id: &str
5572    /// ) -> Result<()> {
5573    ///     let response = client.get_target_site()
5574    ///         .set_name(format!("projects/{project_id}/locations/{location_id}/dataStores/{data_store_id}/siteSearchEngine/targetSites/{target_site_id}"))
5575    ///         .send().await?;
5576    ///     println!("response {:?}", response);
5577    ///     Ok(())
5578    /// }
5579    /// ```
5580    pub fn get_target_site(&self) -> super::builder::site_search_engine_service::GetTargetSite {
5581        super::builder::site_search_engine_service::GetTargetSite::new(self.inner.clone())
5582    }
5583
5584    /// Updates a [TargetSite][google.cloud.discoveryengine.v1.TargetSite].
5585    ///
5586    /// [google.cloud.discoveryengine.v1.TargetSite]: crate::model::TargetSite
5587    ///
5588    /// # Long running operations
5589    ///
5590    /// This method is used to start, and/or poll a [long-running Operation].
5591    /// The [Working with long-running operations] chapter in the [user guide]
5592    /// covers these operations in detail.
5593    ///
5594    /// [long-running operation]: https://google.aip.dev/151
5595    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
5596    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
5597    ///
5598    /// # Example
5599    /// ```
5600    /// # use google_cloud_discoveryengine_v1::client::SiteSearchEngineService;
5601    /// use google_cloud_lro::Poller;
5602    /// use google_cloud_discoveryengine_v1::model::TargetSite;
5603    /// use google_cloud_discoveryengine_v1::Result;
5604    /// async fn sample(
5605    ///    client: &SiteSearchEngineService, project_id: &str, location_id: &str, data_store_id: &str, target_site_id: &str
5606    /// ) -> Result<()> {
5607    ///     let response = client.update_target_site()
5608    ///         .set_target_site(
5609    ///             TargetSite::new().set_name(format!("projects/{project_id}/locations/{location_id}/dataStores/{data_store_id}/siteSearchEngine/targetSites/{target_site_id}"))/* set fields */
5610    ///         )
5611    ///         .poller().until_done().await?;
5612    ///     println!("response {:?}", response);
5613    ///     Ok(())
5614    /// }
5615    /// ```
5616    pub fn update_target_site(
5617        &self,
5618    ) -> super::builder::site_search_engine_service::UpdateTargetSite {
5619        super::builder::site_search_engine_service::UpdateTargetSite::new(self.inner.clone())
5620    }
5621
5622    /// Deletes a [TargetSite][google.cloud.discoveryengine.v1.TargetSite].
5623    ///
5624    /// [google.cloud.discoveryengine.v1.TargetSite]: crate::model::TargetSite
5625    ///
5626    /// # Long running operations
5627    ///
5628    /// This method is used to start, and/or poll a [long-running Operation].
5629    /// The [Working with long-running operations] chapter in the [user guide]
5630    /// covers these operations in detail.
5631    ///
5632    /// [long-running operation]: https://google.aip.dev/151
5633    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
5634    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
5635    ///
5636    /// # Example
5637    /// ```
5638    /// # use google_cloud_discoveryengine_v1::client::SiteSearchEngineService;
5639    /// use google_cloud_lro::Poller;
5640    /// use google_cloud_discoveryengine_v1::Result;
5641    /// async fn sample(
5642    ///    client: &SiteSearchEngineService, project_id: &str, location_id: &str, data_store_id: &str, target_site_id: &str
5643    /// ) -> Result<()> {
5644    ///     client.delete_target_site()
5645    ///         .set_name(format!("projects/{project_id}/locations/{location_id}/dataStores/{data_store_id}/siteSearchEngine/targetSites/{target_site_id}"))
5646    ///         .poller().until_done().await?;
5647    ///     Ok(())
5648    /// }
5649    /// ```
5650    pub fn delete_target_site(
5651        &self,
5652    ) -> super::builder::site_search_engine_service::DeleteTargetSite {
5653        super::builder::site_search_engine_service::DeleteTargetSite::new(self.inner.clone())
5654    }
5655
5656    /// Gets a list of [TargetSite][google.cloud.discoveryengine.v1.TargetSite]s.
5657    ///
5658    /// [google.cloud.discoveryengine.v1.TargetSite]: crate::model::TargetSite
5659    ///
5660    /// # Example
5661    /// ```
5662    /// # use google_cloud_discoveryengine_v1::client::SiteSearchEngineService;
5663    /// use google_cloud_gax::paginator::ItemPaginator as _;
5664    /// use google_cloud_discoveryengine_v1::Result;
5665    /// async fn sample(
5666    ///    client: &SiteSearchEngineService, project_id: &str, location_id: &str, data_store_id: &str
5667    /// ) -> Result<()> {
5668    ///     let mut list = client.list_target_sites()
5669    ///         .set_parent(format!("projects/{project_id}/locations/{location_id}/dataStores/{data_store_id}/siteSearchEngine"))
5670    ///         .by_item();
5671    ///     while let Some(item) = list.next().await.transpose()? {
5672    ///         println!("{:?}", item);
5673    ///     }
5674    ///     Ok(())
5675    /// }
5676    /// ```
5677    pub fn list_target_sites(&self) -> super::builder::site_search_engine_service::ListTargetSites {
5678        super::builder::site_search_engine_service::ListTargetSites::new(self.inner.clone())
5679    }
5680
5681    /// Creates a [Sitemap][google.cloud.discoveryengine.v1.Sitemap].
5682    ///
5683    /// [google.cloud.discoveryengine.v1.Sitemap]: crate::model::Sitemap
5684    ///
5685    /// # Long running operations
5686    ///
5687    /// This method is used to start, and/or poll a [long-running Operation].
5688    /// The [Working with long-running operations] chapter in the [user guide]
5689    /// covers these operations in detail.
5690    ///
5691    /// [long-running operation]: https://google.aip.dev/151
5692    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
5693    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
5694    ///
5695    /// # Example
5696    /// ```
5697    /// # use google_cloud_discoveryengine_v1::client::SiteSearchEngineService;
5698    /// use google_cloud_lro::Poller;
5699    /// use google_cloud_discoveryengine_v1::model::Sitemap;
5700    /// use google_cloud_discoveryengine_v1::Result;
5701    /// async fn sample(
5702    ///    client: &SiteSearchEngineService, project_id: &str, location_id: &str, data_store_id: &str
5703    /// ) -> Result<()> {
5704    ///     let response = client.create_sitemap()
5705    ///         .set_parent(format!("projects/{project_id}/locations/{location_id}/dataStores/{data_store_id}/siteSearchEngine"))
5706    ///         .set_sitemap(
5707    ///             Sitemap::new()/* set fields */
5708    ///         )
5709    ///         .poller().until_done().await?;
5710    ///     println!("response {:?}", response);
5711    ///     Ok(())
5712    /// }
5713    /// ```
5714    pub fn create_sitemap(&self) -> super::builder::site_search_engine_service::CreateSitemap {
5715        super::builder::site_search_engine_service::CreateSitemap::new(self.inner.clone())
5716    }
5717
5718    /// Deletes a [Sitemap][google.cloud.discoveryengine.v1.Sitemap].
5719    ///
5720    /// [google.cloud.discoveryengine.v1.Sitemap]: crate::model::Sitemap
5721    ///
5722    /// # Long running operations
5723    ///
5724    /// This method is used to start, and/or poll a [long-running Operation].
5725    /// The [Working with long-running operations] chapter in the [user guide]
5726    /// covers these operations in detail.
5727    ///
5728    /// [long-running operation]: https://google.aip.dev/151
5729    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
5730    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
5731    ///
5732    /// # Example
5733    /// ```
5734    /// # use google_cloud_discoveryengine_v1::client::SiteSearchEngineService;
5735    /// use google_cloud_lro::Poller;
5736    /// use google_cloud_discoveryengine_v1::Result;
5737    /// async fn sample(
5738    ///    client: &SiteSearchEngineService, project_id: &str, location_id: &str, data_store_id: &str, sitemap_id: &str
5739    /// ) -> Result<()> {
5740    ///     client.delete_sitemap()
5741    ///         .set_name(format!("projects/{project_id}/locations/{location_id}/dataStores/{data_store_id}/siteSearchEngine/sitemaps/{sitemap_id}"))
5742    ///         .poller().until_done().await?;
5743    ///     Ok(())
5744    /// }
5745    /// ```
5746    pub fn delete_sitemap(&self) -> super::builder::site_search_engine_service::DeleteSitemap {
5747        super::builder::site_search_engine_service::DeleteSitemap::new(self.inner.clone())
5748    }
5749
5750    /// Fetch [Sitemap][google.cloud.discoveryengine.v1.Sitemap]s in a
5751    /// [DataStore][google.cloud.discoveryengine.v1.DataStore].
5752    ///
5753    /// [google.cloud.discoveryengine.v1.DataStore]: crate::model::DataStore
5754    /// [google.cloud.discoveryengine.v1.Sitemap]: crate::model::Sitemap
5755    ///
5756    /// # Example
5757    /// ```
5758    /// # use google_cloud_discoveryengine_v1::client::SiteSearchEngineService;
5759    /// use google_cloud_discoveryengine_v1::Result;
5760    /// async fn sample(
5761    ///    client: &SiteSearchEngineService
5762    /// ) -> Result<()> {
5763    ///     let response = client.fetch_sitemaps()
5764    ///         /* set fields */
5765    ///         .send().await?;
5766    ///     println!("response {:?}", response);
5767    ///     Ok(())
5768    /// }
5769    /// ```
5770    pub fn fetch_sitemaps(&self) -> super::builder::site_search_engine_service::FetchSitemaps {
5771        super::builder::site_search_engine_service::FetchSitemaps::new(self.inner.clone())
5772    }
5773
5774    /// Upgrade from basic site search to advanced site search.
5775    ///
5776    /// # Long running operations
5777    ///
5778    /// This method is used to start, and/or poll a [long-running Operation].
5779    /// The [Working with long-running operations] chapter in the [user guide]
5780    /// covers these operations in detail.
5781    ///
5782    /// [long-running operation]: https://google.aip.dev/151
5783    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
5784    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
5785    ///
5786    /// # Example
5787    /// ```
5788    /// # use google_cloud_discoveryengine_v1::client::SiteSearchEngineService;
5789    /// use google_cloud_lro::Poller;
5790    /// use google_cloud_discoveryengine_v1::Result;
5791    /// async fn sample(
5792    ///    client: &SiteSearchEngineService
5793    /// ) -> Result<()> {
5794    ///     let response = client.enable_advanced_site_search()
5795    ///         /* set fields */
5796    ///         .poller().until_done().await?;
5797    ///     println!("response {:?}", response);
5798    ///     Ok(())
5799    /// }
5800    /// ```
5801    pub fn enable_advanced_site_search(
5802        &self,
5803    ) -> super::builder::site_search_engine_service::EnableAdvancedSiteSearch {
5804        super::builder::site_search_engine_service::EnableAdvancedSiteSearch::new(
5805            self.inner.clone(),
5806        )
5807    }
5808
5809    /// Downgrade from advanced site search to basic site search.
5810    ///
5811    /// # Long running operations
5812    ///
5813    /// This method is used to start, and/or poll a [long-running Operation].
5814    /// The [Working with long-running operations] chapter in the [user guide]
5815    /// covers these operations in detail.
5816    ///
5817    /// [long-running operation]: https://google.aip.dev/151
5818    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
5819    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
5820    ///
5821    /// # Example
5822    /// ```
5823    /// # use google_cloud_discoveryengine_v1::client::SiteSearchEngineService;
5824    /// use google_cloud_lro::Poller;
5825    /// use google_cloud_discoveryengine_v1::Result;
5826    /// async fn sample(
5827    ///    client: &SiteSearchEngineService
5828    /// ) -> Result<()> {
5829    ///     let response = client.disable_advanced_site_search()
5830    ///         /* set fields */
5831    ///         .poller().until_done().await?;
5832    ///     println!("response {:?}", response);
5833    ///     Ok(())
5834    /// }
5835    /// ```
5836    pub fn disable_advanced_site_search(
5837        &self,
5838    ) -> super::builder::site_search_engine_service::DisableAdvancedSiteSearch {
5839        super::builder::site_search_engine_service::DisableAdvancedSiteSearch::new(
5840            self.inner.clone(),
5841        )
5842    }
5843
5844    /// Request on-demand recrawl for a list of URIs.
5845    ///
5846    /// # Long running operations
5847    ///
5848    /// This method is used to start, and/or poll a [long-running Operation].
5849    /// The [Working with long-running operations] chapter in the [user guide]
5850    /// covers these operations in detail.
5851    ///
5852    /// [long-running operation]: https://google.aip.dev/151
5853    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
5854    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
5855    ///
5856    /// # Example
5857    /// ```
5858    /// # use google_cloud_discoveryengine_v1::client::SiteSearchEngineService;
5859    /// use google_cloud_lro::Poller;
5860    /// use google_cloud_discoveryengine_v1::Result;
5861    /// async fn sample(
5862    ///    client: &SiteSearchEngineService
5863    /// ) -> Result<()> {
5864    ///     let response = client.recrawl_uris()
5865    ///         /* set fields */
5866    ///         .poller().until_done().await?;
5867    ///     println!("response {:?}", response);
5868    ///     Ok(())
5869    /// }
5870    /// ```
5871    pub fn recrawl_uris(&self) -> super::builder::site_search_engine_service::RecrawlUris {
5872        super::builder::site_search_engine_service::RecrawlUris::new(self.inner.clone())
5873    }
5874
5875    /// Verify target sites' ownership and validity.
5876    /// This API sends all the target sites under site search engine for
5877    /// verification.
5878    ///
5879    /// # Long running operations
5880    ///
5881    /// This method is used to start, and/or poll a [long-running Operation].
5882    /// The [Working with long-running operations] chapter in the [user guide]
5883    /// covers these operations in detail.
5884    ///
5885    /// [long-running operation]: https://google.aip.dev/151
5886    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
5887    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
5888    ///
5889    /// # Example
5890    /// ```
5891    /// # use google_cloud_discoveryengine_v1::client::SiteSearchEngineService;
5892    /// use google_cloud_lro::Poller;
5893    /// use google_cloud_discoveryengine_v1::Result;
5894    /// async fn sample(
5895    ///    client: &SiteSearchEngineService
5896    /// ) -> Result<()> {
5897    ///     let response = client.batch_verify_target_sites()
5898    ///         /* set fields */
5899    ///         .poller().until_done().await?;
5900    ///     println!("response {:?}", response);
5901    ///     Ok(())
5902    /// }
5903    /// ```
5904    pub fn batch_verify_target_sites(
5905        &self,
5906    ) -> super::builder::site_search_engine_service::BatchVerifyTargetSites {
5907        super::builder::site_search_engine_service::BatchVerifyTargetSites::new(self.inner.clone())
5908    }
5909
5910    /// Returns list of target sites with its domain verification status.
5911    /// This method can only be called under data store with BASIC_SITE_SEARCH
5912    /// state at the moment.
5913    ///
5914    /// # Example
5915    /// ```
5916    /// # use google_cloud_discoveryengine_v1::client::SiteSearchEngineService;
5917    /// use google_cloud_gax::paginator::ItemPaginator as _;
5918    /// use google_cloud_discoveryengine_v1::Result;
5919    /// async fn sample(
5920    ///    client: &SiteSearchEngineService
5921    /// ) -> Result<()> {
5922    ///     let mut list = client.fetch_domain_verification_status()
5923    ///         /* set fields */
5924    ///         .by_item();
5925    ///     while let Some(item) = list.next().await.transpose()? {
5926    ///         println!("{:?}", item);
5927    ///     }
5928    ///     Ok(())
5929    /// }
5930    /// ```
5931    pub fn fetch_domain_verification_status(
5932        &self,
5933    ) -> super::builder::site_search_engine_service::FetchDomainVerificationStatus {
5934        super::builder::site_search_engine_service::FetchDomainVerificationStatus::new(
5935            self.inner.clone(),
5936        )
5937    }
5938
5939    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
5940    ///
5941    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
5942    ///
5943    /// # Example
5944    /// ```
5945    /// # use google_cloud_discoveryengine_v1::client::SiteSearchEngineService;
5946    /// use google_cloud_gax::paginator::ItemPaginator as _;
5947    /// use google_cloud_discoveryengine_v1::Result;
5948    /// async fn sample(
5949    ///    client: &SiteSearchEngineService
5950    /// ) -> Result<()> {
5951    ///     let mut list = client.list_operations()
5952    ///         /* set fields */
5953    ///         .by_item();
5954    ///     while let Some(item) = list.next().await.transpose()? {
5955    ///         println!("{:?}", item);
5956    ///     }
5957    ///     Ok(())
5958    /// }
5959    /// ```
5960    pub fn list_operations(&self) -> super::builder::site_search_engine_service::ListOperations {
5961        super::builder::site_search_engine_service::ListOperations::new(self.inner.clone())
5962    }
5963
5964    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
5965    ///
5966    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
5967    ///
5968    /// # Example
5969    /// ```
5970    /// # use google_cloud_discoveryengine_v1::client::SiteSearchEngineService;
5971    /// use google_cloud_discoveryengine_v1::Result;
5972    /// async fn sample(
5973    ///    client: &SiteSearchEngineService
5974    /// ) -> Result<()> {
5975    ///     let response = client.get_operation()
5976    ///         /* set fields */
5977    ///         .send().await?;
5978    ///     println!("response {:?}", response);
5979    ///     Ok(())
5980    /// }
5981    /// ```
5982    pub fn get_operation(&self) -> super::builder::site_search_engine_service::GetOperation {
5983        super::builder::site_search_engine_service::GetOperation::new(self.inner.clone())
5984    }
5985
5986    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
5987    ///
5988    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
5989    ///
5990    /// # Example
5991    /// ```
5992    /// # use google_cloud_discoveryengine_v1::client::SiteSearchEngineService;
5993    /// use google_cloud_discoveryengine_v1::Result;
5994    /// async fn sample(
5995    ///    client: &SiteSearchEngineService
5996    /// ) -> Result<()> {
5997    ///     client.cancel_operation()
5998    ///         /* set fields */
5999    ///         .send().await?;
6000    ///     Ok(())
6001    /// }
6002    /// ```
6003    pub fn cancel_operation(&self) -> super::builder::site_search_engine_service::CancelOperation {
6004        super::builder::site_search_engine_service::CancelOperation::new(self.inner.clone())
6005    }
6006}
6007
6008/// Implements a client for the Discovery Engine API.
6009///
6010/// # Example
6011/// ```
6012/// # use google_cloud_discoveryengine_v1::client::UserEventService;
6013/// async fn sample(
6014/// ) -> anyhow::Result<()> {
6015///     let client = UserEventService::builder().build().await?;
6016///     let response = client.write_user_event()
6017///         /* set fields */
6018///         .send().await?;
6019///     println!("response {:?}", response);
6020///     Ok(())
6021/// }
6022/// ```
6023///
6024/// # Service Description
6025///
6026/// Service for ingesting end user actions on a website to Discovery Engine API.
6027///
6028/// # Configuration
6029///
6030/// To configure `UserEventService` use the `with_*` methods in the type returned
6031/// by [builder()][UserEventService::builder]. The default configuration should
6032/// work for most applications. Common configuration changes include
6033///
6034/// * [with_endpoint()]: by default this client uses the global default endpoint
6035///   (`https://discoveryengine.googleapis.com`). Applications using regional
6036///   endpoints or running in restricted networks (e.g. a network configured
6037//    with [Private Google Access with VPC Service Controls]) may want to
6038///   override this default.
6039/// * [with_credentials()]: by default this client uses
6040///   [Application Default Credentials]. Applications using custom
6041///   authentication may need to override this default.
6042///
6043/// [with_endpoint()]: super::builder::user_event_service::ClientBuilder::with_endpoint
6044/// [with_credentials()]: super::builder::user_event_service::ClientBuilder::with_credentials
6045/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
6046/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
6047///
6048/// # Pooling and Cloning
6049///
6050/// `UserEventService` holds a connection pool internally, it is advised to
6051/// create one and reuse it. You do not need to wrap `UserEventService` in
6052/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
6053/// already uses an `Arc` internally.
6054#[cfg(feature = "user-event-service")]
6055#[cfg_attr(docsrs, doc(cfg(feature = "user-event-service")))]
6056#[derive(Clone, Debug)]
6057pub struct UserEventService {
6058    inner: std::sync::Arc<dyn super::stub::dynamic::UserEventService>,
6059}
6060
6061#[cfg(feature = "user-event-service")]
6062impl UserEventService {
6063    /// Returns a builder for [UserEventService].
6064    ///
6065    /// ```
6066    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
6067    /// # use google_cloud_discoveryengine_v1::client::UserEventService;
6068    /// let client = UserEventService::builder().build().await?;
6069    /// # Ok(()) }
6070    /// ```
6071    pub fn builder() -> super::builder::user_event_service::ClientBuilder {
6072        crate::new_client_builder(super::builder::user_event_service::client::Factory)
6073    }
6074
6075    /// Creates a new client from the provided stub.
6076    ///
6077    /// The most common case for calling this function is in tests mocking the
6078    /// client's behavior.
6079    pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
6080    where
6081        T: super::stub::UserEventService + 'static,
6082    {
6083        Self { inner: stub.into() }
6084    }
6085
6086    pub(crate) async fn new(
6087        config: gaxi::options::ClientConfig,
6088    ) -> crate::ClientBuilderResult<Self> {
6089        let inner = Self::build_inner(config).await?;
6090        Ok(Self { inner })
6091    }
6092
6093    async fn build_inner(
6094        conf: gaxi::options::ClientConfig,
6095    ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::UserEventService>>
6096    {
6097        if gaxi::options::tracing_enabled(&conf) {
6098            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
6099        }
6100        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
6101    }
6102
6103    async fn build_transport(
6104        conf: gaxi::options::ClientConfig,
6105    ) -> crate::ClientBuilderResult<impl super::stub::UserEventService> {
6106        super::transport::UserEventService::new(conf).await
6107    }
6108
6109    async fn build_with_tracing(
6110        conf: gaxi::options::ClientConfig,
6111    ) -> crate::ClientBuilderResult<impl super::stub::UserEventService> {
6112        Self::build_transport(conf)
6113            .await
6114            .map(super::tracing::UserEventService::new)
6115    }
6116
6117    /// Writes a single user event.
6118    ///
6119    /// # Example
6120    /// ```
6121    /// # use google_cloud_discoveryengine_v1::client::UserEventService;
6122    /// use google_cloud_discoveryengine_v1::Result;
6123    /// async fn sample(
6124    ///    client: &UserEventService
6125    /// ) -> Result<()> {
6126    ///     let response = client.write_user_event()
6127    ///         /* set fields */
6128    ///         .send().await?;
6129    ///     println!("response {:?}", response);
6130    ///     Ok(())
6131    /// }
6132    /// ```
6133    pub fn write_user_event(&self) -> super::builder::user_event_service::WriteUserEvent {
6134        super::builder::user_event_service::WriteUserEvent::new(self.inner.clone())
6135    }
6136
6137    /// Writes a single user event from the browser. This uses a GET request to
6138    /// due to browser restriction of POST-ing to a third-party domain.
6139    ///
6140    /// This method is used only by the Discovery Engine API JavaScript pixel and
6141    /// Google Tag Manager. Users should not call this method directly.
6142    ///
6143    /// # Example
6144    /// ```
6145    /// # use google_cloud_discoveryengine_v1::client::UserEventService;
6146    /// use google_cloud_discoveryengine_v1::Result;
6147    /// async fn sample(
6148    ///    client: &UserEventService
6149    /// ) -> Result<()> {
6150    ///     let response = client.collect_user_event()
6151    ///         /* set fields */
6152    ///         .send().await?;
6153    ///     println!("response {:?}", response);
6154    ///     Ok(())
6155    /// }
6156    /// ```
6157    pub fn collect_user_event(&self) -> super::builder::user_event_service::CollectUserEvent {
6158        super::builder::user_event_service::CollectUserEvent::new(self.inner.clone())
6159    }
6160
6161    /// Deletes permanently all user events specified by the filter provided.
6162    /// Depending on the number of events specified by the filter, this operation
6163    /// could take hours or days to complete. To test a filter, use the list
6164    /// command first.
6165    ///
6166    /// # Long running operations
6167    ///
6168    /// This method is used to start, and/or poll a [long-running Operation].
6169    /// The [Working with long-running operations] chapter in the [user guide]
6170    /// covers these operations in detail.
6171    ///
6172    /// [long-running operation]: https://google.aip.dev/151
6173    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
6174    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
6175    ///
6176    /// # Example
6177    /// ```
6178    /// # use google_cloud_discoveryengine_v1::client::UserEventService;
6179    /// use google_cloud_lro::Poller;
6180    /// use google_cloud_discoveryengine_v1::Result;
6181    /// async fn sample(
6182    ///    client: &UserEventService
6183    /// ) -> Result<()> {
6184    ///     let response = client.purge_user_events()
6185    ///         /* set fields */
6186    ///         .poller().until_done().await?;
6187    ///     println!("response {:?}", response);
6188    ///     Ok(())
6189    /// }
6190    /// ```
6191    pub fn purge_user_events(&self) -> super::builder::user_event_service::PurgeUserEvents {
6192        super::builder::user_event_service::PurgeUserEvents::new(self.inner.clone())
6193    }
6194
6195    /// Bulk import of user events. Request processing might be
6196    /// synchronous. Events that already exist are skipped.
6197    /// Use this method for backfilling historical user events.
6198    ///
6199    /// Operation.response is of type ImportResponse. Note that it is
6200    /// possible for a subset of the items to be successfully inserted.
6201    /// Operation.metadata is of type ImportMetadata.
6202    ///
6203    /// # Long running operations
6204    ///
6205    /// This method is used to start, and/or poll a [long-running Operation].
6206    /// The [Working with long-running operations] chapter in the [user guide]
6207    /// covers these operations in detail.
6208    ///
6209    /// [long-running operation]: https://google.aip.dev/151
6210    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
6211    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
6212    ///
6213    /// # Example
6214    /// ```
6215    /// # use google_cloud_discoveryengine_v1::client::UserEventService;
6216    /// use google_cloud_lro::Poller;
6217    /// use google_cloud_discoveryengine_v1::Result;
6218    /// async fn sample(
6219    ///    client: &UserEventService
6220    /// ) -> Result<()> {
6221    ///     let response = client.import_user_events()
6222    ///         /* set fields */
6223    ///         .poller().until_done().await?;
6224    ///     println!("response {:?}", response);
6225    ///     Ok(())
6226    /// }
6227    /// ```
6228    pub fn import_user_events(&self) -> super::builder::user_event_service::ImportUserEvents {
6229        super::builder::user_event_service::ImportUserEvents::new(self.inner.clone())
6230    }
6231
6232    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
6233    ///
6234    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
6235    ///
6236    /// # Example
6237    /// ```
6238    /// # use google_cloud_discoveryengine_v1::client::UserEventService;
6239    /// use google_cloud_gax::paginator::ItemPaginator as _;
6240    /// use google_cloud_discoveryengine_v1::Result;
6241    /// async fn sample(
6242    ///    client: &UserEventService
6243    /// ) -> Result<()> {
6244    ///     let mut list = client.list_operations()
6245    ///         /* set fields */
6246    ///         .by_item();
6247    ///     while let Some(item) = list.next().await.transpose()? {
6248    ///         println!("{:?}", item);
6249    ///     }
6250    ///     Ok(())
6251    /// }
6252    /// ```
6253    pub fn list_operations(&self) -> super::builder::user_event_service::ListOperations {
6254        super::builder::user_event_service::ListOperations::new(self.inner.clone())
6255    }
6256
6257    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
6258    ///
6259    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
6260    ///
6261    /// # Example
6262    /// ```
6263    /// # use google_cloud_discoveryengine_v1::client::UserEventService;
6264    /// use google_cloud_discoveryengine_v1::Result;
6265    /// async fn sample(
6266    ///    client: &UserEventService
6267    /// ) -> Result<()> {
6268    ///     let response = client.get_operation()
6269    ///         /* set fields */
6270    ///         .send().await?;
6271    ///     println!("response {:?}", response);
6272    ///     Ok(())
6273    /// }
6274    /// ```
6275    pub fn get_operation(&self) -> super::builder::user_event_service::GetOperation {
6276        super::builder::user_event_service::GetOperation::new(self.inner.clone())
6277    }
6278
6279    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
6280    ///
6281    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
6282    ///
6283    /// # Example
6284    /// ```
6285    /// # use google_cloud_discoveryengine_v1::client::UserEventService;
6286    /// use google_cloud_discoveryengine_v1::Result;
6287    /// async fn sample(
6288    ///    client: &UserEventService
6289    /// ) -> Result<()> {
6290    ///     client.cancel_operation()
6291    ///         /* set fields */
6292    ///         .send().await?;
6293    ///     Ok(())
6294    /// }
6295    /// ```
6296    pub fn cancel_operation(&self) -> super::builder::user_event_service::CancelOperation {
6297        super::builder::user_event_service::CancelOperation::new(self.inner.clone())
6298    }
6299}
6300
6301/// Implements a client for the Discovery Engine API.
6302///
6303/// # Example
6304/// ```
6305/// # use google_cloud_discoveryengine_v1::client::UserLicenseService;
6306/// use google_cloud_gax::paginator::ItemPaginator as _;
6307/// async fn sample(
6308/// ) -> anyhow::Result<()> {
6309///     let client = UserLicenseService::builder().build().await?;
6310///     let mut list = client.list_user_licenses()
6311///         /* set fields */
6312///         .by_item();
6313///     while let Some(item) = list.next().await.transpose()? {
6314///         println!("{:?}", item);
6315///     }
6316///     Ok(())
6317/// }
6318/// ```
6319///
6320/// # Service Description
6321///
6322/// Service for managing User Licenses.
6323///
6324/// # Configuration
6325///
6326/// To configure `UserLicenseService` use the `with_*` methods in the type returned
6327/// by [builder()][UserLicenseService::builder]. The default configuration should
6328/// work for most applications. Common configuration changes include
6329///
6330/// * [with_endpoint()]: by default this client uses the global default endpoint
6331///   (`https://discoveryengine.googleapis.com`). Applications using regional
6332///   endpoints or running in restricted networks (e.g. a network configured
6333//    with [Private Google Access with VPC Service Controls]) may want to
6334///   override this default.
6335/// * [with_credentials()]: by default this client uses
6336///   [Application Default Credentials]. Applications using custom
6337///   authentication may need to override this default.
6338///
6339/// [with_endpoint()]: super::builder::user_license_service::ClientBuilder::with_endpoint
6340/// [with_credentials()]: super::builder::user_license_service::ClientBuilder::with_credentials
6341/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
6342/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
6343///
6344/// # Pooling and Cloning
6345///
6346/// `UserLicenseService` holds a connection pool internally, it is advised to
6347/// create one and reuse it. You do not need to wrap `UserLicenseService` in
6348/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
6349/// already uses an `Arc` internally.
6350#[cfg(feature = "user-license-service")]
6351#[cfg_attr(docsrs, doc(cfg(feature = "user-license-service")))]
6352#[derive(Clone, Debug)]
6353pub struct UserLicenseService {
6354    inner: std::sync::Arc<dyn super::stub::dynamic::UserLicenseService>,
6355}
6356
6357#[cfg(feature = "user-license-service")]
6358impl UserLicenseService {
6359    /// Returns a builder for [UserLicenseService].
6360    ///
6361    /// ```
6362    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
6363    /// # use google_cloud_discoveryengine_v1::client::UserLicenseService;
6364    /// let client = UserLicenseService::builder().build().await?;
6365    /// # Ok(()) }
6366    /// ```
6367    pub fn builder() -> super::builder::user_license_service::ClientBuilder {
6368        crate::new_client_builder(super::builder::user_license_service::client::Factory)
6369    }
6370
6371    /// Creates a new client from the provided stub.
6372    ///
6373    /// The most common case for calling this function is in tests mocking the
6374    /// client's behavior.
6375    pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
6376    where
6377        T: super::stub::UserLicenseService + 'static,
6378    {
6379        Self { inner: stub.into() }
6380    }
6381
6382    pub(crate) async fn new(
6383        config: gaxi::options::ClientConfig,
6384    ) -> crate::ClientBuilderResult<Self> {
6385        let inner = Self::build_inner(config).await?;
6386        Ok(Self { inner })
6387    }
6388
6389    async fn build_inner(
6390        conf: gaxi::options::ClientConfig,
6391    ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::UserLicenseService>>
6392    {
6393        if gaxi::options::tracing_enabled(&conf) {
6394            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
6395        }
6396        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
6397    }
6398
6399    async fn build_transport(
6400        conf: gaxi::options::ClientConfig,
6401    ) -> crate::ClientBuilderResult<impl super::stub::UserLicenseService> {
6402        super::transport::UserLicenseService::new(conf).await
6403    }
6404
6405    async fn build_with_tracing(
6406        conf: gaxi::options::ClientConfig,
6407    ) -> crate::ClientBuilderResult<impl super::stub::UserLicenseService> {
6408        Self::build_transport(conf)
6409            .await
6410            .map(super::tracing::UserLicenseService::new)
6411    }
6412
6413    /// Lists the User Licenses.
6414    ///
6415    /// # Example
6416    /// ```
6417    /// # use google_cloud_discoveryengine_v1::client::UserLicenseService;
6418    /// use google_cloud_gax::paginator::ItemPaginator as _;
6419    /// use google_cloud_discoveryengine_v1::Result;
6420    /// async fn sample(
6421    ///    client: &UserLicenseService
6422    /// ) -> Result<()> {
6423    ///     let mut list = client.list_user_licenses()
6424    ///         /* set fields */
6425    ///         .by_item();
6426    ///     while let Some(item) = list.next().await.transpose()? {
6427    ///         println!("{:?}", item);
6428    ///     }
6429    ///     Ok(())
6430    /// }
6431    /// ```
6432    pub fn list_user_licenses(&self) -> super::builder::user_license_service::ListUserLicenses {
6433        super::builder::user_license_service::ListUserLicenses::new(self.inner.clone())
6434    }
6435
6436    /// Updates the User License.
6437    /// This method is used for batch assign/unassign licenses to users.
6438    ///
6439    /// # Long running operations
6440    ///
6441    /// This method is used to start, and/or poll a [long-running Operation].
6442    /// The [Working with long-running operations] chapter in the [user guide]
6443    /// covers these operations in detail.
6444    ///
6445    /// [long-running operation]: https://google.aip.dev/151
6446    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
6447    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
6448    ///
6449    /// # Example
6450    /// ```
6451    /// # use google_cloud_discoveryengine_v1::client::UserLicenseService;
6452    /// use google_cloud_lro::Poller;
6453    /// use google_cloud_discoveryengine_v1::Result;
6454    /// async fn sample(
6455    ///    client: &UserLicenseService
6456    /// ) -> Result<()> {
6457    ///     let response = client.batch_update_user_licenses()
6458    ///         /* set fields */
6459    ///         .poller().until_done().await?;
6460    ///     println!("response {:?}", response);
6461    ///     Ok(())
6462    /// }
6463    /// ```
6464    pub fn batch_update_user_licenses(
6465        &self,
6466    ) -> super::builder::user_license_service::BatchUpdateUserLicenses {
6467        super::builder::user_license_service::BatchUpdateUserLicenses::new(self.inner.clone())
6468    }
6469
6470    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
6471    ///
6472    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
6473    ///
6474    /// # Example
6475    /// ```
6476    /// # use google_cloud_discoveryengine_v1::client::UserLicenseService;
6477    /// use google_cloud_gax::paginator::ItemPaginator as _;
6478    /// use google_cloud_discoveryengine_v1::Result;
6479    /// async fn sample(
6480    ///    client: &UserLicenseService
6481    /// ) -> Result<()> {
6482    ///     let mut list = client.list_operations()
6483    ///         /* set fields */
6484    ///         .by_item();
6485    ///     while let Some(item) = list.next().await.transpose()? {
6486    ///         println!("{:?}", item);
6487    ///     }
6488    ///     Ok(())
6489    /// }
6490    /// ```
6491    pub fn list_operations(&self) -> super::builder::user_license_service::ListOperations {
6492        super::builder::user_license_service::ListOperations::new(self.inner.clone())
6493    }
6494
6495    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
6496    ///
6497    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
6498    ///
6499    /// # Example
6500    /// ```
6501    /// # use google_cloud_discoveryengine_v1::client::UserLicenseService;
6502    /// use google_cloud_discoveryengine_v1::Result;
6503    /// async fn sample(
6504    ///    client: &UserLicenseService
6505    /// ) -> Result<()> {
6506    ///     let response = client.get_operation()
6507    ///         /* set fields */
6508    ///         .send().await?;
6509    ///     println!("response {:?}", response);
6510    ///     Ok(())
6511    /// }
6512    /// ```
6513    pub fn get_operation(&self) -> super::builder::user_license_service::GetOperation {
6514        super::builder::user_license_service::GetOperation::new(self.inner.clone())
6515    }
6516
6517    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
6518    ///
6519    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
6520    ///
6521    /// # Example
6522    /// ```
6523    /// # use google_cloud_discoveryengine_v1::client::UserLicenseService;
6524    /// use google_cloud_discoveryengine_v1::Result;
6525    /// async fn sample(
6526    ///    client: &UserLicenseService
6527    /// ) -> Result<()> {
6528    ///     client.cancel_operation()
6529    ///         /* set fields */
6530    ///         .send().await?;
6531    ///     Ok(())
6532    /// }
6533    /// ```
6534    pub fn cancel_operation(&self) -> super::builder::user_license_service::CancelOperation {
6535        super::builder::user_license_service::CancelOperation::new(self.inner.clone())
6536    }
6537}