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