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/// # tokio_test::block_on(async {
24/// # use google_cloud_discoveryengine_v1::client::CmekConfigService;
25/// let client = CmekConfigService::builder().build().await?;
26/// // use `client` to make requests to the Discovery Engine API.
27/// # gax::client_builder::Result::<()>::Ok(()) });
28/// ```
29///
30/// # Service Description
31///
32/// Service for managing CMEK related tasks
33///
34/// # Configuration
35///
36/// To configure `CmekConfigService` use the `with_*` methods in the type returned
37/// by [builder()][CmekConfigService::builder]. The default configuration should
38/// work for most applications. Common configuration changes include
39///
40/// * [with_endpoint()]: by default this client uses the global default endpoint
41///   (`https://discoveryengine.googleapis.com`). Applications using regional
42///   endpoints or running in restricted networks (e.g. a network configured
43//    with [Private Google Access with VPC Service Controls]) may want to
44///   override this default.
45/// * [with_credentials()]: by default this client uses
46///   [Application Default Credentials]. Applications using custom
47///   authentication may need to override this default.
48///
49/// [with_endpoint()]: super::builder::cmek_config_service::ClientBuilder::with_endpoint
50/// [with_credentials()]: super::builder::cmek_config_service::ClientBuilder::credentials
51/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
52/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
53///
54/// # Pooling and Cloning
55///
56/// `CmekConfigService` holds a connection pool internally, it is advised to
57/// create one and the reuse it.  You do not need to wrap `CmekConfigService` in
58/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
59/// already uses an `Arc` internally.
60#[cfg(feature = "cmek-config-service")]
61#[cfg_attr(docsrs, doc(cfg(feature = "cmek-config-service")))]
62#[derive(Clone, Debug)]
63pub struct CmekConfigService {
64    inner: std::sync::Arc<dyn super::stub::dynamic::CmekConfigService>,
65}
66
67#[cfg(feature = "cmek-config-service")]
68impl CmekConfigService {
69    /// Returns a builder for [CmekConfigService].
70    ///
71    /// ```
72    /// # tokio_test::block_on(async {
73    /// # use google_cloud_discoveryengine_v1::client::CmekConfigService;
74    /// let client = CmekConfigService::builder().build().await?;
75    /// # gax::client_builder::Result::<()>::Ok(()) });
76    /// ```
77    pub fn builder() -> super::builder::cmek_config_service::ClientBuilder {
78        gax::client_builder::internal::new_builder(
79            super::builder::cmek_config_service::client::Factory,
80        )
81    }
82
83    /// Creates a new client from the provided stub.
84    ///
85    /// The most common case for calling this function is in tests mocking the
86    /// client's behavior.
87    pub fn from_stub<T>(stub: T) -> Self
88    where
89        T: super::stub::CmekConfigService + 'static,
90    {
91        Self {
92            inner: std::sync::Arc::new(stub),
93        }
94    }
95
96    pub(crate) async fn new(
97        config: gaxi::options::ClientConfig,
98    ) -> gax::client_builder::Result<Self> {
99        let inner = Self::build_inner(config).await?;
100        Ok(Self { inner })
101    }
102
103    async fn build_inner(
104        conf: gaxi::options::ClientConfig,
105    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::CmekConfigService>>
106    {
107        if gaxi::options::tracing_enabled(&conf) {
108            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
109        }
110        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
111    }
112
113    async fn build_transport(
114        conf: gaxi::options::ClientConfig,
115    ) -> gax::client_builder::Result<impl super::stub::CmekConfigService> {
116        super::transport::CmekConfigService::new(conf).await
117    }
118
119    async fn build_with_tracing(
120        conf: gaxi::options::ClientConfig,
121    ) -> gax::client_builder::Result<impl super::stub::CmekConfigService> {
122        Self::build_transport(conf)
123            .await
124            .map(super::tracing::CmekConfigService::new)
125    }
126
127    /// Provisions a CMEK key for use in a location of a customer's project.
128    /// This method will also conduct location validation on the provided
129    /// cmekConfig to make sure the key is valid and can be used in the
130    /// selected location.
131    ///
132    /// # Long running operations
133    ///
134    /// This method is used to start, and/or poll a [long-running Operation].
135    /// The [Working with long-running operations] chapter in the [user guide]
136    /// covers these operations in detail.
137    ///
138    /// [long-running operation]: https://google.aip.dev/151
139    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
140    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
141    pub fn update_cmek_config(&self) -> super::builder::cmek_config_service::UpdateCmekConfig {
142        super::builder::cmek_config_service::UpdateCmekConfig::new(self.inner.clone())
143    }
144
145    /// Gets the [CmekConfig][google.cloud.discoveryengine.v1.CmekConfig].
146    ///
147    /// [google.cloud.discoveryengine.v1.CmekConfig]: crate::model::CmekConfig
148    pub fn get_cmek_config(&self) -> super::builder::cmek_config_service::GetCmekConfig {
149        super::builder::cmek_config_service::GetCmekConfig::new(self.inner.clone())
150    }
151
152    /// Lists all the [CmekConfig][google.cloud.discoveryengine.v1.CmekConfig]s
153    /// with the project.
154    ///
155    /// [google.cloud.discoveryengine.v1.CmekConfig]: crate::model::CmekConfig
156    pub fn list_cmek_configs(&self) -> super::builder::cmek_config_service::ListCmekConfigs {
157        super::builder::cmek_config_service::ListCmekConfigs::new(self.inner.clone())
158    }
159
160    /// De-provisions a CmekConfig.
161    ///
162    /// # Long running operations
163    ///
164    /// This method is used to start, and/or poll a [long-running Operation].
165    /// The [Working with long-running operations] chapter in the [user guide]
166    /// covers these operations in detail.
167    ///
168    /// [long-running operation]: https://google.aip.dev/151
169    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
170    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
171    pub fn delete_cmek_config(&self) -> super::builder::cmek_config_service::DeleteCmekConfig {
172        super::builder::cmek_config_service::DeleteCmekConfig::new(self.inner.clone())
173    }
174
175    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
176    ///
177    /// [google.longrunning.Operations]: longrunning::client::Operations
178    pub fn list_operations(&self) -> super::builder::cmek_config_service::ListOperations {
179        super::builder::cmek_config_service::ListOperations::new(self.inner.clone())
180    }
181
182    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
183    ///
184    /// [google.longrunning.Operations]: longrunning::client::Operations
185    pub fn get_operation(&self) -> super::builder::cmek_config_service::GetOperation {
186        super::builder::cmek_config_service::GetOperation::new(self.inner.clone())
187    }
188
189    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
190    ///
191    /// [google.longrunning.Operations]: longrunning::client::Operations
192    pub fn cancel_operation(&self) -> super::builder::cmek_config_service::CancelOperation {
193        super::builder::cmek_config_service::CancelOperation::new(self.inner.clone())
194    }
195}
196
197/// Implements a client for the Discovery Engine API.
198///
199/// # Example
200/// ```
201/// # tokio_test::block_on(async {
202/// # use google_cloud_discoveryengine_v1::client::CompletionService;
203/// let client = CompletionService::builder().build().await?;
204/// // use `client` to make requests to the Discovery Engine API.
205/// # gax::client_builder::Result::<()>::Ok(()) });
206/// ```
207///
208/// # Service Description
209///
210/// Service for Auto-Completion.
211///
212/// # Configuration
213///
214/// To configure `CompletionService` use the `with_*` methods in the type returned
215/// by [builder()][CompletionService::builder]. The default configuration should
216/// work for most applications. Common configuration changes include
217///
218/// * [with_endpoint()]: by default this client uses the global default endpoint
219///   (`https://discoveryengine.googleapis.com`). Applications using regional
220///   endpoints or running in restricted networks (e.g. a network configured
221//    with [Private Google Access with VPC Service Controls]) may want to
222///   override this default.
223/// * [with_credentials()]: by default this client uses
224///   [Application Default Credentials]. Applications using custom
225///   authentication may need to override this default.
226///
227/// [with_endpoint()]: super::builder::completion_service::ClientBuilder::with_endpoint
228/// [with_credentials()]: super::builder::completion_service::ClientBuilder::credentials
229/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
230/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
231///
232/// # Pooling and Cloning
233///
234/// `CompletionService` holds a connection pool internally, it is advised to
235/// create one and the reuse it.  You do not need to wrap `CompletionService` in
236/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
237/// already uses an `Arc` internally.
238#[cfg(feature = "completion-service")]
239#[cfg_attr(docsrs, doc(cfg(feature = "completion-service")))]
240#[derive(Clone, Debug)]
241pub struct CompletionService {
242    inner: std::sync::Arc<dyn super::stub::dynamic::CompletionService>,
243}
244
245#[cfg(feature = "completion-service")]
246impl CompletionService {
247    /// Returns a builder for [CompletionService].
248    ///
249    /// ```
250    /// # tokio_test::block_on(async {
251    /// # use google_cloud_discoveryengine_v1::client::CompletionService;
252    /// let client = CompletionService::builder().build().await?;
253    /// # gax::client_builder::Result::<()>::Ok(()) });
254    /// ```
255    pub fn builder() -> super::builder::completion_service::ClientBuilder {
256        gax::client_builder::internal::new_builder(
257            super::builder::completion_service::client::Factory,
258        )
259    }
260
261    /// Creates a new client from the provided stub.
262    ///
263    /// The most common case for calling this function is in tests mocking the
264    /// client's behavior.
265    pub fn from_stub<T>(stub: T) -> Self
266    where
267        T: super::stub::CompletionService + 'static,
268    {
269        Self {
270            inner: std::sync::Arc::new(stub),
271        }
272    }
273
274    pub(crate) async fn new(
275        config: gaxi::options::ClientConfig,
276    ) -> gax::client_builder::Result<Self> {
277        let inner = Self::build_inner(config).await?;
278        Ok(Self { inner })
279    }
280
281    async fn build_inner(
282        conf: gaxi::options::ClientConfig,
283    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::CompletionService>>
284    {
285        if gaxi::options::tracing_enabled(&conf) {
286            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
287        }
288        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
289    }
290
291    async fn build_transport(
292        conf: gaxi::options::ClientConfig,
293    ) -> gax::client_builder::Result<impl super::stub::CompletionService> {
294        super::transport::CompletionService::new(conf).await
295    }
296
297    async fn build_with_tracing(
298        conf: gaxi::options::ClientConfig,
299    ) -> gax::client_builder::Result<impl super::stub::CompletionService> {
300        Self::build_transport(conf)
301            .await
302            .map(super::tracing::CompletionService::new)
303    }
304
305    /// Completes the specified user input with keyword suggestions.
306    pub fn complete_query(&self) -> super::builder::completion_service::CompleteQuery {
307        super::builder::completion_service::CompleteQuery::new(self.inner.clone())
308    }
309
310    /// Imports all
311    /// [SuggestionDenyListEntry][google.cloud.discoveryengine.v1.SuggestionDenyListEntry]
312    /// for a DataStore.
313    ///
314    /// [google.cloud.discoveryengine.v1.SuggestionDenyListEntry]: crate::model::SuggestionDenyListEntry
315    ///
316    /// # Long running operations
317    ///
318    /// This method is used to start, and/or poll a [long-running Operation].
319    /// The [Working with long-running operations] chapter in the [user guide]
320    /// covers these operations in detail.
321    ///
322    /// [long-running operation]: https://google.aip.dev/151
323    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
324    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
325    pub fn import_suggestion_deny_list_entries(
326        &self,
327    ) -> super::builder::completion_service::ImportSuggestionDenyListEntries {
328        super::builder::completion_service::ImportSuggestionDenyListEntries::new(self.inner.clone())
329    }
330
331    /// Permanently deletes all
332    /// [SuggestionDenyListEntry][google.cloud.discoveryengine.v1.SuggestionDenyListEntry]
333    /// for a DataStore.
334    ///
335    /// [google.cloud.discoveryengine.v1.SuggestionDenyListEntry]: crate::model::SuggestionDenyListEntry
336    ///
337    /// # Long running operations
338    ///
339    /// This method is used to start, and/or poll a [long-running Operation].
340    /// The [Working with long-running operations] chapter in the [user guide]
341    /// covers these operations in detail.
342    ///
343    /// [long-running operation]: https://google.aip.dev/151
344    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
345    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
346    pub fn purge_suggestion_deny_list_entries(
347        &self,
348    ) -> super::builder::completion_service::PurgeSuggestionDenyListEntries {
349        super::builder::completion_service::PurgeSuggestionDenyListEntries::new(self.inner.clone())
350    }
351
352    /// Imports
353    /// [CompletionSuggestion][google.cloud.discoveryengine.v1.CompletionSuggestion]s
354    /// for a DataStore.
355    ///
356    /// [google.cloud.discoveryengine.v1.CompletionSuggestion]: crate::model::CompletionSuggestion
357    ///
358    /// # Long running operations
359    ///
360    /// This method is used to start, and/or poll a [long-running Operation].
361    /// The [Working with long-running operations] chapter in the [user guide]
362    /// covers these operations in detail.
363    ///
364    /// [long-running operation]: https://google.aip.dev/151
365    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
366    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
367    pub fn import_completion_suggestions(
368        &self,
369    ) -> super::builder::completion_service::ImportCompletionSuggestions {
370        super::builder::completion_service::ImportCompletionSuggestions::new(self.inner.clone())
371    }
372
373    /// Permanently deletes all
374    /// [CompletionSuggestion][google.cloud.discoveryengine.v1.CompletionSuggestion]s
375    /// for a DataStore.
376    ///
377    /// [google.cloud.discoveryengine.v1.CompletionSuggestion]: crate::model::CompletionSuggestion
378    ///
379    /// # Long running operations
380    ///
381    /// This method is used to start, and/or poll a [long-running Operation].
382    /// The [Working with long-running operations] chapter in the [user guide]
383    /// covers these operations in detail.
384    ///
385    /// [long-running operation]: https://google.aip.dev/151
386    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
387    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
388    pub fn purge_completion_suggestions(
389        &self,
390    ) -> super::builder::completion_service::PurgeCompletionSuggestions {
391        super::builder::completion_service::PurgeCompletionSuggestions::new(self.inner.clone())
392    }
393
394    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
395    ///
396    /// [google.longrunning.Operations]: longrunning::client::Operations
397    pub fn list_operations(&self) -> super::builder::completion_service::ListOperations {
398        super::builder::completion_service::ListOperations::new(self.inner.clone())
399    }
400
401    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
402    ///
403    /// [google.longrunning.Operations]: longrunning::client::Operations
404    pub fn get_operation(&self) -> super::builder::completion_service::GetOperation {
405        super::builder::completion_service::GetOperation::new(self.inner.clone())
406    }
407
408    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
409    ///
410    /// [google.longrunning.Operations]: longrunning::client::Operations
411    pub fn cancel_operation(&self) -> super::builder::completion_service::CancelOperation {
412        super::builder::completion_service::CancelOperation::new(self.inner.clone())
413    }
414}
415
416/// Implements a client for the Discovery Engine API.
417///
418/// # Example
419/// ```
420/// # tokio_test::block_on(async {
421/// # use google_cloud_discoveryengine_v1::client::ControlService;
422/// let client = ControlService::builder().build().await?;
423/// // use `client` to make requests to the Discovery Engine API.
424/// # gax::client_builder::Result::<()>::Ok(()) });
425/// ```
426///
427/// # Service Description
428///
429/// Service for performing CRUD operations on Controls.
430/// Controls allow for custom logic to be implemented in the serving path.
431/// Controls need to be attached to a Serving Config to be considered during a
432/// request.
433///
434/// # Configuration
435///
436/// To configure `ControlService` use the `with_*` methods in the type returned
437/// by [builder()][ControlService::builder]. The default configuration should
438/// work for most applications. Common configuration changes include
439///
440/// * [with_endpoint()]: by default this client uses the global default endpoint
441///   (`https://discoveryengine.googleapis.com`). Applications using regional
442///   endpoints or running in restricted networks (e.g. a network configured
443//    with [Private Google Access with VPC Service Controls]) may want to
444///   override this default.
445/// * [with_credentials()]: by default this client uses
446///   [Application Default Credentials]. Applications using custom
447///   authentication may need to override this default.
448///
449/// [with_endpoint()]: super::builder::control_service::ClientBuilder::with_endpoint
450/// [with_credentials()]: super::builder::control_service::ClientBuilder::credentials
451/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
452/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
453///
454/// # Pooling and Cloning
455///
456/// `ControlService` holds a connection pool internally, it is advised to
457/// create one and the reuse it.  You do not need to wrap `ControlService` in
458/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
459/// already uses an `Arc` internally.
460#[cfg(feature = "control-service")]
461#[cfg_attr(docsrs, doc(cfg(feature = "control-service")))]
462#[derive(Clone, Debug)]
463pub struct ControlService {
464    inner: std::sync::Arc<dyn super::stub::dynamic::ControlService>,
465}
466
467#[cfg(feature = "control-service")]
468impl ControlService {
469    /// Returns a builder for [ControlService].
470    ///
471    /// ```
472    /// # tokio_test::block_on(async {
473    /// # use google_cloud_discoveryengine_v1::client::ControlService;
474    /// let client = ControlService::builder().build().await?;
475    /// # gax::client_builder::Result::<()>::Ok(()) });
476    /// ```
477    pub fn builder() -> super::builder::control_service::ClientBuilder {
478        gax::client_builder::internal::new_builder(super::builder::control_service::client::Factory)
479    }
480
481    /// Creates a new client from the provided stub.
482    ///
483    /// The most common case for calling this function is in tests mocking the
484    /// client's behavior.
485    pub fn from_stub<T>(stub: T) -> Self
486    where
487        T: super::stub::ControlService + 'static,
488    {
489        Self {
490            inner: std::sync::Arc::new(stub),
491        }
492    }
493
494    pub(crate) async fn new(
495        config: gaxi::options::ClientConfig,
496    ) -> gax::client_builder::Result<Self> {
497        let inner = Self::build_inner(config).await?;
498        Ok(Self { inner })
499    }
500
501    async fn build_inner(
502        conf: gaxi::options::ClientConfig,
503    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::ControlService>> {
504        if gaxi::options::tracing_enabled(&conf) {
505            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
506        }
507        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
508    }
509
510    async fn build_transport(
511        conf: gaxi::options::ClientConfig,
512    ) -> gax::client_builder::Result<impl super::stub::ControlService> {
513        super::transport::ControlService::new(conf).await
514    }
515
516    async fn build_with_tracing(
517        conf: gaxi::options::ClientConfig,
518    ) -> gax::client_builder::Result<impl super::stub::ControlService> {
519        Self::build_transport(conf)
520            .await
521            .map(super::tracing::ControlService::new)
522    }
523
524    /// Creates a Control.
525    ///
526    /// By default 1000 controls are allowed for a data store.
527    /// A request can be submitted to adjust this limit.
528    /// If the [Control][google.cloud.discoveryengine.v1.Control] to create already
529    /// exists, an ALREADY_EXISTS error is returned.
530    ///
531    /// [google.cloud.discoveryengine.v1.Control]: crate::model::Control
532    pub fn create_control(&self) -> super::builder::control_service::CreateControl {
533        super::builder::control_service::CreateControl::new(self.inner.clone())
534    }
535
536    /// Deletes a Control.
537    ///
538    /// If the [Control][google.cloud.discoveryengine.v1.Control] to delete does
539    /// not exist, a NOT_FOUND error is returned.
540    ///
541    /// [google.cloud.discoveryengine.v1.Control]: crate::model::Control
542    pub fn delete_control(&self) -> super::builder::control_service::DeleteControl {
543        super::builder::control_service::DeleteControl::new(self.inner.clone())
544    }
545
546    /// Updates a Control.
547    ///
548    /// [Control][google.cloud.discoveryengine.v1.Control] action type cannot be
549    /// changed. If the [Control][google.cloud.discoveryengine.v1.Control] to
550    /// update does not exist, a NOT_FOUND error is returned.
551    ///
552    /// [google.cloud.discoveryengine.v1.Control]: crate::model::Control
553    pub fn update_control(&self) -> super::builder::control_service::UpdateControl {
554        super::builder::control_service::UpdateControl::new(self.inner.clone())
555    }
556
557    /// Gets a Control.
558    pub fn get_control(&self) -> super::builder::control_service::GetControl {
559        super::builder::control_service::GetControl::new(self.inner.clone())
560    }
561
562    /// Lists all Controls by their parent
563    /// [DataStore][google.cloud.discoveryengine.v1.DataStore].
564    ///
565    /// [google.cloud.discoveryengine.v1.DataStore]: crate::model::DataStore
566    pub fn list_controls(&self) -> super::builder::control_service::ListControls {
567        super::builder::control_service::ListControls::new(self.inner.clone())
568    }
569
570    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
571    ///
572    /// [google.longrunning.Operations]: longrunning::client::Operations
573    pub fn list_operations(&self) -> super::builder::control_service::ListOperations {
574        super::builder::control_service::ListOperations::new(self.inner.clone())
575    }
576
577    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
578    ///
579    /// [google.longrunning.Operations]: longrunning::client::Operations
580    pub fn get_operation(&self) -> super::builder::control_service::GetOperation {
581        super::builder::control_service::GetOperation::new(self.inner.clone())
582    }
583
584    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
585    ///
586    /// [google.longrunning.Operations]: longrunning::client::Operations
587    pub fn cancel_operation(&self) -> super::builder::control_service::CancelOperation {
588        super::builder::control_service::CancelOperation::new(self.inner.clone())
589    }
590}
591
592/// Implements a client for the Discovery Engine API.
593///
594/// # Example
595/// ```
596/// # tokio_test::block_on(async {
597/// # use google_cloud_discoveryengine_v1::client::ConversationalSearchService;
598/// let client = ConversationalSearchService::builder().build().await?;
599/// // use `client` to make requests to the Discovery Engine API.
600/// # gax::client_builder::Result::<()>::Ok(()) });
601/// ```
602///
603/// # Service Description
604///
605/// Service for conversational search.
606///
607/// # Configuration
608///
609/// To configure `ConversationalSearchService` use the `with_*` methods in the type returned
610/// by [builder()][ConversationalSearchService::builder]. The default configuration should
611/// work for most applications. Common configuration changes include
612///
613/// * [with_endpoint()]: by default this client uses the global default endpoint
614///   (`https://discoveryengine.googleapis.com`). Applications using regional
615///   endpoints or running in restricted networks (e.g. a network configured
616//    with [Private Google Access with VPC Service Controls]) may want to
617///   override this default.
618/// * [with_credentials()]: by default this client uses
619///   [Application Default Credentials]. Applications using custom
620///   authentication may need to override this default.
621///
622/// [with_endpoint()]: super::builder::conversational_search_service::ClientBuilder::with_endpoint
623/// [with_credentials()]: super::builder::conversational_search_service::ClientBuilder::credentials
624/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
625/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
626///
627/// # Pooling and Cloning
628///
629/// `ConversationalSearchService` holds a connection pool internally, it is advised to
630/// create one and the reuse it.  You do not need to wrap `ConversationalSearchService` in
631/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
632/// already uses an `Arc` internally.
633#[cfg(feature = "conversational-search-service")]
634#[cfg_attr(docsrs, doc(cfg(feature = "conversational-search-service")))]
635#[derive(Clone, Debug)]
636pub struct ConversationalSearchService {
637    inner: std::sync::Arc<dyn super::stub::dynamic::ConversationalSearchService>,
638}
639
640#[cfg(feature = "conversational-search-service")]
641impl ConversationalSearchService {
642    /// Returns a builder for [ConversationalSearchService].
643    ///
644    /// ```
645    /// # tokio_test::block_on(async {
646    /// # use google_cloud_discoveryengine_v1::client::ConversationalSearchService;
647    /// let client = ConversationalSearchService::builder().build().await?;
648    /// # gax::client_builder::Result::<()>::Ok(()) });
649    /// ```
650    pub fn builder() -> super::builder::conversational_search_service::ClientBuilder {
651        gax::client_builder::internal::new_builder(
652            super::builder::conversational_search_service::client::Factory,
653        )
654    }
655
656    /// Creates a new client from the provided stub.
657    ///
658    /// The most common case for calling this function is in tests mocking the
659    /// client's behavior.
660    pub fn from_stub<T>(stub: T) -> Self
661    where
662        T: super::stub::ConversationalSearchService + 'static,
663    {
664        Self {
665            inner: std::sync::Arc::new(stub),
666        }
667    }
668
669    pub(crate) async fn new(
670        config: gaxi::options::ClientConfig,
671    ) -> gax::client_builder::Result<Self> {
672        let inner = Self::build_inner(config).await?;
673        Ok(Self { inner })
674    }
675
676    async fn build_inner(
677        conf: gaxi::options::ClientConfig,
678    ) -> gax::client_builder::Result<
679        std::sync::Arc<dyn super::stub::dynamic::ConversationalSearchService>,
680    > {
681        if gaxi::options::tracing_enabled(&conf) {
682            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
683        }
684        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
685    }
686
687    async fn build_transport(
688        conf: gaxi::options::ClientConfig,
689    ) -> gax::client_builder::Result<impl super::stub::ConversationalSearchService> {
690        super::transport::ConversationalSearchService::new(conf).await
691    }
692
693    async fn build_with_tracing(
694        conf: gaxi::options::ClientConfig,
695    ) -> gax::client_builder::Result<impl super::stub::ConversationalSearchService> {
696        Self::build_transport(conf)
697            .await
698            .map(super::tracing::ConversationalSearchService::new)
699    }
700
701    /// Converses a conversation.
702    pub fn converse_conversation(
703        &self,
704    ) -> super::builder::conversational_search_service::ConverseConversation {
705        super::builder::conversational_search_service::ConverseConversation::new(self.inner.clone())
706    }
707
708    /// Creates a Conversation.
709    ///
710    /// If the [Conversation][google.cloud.discoveryengine.v1.Conversation] to
711    /// create already exists, an ALREADY_EXISTS error is returned.
712    ///
713    /// [google.cloud.discoveryengine.v1.Conversation]: crate::model::Conversation
714    pub fn create_conversation(
715        &self,
716    ) -> super::builder::conversational_search_service::CreateConversation {
717        super::builder::conversational_search_service::CreateConversation::new(self.inner.clone())
718    }
719
720    /// Deletes a Conversation.
721    ///
722    /// If the [Conversation][google.cloud.discoveryengine.v1.Conversation] to
723    /// delete does not exist, a NOT_FOUND error is returned.
724    ///
725    /// [google.cloud.discoveryengine.v1.Conversation]: crate::model::Conversation
726    pub fn delete_conversation(
727        &self,
728    ) -> super::builder::conversational_search_service::DeleteConversation {
729        super::builder::conversational_search_service::DeleteConversation::new(self.inner.clone())
730    }
731
732    /// Updates a Conversation.
733    ///
734    /// [Conversation][google.cloud.discoveryengine.v1.Conversation] action type
735    /// cannot be changed. If the
736    /// [Conversation][google.cloud.discoveryengine.v1.Conversation] to update does
737    /// not exist, a NOT_FOUND error is returned.
738    ///
739    /// [google.cloud.discoveryengine.v1.Conversation]: crate::model::Conversation
740    pub fn update_conversation(
741        &self,
742    ) -> super::builder::conversational_search_service::UpdateConversation {
743        super::builder::conversational_search_service::UpdateConversation::new(self.inner.clone())
744    }
745
746    /// Gets a Conversation.
747    pub fn get_conversation(
748        &self,
749    ) -> super::builder::conversational_search_service::GetConversation {
750        super::builder::conversational_search_service::GetConversation::new(self.inner.clone())
751    }
752
753    /// Lists all Conversations by their parent
754    /// [DataStore][google.cloud.discoveryengine.v1.DataStore].
755    ///
756    /// [google.cloud.discoveryengine.v1.DataStore]: crate::model::DataStore
757    pub fn list_conversations(
758        &self,
759    ) -> super::builder::conversational_search_service::ListConversations {
760        super::builder::conversational_search_service::ListConversations::new(self.inner.clone())
761    }
762
763    /// Answer query method.
764    pub fn answer_query(&self) -> super::builder::conversational_search_service::AnswerQuery {
765        super::builder::conversational_search_service::AnswerQuery::new(self.inner.clone())
766    }
767
768    /// Gets a Answer.
769    pub fn get_answer(&self) -> super::builder::conversational_search_service::GetAnswer {
770        super::builder::conversational_search_service::GetAnswer::new(self.inner.clone())
771    }
772
773    /// Creates a Session.
774    ///
775    /// If the [Session][google.cloud.discoveryengine.v1.Session] to create already
776    /// exists, an ALREADY_EXISTS error is returned.
777    ///
778    /// [google.cloud.discoveryengine.v1.Session]: crate::model::Session
779    pub fn create_session(&self) -> super::builder::conversational_search_service::CreateSession {
780        super::builder::conversational_search_service::CreateSession::new(self.inner.clone())
781    }
782
783    /// Deletes a Session.
784    ///
785    /// If the [Session][google.cloud.discoveryengine.v1.Session] to delete does
786    /// not exist, a NOT_FOUND error is returned.
787    ///
788    /// [google.cloud.discoveryengine.v1.Session]: crate::model::Session
789    pub fn delete_session(&self) -> super::builder::conversational_search_service::DeleteSession {
790        super::builder::conversational_search_service::DeleteSession::new(self.inner.clone())
791    }
792
793    /// Updates a Session.
794    ///
795    /// [Session][google.cloud.discoveryengine.v1.Session] action type cannot be
796    /// changed. If the [Session][google.cloud.discoveryengine.v1.Session] to
797    /// update does not exist, a NOT_FOUND error is returned.
798    ///
799    /// [google.cloud.discoveryengine.v1.Session]: crate::model::Session
800    pub fn update_session(&self) -> super::builder::conversational_search_service::UpdateSession {
801        super::builder::conversational_search_service::UpdateSession::new(self.inner.clone())
802    }
803
804    /// Gets a Session.
805    pub fn get_session(&self) -> super::builder::conversational_search_service::GetSession {
806        super::builder::conversational_search_service::GetSession::new(self.inner.clone())
807    }
808
809    /// Lists all Sessions by their parent
810    /// [DataStore][google.cloud.discoveryengine.v1.DataStore].
811    ///
812    /// [google.cloud.discoveryengine.v1.DataStore]: crate::model::DataStore
813    pub fn list_sessions(&self) -> super::builder::conversational_search_service::ListSessions {
814        super::builder::conversational_search_service::ListSessions::new(self.inner.clone())
815    }
816
817    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
818    ///
819    /// [google.longrunning.Operations]: longrunning::client::Operations
820    pub fn list_operations(&self) -> super::builder::conversational_search_service::ListOperations {
821        super::builder::conversational_search_service::ListOperations::new(self.inner.clone())
822    }
823
824    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
825    ///
826    /// [google.longrunning.Operations]: longrunning::client::Operations
827    pub fn get_operation(&self) -> super::builder::conversational_search_service::GetOperation {
828        super::builder::conversational_search_service::GetOperation::new(self.inner.clone())
829    }
830
831    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
832    ///
833    /// [google.longrunning.Operations]: longrunning::client::Operations
834    pub fn cancel_operation(
835        &self,
836    ) -> super::builder::conversational_search_service::CancelOperation {
837        super::builder::conversational_search_service::CancelOperation::new(self.inner.clone())
838    }
839}
840
841/// Implements a client for the Discovery Engine API.
842///
843/// # Example
844/// ```
845/// # tokio_test::block_on(async {
846/// # use google_cloud_discoveryengine_v1::client::DataStoreService;
847/// let client = DataStoreService::builder().build().await?;
848/// // use `client` to make requests to the Discovery Engine API.
849/// # gax::client_builder::Result::<()>::Ok(()) });
850/// ```
851///
852/// # Service Description
853///
854/// Service for managing [DataStore][google.cloud.discoveryengine.v1.DataStore]
855/// configuration.
856///
857/// [google.cloud.discoveryengine.v1.DataStore]: crate::model::DataStore
858///
859/// # Configuration
860///
861/// To configure `DataStoreService` use the `with_*` methods in the type returned
862/// by [builder()][DataStoreService::builder]. The default configuration should
863/// work for most applications. Common configuration changes include
864///
865/// * [with_endpoint()]: by default this client uses the global default endpoint
866///   (`https://discoveryengine.googleapis.com`). Applications using regional
867///   endpoints or running in restricted networks (e.g. a network configured
868//    with [Private Google Access with VPC Service Controls]) may want to
869///   override this default.
870/// * [with_credentials()]: by default this client uses
871///   [Application Default Credentials]. Applications using custom
872///   authentication may need to override this default.
873///
874/// [with_endpoint()]: super::builder::data_store_service::ClientBuilder::with_endpoint
875/// [with_credentials()]: super::builder::data_store_service::ClientBuilder::credentials
876/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
877/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
878///
879/// # Pooling and Cloning
880///
881/// `DataStoreService` holds a connection pool internally, it is advised to
882/// create one and the reuse it.  You do not need to wrap `DataStoreService` in
883/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
884/// already uses an `Arc` internally.
885#[cfg(feature = "data-store-service")]
886#[cfg_attr(docsrs, doc(cfg(feature = "data-store-service")))]
887#[derive(Clone, Debug)]
888pub struct DataStoreService {
889    inner: std::sync::Arc<dyn super::stub::dynamic::DataStoreService>,
890}
891
892#[cfg(feature = "data-store-service")]
893impl DataStoreService {
894    /// Returns a builder for [DataStoreService].
895    ///
896    /// ```
897    /// # tokio_test::block_on(async {
898    /// # use google_cloud_discoveryengine_v1::client::DataStoreService;
899    /// let client = DataStoreService::builder().build().await?;
900    /// # gax::client_builder::Result::<()>::Ok(()) });
901    /// ```
902    pub fn builder() -> super::builder::data_store_service::ClientBuilder {
903        gax::client_builder::internal::new_builder(
904            super::builder::data_store_service::client::Factory,
905        )
906    }
907
908    /// Creates a new client from the provided stub.
909    ///
910    /// The most common case for calling this function is in tests mocking the
911    /// client's behavior.
912    pub fn from_stub<T>(stub: T) -> Self
913    where
914        T: super::stub::DataStoreService + 'static,
915    {
916        Self {
917            inner: std::sync::Arc::new(stub),
918        }
919    }
920
921    pub(crate) async fn new(
922        config: gaxi::options::ClientConfig,
923    ) -> gax::client_builder::Result<Self> {
924        let inner = Self::build_inner(config).await?;
925        Ok(Self { inner })
926    }
927
928    async fn build_inner(
929        conf: gaxi::options::ClientConfig,
930    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::DataStoreService>>
931    {
932        if gaxi::options::tracing_enabled(&conf) {
933            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
934        }
935        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
936    }
937
938    async fn build_transport(
939        conf: gaxi::options::ClientConfig,
940    ) -> gax::client_builder::Result<impl super::stub::DataStoreService> {
941        super::transport::DataStoreService::new(conf).await
942    }
943
944    async fn build_with_tracing(
945        conf: gaxi::options::ClientConfig,
946    ) -> gax::client_builder::Result<impl super::stub::DataStoreService> {
947        Self::build_transport(conf)
948            .await
949            .map(super::tracing::DataStoreService::new)
950    }
951
952    /// Creates a [DataStore][google.cloud.discoveryengine.v1.DataStore].
953    ///
954    /// DataStore is for storing
955    /// [Documents][google.cloud.discoveryengine.v1.Document]. To serve these
956    /// documents for Search, or Recommendation use case, an
957    /// [Engine][google.cloud.discoveryengine.v1.Engine] needs to be created
958    /// separately.
959    ///
960    /// [google.cloud.discoveryengine.v1.DataStore]: crate::model::DataStore
961    /// [google.cloud.discoveryengine.v1.Document]: crate::model::Document
962    /// [google.cloud.discoveryengine.v1.Engine]: crate::model::Engine
963    ///
964    /// # Long running operations
965    ///
966    /// This method is used to start, and/or poll a [long-running Operation].
967    /// The [Working with long-running operations] chapter in the [user guide]
968    /// covers these operations in detail.
969    ///
970    /// [long-running operation]: https://google.aip.dev/151
971    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
972    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
973    pub fn create_data_store(&self) -> super::builder::data_store_service::CreateDataStore {
974        super::builder::data_store_service::CreateDataStore::new(self.inner.clone())
975    }
976
977    /// Gets a [DataStore][google.cloud.discoveryengine.v1.DataStore].
978    ///
979    /// [google.cloud.discoveryengine.v1.DataStore]: crate::model::DataStore
980    pub fn get_data_store(&self) -> super::builder::data_store_service::GetDataStore {
981        super::builder::data_store_service::GetDataStore::new(self.inner.clone())
982    }
983
984    /// Lists all the [DataStore][google.cloud.discoveryengine.v1.DataStore]s
985    /// associated with the project.
986    ///
987    /// [google.cloud.discoveryengine.v1.DataStore]: crate::model::DataStore
988    pub fn list_data_stores(&self) -> super::builder::data_store_service::ListDataStores {
989        super::builder::data_store_service::ListDataStores::new(self.inner.clone())
990    }
991
992    /// Deletes a [DataStore][google.cloud.discoveryengine.v1.DataStore].
993    ///
994    /// [google.cloud.discoveryengine.v1.DataStore]: crate::model::DataStore
995    ///
996    /// # Long running operations
997    ///
998    /// This method is used to start, and/or poll a [long-running Operation].
999    /// The [Working with long-running operations] chapter in the [user guide]
1000    /// covers these operations in detail.
1001    ///
1002    /// [long-running operation]: https://google.aip.dev/151
1003    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1004    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1005    pub fn delete_data_store(&self) -> super::builder::data_store_service::DeleteDataStore {
1006        super::builder::data_store_service::DeleteDataStore::new(self.inner.clone())
1007    }
1008
1009    /// Updates a [DataStore][google.cloud.discoveryengine.v1.DataStore]
1010    ///
1011    /// [google.cloud.discoveryengine.v1.DataStore]: crate::model::DataStore
1012    pub fn update_data_store(&self) -> super::builder::data_store_service::UpdateDataStore {
1013        super::builder::data_store_service::UpdateDataStore::new(self.inner.clone())
1014    }
1015
1016    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1017    ///
1018    /// [google.longrunning.Operations]: longrunning::client::Operations
1019    pub fn list_operations(&self) -> super::builder::data_store_service::ListOperations {
1020        super::builder::data_store_service::ListOperations::new(self.inner.clone())
1021    }
1022
1023    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1024    ///
1025    /// [google.longrunning.Operations]: longrunning::client::Operations
1026    pub fn get_operation(&self) -> super::builder::data_store_service::GetOperation {
1027        super::builder::data_store_service::GetOperation::new(self.inner.clone())
1028    }
1029
1030    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1031    ///
1032    /// [google.longrunning.Operations]: longrunning::client::Operations
1033    pub fn cancel_operation(&self) -> super::builder::data_store_service::CancelOperation {
1034        super::builder::data_store_service::CancelOperation::new(self.inner.clone())
1035    }
1036}
1037
1038/// Implements a client for the Discovery Engine API.
1039///
1040/// # Example
1041/// ```
1042/// # tokio_test::block_on(async {
1043/// # use google_cloud_discoveryengine_v1::client::DocumentService;
1044/// let client = DocumentService::builder().build().await?;
1045/// // use `client` to make requests to the Discovery Engine API.
1046/// # gax::client_builder::Result::<()>::Ok(()) });
1047/// ```
1048///
1049/// # Service Description
1050///
1051/// Service for ingesting [Document][google.cloud.discoveryengine.v1.Document]
1052/// information of the customer's website.
1053///
1054/// [google.cloud.discoveryengine.v1.Document]: crate::model::Document
1055///
1056/// # Configuration
1057///
1058/// To configure `DocumentService` use the `with_*` methods in the type returned
1059/// by [builder()][DocumentService::builder]. The default configuration should
1060/// work for most applications. Common configuration changes include
1061///
1062/// * [with_endpoint()]: by default this client uses the global default endpoint
1063///   (`https://discoveryengine.googleapis.com`). Applications using regional
1064///   endpoints or running in restricted networks (e.g. a network configured
1065//    with [Private Google Access with VPC Service Controls]) may want to
1066///   override this default.
1067/// * [with_credentials()]: by default this client uses
1068///   [Application Default Credentials]. Applications using custom
1069///   authentication may need to override this default.
1070///
1071/// [with_endpoint()]: super::builder::document_service::ClientBuilder::with_endpoint
1072/// [with_credentials()]: super::builder::document_service::ClientBuilder::credentials
1073/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
1074/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
1075///
1076/// # Pooling and Cloning
1077///
1078/// `DocumentService` holds a connection pool internally, it is advised to
1079/// create one and the reuse it.  You do not need to wrap `DocumentService` in
1080/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
1081/// already uses an `Arc` internally.
1082#[cfg(feature = "document-service")]
1083#[cfg_attr(docsrs, doc(cfg(feature = "document-service")))]
1084#[derive(Clone, Debug)]
1085pub struct DocumentService {
1086    inner: std::sync::Arc<dyn super::stub::dynamic::DocumentService>,
1087}
1088
1089#[cfg(feature = "document-service")]
1090impl DocumentService {
1091    /// Returns a builder for [DocumentService].
1092    ///
1093    /// ```
1094    /// # tokio_test::block_on(async {
1095    /// # use google_cloud_discoveryengine_v1::client::DocumentService;
1096    /// let client = DocumentService::builder().build().await?;
1097    /// # gax::client_builder::Result::<()>::Ok(()) });
1098    /// ```
1099    pub fn builder() -> super::builder::document_service::ClientBuilder {
1100        gax::client_builder::internal::new_builder(
1101            super::builder::document_service::client::Factory,
1102        )
1103    }
1104
1105    /// Creates a new client from the provided stub.
1106    ///
1107    /// The most common case for calling this function is in tests mocking the
1108    /// client's behavior.
1109    pub fn from_stub<T>(stub: T) -> Self
1110    where
1111        T: super::stub::DocumentService + 'static,
1112    {
1113        Self {
1114            inner: std::sync::Arc::new(stub),
1115        }
1116    }
1117
1118    pub(crate) async fn new(
1119        config: gaxi::options::ClientConfig,
1120    ) -> gax::client_builder::Result<Self> {
1121        let inner = Self::build_inner(config).await?;
1122        Ok(Self { inner })
1123    }
1124
1125    async fn build_inner(
1126        conf: gaxi::options::ClientConfig,
1127    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::DocumentService>>
1128    {
1129        if gaxi::options::tracing_enabled(&conf) {
1130            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
1131        }
1132        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
1133    }
1134
1135    async fn build_transport(
1136        conf: gaxi::options::ClientConfig,
1137    ) -> gax::client_builder::Result<impl super::stub::DocumentService> {
1138        super::transport::DocumentService::new(conf).await
1139    }
1140
1141    async fn build_with_tracing(
1142        conf: gaxi::options::ClientConfig,
1143    ) -> gax::client_builder::Result<impl super::stub::DocumentService> {
1144        Self::build_transport(conf)
1145            .await
1146            .map(super::tracing::DocumentService::new)
1147    }
1148
1149    /// Gets a [Document][google.cloud.discoveryengine.v1.Document].
1150    ///
1151    /// [google.cloud.discoveryengine.v1.Document]: crate::model::Document
1152    pub fn get_document(&self) -> super::builder::document_service::GetDocument {
1153        super::builder::document_service::GetDocument::new(self.inner.clone())
1154    }
1155
1156    /// Gets a list of [Document][google.cloud.discoveryengine.v1.Document]s.
1157    ///
1158    /// [google.cloud.discoveryengine.v1.Document]: crate::model::Document
1159    pub fn list_documents(&self) -> super::builder::document_service::ListDocuments {
1160        super::builder::document_service::ListDocuments::new(self.inner.clone())
1161    }
1162
1163    /// Creates a [Document][google.cloud.discoveryengine.v1.Document].
1164    ///
1165    /// [google.cloud.discoveryengine.v1.Document]: crate::model::Document
1166    pub fn create_document(&self) -> super::builder::document_service::CreateDocument {
1167        super::builder::document_service::CreateDocument::new(self.inner.clone())
1168    }
1169
1170    /// Updates a [Document][google.cloud.discoveryengine.v1.Document].
1171    ///
1172    /// [google.cloud.discoveryengine.v1.Document]: crate::model::Document
1173    pub fn update_document(&self) -> super::builder::document_service::UpdateDocument {
1174        super::builder::document_service::UpdateDocument::new(self.inner.clone())
1175    }
1176
1177    /// Deletes a [Document][google.cloud.discoveryengine.v1.Document].
1178    ///
1179    /// [google.cloud.discoveryengine.v1.Document]: crate::model::Document
1180    pub fn delete_document(&self) -> super::builder::document_service::DeleteDocument {
1181        super::builder::document_service::DeleteDocument::new(self.inner.clone())
1182    }
1183
1184    /// Bulk import of multiple
1185    /// [Document][google.cloud.discoveryengine.v1.Document]s. Request processing
1186    /// may be synchronous. Non-existing items are created.
1187    ///
1188    /// Note: It is possible for a subset of the
1189    /// [Document][google.cloud.discoveryengine.v1.Document]s to be successfully
1190    /// updated.
1191    ///
1192    /// [google.cloud.discoveryengine.v1.Document]: crate::model::Document
1193    ///
1194    /// # Long running operations
1195    ///
1196    /// This method is used to start, and/or poll a [long-running Operation].
1197    /// The [Working with long-running operations] chapter in the [user guide]
1198    /// covers these operations in detail.
1199    ///
1200    /// [long-running operation]: https://google.aip.dev/151
1201    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1202    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1203    pub fn import_documents(&self) -> super::builder::document_service::ImportDocuments {
1204        super::builder::document_service::ImportDocuments::new(self.inner.clone())
1205    }
1206
1207    /// Permanently deletes all selected
1208    /// [Document][google.cloud.discoveryengine.v1.Document]s in a branch.
1209    ///
1210    /// This process is asynchronous. Depending on the number of
1211    /// [Document][google.cloud.discoveryengine.v1.Document]s to be deleted, this
1212    /// operation can take hours to complete. Before the delete operation
1213    /// completes, some [Document][google.cloud.discoveryengine.v1.Document]s might
1214    /// still be returned by
1215    /// [DocumentService.GetDocument][google.cloud.discoveryengine.v1.DocumentService.GetDocument]
1216    /// or
1217    /// [DocumentService.ListDocuments][google.cloud.discoveryengine.v1.DocumentService.ListDocuments].
1218    ///
1219    /// To get a list of the [Document][google.cloud.discoveryengine.v1.Document]s
1220    /// to be deleted, set
1221    /// [PurgeDocumentsRequest.force][google.cloud.discoveryengine.v1.PurgeDocumentsRequest.force]
1222    /// to false.
1223    ///
1224    /// [google.cloud.discoveryengine.v1.Document]: crate::model::Document
1225    /// [google.cloud.discoveryengine.v1.DocumentService.GetDocument]: crate::client::DocumentService::get_document
1226    /// [google.cloud.discoveryengine.v1.DocumentService.ListDocuments]: crate::client::DocumentService::list_documents
1227    /// [google.cloud.discoveryengine.v1.PurgeDocumentsRequest.force]: crate::model::PurgeDocumentsRequest::force
1228    ///
1229    /// # Long running operations
1230    ///
1231    /// This method is used to start, and/or poll a [long-running Operation].
1232    /// The [Working with long-running operations] chapter in the [user guide]
1233    /// covers these operations in detail.
1234    ///
1235    /// [long-running operation]: https://google.aip.dev/151
1236    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1237    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1238    pub fn purge_documents(&self) -> super::builder::document_service::PurgeDocuments {
1239        super::builder::document_service::PurgeDocuments::new(self.inner.clone())
1240    }
1241
1242    /// Gets index freshness metadata for
1243    /// [Document][google.cloud.discoveryengine.v1.Document]s. Supported for
1244    /// website search only.
1245    ///
1246    /// [google.cloud.discoveryengine.v1.Document]: crate::model::Document
1247    pub fn batch_get_documents_metadata(
1248        &self,
1249    ) -> super::builder::document_service::BatchGetDocumentsMetadata {
1250        super::builder::document_service::BatchGetDocumentsMetadata::new(self.inner.clone())
1251    }
1252
1253    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1254    ///
1255    /// [google.longrunning.Operations]: longrunning::client::Operations
1256    pub fn list_operations(&self) -> super::builder::document_service::ListOperations {
1257        super::builder::document_service::ListOperations::new(self.inner.clone())
1258    }
1259
1260    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1261    ///
1262    /// [google.longrunning.Operations]: longrunning::client::Operations
1263    pub fn get_operation(&self) -> super::builder::document_service::GetOperation {
1264        super::builder::document_service::GetOperation::new(self.inner.clone())
1265    }
1266
1267    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1268    ///
1269    /// [google.longrunning.Operations]: longrunning::client::Operations
1270    pub fn cancel_operation(&self) -> super::builder::document_service::CancelOperation {
1271        super::builder::document_service::CancelOperation::new(self.inner.clone())
1272    }
1273}
1274
1275/// Implements a client for the Discovery Engine API.
1276///
1277/// # Example
1278/// ```
1279/// # tokio_test::block_on(async {
1280/// # use google_cloud_discoveryengine_v1::client::EngineService;
1281/// let client = EngineService::builder().build().await?;
1282/// // use `client` to make requests to the Discovery Engine API.
1283/// # gax::client_builder::Result::<()>::Ok(()) });
1284/// ```
1285///
1286/// # Service Description
1287///
1288/// Service for managing [Engine][google.cloud.discoveryengine.v1.Engine]
1289/// configuration.
1290///
1291/// [google.cloud.discoveryengine.v1.Engine]: crate::model::Engine
1292///
1293/// # Configuration
1294///
1295/// To configure `EngineService` use the `with_*` methods in the type returned
1296/// by [builder()][EngineService::builder]. The default configuration should
1297/// work for most applications. Common configuration changes include
1298///
1299/// * [with_endpoint()]: by default this client uses the global default endpoint
1300///   (`https://discoveryengine.googleapis.com`). Applications using regional
1301///   endpoints or running in restricted networks (e.g. a network configured
1302//    with [Private Google Access with VPC Service Controls]) may want to
1303///   override this default.
1304/// * [with_credentials()]: by default this client uses
1305///   [Application Default Credentials]. Applications using custom
1306///   authentication may need to override this default.
1307///
1308/// [with_endpoint()]: super::builder::engine_service::ClientBuilder::with_endpoint
1309/// [with_credentials()]: super::builder::engine_service::ClientBuilder::credentials
1310/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
1311/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
1312///
1313/// # Pooling and Cloning
1314///
1315/// `EngineService` holds a connection pool internally, it is advised to
1316/// create one and the reuse it.  You do not need to wrap `EngineService` in
1317/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
1318/// already uses an `Arc` internally.
1319#[cfg(feature = "engine-service")]
1320#[cfg_attr(docsrs, doc(cfg(feature = "engine-service")))]
1321#[derive(Clone, Debug)]
1322pub struct EngineService {
1323    inner: std::sync::Arc<dyn super::stub::dynamic::EngineService>,
1324}
1325
1326#[cfg(feature = "engine-service")]
1327impl EngineService {
1328    /// Returns a builder for [EngineService].
1329    ///
1330    /// ```
1331    /// # tokio_test::block_on(async {
1332    /// # use google_cloud_discoveryengine_v1::client::EngineService;
1333    /// let client = EngineService::builder().build().await?;
1334    /// # gax::client_builder::Result::<()>::Ok(()) });
1335    /// ```
1336    pub fn builder() -> super::builder::engine_service::ClientBuilder {
1337        gax::client_builder::internal::new_builder(super::builder::engine_service::client::Factory)
1338    }
1339
1340    /// Creates a new client from the provided stub.
1341    ///
1342    /// The most common case for calling this function is in tests mocking the
1343    /// client's behavior.
1344    pub fn from_stub<T>(stub: T) -> Self
1345    where
1346        T: super::stub::EngineService + 'static,
1347    {
1348        Self {
1349            inner: std::sync::Arc::new(stub),
1350        }
1351    }
1352
1353    pub(crate) async fn new(
1354        config: gaxi::options::ClientConfig,
1355    ) -> gax::client_builder::Result<Self> {
1356        let inner = Self::build_inner(config).await?;
1357        Ok(Self { inner })
1358    }
1359
1360    async fn build_inner(
1361        conf: gaxi::options::ClientConfig,
1362    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::EngineService>> {
1363        if gaxi::options::tracing_enabled(&conf) {
1364            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
1365        }
1366        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
1367    }
1368
1369    async fn build_transport(
1370        conf: gaxi::options::ClientConfig,
1371    ) -> gax::client_builder::Result<impl super::stub::EngineService> {
1372        super::transport::EngineService::new(conf).await
1373    }
1374
1375    async fn build_with_tracing(
1376        conf: gaxi::options::ClientConfig,
1377    ) -> gax::client_builder::Result<impl super::stub::EngineService> {
1378        Self::build_transport(conf)
1379            .await
1380            .map(super::tracing::EngineService::new)
1381    }
1382
1383    /// Creates a [Engine][google.cloud.discoveryengine.v1.Engine].
1384    ///
1385    /// [google.cloud.discoveryengine.v1.Engine]: crate::model::Engine
1386    ///
1387    /// # Long running operations
1388    ///
1389    /// This method is used to start, and/or poll a [long-running Operation].
1390    /// The [Working with long-running operations] chapter in the [user guide]
1391    /// covers these operations in detail.
1392    ///
1393    /// [long-running operation]: https://google.aip.dev/151
1394    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1395    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1396    pub fn create_engine(&self) -> super::builder::engine_service::CreateEngine {
1397        super::builder::engine_service::CreateEngine::new(self.inner.clone())
1398    }
1399
1400    /// Deletes a [Engine][google.cloud.discoveryengine.v1.Engine].
1401    ///
1402    /// [google.cloud.discoveryengine.v1.Engine]: crate::model::Engine
1403    ///
1404    /// # Long running operations
1405    ///
1406    /// This method is used to start, and/or poll a [long-running Operation].
1407    /// The [Working with long-running operations] chapter in the [user guide]
1408    /// covers these operations in detail.
1409    ///
1410    /// [long-running operation]: https://google.aip.dev/151
1411    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1412    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1413    pub fn delete_engine(&self) -> super::builder::engine_service::DeleteEngine {
1414        super::builder::engine_service::DeleteEngine::new(self.inner.clone())
1415    }
1416
1417    /// Updates an [Engine][google.cloud.discoveryengine.v1.Engine]
1418    ///
1419    /// [google.cloud.discoveryengine.v1.Engine]: crate::model::Engine
1420    pub fn update_engine(&self) -> super::builder::engine_service::UpdateEngine {
1421        super::builder::engine_service::UpdateEngine::new(self.inner.clone())
1422    }
1423
1424    /// Gets a [Engine][google.cloud.discoveryengine.v1.Engine].
1425    ///
1426    /// [google.cloud.discoveryengine.v1.Engine]: crate::model::Engine
1427    pub fn get_engine(&self) -> super::builder::engine_service::GetEngine {
1428        super::builder::engine_service::GetEngine::new(self.inner.clone())
1429    }
1430
1431    /// Lists all the [Engine][google.cloud.discoveryengine.v1.Engine]s associated
1432    /// with the project.
1433    ///
1434    /// [google.cloud.discoveryengine.v1.Engine]: crate::model::Engine
1435    pub fn list_engines(&self) -> super::builder::engine_service::ListEngines {
1436        super::builder::engine_service::ListEngines::new(self.inner.clone())
1437    }
1438
1439    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1440    ///
1441    /// [google.longrunning.Operations]: longrunning::client::Operations
1442    pub fn list_operations(&self) -> super::builder::engine_service::ListOperations {
1443        super::builder::engine_service::ListOperations::new(self.inner.clone())
1444    }
1445
1446    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1447    ///
1448    /// [google.longrunning.Operations]: longrunning::client::Operations
1449    pub fn get_operation(&self) -> super::builder::engine_service::GetOperation {
1450        super::builder::engine_service::GetOperation::new(self.inner.clone())
1451    }
1452
1453    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1454    ///
1455    /// [google.longrunning.Operations]: longrunning::client::Operations
1456    pub fn cancel_operation(&self) -> super::builder::engine_service::CancelOperation {
1457        super::builder::engine_service::CancelOperation::new(self.inner.clone())
1458    }
1459}
1460
1461/// Implements a client for the Discovery Engine API.
1462///
1463/// # Example
1464/// ```
1465/// # tokio_test::block_on(async {
1466/// # use google_cloud_discoveryengine_v1::client::GroundedGenerationService;
1467/// let client = GroundedGenerationService::builder().build().await?;
1468/// // use `client` to make requests to the Discovery Engine API.
1469/// # gax::client_builder::Result::<()>::Ok(()) });
1470/// ```
1471///
1472/// # Service Description
1473///
1474/// Service for grounded generation.
1475///
1476/// # Configuration
1477///
1478/// To configure `GroundedGenerationService` use the `with_*` methods in the type returned
1479/// by [builder()][GroundedGenerationService::builder]. The default configuration should
1480/// work for most applications. Common configuration changes include
1481///
1482/// * [with_endpoint()]: by default this client uses the global default endpoint
1483///   (`https://discoveryengine.googleapis.com`). Applications using regional
1484///   endpoints or running in restricted networks (e.g. a network configured
1485//    with [Private Google Access with VPC Service Controls]) may want to
1486///   override this default.
1487/// * [with_credentials()]: by default this client uses
1488///   [Application Default Credentials]. Applications using custom
1489///   authentication may need to override this default.
1490///
1491/// [with_endpoint()]: super::builder::grounded_generation_service::ClientBuilder::with_endpoint
1492/// [with_credentials()]: super::builder::grounded_generation_service::ClientBuilder::credentials
1493/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
1494/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
1495///
1496/// # Pooling and Cloning
1497///
1498/// `GroundedGenerationService` holds a connection pool internally, it is advised to
1499/// create one and the reuse it.  You do not need to wrap `GroundedGenerationService` in
1500/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
1501/// already uses an `Arc` internally.
1502#[cfg(feature = "grounded-generation-service")]
1503#[cfg_attr(docsrs, doc(cfg(feature = "grounded-generation-service")))]
1504#[derive(Clone, Debug)]
1505pub struct GroundedGenerationService {
1506    inner: std::sync::Arc<dyn super::stub::dynamic::GroundedGenerationService>,
1507}
1508
1509#[cfg(feature = "grounded-generation-service")]
1510impl GroundedGenerationService {
1511    /// Returns a builder for [GroundedGenerationService].
1512    ///
1513    /// ```
1514    /// # tokio_test::block_on(async {
1515    /// # use google_cloud_discoveryengine_v1::client::GroundedGenerationService;
1516    /// let client = GroundedGenerationService::builder().build().await?;
1517    /// # gax::client_builder::Result::<()>::Ok(()) });
1518    /// ```
1519    pub fn builder() -> super::builder::grounded_generation_service::ClientBuilder {
1520        gax::client_builder::internal::new_builder(
1521            super::builder::grounded_generation_service::client::Factory,
1522        )
1523    }
1524
1525    /// Creates a new client from the provided stub.
1526    ///
1527    /// The most common case for calling this function is in tests mocking the
1528    /// client's behavior.
1529    pub fn from_stub<T>(stub: T) -> Self
1530    where
1531        T: super::stub::GroundedGenerationService + 'static,
1532    {
1533        Self {
1534            inner: std::sync::Arc::new(stub),
1535        }
1536    }
1537
1538    pub(crate) async fn new(
1539        config: gaxi::options::ClientConfig,
1540    ) -> gax::client_builder::Result<Self> {
1541        let inner = Self::build_inner(config).await?;
1542        Ok(Self { inner })
1543    }
1544
1545    async fn build_inner(
1546        conf: gaxi::options::ClientConfig,
1547    ) -> gax::client_builder::Result<
1548        std::sync::Arc<dyn super::stub::dynamic::GroundedGenerationService>,
1549    > {
1550        if gaxi::options::tracing_enabled(&conf) {
1551            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
1552        }
1553        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
1554    }
1555
1556    async fn build_transport(
1557        conf: gaxi::options::ClientConfig,
1558    ) -> gax::client_builder::Result<impl super::stub::GroundedGenerationService> {
1559        super::transport::GroundedGenerationService::new(conf).await
1560    }
1561
1562    async fn build_with_tracing(
1563        conf: gaxi::options::ClientConfig,
1564    ) -> gax::client_builder::Result<impl super::stub::GroundedGenerationService> {
1565        Self::build_transport(conf)
1566            .await
1567            .map(super::tracing::GroundedGenerationService::new)
1568    }
1569
1570    /// Generates grounded content.
1571    pub fn generate_grounded_content(
1572        &self,
1573    ) -> super::builder::grounded_generation_service::GenerateGroundedContent {
1574        super::builder::grounded_generation_service::GenerateGroundedContent::new(
1575            self.inner.clone(),
1576        )
1577    }
1578
1579    /// Performs a grounding check.
1580    pub fn check_grounding(&self) -> super::builder::grounded_generation_service::CheckGrounding {
1581        super::builder::grounded_generation_service::CheckGrounding::new(self.inner.clone())
1582    }
1583
1584    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1585    ///
1586    /// [google.longrunning.Operations]: longrunning::client::Operations
1587    pub fn list_operations(&self) -> super::builder::grounded_generation_service::ListOperations {
1588        super::builder::grounded_generation_service::ListOperations::new(self.inner.clone())
1589    }
1590
1591    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1592    ///
1593    /// [google.longrunning.Operations]: longrunning::client::Operations
1594    pub fn get_operation(&self) -> super::builder::grounded_generation_service::GetOperation {
1595        super::builder::grounded_generation_service::GetOperation::new(self.inner.clone())
1596    }
1597
1598    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1599    ///
1600    /// [google.longrunning.Operations]: longrunning::client::Operations
1601    pub fn cancel_operation(&self) -> super::builder::grounded_generation_service::CancelOperation {
1602        super::builder::grounded_generation_service::CancelOperation::new(self.inner.clone())
1603    }
1604}
1605
1606/// Implements a client for the Discovery Engine API.
1607///
1608/// # Example
1609/// ```
1610/// # tokio_test::block_on(async {
1611/// # use google_cloud_discoveryengine_v1::client::IdentityMappingStoreService;
1612/// let client = IdentityMappingStoreService::builder().build().await?;
1613/// // use `client` to make requests to the Discovery Engine API.
1614/// # gax::client_builder::Result::<()>::Ok(()) });
1615/// ```
1616///
1617/// # Service Description
1618///
1619/// Service for managing Identity Mapping Stores.
1620///
1621/// # Configuration
1622///
1623/// To configure `IdentityMappingStoreService` use the `with_*` methods in the type returned
1624/// by [builder()][IdentityMappingStoreService::builder]. The default configuration should
1625/// work for most applications. Common configuration changes include
1626///
1627/// * [with_endpoint()]: by default this client uses the global default endpoint
1628///   (`https://discoveryengine.googleapis.com`). Applications using regional
1629///   endpoints or running in restricted networks (e.g. a network configured
1630//    with [Private Google Access with VPC Service Controls]) may want to
1631///   override this default.
1632/// * [with_credentials()]: by default this client uses
1633///   [Application Default Credentials]. Applications using custom
1634///   authentication may need to override this default.
1635///
1636/// [with_endpoint()]: super::builder::identity_mapping_store_service::ClientBuilder::with_endpoint
1637/// [with_credentials()]: super::builder::identity_mapping_store_service::ClientBuilder::credentials
1638/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
1639/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
1640///
1641/// # Pooling and Cloning
1642///
1643/// `IdentityMappingStoreService` holds a connection pool internally, it is advised to
1644/// create one and the reuse it.  You do not need to wrap `IdentityMappingStoreService` in
1645/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
1646/// already uses an `Arc` internally.
1647#[cfg(feature = "identity-mapping-store-service")]
1648#[cfg_attr(docsrs, doc(cfg(feature = "identity-mapping-store-service")))]
1649#[derive(Clone, Debug)]
1650pub struct IdentityMappingStoreService {
1651    inner: std::sync::Arc<dyn super::stub::dynamic::IdentityMappingStoreService>,
1652}
1653
1654#[cfg(feature = "identity-mapping-store-service")]
1655impl IdentityMappingStoreService {
1656    /// Returns a builder for [IdentityMappingStoreService].
1657    ///
1658    /// ```
1659    /// # tokio_test::block_on(async {
1660    /// # use google_cloud_discoveryengine_v1::client::IdentityMappingStoreService;
1661    /// let client = IdentityMappingStoreService::builder().build().await?;
1662    /// # gax::client_builder::Result::<()>::Ok(()) });
1663    /// ```
1664    pub fn builder() -> super::builder::identity_mapping_store_service::ClientBuilder {
1665        gax::client_builder::internal::new_builder(
1666            super::builder::identity_mapping_store_service::client::Factory,
1667        )
1668    }
1669
1670    /// Creates a new client from the provided stub.
1671    ///
1672    /// The most common case for calling this function is in tests mocking the
1673    /// client's behavior.
1674    pub fn from_stub<T>(stub: T) -> Self
1675    where
1676        T: super::stub::IdentityMappingStoreService + 'static,
1677    {
1678        Self {
1679            inner: std::sync::Arc::new(stub),
1680        }
1681    }
1682
1683    pub(crate) async fn new(
1684        config: gaxi::options::ClientConfig,
1685    ) -> gax::client_builder::Result<Self> {
1686        let inner = Self::build_inner(config).await?;
1687        Ok(Self { inner })
1688    }
1689
1690    async fn build_inner(
1691        conf: gaxi::options::ClientConfig,
1692    ) -> gax::client_builder::Result<
1693        std::sync::Arc<dyn super::stub::dynamic::IdentityMappingStoreService>,
1694    > {
1695        if gaxi::options::tracing_enabled(&conf) {
1696            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
1697        }
1698        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
1699    }
1700
1701    async fn build_transport(
1702        conf: gaxi::options::ClientConfig,
1703    ) -> gax::client_builder::Result<impl super::stub::IdentityMappingStoreService> {
1704        super::transport::IdentityMappingStoreService::new(conf).await
1705    }
1706
1707    async fn build_with_tracing(
1708        conf: gaxi::options::ClientConfig,
1709    ) -> gax::client_builder::Result<impl super::stub::IdentityMappingStoreService> {
1710        Self::build_transport(conf)
1711            .await
1712            .map(super::tracing::IdentityMappingStoreService::new)
1713    }
1714
1715    /// Creates a new Identity Mapping Store.
1716    pub fn create_identity_mapping_store(
1717        &self,
1718    ) -> super::builder::identity_mapping_store_service::CreateIdentityMappingStore {
1719        super::builder::identity_mapping_store_service::CreateIdentityMappingStore::new(
1720            self.inner.clone(),
1721        )
1722    }
1723
1724    /// Gets the Identity Mapping Store.
1725    pub fn get_identity_mapping_store(
1726        &self,
1727    ) -> super::builder::identity_mapping_store_service::GetIdentityMappingStore {
1728        super::builder::identity_mapping_store_service::GetIdentityMappingStore::new(
1729            self.inner.clone(),
1730        )
1731    }
1732
1733    /// Deletes the Identity Mapping Store.
1734    ///
1735    /// # Long running operations
1736    ///
1737    /// This method is used to start, and/or poll a [long-running Operation].
1738    /// The [Working with long-running operations] chapter in the [user guide]
1739    /// covers these operations in detail.
1740    ///
1741    /// [long-running operation]: https://google.aip.dev/151
1742    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1743    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1744    pub fn delete_identity_mapping_store(
1745        &self,
1746    ) -> super::builder::identity_mapping_store_service::DeleteIdentityMappingStore {
1747        super::builder::identity_mapping_store_service::DeleteIdentityMappingStore::new(
1748            self.inner.clone(),
1749        )
1750    }
1751
1752    /// Imports a list of Identity Mapping Entries to an Identity Mapping Store.
1753    ///
1754    /// # Long running operations
1755    ///
1756    /// This method is used to start, and/or poll a [long-running Operation].
1757    /// The [Working with long-running operations] chapter in the [user guide]
1758    /// covers these operations in detail.
1759    ///
1760    /// [long-running operation]: https://google.aip.dev/151
1761    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1762    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1763    pub fn import_identity_mappings(
1764        &self,
1765    ) -> super::builder::identity_mapping_store_service::ImportIdentityMappings {
1766        super::builder::identity_mapping_store_service::ImportIdentityMappings::new(
1767            self.inner.clone(),
1768        )
1769    }
1770
1771    /// Purges specified or all Identity Mapping Entries from an Identity Mapping
1772    /// Store.
1773    ///
1774    /// # Long running operations
1775    ///
1776    /// This method is used to start, and/or poll a [long-running Operation].
1777    /// The [Working with long-running operations] chapter in the [user guide]
1778    /// covers these operations in detail.
1779    ///
1780    /// [long-running operation]: https://google.aip.dev/151
1781    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1782    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1783    pub fn purge_identity_mappings(
1784        &self,
1785    ) -> super::builder::identity_mapping_store_service::PurgeIdentityMappings {
1786        super::builder::identity_mapping_store_service::PurgeIdentityMappings::new(
1787            self.inner.clone(),
1788        )
1789    }
1790
1791    /// Lists Identity Mappings in an Identity Mapping Store.
1792    pub fn list_identity_mappings(
1793        &self,
1794    ) -> super::builder::identity_mapping_store_service::ListIdentityMappings {
1795        super::builder::identity_mapping_store_service::ListIdentityMappings::new(
1796            self.inner.clone(),
1797        )
1798    }
1799
1800    /// Lists all Identity Mapping Stores.
1801    pub fn list_identity_mapping_stores(
1802        &self,
1803    ) -> super::builder::identity_mapping_store_service::ListIdentityMappingStores {
1804        super::builder::identity_mapping_store_service::ListIdentityMappingStores::new(
1805            self.inner.clone(),
1806        )
1807    }
1808
1809    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1810    ///
1811    /// [google.longrunning.Operations]: longrunning::client::Operations
1812    pub fn list_operations(
1813        &self,
1814    ) -> super::builder::identity_mapping_store_service::ListOperations {
1815        super::builder::identity_mapping_store_service::ListOperations::new(self.inner.clone())
1816    }
1817
1818    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1819    ///
1820    /// [google.longrunning.Operations]: longrunning::client::Operations
1821    pub fn get_operation(&self) -> super::builder::identity_mapping_store_service::GetOperation {
1822        super::builder::identity_mapping_store_service::GetOperation::new(self.inner.clone())
1823    }
1824
1825    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1826    ///
1827    /// [google.longrunning.Operations]: longrunning::client::Operations
1828    pub fn cancel_operation(
1829        &self,
1830    ) -> super::builder::identity_mapping_store_service::CancelOperation {
1831        super::builder::identity_mapping_store_service::CancelOperation::new(self.inner.clone())
1832    }
1833}
1834
1835/// Implements a client for the Discovery Engine API.
1836///
1837/// # Example
1838/// ```
1839/// # tokio_test::block_on(async {
1840/// # use google_cloud_discoveryengine_v1::client::ProjectService;
1841/// let client = ProjectService::builder().build().await?;
1842/// // use `client` to make requests to the Discovery Engine API.
1843/// # gax::client_builder::Result::<()>::Ok(()) });
1844/// ```
1845///
1846/// # Service Description
1847///
1848/// Service for operations on the
1849/// [Project][google.cloud.discoveryengine.v1.Project].
1850///
1851/// [google.cloud.discoveryengine.v1.Project]: crate::model::Project
1852///
1853/// # Configuration
1854///
1855/// To configure `ProjectService` use the `with_*` methods in the type returned
1856/// by [builder()][ProjectService::builder]. The default configuration should
1857/// work for most applications. Common configuration changes include
1858///
1859/// * [with_endpoint()]: by default this client uses the global default endpoint
1860///   (`https://discoveryengine.googleapis.com`). Applications using regional
1861///   endpoints or running in restricted networks (e.g. a network configured
1862//    with [Private Google Access with VPC Service Controls]) may want to
1863///   override this default.
1864/// * [with_credentials()]: by default this client uses
1865///   [Application Default Credentials]. Applications using custom
1866///   authentication may need to override this default.
1867///
1868/// [with_endpoint()]: super::builder::project_service::ClientBuilder::with_endpoint
1869/// [with_credentials()]: super::builder::project_service::ClientBuilder::credentials
1870/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
1871/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
1872///
1873/// # Pooling and Cloning
1874///
1875/// `ProjectService` holds a connection pool internally, it is advised to
1876/// create one and the reuse it.  You do not need to wrap `ProjectService` in
1877/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
1878/// already uses an `Arc` internally.
1879#[cfg(feature = "project-service")]
1880#[cfg_attr(docsrs, doc(cfg(feature = "project-service")))]
1881#[derive(Clone, Debug)]
1882pub struct ProjectService {
1883    inner: std::sync::Arc<dyn super::stub::dynamic::ProjectService>,
1884}
1885
1886#[cfg(feature = "project-service")]
1887impl ProjectService {
1888    /// Returns a builder for [ProjectService].
1889    ///
1890    /// ```
1891    /// # tokio_test::block_on(async {
1892    /// # use google_cloud_discoveryengine_v1::client::ProjectService;
1893    /// let client = ProjectService::builder().build().await?;
1894    /// # gax::client_builder::Result::<()>::Ok(()) });
1895    /// ```
1896    pub fn builder() -> super::builder::project_service::ClientBuilder {
1897        gax::client_builder::internal::new_builder(super::builder::project_service::client::Factory)
1898    }
1899
1900    /// Creates a new client from the provided stub.
1901    ///
1902    /// The most common case for calling this function is in tests mocking the
1903    /// client's behavior.
1904    pub fn from_stub<T>(stub: T) -> Self
1905    where
1906        T: super::stub::ProjectService + 'static,
1907    {
1908        Self {
1909            inner: std::sync::Arc::new(stub),
1910        }
1911    }
1912
1913    pub(crate) async fn new(
1914        config: gaxi::options::ClientConfig,
1915    ) -> gax::client_builder::Result<Self> {
1916        let inner = Self::build_inner(config).await?;
1917        Ok(Self { inner })
1918    }
1919
1920    async fn build_inner(
1921        conf: gaxi::options::ClientConfig,
1922    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::ProjectService>> {
1923        if gaxi::options::tracing_enabled(&conf) {
1924            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
1925        }
1926        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
1927    }
1928
1929    async fn build_transport(
1930        conf: gaxi::options::ClientConfig,
1931    ) -> gax::client_builder::Result<impl super::stub::ProjectService> {
1932        super::transport::ProjectService::new(conf).await
1933    }
1934
1935    async fn build_with_tracing(
1936        conf: gaxi::options::ClientConfig,
1937    ) -> gax::client_builder::Result<impl super::stub::ProjectService> {
1938        Self::build_transport(conf)
1939            .await
1940            .map(super::tracing::ProjectService::new)
1941    }
1942
1943    /// Provisions the project resource. During the
1944    /// process, related systems will get prepared and initialized.
1945    ///
1946    /// Caller must read the [Terms for data
1947    /// use](https://cloud.google.com/retail/data-use-terms), and optionally
1948    /// specify in request to provide consent to that service terms.
1949    ///
1950    /// # Long running operations
1951    ///
1952    /// This method is used to start, and/or poll a [long-running Operation].
1953    /// The [Working with long-running operations] chapter in the [user guide]
1954    /// covers these operations in detail.
1955    ///
1956    /// [long-running operation]: https://google.aip.dev/151
1957    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1958    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1959    pub fn provision_project(&self) -> super::builder::project_service::ProvisionProject {
1960        super::builder::project_service::ProvisionProject::new(self.inner.clone())
1961    }
1962
1963    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1964    ///
1965    /// [google.longrunning.Operations]: longrunning::client::Operations
1966    pub fn list_operations(&self) -> super::builder::project_service::ListOperations {
1967        super::builder::project_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]: longrunning::client::Operations
1973    pub fn get_operation(&self) -> super::builder::project_service::GetOperation {
1974        super::builder::project_service::GetOperation::new(self.inner.clone())
1975    }
1976
1977    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1978    ///
1979    /// [google.longrunning.Operations]: longrunning::client::Operations
1980    pub fn cancel_operation(&self) -> super::builder::project_service::CancelOperation {
1981        super::builder::project_service::CancelOperation::new(self.inner.clone())
1982    }
1983}
1984
1985/// Implements a client for the Discovery Engine API.
1986///
1987/// # Example
1988/// ```
1989/// # tokio_test::block_on(async {
1990/// # use google_cloud_discoveryengine_v1::client::RankService;
1991/// let client = RankService::builder().build().await?;
1992/// // use `client` to make requests to the Discovery Engine API.
1993/// # gax::client_builder::Result::<()>::Ok(()) });
1994/// ```
1995///
1996/// # Service Description
1997///
1998/// Service for ranking text records.
1999///
2000/// # Configuration
2001///
2002/// To configure `RankService` use the `with_*` methods in the type returned
2003/// by [builder()][RankService::builder]. The default configuration should
2004/// work for most applications. Common configuration changes include
2005///
2006/// * [with_endpoint()]: by default this client uses the global default endpoint
2007///   (`https://discoveryengine.googleapis.com`). Applications using regional
2008///   endpoints or running in restricted networks (e.g. a network configured
2009//    with [Private Google Access with VPC Service Controls]) may want to
2010///   override this default.
2011/// * [with_credentials()]: by default this client uses
2012///   [Application Default Credentials]. Applications using custom
2013///   authentication may need to override this default.
2014///
2015/// [with_endpoint()]: super::builder::rank_service::ClientBuilder::with_endpoint
2016/// [with_credentials()]: super::builder::rank_service::ClientBuilder::credentials
2017/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
2018/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
2019///
2020/// # Pooling and Cloning
2021///
2022/// `RankService` holds a connection pool internally, it is advised to
2023/// create one and the reuse it.  You do not need to wrap `RankService` in
2024/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
2025/// already uses an `Arc` internally.
2026#[cfg(feature = "rank-service")]
2027#[cfg_attr(docsrs, doc(cfg(feature = "rank-service")))]
2028#[derive(Clone, Debug)]
2029pub struct RankService {
2030    inner: std::sync::Arc<dyn super::stub::dynamic::RankService>,
2031}
2032
2033#[cfg(feature = "rank-service")]
2034impl RankService {
2035    /// Returns a builder for [RankService].
2036    ///
2037    /// ```
2038    /// # tokio_test::block_on(async {
2039    /// # use google_cloud_discoveryengine_v1::client::RankService;
2040    /// let client = RankService::builder().build().await?;
2041    /// # gax::client_builder::Result::<()>::Ok(()) });
2042    /// ```
2043    pub fn builder() -> super::builder::rank_service::ClientBuilder {
2044        gax::client_builder::internal::new_builder(super::builder::rank_service::client::Factory)
2045    }
2046
2047    /// Creates a new client from the provided stub.
2048    ///
2049    /// The most common case for calling this function is in tests mocking the
2050    /// client's behavior.
2051    pub fn from_stub<T>(stub: T) -> Self
2052    where
2053        T: super::stub::RankService + 'static,
2054    {
2055        Self {
2056            inner: std::sync::Arc::new(stub),
2057        }
2058    }
2059
2060    pub(crate) async fn new(
2061        config: gaxi::options::ClientConfig,
2062    ) -> gax::client_builder::Result<Self> {
2063        let inner = Self::build_inner(config).await?;
2064        Ok(Self { inner })
2065    }
2066
2067    async fn build_inner(
2068        conf: gaxi::options::ClientConfig,
2069    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::RankService>> {
2070        if gaxi::options::tracing_enabled(&conf) {
2071            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
2072        }
2073        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
2074    }
2075
2076    async fn build_transport(
2077        conf: gaxi::options::ClientConfig,
2078    ) -> gax::client_builder::Result<impl super::stub::RankService> {
2079        super::transport::RankService::new(conf).await
2080    }
2081
2082    async fn build_with_tracing(
2083        conf: gaxi::options::ClientConfig,
2084    ) -> gax::client_builder::Result<impl super::stub::RankService> {
2085        Self::build_transport(conf)
2086            .await
2087            .map(super::tracing::RankService::new)
2088    }
2089
2090    /// Ranks a list of text records based on the given input query.
2091    pub fn rank(&self) -> super::builder::rank_service::Rank {
2092        super::builder::rank_service::Rank::new(self.inner.clone())
2093    }
2094
2095    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2096    ///
2097    /// [google.longrunning.Operations]: longrunning::client::Operations
2098    pub fn list_operations(&self) -> super::builder::rank_service::ListOperations {
2099        super::builder::rank_service::ListOperations::new(self.inner.clone())
2100    }
2101
2102    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2103    ///
2104    /// [google.longrunning.Operations]: longrunning::client::Operations
2105    pub fn get_operation(&self) -> super::builder::rank_service::GetOperation {
2106        super::builder::rank_service::GetOperation::new(self.inner.clone())
2107    }
2108
2109    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2110    ///
2111    /// [google.longrunning.Operations]: longrunning::client::Operations
2112    pub fn cancel_operation(&self) -> super::builder::rank_service::CancelOperation {
2113        super::builder::rank_service::CancelOperation::new(self.inner.clone())
2114    }
2115}
2116
2117/// Implements a client for the Discovery Engine API.
2118///
2119/// # Example
2120/// ```
2121/// # tokio_test::block_on(async {
2122/// # use google_cloud_discoveryengine_v1::client::RecommendationService;
2123/// let client = RecommendationService::builder().build().await?;
2124/// // use `client` to make requests to the Discovery Engine API.
2125/// # gax::client_builder::Result::<()>::Ok(()) });
2126/// ```
2127///
2128/// # Service Description
2129///
2130/// Service for making recommendations.
2131///
2132/// # Configuration
2133///
2134/// To configure `RecommendationService` use the `with_*` methods in the type returned
2135/// by [builder()][RecommendationService::builder]. The default configuration should
2136/// work for most applications. Common configuration changes include
2137///
2138/// * [with_endpoint()]: by default this client uses the global default endpoint
2139///   (`https://discoveryengine.googleapis.com`). Applications using regional
2140///   endpoints or running in restricted networks (e.g. a network configured
2141//    with [Private Google Access with VPC Service Controls]) may want to
2142///   override this default.
2143/// * [with_credentials()]: by default this client uses
2144///   [Application Default Credentials]. Applications using custom
2145///   authentication may need to override this default.
2146///
2147/// [with_endpoint()]: super::builder::recommendation_service::ClientBuilder::with_endpoint
2148/// [with_credentials()]: super::builder::recommendation_service::ClientBuilder::credentials
2149/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
2150/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
2151///
2152/// # Pooling and Cloning
2153///
2154/// `RecommendationService` holds a connection pool internally, it is advised to
2155/// create one and the reuse it.  You do not need to wrap `RecommendationService` in
2156/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
2157/// already uses an `Arc` internally.
2158#[cfg(feature = "recommendation-service")]
2159#[cfg_attr(docsrs, doc(cfg(feature = "recommendation-service")))]
2160#[derive(Clone, Debug)]
2161pub struct RecommendationService {
2162    inner: std::sync::Arc<dyn super::stub::dynamic::RecommendationService>,
2163}
2164
2165#[cfg(feature = "recommendation-service")]
2166impl RecommendationService {
2167    /// Returns a builder for [RecommendationService].
2168    ///
2169    /// ```
2170    /// # tokio_test::block_on(async {
2171    /// # use google_cloud_discoveryengine_v1::client::RecommendationService;
2172    /// let client = RecommendationService::builder().build().await?;
2173    /// # gax::client_builder::Result::<()>::Ok(()) });
2174    /// ```
2175    pub fn builder() -> super::builder::recommendation_service::ClientBuilder {
2176        gax::client_builder::internal::new_builder(
2177            super::builder::recommendation_service::client::Factory,
2178        )
2179    }
2180
2181    /// Creates a new client from the provided stub.
2182    ///
2183    /// The most common case for calling this function is in tests mocking the
2184    /// client's behavior.
2185    pub fn from_stub<T>(stub: T) -> Self
2186    where
2187        T: super::stub::RecommendationService + 'static,
2188    {
2189        Self {
2190            inner: std::sync::Arc::new(stub),
2191        }
2192    }
2193
2194    pub(crate) async fn new(
2195        config: gaxi::options::ClientConfig,
2196    ) -> gax::client_builder::Result<Self> {
2197        let inner = Self::build_inner(config).await?;
2198        Ok(Self { inner })
2199    }
2200
2201    async fn build_inner(
2202        conf: gaxi::options::ClientConfig,
2203    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::RecommendationService>>
2204    {
2205        if gaxi::options::tracing_enabled(&conf) {
2206            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
2207        }
2208        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
2209    }
2210
2211    async fn build_transport(
2212        conf: gaxi::options::ClientConfig,
2213    ) -> gax::client_builder::Result<impl super::stub::RecommendationService> {
2214        super::transport::RecommendationService::new(conf).await
2215    }
2216
2217    async fn build_with_tracing(
2218        conf: gaxi::options::ClientConfig,
2219    ) -> gax::client_builder::Result<impl super::stub::RecommendationService> {
2220        Self::build_transport(conf)
2221            .await
2222            .map(super::tracing::RecommendationService::new)
2223    }
2224
2225    /// Makes a recommendation, which requires a contextual user event.
2226    pub fn recommend(&self) -> super::builder::recommendation_service::Recommend {
2227        super::builder::recommendation_service::Recommend::new(self.inner.clone())
2228    }
2229
2230    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2231    ///
2232    /// [google.longrunning.Operations]: longrunning::client::Operations
2233    pub fn list_operations(&self) -> super::builder::recommendation_service::ListOperations {
2234        super::builder::recommendation_service::ListOperations::new(self.inner.clone())
2235    }
2236
2237    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2238    ///
2239    /// [google.longrunning.Operations]: longrunning::client::Operations
2240    pub fn get_operation(&self) -> super::builder::recommendation_service::GetOperation {
2241        super::builder::recommendation_service::GetOperation::new(self.inner.clone())
2242    }
2243
2244    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2245    ///
2246    /// [google.longrunning.Operations]: longrunning::client::Operations
2247    pub fn cancel_operation(&self) -> super::builder::recommendation_service::CancelOperation {
2248        super::builder::recommendation_service::CancelOperation::new(self.inner.clone())
2249    }
2250}
2251
2252/// Implements a client for the Discovery Engine API.
2253///
2254/// # Example
2255/// ```
2256/// # tokio_test::block_on(async {
2257/// # use google_cloud_discoveryengine_v1::client::SchemaService;
2258/// let client = SchemaService::builder().build().await?;
2259/// // use `client` to make requests to the Discovery Engine API.
2260/// # gax::client_builder::Result::<()>::Ok(()) });
2261/// ```
2262///
2263/// # Service Description
2264///
2265/// Service for managing [Schema][google.cloud.discoveryengine.v1.Schema]s.
2266///
2267/// [google.cloud.discoveryengine.v1.Schema]: crate::model::Schema
2268///
2269/// # Configuration
2270///
2271/// To configure `SchemaService` use the `with_*` methods in the type returned
2272/// by [builder()][SchemaService::builder]. The default configuration should
2273/// work for most applications. Common configuration changes include
2274///
2275/// * [with_endpoint()]: by default this client uses the global default endpoint
2276///   (`https://discoveryengine.googleapis.com`). Applications using regional
2277///   endpoints or running in restricted networks (e.g. a network configured
2278//    with [Private Google Access with VPC Service Controls]) may want to
2279///   override this default.
2280/// * [with_credentials()]: by default this client uses
2281///   [Application Default Credentials]. Applications using custom
2282///   authentication may need to override this default.
2283///
2284/// [with_endpoint()]: super::builder::schema_service::ClientBuilder::with_endpoint
2285/// [with_credentials()]: super::builder::schema_service::ClientBuilder::credentials
2286/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
2287/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
2288///
2289/// # Pooling and Cloning
2290///
2291/// `SchemaService` holds a connection pool internally, it is advised to
2292/// create one and the reuse it.  You do not need to wrap `SchemaService` in
2293/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
2294/// already uses an `Arc` internally.
2295#[cfg(feature = "schema-service")]
2296#[cfg_attr(docsrs, doc(cfg(feature = "schema-service")))]
2297#[derive(Clone, Debug)]
2298pub struct SchemaService {
2299    inner: std::sync::Arc<dyn super::stub::dynamic::SchemaService>,
2300}
2301
2302#[cfg(feature = "schema-service")]
2303impl SchemaService {
2304    /// Returns a builder for [SchemaService].
2305    ///
2306    /// ```
2307    /// # tokio_test::block_on(async {
2308    /// # use google_cloud_discoveryengine_v1::client::SchemaService;
2309    /// let client = SchemaService::builder().build().await?;
2310    /// # gax::client_builder::Result::<()>::Ok(()) });
2311    /// ```
2312    pub fn builder() -> super::builder::schema_service::ClientBuilder {
2313        gax::client_builder::internal::new_builder(super::builder::schema_service::client::Factory)
2314    }
2315
2316    /// Creates a new client from the provided stub.
2317    ///
2318    /// The most common case for calling this function is in tests mocking the
2319    /// client's behavior.
2320    pub fn from_stub<T>(stub: T) -> Self
2321    where
2322        T: super::stub::SchemaService + 'static,
2323    {
2324        Self {
2325            inner: std::sync::Arc::new(stub),
2326        }
2327    }
2328
2329    pub(crate) async fn new(
2330        config: gaxi::options::ClientConfig,
2331    ) -> gax::client_builder::Result<Self> {
2332        let inner = Self::build_inner(config).await?;
2333        Ok(Self { inner })
2334    }
2335
2336    async fn build_inner(
2337        conf: gaxi::options::ClientConfig,
2338    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::SchemaService>> {
2339        if gaxi::options::tracing_enabled(&conf) {
2340            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
2341        }
2342        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
2343    }
2344
2345    async fn build_transport(
2346        conf: gaxi::options::ClientConfig,
2347    ) -> gax::client_builder::Result<impl super::stub::SchemaService> {
2348        super::transport::SchemaService::new(conf).await
2349    }
2350
2351    async fn build_with_tracing(
2352        conf: gaxi::options::ClientConfig,
2353    ) -> gax::client_builder::Result<impl super::stub::SchemaService> {
2354        Self::build_transport(conf)
2355            .await
2356            .map(super::tracing::SchemaService::new)
2357    }
2358
2359    /// Gets a [Schema][google.cloud.discoveryengine.v1.Schema].
2360    ///
2361    /// [google.cloud.discoveryengine.v1.Schema]: crate::model::Schema
2362    pub fn get_schema(&self) -> super::builder::schema_service::GetSchema {
2363        super::builder::schema_service::GetSchema::new(self.inner.clone())
2364    }
2365
2366    /// Gets a list of [Schema][google.cloud.discoveryengine.v1.Schema]s.
2367    ///
2368    /// [google.cloud.discoveryengine.v1.Schema]: crate::model::Schema
2369    pub fn list_schemas(&self) -> super::builder::schema_service::ListSchemas {
2370        super::builder::schema_service::ListSchemas::new(self.inner.clone())
2371    }
2372
2373    /// Creates a [Schema][google.cloud.discoveryengine.v1.Schema].
2374    ///
2375    /// [google.cloud.discoveryengine.v1.Schema]: crate::model::Schema
2376    ///
2377    /// # Long running operations
2378    ///
2379    /// This method is used to start, and/or poll a [long-running Operation].
2380    /// The [Working with long-running operations] chapter in the [user guide]
2381    /// covers these operations in detail.
2382    ///
2383    /// [long-running operation]: https://google.aip.dev/151
2384    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2385    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2386    pub fn create_schema(&self) -> super::builder::schema_service::CreateSchema {
2387        super::builder::schema_service::CreateSchema::new(self.inner.clone())
2388    }
2389
2390    /// Updates a [Schema][google.cloud.discoveryengine.v1.Schema].
2391    ///
2392    /// [google.cloud.discoveryengine.v1.Schema]: crate::model::Schema
2393    ///
2394    /// # Long running operations
2395    ///
2396    /// This method is used to start, and/or poll a [long-running Operation].
2397    /// The [Working with long-running operations] chapter in the [user guide]
2398    /// covers these operations in detail.
2399    ///
2400    /// [long-running operation]: https://google.aip.dev/151
2401    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2402    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2403    pub fn update_schema(&self) -> super::builder::schema_service::UpdateSchema {
2404        super::builder::schema_service::UpdateSchema::new(self.inner.clone())
2405    }
2406
2407    /// Deletes a [Schema][google.cloud.discoveryengine.v1.Schema].
2408    ///
2409    /// [google.cloud.discoveryengine.v1.Schema]: crate::model::Schema
2410    ///
2411    /// # Long running operations
2412    ///
2413    /// This method is used to start, and/or poll a [long-running Operation].
2414    /// The [Working with long-running operations] chapter in the [user guide]
2415    /// covers these operations in detail.
2416    ///
2417    /// [long-running operation]: https://google.aip.dev/151
2418    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2419    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2420    pub fn delete_schema(&self) -> super::builder::schema_service::DeleteSchema {
2421        super::builder::schema_service::DeleteSchema::new(self.inner.clone())
2422    }
2423
2424    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2425    ///
2426    /// [google.longrunning.Operations]: longrunning::client::Operations
2427    pub fn list_operations(&self) -> super::builder::schema_service::ListOperations {
2428        super::builder::schema_service::ListOperations::new(self.inner.clone())
2429    }
2430
2431    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2432    ///
2433    /// [google.longrunning.Operations]: longrunning::client::Operations
2434    pub fn get_operation(&self) -> super::builder::schema_service::GetOperation {
2435        super::builder::schema_service::GetOperation::new(self.inner.clone())
2436    }
2437
2438    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2439    ///
2440    /// [google.longrunning.Operations]: longrunning::client::Operations
2441    pub fn cancel_operation(&self) -> super::builder::schema_service::CancelOperation {
2442        super::builder::schema_service::CancelOperation::new(self.inner.clone())
2443    }
2444}
2445
2446/// Implements a client for the Discovery Engine API.
2447///
2448/// # Example
2449/// ```
2450/// # tokio_test::block_on(async {
2451/// # use google_cloud_discoveryengine_v1::client::SearchService;
2452/// let client = SearchService::builder().build().await?;
2453/// // use `client` to make requests to the Discovery Engine API.
2454/// # gax::client_builder::Result::<()>::Ok(()) });
2455/// ```
2456///
2457/// # Service Description
2458///
2459/// Service for search.
2460///
2461/// # Configuration
2462///
2463/// To configure `SearchService` use the `with_*` methods in the type returned
2464/// by [builder()][SearchService::builder]. The default configuration should
2465/// work for most applications. Common configuration changes include
2466///
2467/// * [with_endpoint()]: by default this client uses the global default endpoint
2468///   (`https://discoveryengine.googleapis.com`). Applications using regional
2469///   endpoints or running in restricted networks (e.g. a network configured
2470//    with [Private Google Access with VPC Service Controls]) may want to
2471///   override this default.
2472/// * [with_credentials()]: by default this client uses
2473///   [Application Default Credentials]. Applications using custom
2474///   authentication may need to override this default.
2475///
2476/// [with_endpoint()]: super::builder::search_service::ClientBuilder::with_endpoint
2477/// [with_credentials()]: super::builder::search_service::ClientBuilder::credentials
2478/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
2479/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
2480///
2481/// # Pooling and Cloning
2482///
2483/// `SearchService` holds a connection pool internally, it is advised to
2484/// create one and the reuse it.  You do not need to wrap `SearchService` in
2485/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
2486/// already uses an `Arc` internally.
2487#[cfg(feature = "search-service")]
2488#[cfg_attr(docsrs, doc(cfg(feature = "search-service")))]
2489#[derive(Clone, Debug)]
2490pub struct SearchService {
2491    inner: std::sync::Arc<dyn super::stub::dynamic::SearchService>,
2492}
2493
2494#[cfg(feature = "search-service")]
2495impl SearchService {
2496    /// Returns a builder for [SearchService].
2497    ///
2498    /// ```
2499    /// # tokio_test::block_on(async {
2500    /// # use google_cloud_discoveryengine_v1::client::SearchService;
2501    /// let client = SearchService::builder().build().await?;
2502    /// # gax::client_builder::Result::<()>::Ok(()) });
2503    /// ```
2504    pub fn builder() -> super::builder::search_service::ClientBuilder {
2505        gax::client_builder::internal::new_builder(super::builder::search_service::client::Factory)
2506    }
2507
2508    /// Creates a new client from the provided stub.
2509    ///
2510    /// The most common case for calling this function is in tests mocking the
2511    /// client's behavior.
2512    pub fn from_stub<T>(stub: T) -> Self
2513    where
2514        T: super::stub::SearchService + 'static,
2515    {
2516        Self {
2517            inner: std::sync::Arc::new(stub),
2518        }
2519    }
2520
2521    pub(crate) async fn new(
2522        config: gaxi::options::ClientConfig,
2523    ) -> gax::client_builder::Result<Self> {
2524        let inner = Self::build_inner(config).await?;
2525        Ok(Self { inner })
2526    }
2527
2528    async fn build_inner(
2529        conf: gaxi::options::ClientConfig,
2530    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::SearchService>> {
2531        if gaxi::options::tracing_enabled(&conf) {
2532            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
2533        }
2534        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
2535    }
2536
2537    async fn build_transport(
2538        conf: gaxi::options::ClientConfig,
2539    ) -> gax::client_builder::Result<impl super::stub::SearchService> {
2540        super::transport::SearchService::new(conf).await
2541    }
2542
2543    async fn build_with_tracing(
2544        conf: gaxi::options::ClientConfig,
2545    ) -> gax::client_builder::Result<impl super::stub::SearchService> {
2546        Self::build_transport(conf)
2547            .await
2548            .map(super::tracing::SearchService::new)
2549    }
2550
2551    /// Performs a search.
2552    pub fn search(&self) -> super::builder::search_service::Search {
2553        super::builder::search_service::Search::new(self.inner.clone())
2554    }
2555
2556    /// Performs a search. Similar to the
2557    /// [SearchService.Search][google.cloud.discoveryengine.v1.SearchService.Search]
2558    /// method, but a lite version that allows API key for authentication, where
2559    /// OAuth and IAM checks are not required.
2560    ///
2561    /// Only public website search is supported by this method. If data stores and
2562    /// engines not associated with public website search are specified, a
2563    /// `FAILED_PRECONDITION` error is returned.
2564    ///
2565    /// This method can be used for easy onboarding without having to implement an
2566    /// authentication backend. However, it is strongly recommended to use
2567    /// [SearchService.Search][google.cloud.discoveryengine.v1.SearchService.Search]
2568    /// instead with required OAuth and IAM checks to provide better data security.
2569    ///
2570    /// [google.cloud.discoveryengine.v1.SearchService.Search]: crate::client::SearchService::search
2571    pub fn search_lite(&self) -> super::builder::search_service::SearchLite {
2572        super::builder::search_service::SearchLite::new(self.inner.clone())
2573    }
2574
2575    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2576    ///
2577    /// [google.longrunning.Operations]: longrunning::client::Operations
2578    pub fn list_operations(&self) -> super::builder::search_service::ListOperations {
2579        super::builder::search_service::ListOperations::new(self.inner.clone())
2580    }
2581
2582    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2583    ///
2584    /// [google.longrunning.Operations]: longrunning::client::Operations
2585    pub fn get_operation(&self) -> super::builder::search_service::GetOperation {
2586        super::builder::search_service::GetOperation::new(self.inner.clone())
2587    }
2588
2589    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2590    ///
2591    /// [google.longrunning.Operations]: longrunning::client::Operations
2592    pub fn cancel_operation(&self) -> super::builder::search_service::CancelOperation {
2593        super::builder::search_service::CancelOperation::new(self.inner.clone())
2594    }
2595}
2596
2597/// Implements a client for the Discovery Engine API.
2598///
2599/// # Example
2600/// ```
2601/// # tokio_test::block_on(async {
2602/// # use google_cloud_discoveryengine_v1::client::SearchTuningService;
2603/// let client = SearchTuningService::builder().build().await?;
2604/// // use `client` to make requests to the Discovery Engine API.
2605/// # gax::client_builder::Result::<()>::Ok(()) });
2606/// ```
2607///
2608/// # Service Description
2609///
2610/// Service for search tuning.
2611///
2612/// # Configuration
2613///
2614/// To configure `SearchTuningService` use the `with_*` methods in the type returned
2615/// by [builder()][SearchTuningService::builder]. The default configuration should
2616/// work for most applications. Common configuration changes include
2617///
2618/// * [with_endpoint()]: by default this client uses the global default endpoint
2619///   (`https://discoveryengine.googleapis.com`). Applications using regional
2620///   endpoints or running in restricted networks (e.g. a network configured
2621//    with [Private Google Access with VPC Service Controls]) may want to
2622///   override this default.
2623/// * [with_credentials()]: by default this client uses
2624///   [Application Default Credentials]. Applications using custom
2625///   authentication may need to override this default.
2626///
2627/// [with_endpoint()]: super::builder::search_tuning_service::ClientBuilder::with_endpoint
2628/// [with_credentials()]: super::builder::search_tuning_service::ClientBuilder::credentials
2629/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
2630/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
2631///
2632/// # Pooling and Cloning
2633///
2634/// `SearchTuningService` holds a connection pool internally, it is advised to
2635/// create one and the reuse it.  You do not need to wrap `SearchTuningService` in
2636/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
2637/// already uses an `Arc` internally.
2638#[cfg(feature = "search-tuning-service")]
2639#[cfg_attr(docsrs, doc(cfg(feature = "search-tuning-service")))]
2640#[derive(Clone, Debug)]
2641pub struct SearchTuningService {
2642    inner: std::sync::Arc<dyn super::stub::dynamic::SearchTuningService>,
2643}
2644
2645#[cfg(feature = "search-tuning-service")]
2646impl SearchTuningService {
2647    /// Returns a builder for [SearchTuningService].
2648    ///
2649    /// ```
2650    /// # tokio_test::block_on(async {
2651    /// # use google_cloud_discoveryengine_v1::client::SearchTuningService;
2652    /// let client = SearchTuningService::builder().build().await?;
2653    /// # gax::client_builder::Result::<()>::Ok(()) });
2654    /// ```
2655    pub fn builder() -> super::builder::search_tuning_service::ClientBuilder {
2656        gax::client_builder::internal::new_builder(
2657            super::builder::search_tuning_service::client::Factory,
2658        )
2659    }
2660
2661    /// Creates a new client from the provided stub.
2662    ///
2663    /// The most common case for calling this function is in tests mocking the
2664    /// client's behavior.
2665    pub fn from_stub<T>(stub: T) -> Self
2666    where
2667        T: super::stub::SearchTuningService + 'static,
2668    {
2669        Self {
2670            inner: std::sync::Arc::new(stub),
2671        }
2672    }
2673
2674    pub(crate) async fn new(
2675        config: gaxi::options::ClientConfig,
2676    ) -> gax::client_builder::Result<Self> {
2677        let inner = Self::build_inner(config).await?;
2678        Ok(Self { inner })
2679    }
2680
2681    async fn build_inner(
2682        conf: gaxi::options::ClientConfig,
2683    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::SearchTuningService>>
2684    {
2685        if gaxi::options::tracing_enabled(&conf) {
2686            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
2687        }
2688        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
2689    }
2690
2691    async fn build_transport(
2692        conf: gaxi::options::ClientConfig,
2693    ) -> gax::client_builder::Result<impl super::stub::SearchTuningService> {
2694        super::transport::SearchTuningService::new(conf).await
2695    }
2696
2697    async fn build_with_tracing(
2698        conf: gaxi::options::ClientConfig,
2699    ) -> gax::client_builder::Result<impl super::stub::SearchTuningService> {
2700        Self::build_transport(conf)
2701            .await
2702            .map(super::tracing::SearchTuningService::new)
2703    }
2704
2705    /// Trains a custom model.
2706    ///
2707    /// # Long running operations
2708    ///
2709    /// This method is used to start, and/or poll a [long-running Operation].
2710    /// The [Working with long-running operations] chapter in the [user guide]
2711    /// covers these operations in detail.
2712    ///
2713    /// [long-running operation]: https://google.aip.dev/151
2714    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2715    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2716    pub fn train_custom_model(&self) -> super::builder::search_tuning_service::TrainCustomModel {
2717        super::builder::search_tuning_service::TrainCustomModel::new(self.inner.clone())
2718    }
2719
2720    /// Gets a list of all the custom models.
2721    pub fn list_custom_models(&self) -> super::builder::search_tuning_service::ListCustomModels {
2722        super::builder::search_tuning_service::ListCustomModels::new(self.inner.clone())
2723    }
2724
2725    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2726    ///
2727    /// [google.longrunning.Operations]: longrunning::client::Operations
2728    pub fn list_operations(&self) -> super::builder::search_tuning_service::ListOperations {
2729        super::builder::search_tuning_service::ListOperations::new(self.inner.clone())
2730    }
2731
2732    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2733    ///
2734    /// [google.longrunning.Operations]: longrunning::client::Operations
2735    pub fn get_operation(&self) -> super::builder::search_tuning_service::GetOperation {
2736        super::builder::search_tuning_service::GetOperation::new(self.inner.clone())
2737    }
2738
2739    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2740    ///
2741    /// [google.longrunning.Operations]: longrunning::client::Operations
2742    pub fn cancel_operation(&self) -> super::builder::search_tuning_service::CancelOperation {
2743        super::builder::search_tuning_service::CancelOperation::new(self.inner.clone())
2744    }
2745}
2746
2747/// Implements a client for the Discovery Engine API.
2748///
2749/// # Example
2750/// ```
2751/// # tokio_test::block_on(async {
2752/// # use google_cloud_discoveryengine_v1::client::ServingConfigService;
2753/// let client = ServingConfigService::builder().build().await?;
2754/// // use `client` to make requests to the Discovery Engine API.
2755/// # gax::client_builder::Result::<()>::Ok(()) });
2756/// ```
2757///
2758/// # Service Description
2759///
2760/// Service for operations related to
2761/// [ServingConfig][google.cloud.discoveryengine.v1.ServingConfig].
2762///
2763/// [google.cloud.discoveryengine.v1.ServingConfig]: crate::model::ServingConfig
2764///
2765/// # Configuration
2766///
2767/// To configure `ServingConfigService` use the `with_*` methods in the type returned
2768/// by [builder()][ServingConfigService::builder]. The default configuration should
2769/// work for most applications. Common configuration changes include
2770///
2771/// * [with_endpoint()]: by default this client uses the global default endpoint
2772///   (`https://discoveryengine.googleapis.com`). Applications using regional
2773///   endpoints or running in restricted networks (e.g. a network configured
2774//    with [Private Google Access with VPC Service Controls]) may want to
2775///   override this default.
2776/// * [with_credentials()]: by default this client uses
2777///   [Application Default Credentials]. Applications using custom
2778///   authentication may need to override this default.
2779///
2780/// [with_endpoint()]: super::builder::serving_config_service::ClientBuilder::with_endpoint
2781/// [with_credentials()]: super::builder::serving_config_service::ClientBuilder::credentials
2782/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
2783/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
2784///
2785/// # Pooling and Cloning
2786///
2787/// `ServingConfigService` holds a connection pool internally, it is advised to
2788/// create one and the reuse it.  You do not need to wrap `ServingConfigService` in
2789/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
2790/// already uses an `Arc` internally.
2791#[cfg(feature = "serving-config-service")]
2792#[cfg_attr(docsrs, doc(cfg(feature = "serving-config-service")))]
2793#[derive(Clone, Debug)]
2794pub struct ServingConfigService {
2795    inner: std::sync::Arc<dyn super::stub::dynamic::ServingConfigService>,
2796}
2797
2798#[cfg(feature = "serving-config-service")]
2799impl ServingConfigService {
2800    /// Returns a builder for [ServingConfigService].
2801    ///
2802    /// ```
2803    /// # tokio_test::block_on(async {
2804    /// # use google_cloud_discoveryengine_v1::client::ServingConfigService;
2805    /// let client = ServingConfigService::builder().build().await?;
2806    /// # gax::client_builder::Result::<()>::Ok(()) });
2807    /// ```
2808    pub fn builder() -> super::builder::serving_config_service::ClientBuilder {
2809        gax::client_builder::internal::new_builder(
2810            super::builder::serving_config_service::client::Factory,
2811        )
2812    }
2813
2814    /// Creates a new client from the provided stub.
2815    ///
2816    /// The most common case for calling this function is in tests mocking the
2817    /// client's behavior.
2818    pub fn from_stub<T>(stub: T) -> Self
2819    where
2820        T: super::stub::ServingConfigService + 'static,
2821    {
2822        Self {
2823            inner: std::sync::Arc::new(stub),
2824        }
2825    }
2826
2827    pub(crate) async fn new(
2828        config: gaxi::options::ClientConfig,
2829    ) -> gax::client_builder::Result<Self> {
2830        let inner = Self::build_inner(config).await?;
2831        Ok(Self { inner })
2832    }
2833
2834    async fn build_inner(
2835        conf: gaxi::options::ClientConfig,
2836    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::ServingConfigService>>
2837    {
2838        if gaxi::options::tracing_enabled(&conf) {
2839            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
2840        }
2841        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
2842    }
2843
2844    async fn build_transport(
2845        conf: gaxi::options::ClientConfig,
2846    ) -> gax::client_builder::Result<impl super::stub::ServingConfigService> {
2847        super::transport::ServingConfigService::new(conf).await
2848    }
2849
2850    async fn build_with_tracing(
2851        conf: gaxi::options::ClientConfig,
2852    ) -> gax::client_builder::Result<impl super::stub::ServingConfigService> {
2853        Self::build_transport(conf)
2854            .await
2855            .map(super::tracing::ServingConfigService::new)
2856    }
2857
2858    /// Updates a ServingConfig.
2859    ///
2860    /// Returns a NOT_FOUND error if the ServingConfig does not exist.
2861    pub fn update_serving_config(
2862        &self,
2863    ) -> super::builder::serving_config_service::UpdateServingConfig {
2864        super::builder::serving_config_service::UpdateServingConfig::new(self.inner.clone())
2865    }
2866
2867    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2868    ///
2869    /// [google.longrunning.Operations]: longrunning::client::Operations
2870    pub fn list_operations(&self) -> super::builder::serving_config_service::ListOperations {
2871        super::builder::serving_config_service::ListOperations::new(self.inner.clone())
2872    }
2873
2874    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2875    ///
2876    /// [google.longrunning.Operations]: longrunning::client::Operations
2877    pub fn get_operation(&self) -> super::builder::serving_config_service::GetOperation {
2878        super::builder::serving_config_service::GetOperation::new(self.inner.clone())
2879    }
2880
2881    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2882    ///
2883    /// [google.longrunning.Operations]: longrunning::client::Operations
2884    pub fn cancel_operation(&self) -> super::builder::serving_config_service::CancelOperation {
2885        super::builder::serving_config_service::CancelOperation::new(self.inner.clone())
2886    }
2887}
2888
2889/// Implements a client for the Discovery Engine API.
2890///
2891/// # Example
2892/// ```
2893/// # tokio_test::block_on(async {
2894/// # use google_cloud_discoveryengine_v1::client::SiteSearchEngineService;
2895/// let client = SiteSearchEngineService::builder().build().await?;
2896/// // use `client` to make requests to the Discovery Engine API.
2897/// # gax::client_builder::Result::<()>::Ok(()) });
2898/// ```
2899///
2900/// # Service Description
2901///
2902/// Service for managing site search related resources.
2903///
2904/// # Configuration
2905///
2906/// To configure `SiteSearchEngineService` use the `with_*` methods in the type returned
2907/// by [builder()][SiteSearchEngineService::builder]. The default configuration should
2908/// work for most applications. Common configuration changes include
2909///
2910/// * [with_endpoint()]: by default this client uses the global default endpoint
2911///   (`https://discoveryengine.googleapis.com`). Applications using regional
2912///   endpoints or running in restricted networks (e.g. a network configured
2913//    with [Private Google Access with VPC Service Controls]) may want to
2914///   override this default.
2915/// * [with_credentials()]: by default this client uses
2916///   [Application Default Credentials]. Applications using custom
2917///   authentication may need to override this default.
2918///
2919/// [with_endpoint()]: super::builder::site_search_engine_service::ClientBuilder::with_endpoint
2920/// [with_credentials()]: super::builder::site_search_engine_service::ClientBuilder::credentials
2921/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
2922/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
2923///
2924/// # Pooling and Cloning
2925///
2926/// `SiteSearchEngineService` holds a connection pool internally, it is advised to
2927/// create one and the reuse it.  You do not need to wrap `SiteSearchEngineService` in
2928/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
2929/// already uses an `Arc` internally.
2930#[cfg(feature = "site-search-engine-service")]
2931#[cfg_attr(docsrs, doc(cfg(feature = "site-search-engine-service")))]
2932#[derive(Clone, Debug)]
2933pub struct SiteSearchEngineService {
2934    inner: std::sync::Arc<dyn super::stub::dynamic::SiteSearchEngineService>,
2935}
2936
2937#[cfg(feature = "site-search-engine-service")]
2938impl SiteSearchEngineService {
2939    /// Returns a builder for [SiteSearchEngineService].
2940    ///
2941    /// ```
2942    /// # tokio_test::block_on(async {
2943    /// # use google_cloud_discoveryengine_v1::client::SiteSearchEngineService;
2944    /// let client = SiteSearchEngineService::builder().build().await?;
2945    /// # gax::client_builder::Result::<()>::Ok(()) });
2946    /// ```
2947    pub fn builder() -> super::builder::site_search_engine_service::ClientBuilder {
2948        gax::client_builder::internal::new_builder(
2949            super::builder::site_search_engine_service::client::Factory,
2950        )
2951    }
2952
2953    /// Creates a new client from the provided stub.
2954    ///
2955    /// The most common case for calling this function is in tests mocking the
2956    /// client's behavior.
2957    pub fn from_stub<T>(stub: T) -> Self
2958    where
2959        T: super::stub::SiteSearchEngineService + 'static,
2960    {
2961        Self {
2962            inner: std::sync::Arc::new(stub),
2963        }
2964    }
2965
2966    pub(crate) async fn new(
2967        config: gaxi::options::ClientConfig,
2968    ) -> gax::client_builder::Result<Self> {
2969        let inner = Self::build_inner(config).await?;
2970        Ok(Self { inner })
2971    }
2972
2973    async fn build_inner(
2974        conf: gaxi::options::ClientConfig,
2975    ) -> gax::client_builder::Result<
2976        std::sync::Arc<dyn super::stub::dynamic::SiteSearchEngineService>,
2977    > {
2978        if gaxi::options::tracing_enabled(&conf) {
2979            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
2980        }
2981        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
2982    }
2983
2984    async fn build_transport(
2985        conf: gaxi::options::ClientConfig,
2986    ) -> gax::client_builder::Result<impl super::stub::SiteSearchEngineService> {
2987        super::transport::SiteSearchEngineService::new(conf).await
2988    }
2989
2990    async fn build_with_tracing(
2991        conf: gaxi::options::ClientConfig,
2992    ) -> gax::client_builder::Result<impl super::stub::SiteSearchEngineService> {
2993        Self::build_transport(conf)
2994            .await
2995            .map(super::tracing::SiteSearchEngineService::new)
2996    }
2997
2998    /// Gets the
2999    /// [SiteSearchEngine][google.cloud.discoveryengine.v1.SiteSearchEngine].
3000    ///
3001    /// [google.cloud.discoveryengine.v1.SiteSearchEngine]: crate::model::SiteSearchEngine
3002    pub fn get_site_search_engine(
3003        &self,
3004    ) -> super::builder::site_search_engine_service::GetSiteSearchEngine {
3005        super::builder::site_search_engine_service::GetSiteSearchEngine::new(self.inner.clone())
3006    }
3007
3008    /// Creates a [TargetSite][google.cloud.discoveryengine.v1.TargetSite].
3009    ///
3010    /// [google.cloud.discoveryengine.v1.TargetSite]: crate::model::TargetSite
3011    ///
3012    /// # Long running operations
3013    ///
3014    /// This method is used to start, and/or poll a [long-running Operation].
3015    /// The [Working with long-running operations] chapter in the [user guide]
3016    /// covers these operations in detail.
3017    ///
3018    /// [long-running operation]: https://google.aip.dev/151
3019    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
3020    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
3021    pub fn create_target_site(
3022        &self,
3023    ) -> super::builder::site_search_engine_service::CreateTargetSite {
3024        super::builder::site_search_engine_service::CreateTargetSite::new(self.inner.clone())
3025    }
3026
3027    /// Creates [TargetSite][google.cloud.discoveryengine.v1.TargetSite] in a
3028    /// batch.
3029    ///
3030    /// [google.cloud.discoveryengine.v1.TargetSite]: crate::model::TargetSite
3031    ///
3032    /// # Long running operations
3033    ///
3034    /// This method is used to start, and/or poll a [long-running Operation].
3035    /// The [Working with long-running operations] chapter in the [user guide]
3036    /// covers these operations in detail.
3037    ///
3038    /// [long-running operation]: https://google.aip.dev/151
3039    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
3040    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
3041    pub fn batch_create_target_sites(
3042        &self,
3043    ) -> super::builder::site_search_engine_service::BatchCreateTargetSites {
3044        super::builder::site_search_engine_service::BatchCreateTargetSites::new(self.inner.clone())
3045    }
3046
3047    /// Gets a [TargetSite][google.cloud.discoveryengine.v1.TargetSite].
3048    ///
3049    /// [google.cloud.discoveryengine.v1.TargetSite]: crate::model::TargetSite
3050    pub fn get_target_site(&self) -> super::builder::site_search_engine_service::GetTargetSite {
3051        super::builder::site_search_engine_service::GetTargetSite::new(self.inner.clone())
3052    }
3053
3054    /// Updates a [TargetSite][google.cloud.discoveryengine.v1.TargetSite].
3055    ///
3056    /// [google.cloud.discoveryengine.v1.TargetSite]: crate::model::TargetSite
3057    ///
3058    /// # Long running operations
3059    ///
3060    /// This method is used to start, and/or poll a [long-running Operation].
3061    /// The [Working with long-running operations] chapter in the [user guide]
3062    /// covers these operations in detail.
3063    ///
3064    /// [long-running operation]: https://google.aip.dev/151
3065    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
3066    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
3067    pub fn update_target_site(
3068        &self,
3069    ) -> super::builder::site_search_engine_service::UpdateTargetSite {
3070        super::builder::site_search_engine_service::UpdateTargetSite::new(self.inner.clone())
3071    }
3072
3073    /// Deletes a [TargetSite][google.cloud.discoveryengine.v1.TargetSite].
3074    ///
3075    /// [google.cloud.discoveryengine.v1.TargetSite]: crate::model::TargetSite
3076    ///
3077    /// # Long running operations
3078    ///
3079    /// This method is used to start, and/or poll a [long-running Operation].
3080    /// The [Working with long-running operations] chapter in the [user guide]
3081    /// covers these operations in detail.
3082    ///
3083    /// [long-running operation]: https://google.aip.dev/151
3084    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
3085    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
3086    pub fn delete_target_site(
3087        &self,
3088    ) -> super::builder::site_search_engine_service::DeleteTargetSite {
3089        super::builder::site_search_engine_service::DeleteTargetSite::new(self.inner.clone())
3090    }
3091
3092    /// Gets a list of [TargetSite][google.cloud.discoveryengine.v1.TargetSite]s.
3093    ///
3094    /// [google.cloud.discoveryengine.v1.TargetSite]: crate::model::TargetSite
3095    pub fn list_target_sites(&self) -> super::builder::site_search_engine_service::ListTargetSites {
3096        super::builder::site_search_engine_service::ListTargetSites::new(self.inner.clone())
3097    }
3098
3099    /// Creates a [Sitemap][google.cloud.discoveryengine.v1.Sitemap].
3100    ///
3101    /// [google.cloud.discoveryengine.v1.Sitemap]: crate::model::Sitemap
3102    ///
3103    /// # Long running operations
3104    ///
3105    /// This method is used to start, and/or poll a [long-running Operation].
3106    /// The [Working with long-running operations] chapter in the [user guide]
3107    /// covers these operations in detail.
3108    ///
3109    /// [long-running operation]: https://google.aip.dev/151
3110    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
3111    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
3112    pub fn create_sitemap(&self) -> super::builder::site_search_engine_service::CreateSitemap {
3113        super::builder::site_search_engine_service::CreateSitemap::new(self.inner.clone())
3114    }
3115
3116    /// Deletes a [Sitemap][google.cloud.discoveryengine.v1.Sitemap].
3117    ///
3118    /// [google.cloud.discoveryengine.v1.Sitemap]: crate::model::Sitemap
3119    ///
3120    /// # Long running operations
3121    ///
3122    /// This method is used to start, and/or poll a [long-running Operation].
3123    /// The [Working with long-running operations] chapter in the [user guide]
3124    /// covers these operations in detail.
3125    ///
3126    /// [long-running operation]: https://google.aip.dev/151
3127    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
3128    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
3129    pub fn delete_sitemap(&self) -> super::builder::site_search_engine_service::DeleteSitemap {
3130        super::builder::site_search_engine_service::DeleteSitemap::new(self.inner.clone())
3131    }
3132
3133    /// Fetch [Sitemap][google.cloud.discoveryengine.v1.Sitemap]s in a
3134    /// [DataStore][google.cloud.discoveryengine.v1.DataStore].
3135    ///
3136    /// [google.cloud.discoveryengine.v1.DataStore]: crate::model::DataStore
3137    /// [google.cloud.discoveryengine.v1.Sitemap]: crate::model::Sitemap
3138    pub fn fetch_sitemaps(&self) -> super::builder::site_search_engine_service::FetchSitemaps {
3139        super::builder::site_search_engine_service::FetchSitemaps::new(self.inner.clone())
3140    }
3141
3142    /// Upgrade from basic site search to advanced site search.
3143    ///
3144    /// # Long running operations
3145    ///
3146    /// This method is used to start, and/or poll a [long-running Operation].
3147    /// The [Working with long-running operations] chapter in the [user guide]
3148    /// covers these operations in detail.
3149    ///
3150    /// [long-running operation]: https://google.aip.dev/151
3151    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
3152    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
3153    pub fn enable_advanced_site_search(
3154        &self,
3155    ) -> super::builder::site_search_engine_service::EnableAdvancedSiteSearch {
3156        super::builder::site_search_engine_service::EnableAdvancedSiteSearch::new(
3157            self.inner.clone(),
3158        )
3159    }
3160
3161    /// Downgrade from advanced site search to basic site search.
3162    ///
3163    /// # Long running operations
3164    ///
3165    /// This method is used to start, and/or poll a [long-running Operation].
3166    /// The [Working with long-running operations] chapter in the [user guide]
3167    /// covers these operations in detail.
3168    ///
3169    /// [long-running operation]: https://google.aip.dev/151
3170    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
3171    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
3172    pub fn disable_advanced_site_search(
3173        &self,
3174    ) -> super::builder::site_search_engine_service::DisableAdvancedSiteSearch {
3175        super::builder::site_search_engine_service::DisableAdvancedSiteSearch::new(
3176            self.inner.clone(),
3177        )
3178    }
3179
3180    /// Request on-demand recrawl for a list of URIs.
3181    ///
3182    /// # Long running operations
3183    ///
3184    /// This method is used to start, and/or poll a [long-running Operation].
3185    /// The [Working with long-running operations] chapter in the [user guide]
3186    /// covers these operations in detail.
3187    ///
3188    /// [long-running operation]: https://google.aip.dev/151
3189    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
3190    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
3191    pub fn recrawl_uris(&self) -> super::builder::site_search_engine_service::RecrawlUris {
3192        super::builder::site_search_engine_service::RecrawlUris::new(self.inner.clone())
3193    }
3194
3195    /// Verify target sites' ownership and validity.
3196    /// This API sends all the target sites under site search engine for
3197    /// verification.
3198    ///
3199    /// # Long running operations
3200    ///
3201    /// This method is used to start, and/or poll a [long-running Operation].
3202    /// The [Working with long-running operations] chapter in the [user guide]
3203    /// covers these operations in detail.
3204    ///
3205    /// [long-running operation]: https://google.aip.dev/151
3206    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
3207    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
3208    pub fn batch_verify_target_sites(
3209        &self,
3210    ) -> super::builder::site_search_engine_service::BatchVerifyTargetSites {
3211        super::builder::site_search_engine_service::BatchVerifyTargetSites::new(self.inner.clone())
3212    }
3213
3214    /// Returns list of target sites with its domain verification status.
3215    /// This method can only be called under data store with BASIC_SITE_SEARCH
3216    /// state at the moment.
3217    pub fn fetch_domain_verification_status(
3218        &self,
3219    ) -> super::builder::site_search_engine_service::FetchDomainVerificationStatus {
3220        super::builder::site_search_engine_service::FetchDomainVerificationStatus::new(
3221            self.inner.clone(),
3222        )
3223    }
3224
3225    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3226    ///
3227    /// [google.longrunning.Operations]: longrunning::client::Operations
3228    pub fn list_operations(&self) -> super::builder::site_search_engine_service::ListOperations {
3229        super::builder::site_search_engine_service::ListOperations::new(self.inner.clone())
3230    }
3231
3232    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3233    ///
3234    /// [google.longrunning.Operations]: longrunning::client::Operations
3235    pub fn get_operation(&self) -> super::builder::site_search_engine_service::GetOperation {
3236        super::builder::site_search_engine_service::GetOperation::new(self.inner.clone())
3237    }
3238
3239    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3240    ///
3241    /// [google.longrunning.Operations]: longrunning::client::Operations
3242    pub fn cancel_operation(&self) -> super::builder::site_search_engine_service::CancelOperation {
3243        super::builder::site_search_engine_service::CancelOperation::new(self.inner.clone())
3244    }
3245}
3246
3247/// Implements a client for the Discovery Engine API.
3248///
3249/// # Example
3250/// ```
3251/// # tokio_test::block_on(async {
3252/// # use google_cloud_discoveryengine_v1::client::UserEventService;
3253/// let client = UserEventService::builder().build().await?;
3254/// // use `client` to make requests to the Discovery Engine API.
3255/// # gax::client_builder::Result::<()>::Ok(()) });
3256/// ```
3257///
3258/// # Service Description
3259///
3260/// Service for ingesting end user actions on a website to Discovery Engine API.
3261///
3262/// # Configuration
3263///
3264/// To configure `UserEventService` use the `with_*` methods in the type returned
3265/// by [builder()][UserEventService::builder]. The default configuration should
3266/// work for most applications. Common configuration changes include
3267///
3268/// * [with_endpoint()]: by default this client uses the global default endpoint
3269///   (`https://discoveryengine.googleapis.com`). Applications using regional
3270///   endpoints or running in restricted networks (e.g. a network configured
3271//    with [Private Google Access with VPC Service Controls]) may want to
3272///   override this default.
3273/// * [with_credentials()]: by default this client uses
3274///   [Application Default Credentials]. Applications using custom
3275///   authentication may need to override this default.
3276///
3277/// [with_endpoint()]: super::builder::user_event_service::ClientBuilder::with_endpoint
3278/// [with_credentials()]: super::builder::user_event_service::ClientBuilder::credentials
3279/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
3280/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
3281///
3282/// # Pooling and Cloning
3283///
3284/// `UserEventService` holds a connection pool internally, it is advised to
3285/// create one and the reuse it.  You do not need to wrap `UserEventService` in
3286/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
3287/// already uses an `Arc` internally.
3288#[cfg(feature = "user-event-service")]
3289#[cfg_attr(docsrs, doc(cfg(feature = "user-event-service")))]
3290#[derive(Clone, Debug)]
3291pub struct UserEventService {
3292    inner: std::sync::Arc<dyn super::stub::dynamic::UserEventService>,
3293}
3294
3295#[cfg(feature = "user-event-service")]
3296impl UserEventService {
3297    /// Returns a builder for [UserEventService].
3298    ///
3299    /// ```
3300    /// # tokio_test::block_on(async {
3301    /// # use google_cloud_discoveryengine_v1::client::UserEventService;
3302    /// let client = UserEventService::builder().build().await?;
3303    /// # gax::client_builder::Result::<()>::Ok(()) });
3304    /// ```
3305    pub fn builder() -> super::builder::user_event_service::ClientBuilder {
3306        gax::client_builder::internal::new_builder(
3307            super::builder::user_event_service::client::Factory,
3308        )
3309    }
3310
3311    /// Creates a new client from the provided stub.
3312    ///
3313    /// The most common case for calling this function is in tests mocking the
3314    /// client's behavior.
3315    pub fn from_stub<T>(stub: T) -> Self
3316    where
3317        T: super::stub::UserEventService + 'static,
3318    {
3319        Self {
3320            inner: std::sync::Arc::new(stub),
3321        }
3322    }
3323
3324    pub(crate) async fn new(
3325        config: gaxi::options::ClientConfig,
3326    ) -> gax::client_builder::Result<Self> {
3327        let inner = Self::build_inner(config).await?;
3328        Ok(Self { inner })
3329    }
3330
3331    async fn build_inner(
3332        conf: gaxi::options::ClientConfig,
3333    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::UserEventService>>
3334    {
3335        if gaxi::options::tracing_enabled(&conf) {
3336            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
3337        }
3338        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
3339    }
3340
3341    async fn build_transport(
3342        conf: gaxi::options::ClientConfig,
3343    ) -> gax::client_builder::Result<impl super::stub::UserEventService> {
3344        super::transport::UserEventService::new(conf).await
3345    }
3346
3347    async fn build_with_tracing(
3348        conf: gaxi::options::ClientConfig,
3349    ) -> gax::client_builder::Result<impl super::stub::UserEventService> {
3350        Self::build_transport(conf)
3351            .await
3352            .map(super::tracing::UserEventService::new)
3353    }
3354
3355    /// Writes a single user event.
3356    pub fn write_user_event(&self) -> super::builder::user_event_service::WriteUserEvent {
3357        super::builder::user_event_service::WriteUserEvent::new(self.inner.clone())
3358    }
3359
3360    /// Writes a single user event from the browser. This uses a GET request to
3361    /// due to browser restriction of POST-ing to a third-party domain.
3362    ///
3363    /// This method is used only by the Discovery Engine API JavaScript pixel and
3364    /// Google Tag Manager. Users should not call this method directly.
3365    pub fn collect_user_event(&self) -> super::builder::user_event_service::CollectUserEvent {
3366        super::builder::user_event_service::CollectUserEvent::new(self.inner.clone())
3367    }
3368
3369    /// Deletes permanently all user events specified by the filter provided.
3370    /// Depending on the number of events specified by the filter, this operation
3371    /// could take hours or days to complete. To test a filter, use the list
3372    /// command first.
3373    ///
3374    /// # Long running operations
3375    ///
3376    /// This method is used to start, and/or poll a [long-running Operation].
3377    /// The [Working with long-running operations] chapter in the [user guide]
3378    /// covers these operations in detail.
3379    ///
3380    /// [long-running operation]: https://google.aip.dev/151
3381    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
3382    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
3383    pub fn purge_user_events(&self) -> super::builder::user_event_service::PurgeUserEvents {
3384        super::builder::user_event_service::PurgeUserEvents::new(self.inner.clone())
3385    }
3386
3387    /// Bulk import of user events. Request processing might be
3388    /// synchronous. Events that already exist are skipped.
3389    /// Use this method for backfilling historical user events.
3390    ///
3391    /// Operation.response is of type ImportResponse. Note that it is
3392    /// possible for a subset of the items to be successfully inserted.
3393    /// Operation.metadata is of type ImportMetadata.
3394    ///
3395    /// # Long running operations
3396    ///
3397    /// This method is used to start, and/or poll a [long-running Operation].
3398    /// The [Working with long-running operations] chapter in the [user guide]
3399    /// covers these operations in detail.
3400    ///
3401    /// [long-running operation]: https://google.aip.dev/151
3402    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
3403    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
3404    pub fn import_user_events(&self) -> super::builder::user_event_service::ImportUserEvents {
3405        super::builder::user_event_service::ImportUserEvents::new(self.inner.clone())
3406    }
3407
3408    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3409    ///
3410    /// [google.longrunning.Operations]: longrunning::client::Operations
3411    pub fn list_operations(&self) -> super::builder::user_event_service::ListOperations {
3412        super::builder::user_event_service::ListOperations::new(self.inner.clone())
3413    }
3414
3415    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3416    ///
3417    /// [google.longrunning.Operations]: longrunning::client::Operations
3418    pub fn get_operation(&self) -> super::builder::user_event_service::GetOperation {
3419        super::builder::user_event_service::GetOperation::new(self.inner.clone())
3420    }
3421
3422    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3423    ///
3424    /// [google.longrunning.Operations]: longrunning::client::Operations
3425    pub fn cancel_operation(&self) -> super::builder::user_event_service::CancelOperation {
3426        super::builder::user_event_service::CancelOperation::new(self.inner.clone())
3427    }
3428}
3429
3430/// Implements a client for the Discovery Engine API.
3431///
3432/// # Example
3433/// ```
3434/// # tokio_test::block_on(async {
3435/// # use google_cloud_discoveryengine_v1::client::UserLicenseService;
3436/// let client = UserLicenseService::builder().build().await?;
3437/// // use `client` to make requests to the Discovery Engine API.
3438/// # gax::client_builder::Result::<()>::Ok(()) });
3439/// ```
3440///
3441/// # Service Description
3442///
3443/// Service for managing User Licenses.
3444///
3445/// # Configuration
3446///
3447/// To configure `UserLicenseService` use the `with_*` methods in the type returned
3448/// by [builder()][UserLicenseService::builder]. The default configuration should
3449/// work for most applications. Common configuration changes include
3450///
3451/// * [with_endpoint()]: by default this client uses the global default endpoint
3452///   (`https://discoveryengine.googleapis.com`). Applications using regional
3453///   endpoints or running in restricted networks (e.g. a network configured
3454//    with [Private Google Access with VPC Service Controls]) may want to
3455///   override this default.
3456/// * [with_credentials()]: by default this client uses
3457///   [Application Default Credentials]. Applications using custom
3458///   authentication may need to override this default.
3459///
3460/// [with_endpoint()]: super::builder::user_license_service::ClientBuilder::with_endpoint
3461/// [with_credentials()]: super::builder::user_license_service::ClientBuilder::credentials
3462/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
3463/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
3464///
3465/// # Pooling and Cloning
3466///
3467/// `UserLicenseService` holds a connection pool internally, it is advised to
3468/// create one and the reuse it.  You do not need to wrap `UserLicenseService` in
3469/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
3470/// already uses an `Arc` internally.
3471#[cfg(feature = "user-license-service")]
3472#[cfg_attr(docsrs, doc(cfg(feature = "user-license-service")))]
3473#[derive(Clone, Debug)]
3474pub struct UserLicenseService {
3475    inner: std::sync::Arc<dyn super::stub::dynamic::UserLicenseService>,
3476}
3477
3478#[cfg(feature = "user-license-service")]
3479impl UserLicenseService {
3480    /// Returns a builder for [UserLicenseService].
3481    ///
3482    /// ```
3483    /// # tokio_test::block_on(async {
3484    /// # use google_cloud_discoveryengine_v1::client::UserLicenseService;
3485    /// let client = UserLicenseService::builder().build().await?;
3486    /// # gax::client_builder::Result::<()>::Ok(()) });
3487    /// ```
3488    pub fn builder() -> super::builder::user_license_service::ClientBuilder {
3489        gax::client_builder::internal::new_builder(
3490            super::builder::user_license_service::client::Factory,
3491        )
3492    }
3493
3494    /// Creates a new client from the provided stub.
3495    ///
3496    /// The most common case for calling this function is in tests mocking the
3497    /// client's behavior.
3498    pub fn from_stub<T>(stub: T) -> Self
3499    where
3500        T: super::stub::UserLicenseService + 'static,
3501    {
3502        Self {
3503            inner: std::sync::Arc::new(stub),
3504        }
3505    }
3506
3507    pub(crate) async fn new(
3508        config: gaxi::options::ClientConfig,
3509    ) -> gax::client_builder::Result<Self> {
3510        let inner = Self::build_inner(config).await?;
3511        Ok(Self { inner })
3512    }
3513
3514    async fn build_inner(
3515        conf: gaxi::options::ClientConfig,
3516    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::UserLicenseService>>
3517    {
3518        if gaxi::options::tracing_enabled(&conf) {
3519            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
3520        }
3521        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
3522    }
3523
3524    async fn build_transport(
3525        conf: gaxi::options::ClientConfig,
3526    ) -> gax::client_builder::Result<impl super::stub::UserLicenseService> {
3527        super::transport::UserLicenseService::new(conf).await
3528    }
3529
3530    async fn build_with_tracing(
3531        conf: gaxi::options::ClientConfig,
3532    ) -> gax::client_builder::Result<impl super::stub::UserLicenseService> {
3533        Self::build_transport(conf)
3534            .await
3535            .map(super::tracing::UserLicenseService::new)
3536    }
3537
3538    /// Lists the User Licenses.
3539    pub fn list_user_licenses(&self) -> super::builder::user_license_service::ListUserLicenses {
3540        super::builder::user_license_service::ListUserLicenses::new(self.inner.clone())
3541    }
3542
3543    /// Updates the User License.
3544    /// This method is used for batch assign/unassign licenses to users.
3545    ///
3546    /// # Long running operations
3547    ///
3548    /// This method is used to start, and/or poll a [long-running Operation].
3549    /// The [Working with long-running operations] chapter in the [user guide]
3550    /// covers these operations in detail.
3551    ///
3552    /// [long-running operation]: https://google.aip.dev/151
3553    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
3554    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
3555    pub fn batch_update_user_licenses(
3556        &self,
3557    ) -> super::builder::user_license_service::BatchUpdateUserLicenses {
3558        super::builder::user_license_service::BatchUpdateUserLicenses::new(self.inner.clone())
3559    }
3560
3561    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3562    ///
3563    /// [google.longrunning.Operations]: longrunning::client::Operations
3564    pub fn list_operations(&self) -> super::builder::user_license_service::ListOperations {
3565        super::builder::user_license_service::ListOperations::new(self.inner.clone())
3566    }
3567
3568    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3569    ///
3570    /// [google.longrunning.Operations]: longrunning::client::Operations
3571    pub fn get_operation(&self) -> super::builder::user_license_service::GetOperation {
3572        super::builder::user_license_service::GetOperation::new(self.inner.clone())
3573    }
3574
3575    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3576    ///
3577    /// [google.longrunning.Operations]: longrunning::client::Operations
3578    pub fn cancel_operation(&self) -> super::builder::user_license_service::CancelOperation {
3579        super::builder::user_license_service::CancelOperation::new(self.inner.clone())
3580    }
3581}