Skip to main content

google_cloud_discoveryengine_v1/
builder.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
17/// Request and client builders for [AssistantService][crate::client::AssistantService].
18#[cfg(feature = "assistant-service")]
19#[cfg_attr(docsrs, doc(cfg(feature = "assistant-service")))]
20pub mod assistant_service {
21    use crate::Result;
22
23    /// A builder for [AssistantService][crate::client::AssistantService].
24    ///
25    /// ```
26    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
27    /// # use google_cloud_discoveryengine_v1::*;
28    /// # use builder::assistant_service::ClientBuilder;
29    /// # use client::AssistantService;
30    /// let builder : ClientBuilder = AssistantService::builder();
31    /// let client = builder
32    ///     .with_endpoint("https://discoveryengine.googleapis.com")
33    ///     .build().await?;
34    /// # Ok(()) }
35    /// ```
36    pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
37
38    pub(crate) mod client {
39        use super::super::super::client::AssistantService;
40        pub struct Factory;
41        impl crate::ClientFactory for Factory {
42            type Client = AssistantService;
43            type Credentials = gaxi::options::Credentials;
44            async fn build(
45                self,
46                config: gaxi::options::ClientConfig,
47            ) -> crate::ClientBuilderResult<Self::Client> {
48                Self::Client::new(config).await
49            }
50        }
51    }
52
53    /// Common implementation for [crate::client::AssistantService] request builders.
54    #[derive(Clone, Debug)]
55    pub(crate) struct RequestBuilder<R: std::default::Default> {
56        stub: std::sync::Arc<dyn super::super::stub::dynamic::AssistantService>,
57        request: R,
58        options: crate::RequestOptions,
59    }
60
61    impl<R> RequestBuilder<R>
62    where
63        R: std::default::Default,
64    {
65        pub(crate) fn new(
66            stub: std::sync::Arc<dyn super::super::stub::dynamic::AssistantService>,
67        ) -> Self {
68            Self {
69                stub,
70                request: R::default(),
71                options: crate::RequestOptions::default(),
72            }
73        }
74    }
75
76    /// The request builder for [AssistantService::list_operations][crate::client::AssistantService::list_operations] calls.
77    ///
78    /// # Example
79    /// ```
80    /// # use google_cloud_discoveryengine_v1::builder::assistant_service::ListOperations;
81    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
82    /// use google_cloud_gax::paginator::ItemPaginator;
83    ///
84    /// let builder = prepare_request_builder();
85    /// let mut items = builder.by_item();
86    /// while let Some(result) = items.next().await {
87    ///   let item = result?;
88    /// }
89    /// # Ok(()) }
90    ///
91    /// fn prepare_request_builder() -> ListOperations {
92    ///   # panic!();
93    ///   // ... details omitted ...
94    /// }
95    /// ```
96    #[derive(Clone, Debug)]
97    pub struct ListOperations(
98        RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
99    );
100
101    impl ListOperations {
102        pub(crate) fn new(
103            stub: std::sync::Arc<dyn super::super::stub::dynamic::AssistantService>,
104        ) -> Self {
105            Self(RequestBuilder::new(stub))
106        }
107
108        /// Sets the full request, replacing any prior values.
109        pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
110            mut self,
111            v: V,
112        ) -> Self {
113            self.0.request = v.into();
114            self
115        }
116
117        /// Sets all the options, replacing any prior values.
118        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
119            self.0.options = v.into();
120            self
121        }
122
123        /// Sends the request.
124        pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
125            (*self.0.stub)
126                .list_operations(self.0.request, self.0.options)
127                .await
128                .map(crate::Response::into_body)
129        }
130
131        /// Streams each page in the collection.
132        pub fn by_page(
133            self,
134        ) -> impl google_cloud_gax::paginator::Paginator<
135            google_cloud_longrunning::model::ListOperationsResponse,
136            crate::Error,
137        > {
138            use std::clone::Clone;
139            let token = self.0.request.page_token.clone();
140            let execute = move |token: String| {
141                let mut builder = self.clone();
142                builder.0.request = builder.0.request.set_page_token(token);
143                builder.send()
144            };
145            google_cloud_gax::paginator::internal::new_paginator(token, execute)
146        }
147
148        /// Streams each item in the collection.
149        pub fn by_item(
150            self,
151        ) -> impl google_cloud_gax::paginator::ItemPaginator<
152            google_cloud_longrunning::model::ListOperationsResponse,
153            crate::Error,
154        > {
155            use google_cloud_gax::paginator::Paginator;
156            self.by_page().items()
157        }
158
159        /// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
160        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
161            self.0.request.name = v.into();
162            self
163        }
164
165        /// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::filter].
166        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
167            self.0.request.filter = v.into();
168            self
169        }
170
171        /// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
172        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
173            self.0.request.page_size = v.into();
174            self
175        }
176
177        /// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
178        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
179            self.0.request.page_token = v.into();
180            self
181        }
182
183        /// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
184        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
185            self.0.request.return_partial_success = v.into();
186            self
187        }
188    }
189
190    #[doc(hidden)]
191    impl crate::RequestBuilder for ListOperations {
192        fn request_options(&mut self) -> &mut crate::RequestOptions {
193            &mut self.0.options
194        }
195    }
196
197    /// The request builder for [AssistantService::get_operation][crate::client::AssistantService::get_operation] calls.
198    ///
199    /// # Example
200    /// ```
201    /// # use google_cloud_discoveryengine_v1::builder::assistant_service::GetOperation;
202    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
203    ///
204    /// let builder = prepare_request_builder();
205    /// let response = builder.send().await?;
206    /// # Ok(()) }
207    ///
208    /// fn prepare_request_builder() -> GetOperation {
209    ///   # panic!();
210    ///   // ... details omitted ...
211    /// }
212    /// ```
213    #[derive(Clone, Debug)]
214    pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
215
216    impl GetOperation {
217        pub(crate) fn new(
218            stub: std::sync::Arc<dyn super::super::stub::dynamic::AssistantService>,
219        ) -> Self {
220            Self(RequestBuilder::new(stub))
221        }
222
223        /// Sets the full request, replacing any prior values.
224        pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
225            mut self,
226            v: V,
227        ) -> Self {
228            self.0.request = v.into();
229            self
230        }
231
232        /// Sets all the options, replacing any prior values.
233        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
234            self.0.options = v.into();
235            self
236        }
237
238        /// Sends the request.
239        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
240            (*self.0.stub)
241                .get_operation(self.0.request, self.0.options)
242                .await
243                .map(crate::Response::into_body)
244        }
245
246        /// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
247        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
248            self.0.request.name = v.into();
249            self
250        }
251    }
252
253    #[doc(hidden)]
254    impl crate::RequestBuilder for GetOperation {
255        fn request_options(&mut self) -> &mut crate::RequestOptions {
256            &mut self.0.options
257        }
258    }
259
260    /// The request builder for [AssistantService::cancel_operation][crate::client::AssistantService::cancel_operation] calls.
261    ///
262    /// # Example
263    /// ```
264    /// # use google_cloud_discoveryengine_v1::builder::assistant_service::CancelOperation;
265    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
266    ///
267    /// let builder = prepare_request_builder();
268    /// let response = builder.send().await?;
269    /// # Ok(()) }
270    ///
271    /// fn prepare_request_builder() -> CancelOperation {
272    ///   # panic!();
273    ///   // ... details omitted ...
274    /// }
275    /// ```
276    #[derive(Clone, Debug)]
277    pub struct CancelOperation(
278        RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
279    );
280
281    impl CancelOperation {
282        pub(crate) fn new(
283            stub: std::sync::Arc<dyn super::super::stub::dynamic::AssistantService>,
284        ) -> Self {
285            Self(RequestBuilder::new(stub))
286        }
287
288        /// Sets the full request, replacing any prior values.
289        pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
290            mut self,
291            v: V,
292        ) -> Self {
293            self.0.request = v.into();
294            self
295        }
296
297        /// Sets all the options, replacing any prior values.
298        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
299            self.0.options = v.into();
300            self
301        }
302
303        /// Sends the request.
304        pub async fn send(self) -> Result<()> {
305            (*self.0.stub)
306                .cancel_operation(self.0.request, self.0.options)
307                .await
308                .map(crate::Response::into_body)
309        }
310
311        /// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::name].
312        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
313            self.0.request.name = v.into();
314            self
315        }
316    }
317
318    #[doc(hidden)]
319    impl crate::RequestBuilder for CancelOperation {
320        fn request_options(&mut self) -> &mut crate::RequestOptions {
321            &mut self.0.options
322        }
323    }
324}
325
326/// Request and client builders for [CmekConfigService][crate::client::CmekConfigService].
327#[cfg(feature = "cmek-config-service")]
328#[cfg_attr(docsrs, doc(cfg(feature = "cmek-config-service")))]
329pub mod cmek_config_service {
330    use crate::Result;
331
332    /// A builder for [CmekConfigService][crate::client::CmekConfigService].
333    ///
334    /// ```
335    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
336    /// # use google_cloud_discoveryengine_v1::*;
337    /// # use builder::cmek_config_service::ClientBuilder;
338    /// # use client::CmekConfigService;
339    /// let builder : ClientBuilder = CmekConfigService::builder();
340    /// let client = builder
341    ///     .with_endpoint("https://discoveryengine.googleapis.com")
342    ///     .build().await?;
343    /// # Ok(()) }
344    /// ```
345    pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
346
347    pub(crate) mod client {
348        use super::super::super::client::CmekConfigService;
349        pub struct Factory;
350        impl crate::ClientFactory for Factory {
351            type Client = CmekConfigService;
352            type Credentials = gaxi::options::Credentials;
353            async fn build(
354                self,
355                config: gaxi::options::ClientConfig,
356            ) -> crate::ClientBuilderResult<Self::Client> {
357                Self::Client::new(config).await
358            }
359        }
360    }
361
362    /// Common implementation for [crate::client::CmekConfigService] request builders.
363    #[derive(Clone, Debug)]
364    pub(crate) struct RequestBuilder<R: std::default::Default> {
365        stub: std::sync::Arc<dyn super::super::stub::dynamic::CmekConfigService>,
366        request: R,
367        options: crate::RequestOptions,
368    }
369
370    impl<R> RequestBuilder<R>
371    where
372        R: std::default::Default,
373    {
374        pub(crate) fn new(
375            stub: std::sync::Arc<dyn super::super::stub::dynamic::CmekConfigService>,
376        ) -> Self {
377            Self {
378                stub,
379                request: R::default(),
380                options: crate::RequestOptions::default(),
381            }
382        }
383    }
384
385    /// The request builder for [CmekConfigService::update_cmek_config][crate::client::CmekConfigService::update_cmek_config] calls.
386    ///
387    /// # Example
388    /// ```
389    /// # use google_cloud_discoveryengine_v1::builder::cmek_config_service::UpdateCmekConfig;
390    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
391    /// use google_cloud_lro::Poller;
392    ///
393    /// let builder = prepare_request_builder();
394    /// let response = builder.poller().until_done().await?;
395    /// # Ok(()) }
396    ///
397    /// fn prepare_request_builder() -> UpdateCmekConfig {
398    ///   # panic!();
399    ///   // ... details omitted ...
400    /// }
401    /// ```
402    #[derive(Clone, Debug)]
403    pub struct UpdateCmekConfig(RequestBuilder<crate::model::UpdateCmekConfigRequest>);
404
405    impl UpdateCmekConfig {
406        pub(crate) fn new(
407            stub: std::sync::Arc<dyn super::super::stub::dynamic::CmekConfigService>,
408        ) -> Self {
409            Self(RequestBuilder::new(stub))
410        }
411
412        /// Sets the full request, replacing any prior values.
413        pub fn with_request<V: Into<crate::model::UpdateCmekConfigRequest>>(
414            mut self,
415            v: V,
416        ) -> Self {
417            self.0.request = v.into();
418            self
419        }
420
421        /// Sets all the options, replacing any prior values.
422        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
423            self.0.options = v.into();
424            self
425        }
426
427        /// Sends the request.
428        ///
429        /// # Long running operations
430        ///
431        /// This starts, but does not poll, a longrunning operation. More information
432        /// on [update_cmek_config][crate::client::CmekConfigService::update_cmek_config].
433        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
434            (*self.0.stub)
435                .update_cmek_config(self.0.request, self.0.options)
436                .await
437                .map(crate::Response::into_body)
438        }
439
440        /// Creates a [Poller][google_cloud_lro::Poller] to work with `update_cmek_config`.
441        pub fn poller(
442            self,
443        ) -> impl google_cloud_lro::Poller<
444            crate::model::CmekConfig,
445            crate::model::UpdateCmekConfigMetadata,
446        > {
447            type Operation = google_cloud_lro::internal::Operation<
448                crate::model::CmekConfig,
449                crate::model::UpdateCmekConfigMetadata,
450            >;
451            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
452            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
453            let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
454            if let Some(ref mut details) = poller_options.tracing {
455                details.method_name = "google_cloud_discoveryengine_v1::client::CmekConfigService::update_cmek_config::until_done";
456            }
457
458            let stub = self.0.stub.clone();
459            let mut options = self.0.options.clone();
460            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
461            let query = move |name| {
462                let stub = stub.clone();
463                let options = options.clone();
464                async {
465                    let op = GetOperation::new(stub)
466                        .set_name(name)
467                        .with_options(options)
468                        .send()
469                        .await?;
470                    Ok(Operation::new(op))
471                }
472            };
473
474            let start = move || async {
475                let op = self.send().await?;
476                Ok(Operation::new(op))
477            };
478
479            use google_cloud_lro::internal::PollerExt;
480            {
481                google_cloud_lro::internal::new_poller(
482                    polling_error_policy,
483                    polling_backoff_policy,
484                    start,
485                    query,
486                )
487            }
488            .with_options(poller_options)
489        }
490
491        /// Sets the value of [config][crate::model::UpdateCmekConfigRequest::config].
492        ///
493        /// This is a **required** field for requests.
494        pub fn set_config<T>(mut self, v: T) -> Self
495        where
496            T: std::convert::Into<crate::model::CmekConfig>,
497        {
498            self.0.request.config = std::option::Option::Some(v.into());
499            self
500        }
501
502        /// Sets or clears the value of [config][crate::model::UpdateCmekConfigRequest::config].
503        ///
504        /// This is a **required** field for requests.
505        pub fn set_or_clear_config<T>(mut self, v: std::option::Option<T>) -> Self
506        where
507            T: std::convert::Into<crate::model::CmekConfig>,
508        {
509            self.0.request.config = v.map(|x| x.into());
510            self
511        }
512
513        /// Sets the value of [set_default][crate::model::UpdateCmekConfigRequest::set_default].
514        pub fn set_set_default<T: Into<bool>>(mut self, v: T) -> Self {
515            self.0.request.set_default = v.into();
516            self
517        }
518    }
519
520    #[doc(hidden)]
521    impl crate::RequestBuilder for UpdateCmekConfig {
522        fn request_options(&mut self) -> &mut crate::RequestOptions {
523            &mut self.0.options
524        }
525    }
526
527    /// The request builder for [CmekConfigService::get_cmek_config][crate::client::CmekConfigService::get_cmek_config] calls.
528    ///
529    /// # Example
530    /// ```
531    /// # use google_cloud_discoveryengine_v1::builder::cmek_config_service::GetCmekConfig;
532    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
533    ///
534    /// let builder = prepare_request_builder();
535    /// let response = builder.send().await?;
536    /// # Ok(()) }
537    ///
538    /// fn prepare_request_builder() -> GetCmekConfig {
539    ///   # panic!();
540    ///   // ... details omitted ...
541    /// }
542    /// ```
543    #[derive(Clone, Debug)]
544    pub struct GetCmekConfig(RequestBuilder<crate::model::GetCmekConfigRequest>);
545
546    impl GetCmekConfig {
547        pub(crate) fn new(
548            stub: std::sync::Arc<dyn super::super::stub::dynamic::CmekConfigService>,
549        ) -> Self {
550            Self(RequestBuilder::new(stub))
551        }
552
553        /// Sets the full request, replacing any prior values.
554        pub fn with_request<V: Into<crate::model::GetCmekConfigRequest>>(mut self, v: V) -> Self {
555            self.0.request = v.into();
556            self
557        }
558
559        /// Sets all the options, replacing any prior values.
560        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
561            self.0.options = v.into();
562            self
563        }
564
565        /// Sends the request.
566        pub async fn send(self) -> Result<crate::model::CmekConfig> {
567            (*self.0.stub)
568                .get_cmek_config(self.0.request, self.0.options)
569                .await
570                .map(crate::Response::into_body)
571        }
572
573        /// Sets the value of [name][crate::model::GetCmekConfigRequest::name].
574        ///
575        /// This is a **required** field for requests.
576        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
577            self.0.request.name = v.into();
578            self
579        }
580    }
581
582    #[doc(hidden)]
583    impl crate::RequestBuilder for GetCmekConfig {
584        fn request_options(&mut self) -> &mut crate::RequestOptions {
585            &mut self.0.options
586        }
587    }
588
589    /// The request builder for [CmekConfigService::list_cmek_configs][crate::client::CmekConfigService::list_cmek_configs] calls.
590    ///
591    /// # Example
592    /// ```
593    /// # use google_cloud_discoveryengine_v1::builder::cmek_config_service::ListCmekConfigs;
594    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
595    ///
596    /// let builder = prepare_request_builder();
597    /// let response = builder.send().await?;
598    /// # Ok(()) }
599    ///
600    /// fn prepare_request_builder() -> ListCmekConfigs {
601    ///   # panic!();
602    ///   // ... details omitted ...
603    /// }
604    /// ```
605    #[derive(Clone, Debug)]
606    pub struct ListCmekConfigs(RequestBuilder<crate::model::ListCmekConfigsRequest>);
607
608    impl ListCmekConfigs {
609        pub(crate) fn new(
610            stub: std::sync::Arc<dyn super::super::stub::dynamic::CmekConfigService>,
611        ) -> Self {
612            Self(RequestBuilder::new(stub))
613        }
614
615        /// Sets the full request, replacing any prior values.
616        pub fn with_request<V: Into<crate::model::ListCmekConfigsRequest>>(mut self, v: V) -> Self {
617            self.0.request = v.into();
618            self
619        }
620
621        /// Sets all the options, replacing any prior values.
622        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
623            self.0.options = v.into();
624            self
625        }
626
627        /// Sends the request.
628        pub async fn send(self) -> Result<crate::model::ListCmekConfigsResponse> {
629            (*self.0.stub)
630                .list_cmek_configs(self.0.request, self.0.options)
631                .await
632                .map(crate::Response::into_body)
633        }
634
635        /// Sets the value of [parent][crate::model::ListCmekConfigsRequest::parent].
636        ///
637        /// This is a **required** field for requests.
638        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
639            self.0.request.parent = v.into();
640            self
641        }
642    }
643
644    #[doc(hidden)]
645    impl crate::RequestBuilder for ListCmekConfigs {
646        fn request_options(&mut self) -> &mut crate::RequestOptions {
647            &mut self.0.options
648        }
649    }
650
651    /// The request builder for [CmekConfigService::delete_cmek_config][crate::client::CmekConfigService::delete_cmek_config] calls.
652    ///
653    /// # Example
654    /// ```
655    /// # use google_cloud_discoveryengine_v1::builder::cmek_config_service::DeleteCmekConfig;
656    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
657    /// use google_cloud_lro::Poller;
658    ///
659    /// let builder = prepare_request_builder();
660    /// let response = builder.poller().until_done().await?;
661    /// # Ok(()) }
662    ///
663    /// fn prepare_request_builder() -> DeleteCmekConfig {
664    ///   # panic!();
665    ///   // ... details omitted ...
666    /// }
667    /// ```
668    #[derive(Clone, Debug)]
669    pub struct DeleteCmekConfig(RequestBuilder<crate::model::DeleteCmekConfigRequest>);
670
671    impl DeleteCmekConfig {
672        pub(crate) fn new(
673            stub: std::sync::Arc<dyn super::super::stub::dynamic::CmekConfigService>,
674        ) -> Self {
675            Self(RequestBuilder::new(stub))
676        }
677
678        /// Sets the full request, replacing any prior values.
679        pub fn with_request<V: Into<crate::model::DeleteCmekConfigRequest>>(
680            mut self,
681            v: V,
682        ) -> Self {
683            self.0.request = v.into();
684            self
685        }
686
687        /// Sets all the options, replacing any prior values.
688        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
689            self.0.options = v.into();
690            self
691        }
692
693        /// Sends the request.
694        ///
695        /// # Long running operations
696        ///
697        /// This starts, but does not poll, a longrunning operation. More information
698        /// on [delete_cmek_config][crate::client::CmekConfigService::delete_cmek_config].
699        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
700            (*self.0.stub)
701                .delete_cmek_config(self.0.request, self.0.options)
702                .await
703                .map(crate::Response::into_body)
704        }
705
706        /// Creates a [Poller][google_cloud_lro::Poller] to work with `delete_cmek_config`.
707        pub fn poller(
708            self,
709        ) -> impl google_cloud_lro::Poller<(), crate::model::DeleteCmekConfigMetadata> {
710            type Operation = google_cloud_lro::internal::Operation<
711                wkt::Empty,
712                crate::model::DeleteCmekConfigMetadata,
713            >;
714            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
715            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
716            let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
717            if let Some(ref mut details) = poller_options.tracing {
718                details.method_name = "google_cloud_discoveryengine_v1::client::CmekConfigService::delete_cmek_config::until_done";
719            }
720
721            let stub = self.0.stub.clone();
722            let mut options = self.0.options.clone();
723            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
724            let query = move |name| {
725                let stub = stub.clone();
726                let options = options.clone();
727                async {
728                    let op = GetOperation::new(stub)
729                        .set_name(name)
730                        .with_options(options)
731                        .send()
732                        .await?;
733                    Ok(Operation::new(op))
734                }
735            };
736
737            let start = move || async {
738                let op = self.send().await?;
739                Ok(Operation::new(op))
740            };
741
742            use google_cloud_lro::internal::PollerExt;
743            {
744                google_cloud_lro::internal::new_unit_response_poller(
745                    polling_error_policy,
746                    polling_backoff_policy,
747                    start,
748                    query,
749                )
750            }
751            .with_options(poller_options)
752        }
753
754        /// Sets the value of [name][crate::model::DeleteCmekConfigRequest::name].
755        ///
756        /// This is a **required** field for requests.
757        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
758            self.0.request.name = v.into();
759            self
760        }
761    }
762
763    #[doc(hidden)]
764    impl crate::RequestBuilder for DeleteCmekConfig {
765        fn request_options(&mut self) -> &mut crate::RequestOptions {
766            &mut self.0.options
767        }
768    }
769
770    /// The request builder for [CmekConfigService::list_operations][crate::client::CmekConfigService::list_operations] calls.
771    ///
772    /// # Example
773    /// ```
774    /// # use google_cloud_discoveryengine_v1::builder::cmek_config_service::ListOperations;
775    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
776    /// use google_cloud_gax::paginator::ItemPaginator;
777    ///
778    /// let builder = prepare_request_builder();
779    /// let mut items = builder.by_item();
780    /// while let Some(result) = items.next().await {
781    ///   let item = result?;
782    /// }
783    /// # Ok(()) }
784    ///
785    /// fn prepare_request_builder() -> ListOperations {
786    ///   # panic!();
787    ///   // ... details omitted ...
788    /// }
789    /// ```
790    #[derive(Clone, Debug)]
791    pub struct ListOperations(
792        RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
793    );
794
795    impl ListOperations {
796        pub(crate) fn new(
797            stub: std::sync::Arc<dyn super::super::stub::dynamic::CmekConfigService>,
798        ) -> Self {
799            Self(RequestBuilder::new(stub))
800        }
801
802        /// Sets the full request, replacing any prior values.
803        pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
804            mut self,
805            v: V,
806        ) -> Self {
807            self.0.request = v.into();
808            self
809        }
810
811        /// Sets all the options, replacing any prior values.
812        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
813            self.0.options = v.into();
814            self
815        }
816
817        /// Sends the request.
818        pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
819            (*self.0.stub)
820                .list_operations(self.0.request, self.0.options)
821                .await
822                .map(crate::Response::into_body)
823        }
824
825        /// Streams each page in the collection.
826        pub fn by_page(
827            self,
828        ) -> impl google_cloud_gax::paginator::Paginator<
829            google_cloud_longrunning::model::ListOperationsResponse,
830            crate::Error,
831        > {
832            use std::clone::Clone;
833            let token = self.0.request.page_token.clone();
834            let execute = move |token: String| {
835                let mut builder = self.clone();
836                builder.0.request = builder.0.request.set_page_token(token);
837                builder.send()
838            };
839            google_cloud_gax::paginator::internal::new_paginator(token, execute)
840        }
841
842        /// Streams each item in the collection.
843        pub fn by_item(
844            self,
845        ) -> impl google_cloud_gax::paginator::ItemPaginator<
846            google_cloud_longrunning::model::ListOperationsResponse,
847            crate::Error,
848        > {
849            use google_cloud_gax::paginator::Paginator;
850            self.by_page().items()
851        }
852
853        /// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
854        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
855            self.0.request.name = v.into();
856            self
857        }
858
859        /// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::filter].
860        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
861            self.0.request.filter = v.into();
862            self
863        }
864
865        /// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
866        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
867            self.0.request.page_size = v.into();
868            self
869        }
870
871        /// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
872        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
873            self.0.request.page_token = v.into();
874            self
875        }
876
877        /// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
878        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
879            self.0.request.return_partial_success = v.into();
880            self
881        }
882    }
883
884    #[doc(hidden)]
885    impl crate::RequestBuilder for ListOperations {
886        fn request_options(&mut self) -> &mut crate::RequestOptions {
887            &mut self.0.options
888        }
889    }
890
891    /// The request builder for [CmekConfigService::get_operation][crate::client::CmekConfigService::get_operation] calls.
892    ///
893    /// # Example
894    /// ```
895    /// # use google_cloud_discoveryengine_v1::builder::cmek_config_service::GetOperation;
896    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
897    ///
898    /// let builder = prepare_request_builder();
899    /// let response = builder.send().await?;
900    /// # Ok(()) }
901    ///
902    /// fn prepare_request_builder() -> GetOperation {
903    ///   # panic!();
904    ///   // ... details omitted ...
905    /// }
906    /// ```
907    #[derive(Clone, Debug)]
908    pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
909
910    impl GetOperation {
911        pub(crate) fn new(
912            stub: std::sync::Arc<dyn super::super::stub::dynamic::CmekConfigService>,
913        ) -> Self {
914            Self(RequestBuilder::new(stub))
915        }
916
917        /// Sets the full request, replacing any prior values.
918        pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
919            mut self,
920            v: V,
921        ) -> Self {
922            self.0.request = v.into();
923            self
924        }
925
926        /// Sets all the options, replacing any prior values.
927        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
928            self.0.options = v.into();
929            self
930        }
931
932        /// Sends the request.
933        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
934            (*self.0.stub)
935                .get_operation(self.0.request, self.0.options)
936                .await
937                .map(crate::Response::into_body)
938        }
939
940        /// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
941        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
942            self.0.request.name = v.into();
943            self
944        }
945    }
946
947    #[doc(hidden)]
948    impl crate::RequestBuilder for GetOperation {
949        fn request_options(&mut self) -> &mut crate::RequestOptions {
950            &mut self.0.options
951        }
952    }
953
954    /// The request builder for [CmekConfigService::cancel_operation][crate::client::CmekConfigService::cancel_operation] calls.
955    ///
956    /// # Example
957    /// ```
958    /// # use google_cloud_discoveryengine_v1::builder::cmek_config_service::CancelOperation;
959    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
960    ///
961    /// let builder = prepare_request_builder();
962    /// let response = builder.send().await?;
963    /// # Ok(()) }
964    ///
965    /// fn prepare_request_builder() -> CancelOperation {
966    ///   # panic!();
967    ///   // ... details omitted ...
968    /// }
969    /// ```
970    #[derive(Clone, Debug)]
971    pub struct CancelOperation(
972        RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
973    );
974
975    impl CancelOperation {
976        pub(crate) fn new(
977            stub: std::sync::Arc<dyn super::super::stub::dynamic::CmekConfigService>,
978        ) -> Self {
979            Self(RequestBuilder::new(stub))
980        }
981
982        /// Sets the full request, replacing any prior values.
983        pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
984            mut self,
985            v: V,
986        ) -> Self {
987            self.0.request = v.into();
988            self
989        }
990
991        /// Sets all the options, replacing any prior values.
992        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
993            self.0.options = v.into();
994            self
995        }
996
997        /// Sends the request.
998        pub async fn send(self) -> Result<()> {
999            (*self.0.stub)
1000                .cancel_operation(self.0.request, self.0.options)
1001                .await
1002                .map(crate::Response::into_body)
1003        }
1004
1005        /// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::name].
1006        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1007            self.0.request.name = v.into();
1008            self
1009        }
1010    }
1011
1012    #[doc(hidden)]
1013    impl crate::RequestBuilder for CancelOperation {
1014        fn request_options(&mut self) -> &mut crate::RequestOptions {
1015            &mut self.0.options
1016        }
1017    }
1018}
1019
1020/// Request and client builders for [CompletionService][crate::client::CompletionService].
1021#[cfg(feature = "completion-service")]
1022#[cfg_attr(docsrs, doc(cfg(feature = "completion-service")))]
1023pub mod completion_service {
1024    use crate::Result;
1025
1026    /// A builder for [CompletionService][crate::client::CompletionService].
1027    ///
1028    /// ```
1029    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
1030    /// # use google_cloud_discoveryengine_v1::*;
1031    /// # use builder::completion_service::ClientBuilder;
1032    /// # use client::CompletionService;
1033    /// let builder : ClientBuilder = CompletionService::builder();
1034    /// let client = builder
1035    ///     .with_endpoint("https://discoveryengine.googleapis.com")
1036    ///     .build().await?;
1037    /// # Ok(()) }
1038    /// ```
1039    pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
1040
1041    pub(crate) mod client {
1042        use super::super::super::client::CompletionService;
1043        pub struct Factory;
1044        impl crate::ClientFactory for Factory {
1045            type Client = CompletionService;
1046            type Credentials = gaxi::options::Credentials;
1047            async fn build(
1048                self,
1049                config: gaxi::options::ClientConfig,
1050            ) -> crate::ClientBuilderResult<Self::Client> {
1051                Self::Client::new(config).await
1052            }
1053        }
1054    }
1055
1056    /// Common implementation for [crate::client::CompletionService] request builders.
1057    #[derive(Clone, Debug)]
1058    pub(crate) struct RequestBuilder<R: std::default::Default> {
1059        stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1060        request: R,
1061        options: crate::RequestOptions,
1062    }
1063
1064    impl<R> RequestBuilder<R>
1065    where
1066        R: std::default::Default,
1067    {
1068        pub(crate) fn new(
1069            stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1070        ) -> Self {
1071            Self {
1072                stub,
1073                request: R::default(),
1074                options: crate::RequestOptions::default(),
1075            }
1076        }
1077    }
1078
1079    /// The request builder for [CompletionService::complete_query][crate::client::CompletionService::complete_query] calls.
1080    ///
1081    /// # Example
1082    /// ```
1083    /// # use google_cloud_discoveryengine_v1::builder::completion_service::CompleteQuery;
1084    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
1085    ///
1086    /// let builder = prepare_request_builder();
1087    /// let response = builder.send().await?;
1088    /// # Ok(()) }
1089    ///
1090    /// fn prepare_request_builder() -> CompleteQuery {
1091    ///   # panic!();
1092    ///   // ... details omitted ...
1093    /// }
1094    /// ```
1095    #[derive(Clone, Debug)]
1096    pub struct CompleteQuery(RequestBuilder<crate::model::CompleteQueryRequest>);
1097
1098    impl CompleteQuery {
1099        pub(crate) fn new(
1100            stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1101        ) -> Self {
1102            Self(RequestBuilder::new(stub))
1103        }
1104
1105        /// Sets the full request, replacing any prior values.
1106        pub fn with_request<V: Into<crate::model::CompleteQueryRequest>>(mut self, v: V) -> Self {
1107            self.0.request = v.into();
1108            self
1109        }
1110
1111        /// Sets all the options, replacing any prior values.
1112        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1113            self.0.options = v.into();
1114            self
1115        }
1116
1117        /// Sends the request.
1118        pub async fn send(self) -> Result<crate::model::CompleteQueryResponse> {
1119            (*self.0.stub)
1120                .complete_query(self.0.request, self.0.options)
1121                .await
1122                .map(crate::Response::into_body)
1123        }
1124
1125        /// Sets the value of [data_store][crate::model::CompleteQueryRequest::data_store].
1126        ///
1127        /// This is a **required** field for requests.
1128        pub fn set_data_store<T: Into<std::string::String>>(mut self, v: T) -> Self {
1129            self.0.request.data_store = v.into();
1130            self
1131        }
1132
1133        /// Sets the value of [query][crate::model::CompleteQueryRequest::query].
1134        ///
1135        /// This is a **required** field for requests.
1136        pub fn set_query<T: Into<std::string::String>>(mut self, v: T) -> Self {
1137            self.0.request.query = v.into();
1138            self
1139        }
1140
1141        /// Sets the value of [query_model][crate::model::CompleteQueryRequest::query_model].
1142        pub fn set_query_model<T: Into<std::string::String>>(mut self, v: T) -> Self {
1143            self.0.request.query_model = v.into();
1144            self
1145        }
1146
1147        /// Sets the value of [user_pseudo_id][crate::model::CompleteQueryRequest::user_pseudo_id].
1148        pub fn set_user_pseudo_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1149            self.0.request.user_pseudo_id = v.into();
1150            self
1151        }
1152
1153        /// Sets the value of [include_tail_suggestions][crate::model::CompleteQueryRequest::include_tail_suggestions].
1154        pub fn set_include_tail_suggestions<T: Into<bool>>(mut self, v: T) -> Self {
1155            self.0.request.include_tail_suggestions = v.into();
1156            self
1157        }
1158    }
1159
1160    #[doc(hidden)]
1161    impl crate::RequestBuilder for CompleteQuery {
1162        fn request_options(&mut self) -> &mut crate::RequestOptions {
1163            &mut self.0.options
1164        }
1165    }
1166
1167    /// The request builder for [CompletionService::import_suggestion_deny_list_entries][crate::client::CompletionService::import_suggestion_deny_list_entries] calls.
1168    ///
1169    /// # Example
1170    /// ```
1171    /// # use google_cloud_discoveryengine_v1::builder::completion_service::ImportSuggestionDenyListEntries;
1172    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
1173    /// use google_cloud_lro::Poller;
1174    ///
1175    /// let builder = prepare_request_builder();
1176    /// let response = builder.poller().until_done().await?;
1177    /// # Ok(()) }
1178    ///
1179    /// fn prepare_request_builder() -> ImportSuggestionDenyListEntries {
1180    ///   # panic!();
1181    ///   // ... details omitted ...
1182    /// }
1183    /// ```
1184    #[derive(Clone, Debug)]
1185    pub struct ImportSuggestionDenyListEntries(
1186        RequestBuilder<crate::model::ImportSuggestionDenyListEntriesRequest>,
1187    );
1188
1189    impl ImportSuggestionDenyListEntries {
1190        pub(crate) fn new(
1191            stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1192        ) -> Self {
1193            Self(RequestBuilder::new(stub))
1194        }
1195
1196        /// Sets the full request, replacing any prior values.
1197        pub fn with_request<V: Into<crate::model::ImportSuggestionDenyListEntriesRequest>>(
1198            mut self,
1199            v: V,
1200        ) -> Self {
1201            self.0.request = v.into();
1202            self
1203        }
1204
1205        /// Sets all the options, replacing any prior values.
1206        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1207            self.0.options = v.into();
1208            self
1209        }
1210
1211        /// Sends the request.
1212        ///
1213        /// # Long running operations
1214        ///
1215        /// This starts, but does not poll, a longrunning operation. More information
1216        /// on [import_suggestion_deny_list_entries][crate::client::CompletionService::import_suggestion_deny_list_entries].
1217        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1218            (*self.0.stub)
1219                .import_suggestion_deny_list_entries(self.0.request, self.0.options)
1220                .await
1221                .map(crate::Response::into_body)
1222        }
1223
1224        /// Creates a [Poller][google_cloud_lro::Poller] to work with `import_suggestion_deny_list_entries`.
1225        pub fn poller(
1226            self,
1227        ) -> impl google_cloud_lro::Poller<
1228            crate::model::ImportSuggestionDenyListEntriesResponse,
1229            crate::model::ImportSuggestionDenyListEntriesMetadata,
1230        > {
1231            type Operation = google_cloud_lro::internal::Operation<
1232                crate::model::ImportSuggestionDenyListEntriesResponse,
1233                crate::model::ImportSuggestionDenyListEntriesMetadata,
1234            >;
1235            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1236            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1237            let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
1238            if let Some(ref mut details) = poller_options.tracing {
1239                details.method_name = "google_cloud_discoveryengine_v1::client::CompletionService::import_suggestion_deny_list_entries::until_done";
1240            }
1241
1242            let stub = self.0.stub.clone();
1243            let mut options = self.0.options.clone();
1244            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
1245            let query = move |name| {
1246                let stub = stub.clone();
1247                let options = options.clone();
1248                async {
1249                    let op = GetOperation::new(stub)
1250                        .set_name(name)
1251                        .with_options(options)
1252                        .send()
1253                        .await?;
1254                    Ok(Operation::new(op))
1255                }
1256            };
1257
1258            let start = move || async {
1259                let op = self.send().await?;
1260                Ok(Operation::new(op))
1261            };
1262
1263            use google_cloud_lro::internal::PollerExt;
1264            {
1265                google_cloud_lro::internal::new_poller(
1266                    polling_error_policy,
1267                    polling_backoff_policy,
1268                    start,
1269                    query,
1270                )
1271            }
1272            .with_options(poller_options)
1273        }
1274
1275        /// Sets the value of [parent][crate::model::ImportSuggestionDenyListEntriesRequest::parent].
1276        ///
1277        /// This is a **required** field for requests.
1278        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1279            self.0.request.parent = v.into();
1280            self
1281        }
1282
1283        /// Sets the value of [source][crate::model::ImportSuggestionDenyListEntriesRequest::source].
1284        ///
1285        /// Note that all the setters affecting `source` are
1286        /// mutually exclusive.
1287        pub fn set_source<
1288            T: Into<Option<crate::model::import_suggestion_deny_list_entries_request::Source>>,
1289        >(
1290            mut self,
1291            v: T,
1292        ) -> Self {
1293            self.0.request.source = v.into();
1294            self
1295        }
1296
1297        /// Sets the value of [source][crate::model::ImportSuggestionDenyListEntriesRequest::source]
1298        /// to hold a `InlineSource`.
1299        ///
1300        /// Note that all the setters affecting `source` are
1301        /// mutually exclusive.
1302        pub fn set_inline_source<
1303            T: std::convert::Into<
1304                    std::boxed::Box<
1305                        crate::model::import_suggestion_deny_list_entries_request::InlineSource,
1306                    >,
1307                >,
1308        >(
1309            mut self,
1310            v: T,
1311        ) -> Self {
1312            self.0.request = self.0.request.set_inline_source(v);
1313            self
1314        }
1315
1316        /// Sets the value of [source][crate::model::ImportSuggestionDenyListEntriesRequest::source]
1317        /// to hold a `GcsSource`.
1318        ///
1319        /// Note that all the setters affecting `source` are
1320        /// mutually exclusive.
1321        pub fn set_gcs_source<T: std::convert::Into<std::boxed::Box<crate::model::GcsSource>>>(
1322            mut self,
1323            v: T,
1324        ) -> Self {
1325            self.0.request = self.0.request.set_gcs_source(v);
1326            self
1327        }
1328    }
1329
1330    #[doc(hidden)]
1331    impl crate::RequestBuilder for ImportSuggestionDenyListEntries {
1332        fn request_options(&mut self) -> &mut crate::RequestOptions {
1333            &mut self.0.options
1334        }
1335    }
1336
1337    /// The request builder for [CompletionService::purge_suggestion_deny_list_entries][crate::client::CompletionService::purge_suggestion_deny_list_entries] calls.
1338    ///
1339    /// # Example
1340    /// ```
1341    /// # use google_cloud_discoveryengine_v1::builder::completion_service::PurgeSuggestionDenyListEntries;
1342    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
1343    /// use google_cloud_lro::Poller;
1344    ///
1345    /// let builder = prepare_request_builder();
1346    /// let response = builder.poller().until_done().await?;
1347    /// # Ok(()) }
1348    ///
1349    /// fn prepare_request_builder() -> PurgeSuggestionDenyListEntries {
1350    ///   # panic!();
1351    ///   // ... details omitted ...
1352    /// }
1353    /// ```
1354    #[derive(Clone, Debug)]
1355    pub struct PurgeSuggestionDenyListEntries(
1356        RequestBuilder<crate::model::PurgeSuggestionDenyListEntriesRequest>,
1357    );
1358
1359    impl PurgeSuggestionDenyListEntries {
1360        pub(crate) fn new(
1361            stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1362        ) -> Self {
1363            Self(RequestBuilder::new(stub))
1364        }
1365
1366        /// Sets the full request, replacing any prior values.
1367        pub fn with_request<V: Into<crate::model::PurgeSuggestionDenyListEntriesRequest>>(
1368            mut self,
1369            v: V,
1370        ) -> Self {
1371            self.0.request = v.into();
1372            self
1373        }
1374
1375        /// Sets all the options, replacing any prior values.
1376        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1377            self.0.options = v.into();
1378            self
1379        }
1380
1381        /// Sends the request.
1382        ///
1383        /// # Long running operations
1384        ///
1385        /// This starts, but does not poll, a longrunning operation. More information
1386        /// on [purge_suggestion_deny_list_entries][crate::client::CompletionService::purge_suggestion_deny_list_entries].
1387        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1388            (*self.0.stub)
1389                .purge_suggestion_deny_list_entries(self.0.request, self.0.options)
1390                .await
1391                .map(crate::Response::into_body)
1392        }
1393
1394        /// Creates a [Poller][google_cloud_lro::Poller] to work with `purge_suggestion_deny_list_entries`.
1395        pub fn poller(
1396            self,
1397        ) -> impl google_cloud_lro::Poller<
1398            crate::model::PurgeSuggestionDenyListEntriesResponse,
1399            crate::model::PurgeSuggestionDenyListEntriesMetadata,
1400        > {
1401            type Operation = google_cloud_lro::internal::Operation<
1402                crate::model::PurgeSuggestionDenyListEntriesResponse,
1403                crate::model::PurgeSuggestionDenyListEntriesMetadata,
1404            >;
1405            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1406            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1407            let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
1408            if let Some(ref mut details) = poller_options.tracing {
1409                details.method_name = "google_cloud_discoveryengine_v1::client::CompletionService::purge_suggestion_deny_list_entries::until_done";
1410            }
1411
1412            let stub = self.0.stub.clone();
1413            let mut options = self.0.options.clone();
1414            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
1415            let query = move |name| {
1416                let stub = stub.clone();
1417                let options = options.clone();
1418                async {
1419                    let op = GetOperation::new(stub)
1420                        .set_name(name)
1421                        .with_options(options)
1422                        .send()
1423                        .await?;
1424                    Ok(Operation::new(op))
1425                }
1426            };
1427
1428            let start = move || async {
1429                let op = self.send().await?;
1430                Ok(Operation::new(op))
1431            };
1432
1433            use google_cloud_lro::internal::PollerExt;
1434            {
1435                google_cloud_lro::internal::new_poller(
1436                    polling_error_policy,
1437                    polling_backoff_policy,
1438                    start,
1439                    query,
1440                )
1441            }
1442            .with_options(poller_options)
1443        }
1444
1445        /// Sets the value of [parent][crate::model::PurgeSuggestionDenyListEntriesRequest::parent].
1446        ///
1447        /// This is a **required** field for requests.
1448        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1449            self.0.request.parent = v.into();
1450            self
1451        }
1452    }
1453
1454    #[doc(hidden)]
1455    impl crate::RequestBuilder for PurgeSuggestionDenyListEntries {
1456        fn request_options(&mut self) -> &mut crate::RequestOptions {
1457            &mut self.0.options
1458        }
1459    }
1460
1461    /// The request builder for [CompletionService::import_completion_suggestions][crate::client::CompletionService::import_completion_suggestions] calls.
1462    ///
1463    /// # Example
1464    /// ```
1465    /// # use google_cloud_discoveryengine_v1::builder::completion_service::ImportCompletionSuggestions;
1466    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
1467    /// use google_cloud_lro::Poller;
1468    ///
1469    /// let builder = prepare_request_builder();
1470    /// let response = builder.poller().until_done().await?;
1471    /// # Ok(()) }
1472    ///
1473    /// fn prepare_request_builder() -> ImportCompletionSuggestions {
1474    ///   # panic!();
1475    ///   // ... details omitted ...
1476    /// }
1477    /// ```
1478    #[derive(Clone, Debug)]
1479    pub struct ImportCompletionSuggestions(
1480        RequestBuilder<crate::model::ImportCompletionSuggestionsRequest>,
1481    );
1482
1483    impl ImportCompletionSuggestions {
1484        pub(crate) fn new(
1485            stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1486        ) -> Self {
1487            Self(RequestBuilder::new(stub))
1488        }
1489
1490        /// Sets the full request, replacing any prior values.
1491        pub fn with_request<V: Into<crate::model::ImportCompletionSuggestionsRequest>>(
1492            mut self,
1493            v: V,
1494        ) -> Self {
1495            self.0.request = v.into();
1496            self
1497        }
1498
1499        /// Sets all the options, replacing any prior values.
1500        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1501            self.0.options = v.into();
1502            self
1503        }
1504
1505        /// Sends the request.
1506        ///
1507        /// # Long running operations
1508        ///
1509        /// This starts, but does not poll, a longrunning operation. More information
1510        /// on [import_completion_suggestions][crate::client::CompletionService::import_completion_suggestions].
1511        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1512            (*self.0.stub)
1513                .import_completion_suggestions(self.0.request, self.0.options)
1514                .await
1515                .map(crate::Response::into_body)
1516        }
1517
1518        /// Creates a [Poller][google_cloud_lro::Poller] to work with `import_completion_suggestions`.
1519        pub fn poller(
1520            self,
1521        ) -> impl google_cloud_lro::Poller<
1522            crate::model::ImportCompletionSuggestionsResponse,
1523            crate::model::ImportCompletionSuggestionsMetadata,
1524        > {
1525            type Operation = google_cloud_lro::internal::Operation<
1526                crate::model::ImportCompletionSuggestionsResponse,
1527                crate::model::ImportCompletionSuggestionsMetadata,
1528            >;
1529            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1530            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1531            let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
1532            if let Some(ref mut details) = poller_options.tracing {
1533                details.method_name = "google_cloud_discoveryengine_v1::client::CompletionService::import_completion_suggestions::until_done";
1534            }
1535
1536            let stub = self.0.stub.clone();
1537            let mut options = self.0.options.clone();
1538            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
1539            let query = move |name| {
1540                let stub = stub.clone();
1541                let options = options.clone();
1542                async {
1543                    let op = GetOperation::new(stub)
1544                        .set_name(name)
1545                        .with_options(options)
1546                        .send()
1547                        .await?;
1548                    Ok(Operation::new(op))
1549                }
1550            };
1551
1552            let start = move || async {
1553                let op = self.send().await?;
1554                Ok(Operation::new(op))
1555            };
1556
1557            use google_cloud_lro::internal::PollerExt;
1558            {
1559                google_cloud_lro::internal::new_poller(
1560                    polling_error_policy,
1561                    polling_backoff_policy,
1562                    start,
1563                    query,
1564                )
1565            }
1566            .with_options(poller_options)
1567        }
1568
1569        /// Sets the value of [parent][crate::model::ImportCompletionSuggestionsRequest::parent].
1570        ///
1571        /// This is a **required** field for requests.
1572        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1573            self.0.request.parent = v.into();
1574            self
1575        }
1576
1577        /// Sets the value of [error_config][crate::model::ImportCompletionSuggestionsRequest::error_config].
1578        pub fn set_error_config<T>(mut self, v: T) -> Self
1579        where
1580            T: std::convert::Into<crate::model::ImportErrorConfig>,
1581        {
1582            self.0.request.error_config = std::option::Option::Some(v.into());
1583            self
1584        }
1585
1586        /// Sets or clears the value of [error_config][crate::model::ImportCompletionSuggestionsRequest::error_config].
1587        pub fn set_or_clear_error_config<T>(mut self, v: std::option::Option<T>) -> Self
1588        where
1589            T: std::convert::Into<crate::model::ImportErrorConfig>,
1590        {
1591            self.0.request.error_config = v.map(|x| x.into());
1592            self
1593        }
1594
1595        /// Sets the value of [source][crate::model::ImportCompletionSuggestionsRequest::source].
1596        ///
1597        /// Note that all the setters affecting `source` are
1598        /// mutually exclusive.
1599        pub fn set_source<
1600            T: Into<Option<crate::model::import_completion_suggestions_request::Source>>,
1601        >(
1602            mut self,
1603            v: T,
1604        ) -> Self {
1605            self.0.request.source = v.into();
1606            self
1607        }
1608
1609        /// Sets the value of [source][crate::model::ImportCompletionSuggestionsRequest::source]
1610        /// to hold a `InlineSource`.
1611        ///
1612        /// Note that all the setters affecting `source` are
1613        /// mutually exclusive.
1614        pub fn set_inline_source<
1615            T: std::convert::Into<
1616                    std::boxed::Box<
1617                        crate::model::import_completion_suggestions_request::InlineSource,
1618                    >,
1619                >,
1620        >(
1621            mut self,
1622            v: T,
1623        ) -> Self {
1624            self.0.request = self.0.request.set_inline_source(v);
1625            self
1626        }
1627
1628        /// Sets the value of [source][crate::model::ImportCompletionSuggestionsRequest::source]
1629        /// to hold a `GcsSource`.
1630        ///
1631        /// Note that all the setters affecting `source` are
1632        /// mutually exclusive.
1633        pub fn set_gcs_source<T: std::convert::Into<std::boxed::Box<crate::model::GcsSource>>>(
1634            mut self,
1635            v: T,
1636        ) -> Self {
1637            self.0.request = self.0.request.set_gcs_source(v);
1638            self
1639        }
1640
1641        /// Sets the value of [source][crate::model::ImportCompletionSuggestionsRequest::source]
1642        /// to hold a `BigquerySource`.
1643        ///
1644        /// Note that all the setters affecting `source` are
1645        /// mutually exclusive.
1646        pub fn set_bigquery_source<
1647            T: std::convert::Into<std::boxed::Box<crate::model::BigQuerySource>>,
1648        >(
1649            mut self,
1650            v: T,
1651        ) -> Self {
1652            self.0.request = self.0.request.set_bigquery_source(v);
1653            self
1654        }
1655    }
1656
1657    #[doc(hidden)]
1658    impl crate::RequestBuilder for ImportCompletionSuggestions {
1659        fn request_options(&mut self) -> &mut crate::RequestOptions {
1660            &mut self.0.options
1661        }
1662    }
1663
1664    /// The request builder for [CompletionService::purge_completion_suggestions][crate::client::CompletionService::purge_completion_suggestions] calls.
1665    ///
1666    /// # Example
1667    /// ```
1668    /// # use google_cloud_discoveryengine_v1::builder::completion_service::PurgeCompletionSuggestions;
1669    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
1670    /// use google_cloud_lro::Poller;
1671    ///
1672    /// let builder = prepare_request_builder();
1673    /// let response = builder.poller().until_done().await?;
1674    /// # Ok(()) }
1675    ///
1676    /// fn prepare_request_builder() -> PurgeCompletionSuggestions {
1677    ///   # panic!();
1678    ///   // ... details omitted ...
1679    /// }
1680    /// ```
1681    #[derive(Clone, Debug)]
1682    pub struct PurgeCompletionSuggestions(
1683        RequestBuilder<crate::model::PurgeCompletionSuggestionsRequest>,
1684    );
1685
1686    impl PurgeCompletionSuggestions {
1687        pub(crate) fn new(
1688            stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1689        ) -> Self {
1690            Self(RequestBuilder::new(stub))
1691        }
1692
1693        /// Sets the full request, replacing any prior values.
1694        pub fn with_request<V: Into<crate::model::PurgeCompletionSuggestionsRequest>>(
1695            mut self,
1696            v: V,
1697        ) -> Self {
1698            self.0.request = v.into();
1699            self
1700        }
1701
1702        /// Sets all the options, replacing any prior values.
1703        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1704            self.0.options = v.into();
1705            self
1706        }
1707
1708        /// Sends the request.
1709        ///
1710        /// # Long running operations
1711        ///
1712        /// This starts, but does not poll, a longrunning operation. More information
1713        /// on [purge_completion_suggestions][crate::client::CompletionService::purge_completion_suggestions].
1714        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1715            (*self.0.stub)
1716                .purge_completion_suggestions(self.0.request, self.0.options)
1717                .await
1718                .map(crate::Response::into_body)
1719        }
1720
1721        /// Creates a [Poller][google_cloud_lro::Poller] to work with `purge_completion_suggestions`.
1722        pub fn poller(
1723            self,
1724        ) -> impl google_cloud_lro::Poller<
1725            crate::model::PurgeCompletionSuggestionsResponse,
1726            crate::model::PurgeCompletionSuggestionsMetadata,
1727        > {
1728            type Operation = google_cloud_lro::internal::Operation<
1729                crate::model::PurgeCompletionSuggestionsResponse,
1730                crate::model::PurgeCompletionSuggestionsMetadata,
1731            >;
1732            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1733            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1734            let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
1735            if let Some(ref mut details) = poller_options.tracing {
1736                details.method_name = "google_cloud_discoveryengine_v1::client::CompletionService::purge_completion_suggestions::until_done";
1737            }
1738
1739            let stub = self.0.stub.clone();
1740            let mut options = self.0.options.clone();
1741            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
1742            let query = move |name| {
1743                let stub = stub.clone();
1744                let options = options.clone();
1745                async {
1746                    let op = GetOperation::new(stub)
1747                        .set_name(name)
1748                        .with_options(options)
1749                        .send()
1750                        .await?;
1751                    Ok(Operation::new(op))
1752                }
1753            };
1754
1755            let start = move || async {
1756                let op = self.send().await?;
1757                Ok(Operation::new(op))
1758            };
1759
1760            use google_cloud_lro::internal::PollerExt;
1761            {
1762                google_cloud_lro::internal::new_poller(
1763                    polling_error_policy,
1764                    polling_backoff_policy,
1765                    start,
1766                    query,
1767                )
1768            }
1769            .with_options(poller_options)
1770        }
1771
1772        /// Sets the value of [parent][crate::model::PurgeCompletionSuggestionsRequest::parent].
1773        ///
1774        /// This is a **required** field for requests.
1775        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1776            self.0.request.parent = v.into();
1777            self
1778        }
1779    }
1780
1781    #[doc(hidden)]
1782    impl crate::RequestBuilder for PurgeCompletionSuggestions {
1783        fn request_options(&mut self) -> &mut crate::RequestOptions {
1784            &mut self.0.options
1785        }
1786    }
1787
1788    /// The request builder for [CompletionService::list_operations][crate::client::CompletionService::list_operations] calls.
1789    ///
1790    /// # Example
1791    /// ```
1792    /// # use google_cloud_discoveryengine_v1::builder::completion_service::ListOperations;
1793    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
1794    /// use google_cloud_gax::paginator::ItemPaginator;
1795    ///
1796    /// let builder = prepare_request_builder();
1797    /// let mut items = builder.by_item();
1798    /// while let Some(result) = items.next().await {
1799    ///   let item = result?;
1800    /// }
1801    /// # Ok(()) }
1802    ///
1803    /// fn prepare_request_builder() -> ListOperations {
1804    ///   # panic!();
1805    ///   // ... details omitted ...
1806    /// }
1807    /// ```
1808    #[derive(Clone, Debug)]
1809    pub struct ListOperations(
1810        RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
1811    );
1812
1813    impl ListOperations {
1814        pub(crate) fn new(
1815            stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1816        ) -> Self {
1817            Self(RequestBuilder::new(stub))
1818        }
1819
1820        /// Sets the full request, replacing any prior values.
1821        pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
1822            mut self,
1823            v: V,
1824        ) -> Self {
1825            self.0.request = v.into();
1826            self
1827        }
1828
1829        /// Sets all the options, replacing any prior values.
1830        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1831            self.0.options = v.into();
1832            self
1833        }
1834
1835        /// Sends the request.
1836        pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
1837            (*self.0.stub)
1838                .list_operations(self.0.request, self.0.options)
1839                .await
1840                .map(crate::Response::into_body)
1841        }
1842
1843        /// Streams each page in the collection.
1844        pub fn by_page(
1845            self,
1846        ) -> impl google_cloud_gax::paginator::Paginator<
1847            google_cloud_longrunning::model::ListOperationsResponse,
1848            crate::Error,
1849        > {
1850            use std::clone::Clone;
1851            let token = self.0.request.page_token.clone();
1852            let execute = move |token: String| {
1853                let mut builder = self.clone();
1854                builder.0.request = builder.0.request.set_page_token(token);
1855                builder.send()
1856            };
1857            google_cloud_gax::paginator::internal::new_paginator(token, execute)
1858        }
1859
1860        /// Streams each item in the collection.
1861        pub fn by_item(
1862            self,
1863        ) -> impl google_cloud_gax::paginator::ItemPaginator<
1864            google_cloud_longrunning::model::ListOperationsResponse,
1865            crate::Error,
1866        > {
1867            use google_cloud_gax::paginator::Paginator;
1868            self.by_page().items()
1869        }
1870
1871        /// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
1872        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1873            self.0.request.name = v.into();
1874            self
1875        }
1876
1877        /// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::filter].
1878        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1879            self.0.request.filter = v.into();
1880            self
1881        }
1882
1883        /// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
1884        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1885            self.0.request.page_size = v.into();
1886            self
1887        }
1888
1889        /// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
1890        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1891            self.0.request.page_token = v.into();
1892            self
1893        }
1894
1895        /// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
1896        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
1897            self.0.request.return_partial_success = v.into();
1898            self
1899        }
1900    }
1901
1902    #[doc(hidden)]
1903    impl crate::RequestBuilder for ListOperations {
1904        fn request_options(&mut self) -> &mut crate::RequestOptions {
1905            &mut self.0.options
1906        }
1907    }
1908
1909    /// The request builder for [CompletionService::get_operation][crate::client::CompletionService::get_operation] calls.
1910    ///
1911    /// # Example
1912    /// ```
1913    /// # use google_cloud_discoveryengine_v1::builder::completion_service::GetOperation;
1914    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
1915    ///
1916    /// let builder = prepare_request_builder();
1917    /// let response = builder.send().await?;
1918    /// # Ok(()) }
1919    ///
1920    /// fn prepare_request_builder() -> GetOperation {
1921    ///   # panic!();
1922    ///   // ... details omitted ...
1923    /// }
1924    /// ```
1925    #[derive(Clone, Debug)]
1926    pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
1927
1928    impl GetOperation {
1929        pub(crate) fn new(
1930            stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1931        ) -> Self {
1932            Self(RequestBuilder::new(stub))
1933        }
1934
1935        /// Sets the full request, replacing any prior values.
1936        pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
1937            mut self,
1938            v: V,
1939        ) -> Self {
1940            self.0.request = v.into();
1941            self
1942        }
1943
1944        /// Sets all the options, replacing any prior values.
1945        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1946            self.0.options = v.into();
1947            self
1948        }
1949
1950        /// Sends the request.
1951        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1952            (*self.0.stub)
1953                .get_operation(self.0.request, self.0.options)
1954                .await
1955                .map(crate::Response::into_body)
1956        }
1957
1958        /// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
1959        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1960            self.0.request.name = v.into();
1961            self
1962        }
1963    }
1964
1965    #[doc(hidden)]
1966    impl crate::RequestBuilder for GetOperation {
1967        fn request_options(&mut self) -> &mut crate::RequestOptions {
1968            &mut self.0.options
1969        }
1970    }
1971
1972    /// The request builder for [CompletionService::cancel_operation][crate::client::CompletionService::cancel_operation] calls.
1973    ///
1974    /// # Example
1975    /// ```
1976    /// # use google_cloud_discoveryengine_v1::builder::completion_service::CancelOperation;
1977    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
1978    ///
1979    /// let builder = prepare_request_builder();
1980    /// let response = builder.send().await?;
1981    /// # Ok(()) }
1982    ///
1983    /// fn prepare_request_builder() -> CancelOperation {
1984    ///   # panic!();
1985    ///   // ... details omitted ...
1986    /// }
1987    /// ```
1988    #[derive(Clone, Debug)]
1989    pub struct CancelOperation(
1990        RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
1991    );
1992
1993    impl CancelOperation {
1994        pub(crate) fn new(
1995            stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1996        ) -> Self {
1997            Self(RequestBuilder::new(stub))
1998        }
1999
2000        /// Sets the full request, replacing any prior values.
2001        pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
2002            mut self,
2003            v: V,
2004        ) -> Self {
2005            self.0.request = v.into();
2006            self
2007        }
2008
2009        /// Sets all the options, replacing any prior values.
2010        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2011            self.0.options = v.into();
2012            self
2013        }
2014
2015        /// Sends the request.
2016        pub async fn send(self) -> Result<()> {
2017            (*self.0.stub)
2018                .cancel_operation(self.0.request, self.0.options)
2019                .await
2020                .map(crate::Response::into_body)
2021        }
2022
2023        /// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::name].
2024        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2025            self.0.request.name = v.into();
2026            self
2027        }
2028    }
2029
2030    #[doc(hidden)]
2031    impl crate::RequestBuilder for CancelOperation {
2032        fn request_options(&mut self) -> &mut crate::RequestOptions {
2033            &mut self.0.options
2034        }
2035    }
2036}
2037
2038/// Request and client builders for [ControlService][crate::client::ControlService].
2039#[cfg(feature = "control-service")]
2040#[cfg_attr(docsrs, doc(cfg(feature = "control-service")))]
2041pub mod control_service {
2042    use crate::Result;
2043
2044    /// A builder for [ControlService][crate::client::ControlService].
2045    ///
2046    /// ```
2047    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
2048    /// # use google_cloud_discoveryengine_v1::*;
2049    /// # use builder::control_service::ClientBuilder;
2050    /// # use client::ControlService;
2051    /// let builder : ClientBuilder = ControlService::builder();
2052    /// let client = builder
2053    ///     .with_endpoint("https://discoveryengine.googleapis.com")
2054    ///     .build().await?;
2055    /// # Ok(()) }
2056    /// ```
2057    pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
2058
2059    pub(crate) mod client {
2060        use super::super::super::client::ControlService;
2061        pub struct Factory;
2062        impl crate::ClientFactory for Factory {
2063            type Client = ControlService;
2064            type Credentials = gaxi::options::Credentials;
2065            async fn build(
2066                self,
2067                config: gaxi::options::ClientConfig,
2068            ) -> crate::ClientBuilderResult<Self::Client> {
2069                Self::Client::new(config).await
2070            }
2071        }
2072    }
2073
2074    /// Common implementation for [crate::client::ControlService] request builders.
2075    #[derive(Clone, Debug)]
2076    pub(crate) struct RequestBuilder<R: std::default::Default> {
2077        stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2078        request: R,
2079        options: crate::RequestOptions,
2080    }
2081
2082    impl<R> RequestBuilder<R>
2083    where
2084        R: std::default::Default,
2085    {
2086        pub(crate) fn new(
2087            stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2088        ) -> Self {
2089            Self {
2090                stub,
2091                request: R::default(),
2092                options: crate::RequestOptions::default(),
2093            }
2094        }
2095    }
2096
2097    /// The request builder for [ControlService::create_control][crate::client::ControlService::create_control] calls.
2098    ///
2099    /// # Example
2100    /// ```
2101    /// # use google_cloud_discoveryengine_v1::builder::control_service::CreateControl;
2102    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
2103    ///
2104    /// let builder = prepare_request_builder();
2105    /// let response = builder.send().await?;
2106    /// # Ok(()) }
2107    ///
2108    /// fn prepare_request_builder() -> CreateControl {
2109    ///   # panic!();
2110    ///   // ... details omitted ...
2111    /// }
2112    /// ```
2113    #[derive(Clone, Debug)]
2114    pub struct CreateControl(RequestBuilder<crate::model::CreateControlRequest>);
2115
2116    impl CreateControl {
2117        pub(crate) fn new(
2118            stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2119        ) -> Self {
2120            Self(RequestBuilder::new(stub))
2121        }
2122
2123        /// Sets the full request, replacing any prior values.
2124        pub fn with_request<V: Into<crate::model::CreateControlRequest>>(mut self, v: V) -> Self {
2125            self.0.request = v.into();
2126            self
2127        }
2128
2129        /// Sets all the options, replacing any prior values.
2130        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2131            self.0.options = v.into();
2132            self
2133        }
2134
2135        /// Sends the request.
2136        pub async fn send(self) -> Result<crate::model::Control> {
2137            (*self.0.stub)
2138                .create_control(self.0.request, self.0.options)
2139                .await
2140                .map(crate::Response::into_body)
2141        }
2142
2143        /// Sets the value of [parent][crate::model::CreateControlRequest::parent].
2144        ///
2145        /// This is a **required** field for requests.
2146        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2147            self.0.request.parent = v.into();
2148            self
2149        }
2150
2151        /// Sets the value of [control][crate::model::CreateControlRequest::control].
2152        ///
2153        /// This is a **required** field for requests.
2154        pub fn set_control<T>(mut self, v: T) -> Self
2155        where
2156            T: std::convert::Into<crate::model::Control>,
2157        {
2158            self.0.request.control = std::option::Option::Some(v.into());
2159            self
2160        }
2161
2162        /// Sets or clears the value of [control][crate::model::CreateControlRequest::control].
2163        ///
2164        /// This is a **required** field for requests.
2165        pub fn set_or_clear_control<T>(mut self, v: std::option::Option<T>) -> Self
2166        where
2167            T: std::convert::Into<crate::model::Control>,
2168        {
2169            self.0.request.control = v.map(|x| x.into());
2170            self
2171        }
2172
2173        /// Sets the value of [control_id][crate::model::CreateControlRequest::control_id].
2174        ///
2175        /// This is a **required** field for requests.
2176        pub fn set_control_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2177            self.0.request.control_id = v.into();
2178            self
2179        }
2180    }
2181
2182    #[doc(hidden)]
2183    impl crate::RequestBuilder for CreateControl {
2184        fn request_options(&mut self) -> &mut crate::RequestOptions {
2185            &mut self.0.options
2186        }
2187    }
2188
2189    /// The request builder for [ControlService::delete_control][crate::client::ControlService::delete_control] calls.
2190    ///
2191    /// # Example
2192    /// ```
2193    /// # use google_cloud_discoveryengine_v1::builder::control_service::DeleteControl;
2194    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
2195    ///
2196    /// let builder = prepare_request_builder();
2197    /// let response = builder.send().await?;
2198    /// # Ok(()) }
2199    ///
2200    /// fn prepare_request_builder() -> DeleteControl {
2201    ///   # panic!();
2202    ///   // ... details omitted ...
2203    /// }
2204    /// ```
2205    #[derive(Clone, Debug)]
2206    pub struct DeleteControl(RequestBuilder<crate::model::DeleteControlRequest>);
2207
2208    impl DeleteControl {
2209        pub(crate) fn new(
2210            stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2211        ) -> Self {
2212            Self(RequestBuilder::new(stub))
2213        }
2214
2215        /// Sets the full request, replacing any prior values.
2216        pub fn with_request<V: Into<crate::model::DeleteControlRequest>>(mut self, v: V) -> Self {
2217            self.0.request = v.into();
2218            self
2219        }
2220
2221        /// Sets all the options, replacing any prior values.
2222        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2223            self.0.options = v.into();
2224            self
2225        }
2226
2227        /// Sends the request.
2228        pub async fn send(self) -> Result<()> {
2229            (*self.0.stub)
2230                .delete_control(self.0.request, self.0.options)
2231                .await
2232                .map(crate::Response::into_body)
2233        }
2234
2235        /// Sets the value of [name][crate::model::DeleteControlRequest::name].
2236        ///
2237        /// This is a **required** field for requests.
2238        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2239            self.0.request.name = v.into();
2240            self
2241        }
2242    }
2243
2244    #[doc(hidden)]
2245    impl crate::RequestBuilder for DeleteControl {
2246        fn request_options(&mut self) -> &mut crate::RequestOptions {
2247            &mut self.0.options
2248        }
2249    }
2250
2251    /// The request builder for [ControlService::update_control][crate::client::ControlService::update_control] calls.
2252    ///
2253    /// # Example
2254    /// ```
2255    /// # use google_cloud_discoveryengine_v1::builder::control_service::UpdateControl;
2256    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
2257    ///
2258    /// let builder = prepare_request_builder();
2259    /// let response = builder.send().await?;
2260    /// # Ok(()) }
2261    ///
2262    /// fn prepare_request_builder() -> UpdateControl {
2263    ///   # panic!();
2264    ///   // ... details omitted ...
2265    /// }
2266    /// ```
2267    #[derive(Clone, Debug)]
2268    pub struct UpdateControl(RequestBuilder<crate::model::UpdateControlRequest>);
2269
2270    impl UpdateControl {
2271        pub(crate) fn new(
2272            stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2273        ) -> Self {
2274            Self(RequestBuilder::new(stub))
2275        }
2276
2277        /// Sets the full request, replacing any prior values.
2278        pub fn with_request<V: Into<crate::model::UpdateControlRequest>>(mut self, v: V) -> Self {
2279            self.0.request = v.into();
2280            self
2281        }
2282
2283        /// Sets all the options, replacing any prior values.
2284        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2285            self.0.options = v.into();
2286            self
2287        }
2288
2289        /// Sends the request.
2290        pub async fn send(self) -> Result<crate::model::Control> {
2291            (*self.0.stub)
2292                .update_control(self.0.request, self.0.options)
2293                .await
2294                .map(crate::Response::into_body)
2295        }
2296
2297        /// Sets the value of [control][crate::model::UpdateControlRequest::control].
2298        ///
2299        /// This is a **required** field for requests.
2300        pub fn set_control<T>(mut self, v: T) -> Self
2301        where
2302            T: std::convert::Into<crate::model::Control>,
2303        {
2304            self.0.request.control = std::option::Option::Some(v.into());
2305            self
2306        }
2307
2308        /// Sets or clears the value of [control][crate::model::UpdateControlRequest::control].
2309        ///
2310        /// This is a **required** field for requests.
2311        pub fn set_or_clear_control<T>(mut self, v: std::option::Option<T>) -> Self
2312        where
2313            T: std::convert::Into<crate::model::Control>,
2314        {
2315            self.0.request.control = v.map(|x| x.into());
2316            self
2317        }
2318
2319        /// Sets the value of [update_mask][crate::model::UpdateControlRequest::update_mask].
2320        pub fn set_update_mask<T>(mut self, v: T) -> Self
2321        where
2322            T: std::convert::Into<wkt::FieldMask>,
2323        {
2324            self.0.request.update_mask = std::option::Option::Some(v.into());
2325            self
2326        }
2327
2328        /// Sets or clears the value of [update_mask][crate::model::UpdateControlRequest::update_mask].
2329        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
2330        where
2331            T: std::convert::Into<wkt::FieldMask>,
2332        {
2333            self.0.request.update_mask = v.map(|x| x.into());
2334            self
2335        }
2336    }
2337
2338    #[doc(hidden)]
2339    impl crate::RequestBuilder for UpdateControl {
2340        fn request_options(&mut self) -> &mut crate::RequestOptions {
2341            &mut self.0.options
2342        }
2343    }
2344
2345    /// The request builder for [ControlService::get_control][crate::client::ControlService::get_control] calls.
2346    ///
2347    /// # Example
2348    /// ```
2349    /// # use google_cloud_discoveryengine_v1::builder::control_service::GetControl;
2350    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
2351    ///
2352    /// let builder = prepare_request_builder();
2353    /// let response = builder.send().await?;
2354    /// # Ok(()) }
2355    ///
2356    /// fn prepare_request_builder() -> GetControl {
2357    ///   # panic!();
2358    ///   // ... details omitted ...
2359    /// }
2360    /// ```
2361    #[derive(Clone, Debug)]
2362    pub struct GetControl(RequestBuilder<crate::model::GetControlRequest>);
2363
2364    impl GetControl {
2365        pub(crate) fn new(
2366            stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2367        ) -> Self {
2368            Self(RequestBuilder::new(stub))
2369        }
2370
2371        /// Sets the full request, replacing any prior values.
2372        pub fn with_request<V: Into<crate::model::GetControlRequest>>(mut self, v: V) -> Self {
2373            self.0.request = v.into();
2374            self
2375        }
2376
2377        /// Sets all the options, replacing any prior values.
2378        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2379            self.0.options = v.into();
2380            self
2381        }
2382
2383        /// Sends the request.
2384        pub async fn send(self) -> Result<crate::model::Control> {
2385            (*self.0.stub)
2386                .get_control(self.0.request, self.0.options)
2387                .await
2388                .map(crate::Response::into_body)
2389        }
2390
2391        /// Sets the value of [name][crate::model::GetControlRequest::name].
2392        ///
2393        /// This is a **required** field for requests.
2394        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2395            self.0.request.name = v.into();
2396            self
2397        }
2398    }
2399
2400    #[doc(hidden)]
2401    impl crate::RequestBuilder for GetControl {
2402        fn request_options(&mut self) -> &mut crate::RequestOptions {
2403            &mut self.0.options
2404        }
2405    }
2406
2407    /// The request builder for [ControlService::list_controls][crate::client::ControlService::list_controls] calls.
2408    ///
2409    /// # Example
2410    /// ```
2411    /// # use google_cloud_discoveryengine_v1::builder::control_service::ListControls;
2412    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
2413    /// use google_cloud_gax::paginator::ItemPaginator;
2414    ///
2415    /// let builder = prepare_request_builder();
2416    /// let mut items = builder.by_item();
2417    /// while let Some(result) = items.next().await {
2418    ///   let item = result?;
2419    /// }
2420    /// # Ok(()) }
2421    ///
2422    /// fn prepare_request_builder() -> ListControls {
2423    ///   # panic!();
2424    ///   // ... details omitted ...
2425    /// }
2426    /// ```
2427    #[derive(Clone, Debug)]
2428    pub struct ListControls(RequestBuilder<crate::model::ListControlsRequest>);
2429
2430    impl ListControls {
2431        pub(crate) fn new(
2432            stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2433        ) -> Self {
2434            Self(RequestBuilder::new(stub))
2435        }
2436
2437        /// Sets the full request, replacing any prior values.
2438        pub fn with_request<V: Into<crate::model::ListControlsRequest>>(mut self, v: V) -> Self {
2439            self.0.request = v.into();
2440            self
2441        }
2442
2443        /// Sets all the options, replacing any prior values.
2444        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2445            self.0.options = v.into();
2446            self
2447        }
2448
2449        /// Sends the request.
2450        pub async fn send(self) -> Result<crate::model::ListControlsResponse> {
2451            (*self.0.stub)
2452                .list_controls(self.0.request, self.0.options)
2453                .await
2454                .map(crate::Response::into_body)
2455        }
2456
2457        /// Streams each page in the collection.
2458        pub fn by_page(
2459            self,
2460        ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListControlsResponse, crate::Error>
2461        {
2462            use std::clone::Clone;
2463            let token = self.0.request.page_token.clone();
2464            let execute = move |token: String| {
2465                let mut builder = self.clone();
2466                builder.0.request = builder.0.request.set_page_token(token);
2467                builder.send()
2468            };
2469            google_cloud_gax::paginator::internal::new_paginator(token, execute)
2470        }
2471
2472        /// Streams each item in the collection.
2473        pub fn by_item(
2474            self,
2475        ) -> impl google_cloud_gax::paginator::ItemPaginator<
2476            crate::model::ListControlsResponse,
2477            crate::Error,
2478        > {
2479            use google_cloud_gax::paginator::Paginator;
2480            self.by_page().items()
2481        }
2482
2483        /// Sets the value of [parent][crate::model::ListControlsRequest::parent].
2484        ///
2485        /// This is a **required** field for requests.
2486        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2487            self.0.request.parent = v.into();
2488            self
2489        }
2490
2491        /// Sets the value of [page_size][crate::model::ListControlsRequest::page_size].
2492        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2493            self.0.request.page_size = v.into();
2494            self
2495        }
2496
2497        /// Sets the value of [page_token][crate::model::ListControlsRequest::page_token].
2498        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2499            self.0.request.page_token = v.into();
2500            self
2501        }
2502
2503        /// Sets the value of [filter][crate::model::ListControlsRequest::filter].
2504        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
2505            self.0.request.filter = v.into();
2506            self
2507        }
2508    }
2509
2510    #[doc(hidden)]
2511    impl crate::RequestBuilder for ListControls {
2512        fn request_options(&mut self) -> &mut crate::RequestOptions {
2513            &mut self.0.options
2514        }
2515    }
2516
2517    /// The request builder for [ControlService::list_operations][crate::client::ControlService::list_operations] calls.
2518    ///
2519    /// # Example
2520    /// ```
2521    /// # use google_cloud_discoveryengine_v1::builder::control_service::ListOperations;
2522    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
2523    /// use google_cloud_gax::paginator::ItemPaginator;
2524    ///
2525    /// let builder = prepare_request_builder();
2526    /// let mut items = builder.by_item();
2527    /// while let Some(result) = items.next().await {
2528    ///   let item = result?;
2529    /// }
2530    /// # Ok(()) }
2531    ///
2532    /// fn prepare_request_builder() -> ListOperations {
2533    ///   # panic!();
2534    ///   // ... details omitted ...
2535    /// }
2536    /// ```
2537    #[derive(Clone, Debug)]
2538    pub struct ListOperations(
2539        RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
2540    );
2541
2542    impl ListOperations {
2543        pub(crate) fn new(
2544            stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2545        ) -> Self {
2546            Self(RequestBuilder::new(stub))
2547        }
2548
2549        /// Sets the full request, replacing any prior values.
2550        pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
2551            mut self,
2552            v: V,
2553        ) -> Self {
2554            self.0.request = v.into();
2555            self
2556        }
2557
2558        /// Sets all the options, replacing any prior values.
2559        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2560            self.0.options = v.into();
2561            self
2562        }
2563
2564        /// Sends the request.
2565        pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
2566            (*self.0.stub)
2567                .list_operations(self.0.request, self.0.options)
2568                .await
2569                .map(crate::Response::into_body)
2570        }
2571
2572        /// Streams each page in the collection.
2573        pub fn by_page(
2574            self,
2575        ) -> impl google_cloud_gax::paginator::Paginator<
2576            google_cloud_longrunning::model::ListOperationsResponse,
2577            crate::Error,
2578        > {
2579            use std::clone::Clone;
2580            let token = self.0.request.page_token.clone();
2581            let execute = move |token: String| {
2582                let mut builder = self.clone();
2583                builder.0.request = builder.0.request.set_page_token(token);
2584                builder.send()
2585            };
2586            google_cloud_gax::paginator::internal::new_paginator(token, execute)
2587        }
2588
2589        /// Streams each item in the collection.
2590        pub fn by_item(
2591            self,
2592        ) -> impl google_cloud_gax::paginator::ItemPaginator<
2593            google_cloud_longrunning::model::ListOperationsResponse,
2594            crate::Error,
2595        > {
2596            use google_cloud_gax::paginator::Paginator;
2597            self.by_page().items()
2598        }
2599
2600        /// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
2601        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2602            self.0.request.name = v.into();
2603            self
2604        }
2605
2606        /// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::filter].
2607        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
2608            self.0.request.filter = v.into();
2609            self
2610        }
2611
2612        /// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
2613        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2614            self.0.request.page_size = v.into();
2615            self
2616        }
2617
2618        /// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
2619        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2620            self.0.request.page_token = v.into();
2621            self
2622        }
2623
2624        /// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
2625        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
2626            self.0.request.return_partial_success = v.into();
2627            self
2628        }
2629    }
2630
2631    #[doc(hidden)]
2632    impl crate::RequestBuilder for ListOperations {
2633        fn request_options(&mut self) -> &mut crate::RequestOptions {
2634            &mut self.0.options
2635        }
2636    }
2637
2638    /// The request builder for [ControlService::get_operation][crate::client::ControlService::get_operation] calls.
2639    ///
2640    /// # Example
2641    /// ```
2642    /// # use google_cloud_discoveryengine_v1::builder::control_service::GetOperation;
2643    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
2644    ///
2645    /// let builder = prepare_request_builder();
2646    /// let response = builder.send().await?;
2647    /// # Ok(()) }
2648    ///
2649    /// fn prepare_request_builder() -> GetOperation {
2650    ///   # panic!();
2651    ///   // ... details omitted ...
2652    /// }
2653    /// ```
2654    #[derive(Clone, Debug)]
2655    pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
2656
2657    impl GetOperation {
2658        pub(crate) fn new(
2659            stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2660        ) -> Self {
2661            Self(RequestBuilder::new(stub))
2662        }
2663
2664        /// Sets the full request, replacing any prior values.
2665        pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
2666            mut self,
2667            v: V,
2668        ) -> Self {
2669            self.0.request = v.into();
2670            self
2671        }
2672
2673        /// Sets all the options, replacing any prior values.
2674        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2675            self.0.options = v.into();
2676            self
2677        }
2678
2679        /// Sends the request.
2680        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
2681            (*self.0.stub)
2682                .get_operation(self.0.request, self.0.options)
2683                .await
2684                .map(crate::Response::into_body)
2685        }
2686
2687        /// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
2688        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2689            self.0.request.name = v.into();
2690            self
2691        }
2692    }
2693
2694    #[doc(hidden)]
2695    impl crate::RequestBuilder for GetOperation {
2696        fn request_options(&mut self) -> &mut crate::RequestOptions {
2697            &mut self.0.options
2698        }
2699    }
2700
2701    /// The request builder for [ControlService::cancel_operation][crate::client::ControlService::cancel_operation] calls.
2702    ///
2703    /// # Example
2704    /// ```
2705    /// # use google_cloud_discoveryengine_v1::builder::control_service::CancelOperation;
2706    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
2707    ///
2708    /// let builder = prepare_request_builder();
2709    /// let response = builder.send().await?;
2710    /// # Ok(()) }
2711    ///
2712    /// fn prepare_request_builder() -> CancelOperation {
2713    ///   # panic!();
2714    ///   // ... details omitted ...
2715    /// }
2716    /// ```
2717    #[derive(Clone, Debug)]
2718    pub struct CancelOperation(
2719        RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
2720    );
2721
2722    impl CancelOperation {
2723        pub(crate) fn new(
2724            stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2725        ) -> Self {
2726            Self(RequestBuilder::new(stub))
2727        }
2728
2729        /// Sets the full request, replacing any prior values.
2730        pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
2731            mut self,
2732            v: V,
2733        ) -> Self {
2734            self.0.request = v.into();
2735            self
2736        }
2737
2738        /// Sets all the options, replacing any prior values.
2739        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2740            self.0.options = v.into();
2741            self
2742        }
2743
2744        /// Sends the request.
2745        pub async fn send(self) -> Result<()> {
2746            (*self.0.stub)
2747                .cancel_operation(self.0.request, self.0.options)
2748                .await
2749                .map(crate::Response::into_body)
2750        }
2751
2752        /// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::name].
2753        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2754            self.0.request.name = v.into();
2755            self
2756        }
2757    }
2758
2759    #[doc(hidden)]
2760    impl crate::RequestBuilder for CancelOperation {
2761        fn request_options(&mut self) -> &mut crate::RequestOptions {
2762            &mut self.0.options
2763        }
2764    }
2765}
2766
2767/// Request and client builders for [ConversationalSearchService][crate::client::ConversationalSearchService].
2768#[cfg(feature = "conversational-search-service")]
2769#[cfg_attr(docsrs, doc(cfg(feature = "conversational-search-service")))]
2770pub mod conversational_search_service {
2771    use crate::Result;
2772
2773    /// A builder for [ConversationalSearchService][crate::client::ConversationalSearchService].
2774    ///
2775    /// ```
2776    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
2777    /// # use google_cloud_discoveryengine_v1::*;
2778    /// # use builder::conversational_search_service::ClientBuilder;
2779    /// # use client::ConversationalSearchService;
2780    /// let builder : ClientBuilder = ConversationalSearchService::builder();
2781    /// let client = builder
2782    ///     .with_endpoint("https://discoveryengine.googleapis.com")
2783    ///     .build().await?;
2784    /// # Ok(()) }
2785    /// ```
2786    pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
2787
2788    pub(crate) mod client {
2789        use super::super::super::client::ConversationalSearchService;
2790        pub struct Factory;
2791        impl crate::ClientFactory for Factory {
2792            type Client = ConversationalSearchService;
2793            type Credentials = gaxi::options::Credentials;
2794            async fn build(
2795                self,
2796                config: gaxi::options::ClientConfig,
2797            ) -> crate::ClientBuilderResult<Self::Client> {
2798                Self::Client::new(config).await
2799            }
2800        }
2801    }
2802
2803    /// Common implementation for [crate::client::ConversationalSearchService] request builders.
2804    #[derive(Clone, Debug)]
2805    pub(crate) struct RequestBuilder<R: std::default::Default> {
2806        stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
2807        request: R,
2808        options: crate::RequestOptions,
2809    }
2810
2811    impl<R> RequestBuilder<R>
2812    where
2813        R: std::default::Default,
2814    {
2815        pub(crate) fn new(
2816            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
2817        ) -> Self {
2818            Self {
2819                stub,
2820                request: R::default(),
2821                options: crate::RequestOptions::default(),
2822            }
2823        }
2824    }
2825
2826    /// The request builder for [ConversationalSearchService::converse_conversation][crate::client::ConversationalSearchService::converse_conversation] calls.
2827    ///
2828    /// # Example
2829    /// ```
2830    /// # use google_cloud_discoveryengine_v1::builder::conversational_search_service::ConverseConversation;
2831    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
2832    ///
2833    /// let builder = prepare_request_builder();
2834    /// let response = builder.send().await?;
2835    /// # Ok(()) }
2836    ///
2837    /// fn prepare_request_builder() -> ConverseConversation {
2838    ///   # panic!();
2839    ///   // ... details omitted ...
2840    /// }
2841    /// ```
2842    #[derive(Clone, Debug)]
2843    pub struct ConverseConversation(RequestBuilder<crate::model::ConverseConversationRequest>);
2844
2845    impl ConverseConversation {
2846        pub(crate) fn new(
2847            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
2848        ) -> Self {
2849            Self(RequestBuilder::new(stub))
2850        }
2851
2852        /// Sets the full request, replacing any prior values.
2853        pub fn with_request<V: Into<crate::model::ConverseConversationRequest>>(
2854            mut self,
2855            v: V,
2856        ) -> Self {
2857            self.0.request = v.into();
2858            self
2859        }
2860
2861        /// Sets all the options, replacing any prior values.
2862        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2863            self.0.options = v.into();
2864            self
2865        }
2866
2867        /// Sends the request.
2868        pub async fn send(self) -> Result<crate::model::ConverseConversationResponse> {
2869            (*self.0.stub)
2870                .converse_conversation(self.0.request, self.0.options)
2871                .await
2872                .map(crate::Response::into_body)
2873        }
2874
2875        /// Sets the value of [name][crate::model::ConverseConversationRequest::name].
2876        ///
2877        /// This is a **required** field for requests.
2878        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2879            self.0.request.name = v.into();
2880            self
2881        }
2882
2883        /// Sets the value of [query][crate::model::ConverseConversationRequest::query].
2884        ///
2885        /// This is a **required** field for requests.
2886        pub fn set_query<T>(mut self, v: T) -> Self
2887        where
2888            T: std::convert::Into<crate::model::TextInput>,
2889        {
2890            self.0.request.query = std::option::Option::Some(v.into());
2891            self
2892        }
2893
2894        /// Sets or clears the value of [query][crate::model::ConverseConversationRequest::query].
2895        ///
2896        /// This is a **required** field for requests.
2897        pub fn set_or_clear_query<T>(mut self, v: std::option::Option<T>) -> Self
2898        where
2899            T: std::convert::Into<crate::model::TextInput>,
2900        {
2901            self.0.request.query = v.map(|x| x.into());
2902            self
2903        }
2904
2905        /// Sets the value of [serving_config][crate::model::ConverseConversationRequest::serving_config].
2906        pub fn set_serving_config<T: Into<std::string::String>>(mut self, v: T) -> Self {
2907            self.0.request.serving_config = v.into();
2908            self
2909        }
2910
2911        /// Sets the value of [conversation][crate::model::ConverseConversationRequest::conversation].
2912        pub fn set_conversation<T>(mut self, v: T) -> Self
2913        where
2914            T: std::convert::Into<crate::model::Conversation>,
2915        {
2916            self.0.request.conversation = std::option::Option::Some(v.into());
2917            self
2918        }
2919
2920        /// Sets or clears the value of [conversation][crate::model::ConverseConversationRequest::conversation].
2921        pub fn set_or_clear_conversation<T>(mut self, v: std::option::Option<T>) -> Self
2922        where
2923            T: std::convert::Into<crate::model::Conversation>,
2924        {
2925            self.0.request.conversation = v.map(|x| x.into());
2926            self
2927        }
2928
2929        /// Sets the value of [safe_search][crate::model::ConverseConversationRequest::safe_search].
2930        pub fn set_safe_search<T: Into<bool>>(mut self, v: T) -> Self {
2931            self.0.request.safe_search = v.into();
2932            self
2933        }
2934
2935        /// Sets the value of [user_labels][crate::model::ConverseConversationRequest::user_labels].
2936        pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
2937        where
2938            T: std::iter::IntoIterator<Item = (K, V)>,
2939            K: std::convert::Into<std::string::String>,
2940            V: std::convert::Into<std::string::String>,
2941        {
2942            self.0.request.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
2943            self
2944        }
2945
2946        /// Sets the value of [summary_spec][crate::model::ConverseConversationRequest::summary_spec].
2947        pub fn set_summary_spec<T>(mut self, v: T) -> Self
2948        where
2949            T: std::convert::Into<crate::model::search_request::content_search_spec::SummarySpec>,
2950        {
2951            self.0.request.summary_spec = std::option::Option::Some(v.into());
2952            self
2953        }
2954
2955        /// Sets or clears the value of [summary_spec][crate::model::ConverseConversationRequest::summary_spec].
2956        pub fn set_or_clear_summary_spec<T>(mut self, v: std::option::Option<T>) -> Self
2957        where
2958            T: std::convert::Into<crate::model::search_request::content_search_spec::SummarySpec>,
2959        {
2960            self.0.request.summary_spec = v.map(|x| x.into());
2961            self
2962        }
2963
2964        /// Sets the value of [filter][crate::model::ConverseConversationRequest::filter].
2965        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
2966            self.0.request.filter = v.into();
2967            self
2968        }
2969
2970        /// Sets the value of [boost_spec][crate::model::ConverseConversationRequest::boost_spec].
2971        pub fn set_boost_spec<T>(mut self, v: T) -> Self
2972        where
2973            T: std::convert::Into<crate::model::search_request::BoostSpec>,
2974        {
2975            self.0.request.boost_spec = std::option::Option::Some(v.into());
2976            self
2977        }
2978
2979        /// Sets or clears the value of [boost_spec][crate::model::ConverseConversationRequest::boost_spec].
2980        pub fn set_or_clear_boost_spec<T>(mut self, v: std::option::Option<T>) -> Self
2981        where
2982            T: std::convert::Into<crate::model::search_request::BoostSpec>,
2983        {
2984            self.0.request.boost_spec = v.map(|x| x.into());
2985            self
2986        }
2987    }
2988
2989    #[doc(hidden)]
2990    impl crate::RequestBuilder for ConverseConversation {
2991        fn request_options(&mut self) -> &mut crate::RequestOptions {
2992            &mut self.0.options
2993        }
2994    }
2995
2996    /// The request builder for [ConversationalSearchService::create_conversation][crate::client::ConversationalSearchService::create_conversation] calls.
2997    ///
2998    /// # Example
2999    /// ```
3000    /// # use google_cloud_discoveryengine_v1::builder::conversational_search_service::CreateConversation;
3001    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
3002    ///
3003    /// let builder = prepare_request_builder();
3004    /// let response = builder.send().await?;
3005    /// # Ok(()) }
3006    ///
3007    /// fn prepare_request_builder() -> CreateConversation {
3008    ///   # panic!();
3009    ///   // ... details omitted ...
3010    /// }
3011    /// ```
3012    #[derive(Clone, Debug)]
3013    pub struct CreateConversation(RequestBuilder<crate::model::CreateConversationRequest>);
3014
3015    impl CreateConversation {
3016        pub(crate) fn new(
3017            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3018        ) -> Self {
3019            Self(RequestBuilder::new(stub))
3020        }
3021
3022        /// Sets the full request, replacing any prior values.
3023        pub fn with_request<V: Into<crate::model::CreateConversationRequest>>(
3024            mut self,
3025            v: V,
3026        ) -> Self {
3027            self.0.request = v.into();
3028            self
3029        }
3030
3031        /// Sets all the options, replacing any prior values.
3032        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3033            self.0.options = v.into();
3034            self
3035        }
3036
3037        /// Sends the request.
3038        pub async fn send(self) -> Result<crate::model::Conversation> {
3039            (*self.0.stub)
3040                .create_conversation(self.0.request, self.0.options)
3041                .await
3042                .map(crate::Response::into_body)
3043        }
3044
3045        /// Sets the value of [parent][crate::model::CreateConversationRequest::parent].
3046        ///
3047        /// This is a **required** field for requests.
3048        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
3049            self.0.request.parent = v.into();
3050            self
3051        }
3052
3053        /// Sets the value of [conversation][crate::model::CreateConversationRequest::conversation].
3054        ///
3055        /// This is a **required** field for requests.
3056        pub fn set_conversation<T>(mut self, v: T) -> Self
3057        where
3058            T: std::convert::Into<crate::model::Conversation>,
3059        {
3060            self.0.request.conversation = std::option::Option::Some(v.into());
3061            self
3062        }
3063
3064        /// Sets or clears the value of [conversation][crate::model::CreateConversationRequest::conversation].
3065        ///
3066        /// This is a **required** field for requests.
3067        pub fn set_or_clear_conversation<T>(mut self, v: std::option::Option<T>) -> Self
3068        where
3069            T: std::convert::Into<crate::model::Conversation>,
3070        {
3071            self.0.request.conversation = v.map(|x| x.into());
3072            self
3073        }
3074    }
3075
3076    #[doc(hidden)]
3077    impl crate::RequestBuilder for CreateConversation {
3078        fn request_options(&mut self) -> &mut crate::RequestOptions {
3079            &mut self.0.options
3080        }
3081    }
3082
3083    /// The request builder for [ConversationalSearchService::delete_conversation][crate::client::ConversationalSearchService::delete_conversation] calls.
3084    ///
3085    /// # Example
3086    /// ```
3087    /// # use google_cloud_discoveryengine_v1::builder::conversational_search_service::DeleteConversation;
3088    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
3089    ///
3090    /// let builder = prepare_request_builder();
3091    /// let response = builder.send().await?;
3092    /// # Ok(()) }
3093    ///
3094    /// fn prepare_request_builder() -> DeleteConversation {
3095    ///   # panic!();
3096    ///   // ... details omitted ...
3097    /// }
3098    /// ```
3099    #[derive(Clone, Debug)]
3100    pub struct DeleteConversation(RequestBuilder<crate::model::DeleteConversationRequest>);
3101
3102    impl DeleteConversation {
3103        pub(crate) fn new(
3104            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3105        ) -> Self {
3106            Self(RequestBuilder::new(stub))
3107        }
3108
3109        /// Sets the full request, replacing any prior values.
3110        pub fn with_request<V: Into<crate::model::DeleteConversationRequest>>(
3111            mut self,
3112            v: V,
3113        ) -> Self {
3114            self.0.request = v.into();
3115            self
3116        }
3117
3118        /// Sets all the options, replacing any prior values.
3119        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3120            self.0.options = v.into();
3121            self
3122        }
3123
3124        /// Sends the request.
3125        pub async fn send(self) -> Result<()> {
3126            (*self.0.stub)
3127                .delete_conversation(self.0.request, self.0.options)
3128                .await
3129                .map(crate::Response::into_body)
3130        }
3131
3132        /// Sets the value of [name][crate::model::DeleteConversationRequest::name].
3133        ///
3134        /// This is a **required** field for requests.
3135        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3136            self.0.request.name = v.into();
3137            self
3138        }
3139    }
3140
3141    #[doc(hidden)]
3142    impl crate::RequestBuilder for DeleteConversation {
3143        fn request_options(&mut self) -> &mut crate::RequestOptions {
3144            &mut self.0.options
3145        }
3146    }
3147
3148    /// The request builder for [ConversationalSearchService::update_conversation][crate::client::ConversationalSearchService::update_conversation] calls.
3149    ///
3150    /// # Example
3151    /// ```
3152    /// # use google_cloud_discoveryengine_v1::builder::conversational_search_service::UpdateConversation;
3153    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
3154    ///
3155    /// let builder = prepare_request_builder();
3156    /// let response = builder.send().await?;
3157    /// # Ok(()) }
3158    ///
3159    /// fn prepare_request_builder() -> UpdateConversation {
3160    ///   # panic!();
3161    ///   // ... details omitted ...
3162    /// }
3163    /// ```
3164    #[derive(Clone, Debug)]
3165    pub struct UpdateConversation(RequestBuilder<crate::model::UpdateConversationRequest>);
3166
3167    impl UpdateConversation {
3168        pub(crate) fn new(
3169            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3170        ) -> Self {
3171            Self(RequestBuilder::new(stub))
3172        }
3173
3174        /// Sets the full request, replacing any prior values.
3175        pub fn with_request<V: Into<crate::model::UpdateConversationRequest>>(
3176            mut self,
3177            v: V,
3178        ) -> Self {
3179            self.0.request = v.into();
3180            self
3181        }
3182
3183        /// Sets all the options, replacing any prior values.
3184        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3185            self.0.options = v.into();
3186            self
3187        }
3188
3189        /// Sends the request.
3190        pub async fn send(self) -> Result<crate::model::Conversation> {
3191            (*self.0.stub)
3192                .update_conversation(self.0.request, self.0.options)
3193                .await
3194                .map(crate::Response::into_body)
3195        }
3196
3197        /// Sets the value of [conversation][crate::model::UpdateConversationRequest::conversation].
3198        ///
3199        /// This is a **required** field for requests.
3200        pub fn set_conversation<T>(mut self, v: T) -> Self
3201        where
3202            T: std::convert::Into<crate::model::Conversation>,
3203        {
3204            self.0.request.conversation = std::option::Option::Some(v.into());
3205            self
3206        }
3207
3208        /// Sets or clears the value of [conversation][crate::model::UpdateConversationRequest::conversation].
3209        ///
3210        /// This is a **required** field for requests.
3211        pub fn set_or_clear_conversation<T>(mut self, v: std::option::Option<T>) -> Self
3212        where
3213            T: std::convert::Into<crate::model::Conversation>,
3214        {
3215            self.0.request.conversation = v.map(|x| x.into());
3216            self
3217        }
3218
3219        /// Sets the value of [update_mask][crate::model::UpdateConversationRequest::update_mask].
3220        pub fn set_update_mask<T>(mut self, v: T) -> Self
3221        where
3222            T: std::convert::Into<wkt::FieldMask>,
3223        {
3224            self.0.request.update_mask = std::option::Option::Some(v.into());
3225            self
3226        }
3227
3228        /// Sets or clears the value of [update_mask][crate::model::UpdateConversationRequest::update_mask].
3229        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
3230        where
3231            T: std::convert::Into<wkt::FieldMask>,
3232        {
3233            self.0.request.update_mask = v.map(|x| x.into());
3234            self
3235        }
3236    }
3237
3238    #[doc(hidden)]
3239    impl crate::RequestBuilder for UpdateConversation {
3240        fn request_options(&mut self) -> &mut crate::RequestOptions {
3241            &mut self.0.options
3242        }
3243    }
3244
3245    /// The request builder for [ConversationalSearchService::get_conversation][crate::client::ConversationalSearchService::get_conversation] calls.
3246    ///
3247    /// # Example
3248    /// ```
3249    /// # use google_cloud_discoveryengine_v1::builder::conversational_search_service::GetConversation;
3250    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
3251    ///
3252    /// let builder = prepare_request_builder();
3253    /// let response = builder.send().await?;
3254    /// # Ok(()) }
3255    ///
3256    /// fn prepare_request_builder() -> GetConversation {
3257    ///   # panic!();
3258    ///   // ... details omitted ...
3259    /// }
3260    /// ```
3261    #[derive(Clone, Debug)]
3262    pub struct GetConversation(RequestBuilder<crate::model::GetConversationRequest>);
3263
3264    impl GetConversation {
3265        pub(crate) fn new(
3266            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3267        ) -> Self {
3268            Self(RequestBuilder::new(stub))
3269        }
3270
3271        /// Sets the full request, replacing any prior values.
3272        pub fn with_request<V: Into<crate::model::GetConversationRequest>>(mut self, v: V) -> Self {
3273            self.0.request = v.into();
3274            self
3275        }
3276
3277        /// Sets all the options, replacing any prior values.
3278        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3279            self.0.options = v.into();
3280            self
3281        }
3282
3283        /// Sends the request.
3284        pub async fn send(self) -> Result<crate::model::Conversation> {
3285            (*self.0.stub)
3286                .get_conversation(self.0.request, self.0.options)
3287                .await
3288                .map(crate::Response::into_body)
3289        }
3290
3291        /// Sets the value of [name][crate::model::GetConversationRequest::name].
3292        ///
3293        /// This is a **required** field for requests.
3294        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3295            self.0.request.name = v.into();
3296            self
3297        }
3298    }
3299
3300    #[doc(hidden)]
3301    impl crate::RequestBuilder for GetConversation {
3302        fn request_options(&mut self) -> &mut crate::RequestOptions {
3303            &mut self.0.options
3304        }
3305    }
3306
3307    /// The request builder for [ConversationalSearchService::list_conversations][crate::client::ConversationalSearchService::list_conversations] calls.
3308    ///
3309    /// # Example
3310    /// ```
3311    /// # use google_cloud_discoveryengine_v1::builder::conversational_search_service::ListConversations;
3312    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
3313    /// use google_cloud_gax::paginator::ItemPaginator;
3314    ///
3315    /// let builder = prepare_request_builder();
3316    /// let mut items = builder.by_item();
3317    /// while let Some(result) = items.next().await {
3318    ///   let item = result?;
3319    /// }
3320    /// # Ok(()) }
3321    ///
3322    /// fn prepare_request_builder() -> ListConversations {
3323    ///   # panic!();
3324    ///   // ... details omitted ...
3325    /// }
3326    /// ```
3327    #[derive(Clone, Debug)]
3328    pub struct ListConversations(RequestBuilder<crate::model::ListConversationsRequest>);
3329
3330    impl ListConversations {
3331        pub(crate) fn new(
3332            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3333        ) -> Self {
3334            Self(RequestBuilder::new(stub))
3335        }
3336
3337        /// Sets the full request, replacing any prior values.
3338        pub fn with_request<V: Into<crate::model::ListConversationsRequest>>(
3339            mut self,
3340            v: V,
3341        ) -> Self {
3342            self.0.request = v.into();
3343            self
3344        }
3345
3346        /// Sets all the options, replacing any prior values.
3347        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3348            self.0.options = v.into();
3349            self
3350        }
3351
3352        /// Sends the request.
3353        pub async fn send(self) -> Result<crate::model::ListConversationsResponse> {
3354            (*self.0.stub)
3355                .list_conversations(self.0.request, self.0.options)
3356                .await
3357                .map(crate::Response::into_body)
3358        }
3359
3360        /// Streams each page in the collection.
3361        pub fn by_page(
3362            self,
3363        ) -> impl google_cloud_gax::paginator::Paginator<
3364            crate::model::ListConversationsResponse,
3365            crate::Error,
3366        > {
3367            use std::clone::Clone;
3368            let token = self.0.request.page_token.clone();
3369            let execute = move |token: String| {
3370                let mut builder = self.clone();
3371                builder.0.request = builder.0.request.set_page_token(token);
3372                builder.send()
3373            };
3374            google_cloud_gax::paginator::internal::new_paginator(token, execute)
3375        }
3376
3377        /// Streams each item in the collection.
3378        pub fn by_item(
3379            self,
3380        ) -> impl google_cloud_gax::paginator::ItemPaginator<
3381            crate::model::ListConversationsResponse,
3382            crate::Error,
3383        > {
3384            use google_cloud_gax::paginator::Paginator;
3385            self.by_page().items()
3386        }
3387
3388        /// Sets the value of [parent][crate::model::ListConversationsRequest::parent].
3389        ///
3390        /// This is a **required** field for requests.
3391        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
3392            self.0.request.parent = v.into();
3393            self
3394        }
3395
3396        /// Sets the value of [page_size][crate::model::ListConversationsRequest::page_size].
3397        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
3398            self.0.request.page_size = v.into();
3399            self
3400        }
3401
3402        /// Sets the value of [page_token][crate::model::ListConversationsRequest::page_token].
3403        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
3404            self.0.request.page_token = v.into();
3405            self
3406        }
3407
3408        /// Sets the value of [filter][crate::model::ListConversationsRequest::filter].
3409        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
3410            self.0.request.filter = v.into();
3411            self
3412        }
3413
3414        /// Sets the value of [order_by][crate::model::ListConversationsRequest::order_by].
3415        pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
3416            self.0.request.order_by = v.into();
3417            self
3418        }
3419    }
3420
3421    #[doc(hidden)]
3422    impl crate::RequestBuilder for ListConversations {
3423        fn request_options(&mut self) -> &mut crate::RequestOptions {
3424            &mut self.0.options
3425        }
3426    }
3427
3428    /// The request builder for [ConversationalSearchService::answer_query][crate::client::ConversationalSearchService::answer_query] calls.
3429    ///
3430    /// # Example
3431    /// ```
3432    /// # use google_cloud_discoveryengine_v1::builder::conversational_search_service::AnswerQuery;
3433    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
3434    ///
3435    /// let builder = prepare_request_builder();
3436    /// let response = builder.send().await?;
3437    /// # Ok(()) }
3438    ///
3439    /// fn prepare_request_builder() -> AnswerQuery {
3440    ///   # panic!();
3441    ///   // ... details omitted ...
3442    /// }
3443    /// ```
3444    #[derive(Clone, Debug)]
3445    pub struct AnswerQuery(RequestBuilder<crate::model::AnswerQueryRequest>);
3446
3447    impl AnswerQuery {
3448        pub(crate) fn new(
3449            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3450        ) -> Self {
3451            Self(RequestBuilder::new(stub))
3452        }
3453
3454        /// Sets the full request, replacing any prior values.
3455        pub fn with_request<V: Into<crate::model::AnswerQueryRequest>>(mut self, v: V) -> Self {
3456            self.0.request = v.into();
3457            self
3458        }
3459
3460        /// Sets all the options, replacing any prior values.
3461        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3462            self.0.options = v.into();
3463            self
3464        }
3465
3466        /// Sends the request.
3467        pub async fn send(self) -> Result<crate::model::AnswerQueryResponse> {
3468            (*self.0.stub)
3469                .answer_query(self.0.request, self.0.options)
3470                .await
3471                .map(crate::Response::into_body)
3472        }
3473
3474        /// Sets the value of [serving_config][crate::model::AnswerQueryRequest::serving_config].
3475        ///
3476        /// This is a **required** field for requests.
3477        pub fn set_serving_config<T: Into<std::string::String>>(mut self, v: T) -> Self {
3478            self.0.request.serving_config = v.into();
3479            self
3480        }
3481
3482        /// Sets the value of [query][crate::model::AnswerQueryRequest::query].
3483        ///
3484        /// This is a **required** field for requests.
3485        pub fn set_query<T>(mut self, v: T) -> Self
3486        where
3487            T: std::convert::Into<crate::model::Query>,
3488        {
3489            self.0.request.query = std::option::Option::Some(v.into());
3490            self
3491        }
3492
3493        /// Sets or clears the value of [query][crate::model::AnswerQueryRequest::query].
3494        ///
3495        /// This is a **required** field for requests.
3496        pub fn set_or_clear_query<T>(mut self, v: std::option::Option<T>) -> Self
3497        where
3498            T: std::convert::Into<crate::model::Query>,
3499        {
3500            self.0.request.query = v.map(|x| x.into());
3501            self
3502        }
3503
3504        /// Sets the value of [session][crate::model::AnswerQueryRequest::session].
3505        pub fn set_session<T: Into<std::string::String>>(mut self, v: T) -> Self {
3506            self.0.request.session = v.into();
3507            self
3508        }
3509
3510        /// Sets the value of [safety_spec][crate::model::AnswerQueryRequest::safety_spec].
3511        pub fn set_safety_spec<T>(mut self, v: T) -> Self
3512        where
3513            T: std::convert::Into<crate::model::answer_query_request::SafetySpec>,
3514        {
3515            self.0.request.safety_spec = std::option::Option::Some(v.into());
3516            self
3517        }
3518
3519        /// Sets or clears the value of [safety_spec][crate::model::AnswerQueryRequest::safety_spec].
3520        pub fn set_or_clear_safety_spec<T>(mut self, v: std::option::Option<T>) -> Self
3521        where
3522            T: std::convert::Into<crate::model::answer_query_request::SafetySpec>,
3523        {
3524            self.0.request.safety_spec = v.map(|x| x.into());
3525            self
3526        }
3527
3528        /// Sets the value of [related_questions_spec][crate::model::AnswerQueryRequest::related_questions_spec].
3529        pub fn set_related_questions_spec<T>(mut self, v: T) -> Self
3530        where
3531            T: std::convert::Into<crate::model::answer_query_request::RelatedQuestionsSpec>,
3532        {
3533            self.0.request.related_questions_spec = std::option::Option::Some(v.into());
3534            self
3535        }
3536
3537        /// Sets or clears the value of [related_questions_spec][crate::model::AnswerQueryRequest::related_questions_spec].
3538        pub fn set_or_clear_related_questions_spec<T>(mut self, v: std::option::Option<T>) -> Self
3539        where
3540            T: std::convert::Into<crate::model::answer_query_request::RelatedQuestionsSpec>,
3541        {
3542            self.0.request.related_questions_spec = v.map(|x| x.into());
3543            self
3544        }
3545
3546        /// Sets the value of [grounding_spec][crate::model::AnswerQueryRequest::grounding_spec].
3547        pub fn set_grounding_spec<T>(mut self, v: T) -> Self
3548        where
3549            T: std::convert::Into<crate::model::answer_query_request::GroundingSpec>,
3550        {
3551            self.0.request.grounding_spec = std::option::Option::Some(v.into());
3552            self
3553        }
3554
3555        /// Sets or clears the value of [grounding_spec][crate::model::AnswerQueryRequest::grounding_spec].
3556        pub fn set_or_clear_grounding_spec<T>(mut self, v: std::option::Option<T>) -> Self
3557        where
3558            T: std::convert::Into<crate::model::answer_query_request::GroundingSpec>,
3559        {
3560            self.0.request.grounding_spec = v.map(|x| x.into());
3561            self
3562        }
3563
3564        /// Sets the value of [answer_generation_spec][crate::model::AnswerQueryRequest::answer_generation_spec].
3565        pub fn set_answer_generation_spec<T>(mut self, v: T) -> Self
3566        where
3567            T: std::convert::Into<crate::model::answer_query_request::AnswerGenerationSpec>,
3568        {
3569            self.0.request.answer_generation_spec = std::option::Option::Some(v.into());
3570            self
3571        }
3572
3573        /// Sets or clears the value of [answer_generation_spec][crate::model::AnswerQueryRequest::answer_generation_spec].
3574        pub fn set_or_clear_answer_generation_spec<T>(mut self, v: std::option::Option<T>) -> Self
3575        where
3576            T: std::convert::Into<crate::model::answer_query_request::AnswerGenerationSpec>,
3577        {
3578            self.0.request.answer_generation_spec = v.map(|x| x.into());
3579            self
3580        }
3581
3582        /// Sets the value of [search_spec][crate::model::AnswerQueryRequest::search_spec].
3583        pub fn set_search_spec<T>(mut self, v: T) -> Self
3584        where
3585            T: std::convert::Into<crate::model::answer_query_request::SearchSpec>,
3586        {
3587            self.0.request.search_spec = std::option::Option::Some(v.into());
3588            self
3589        }
3590
3591        /// Sets or clears the value of [search_spec][crate::model::AnswerQueryRequest::search_spec].
3592        pub fn set_or_clear_search_spec<T>(mut self, v: std::option::Option<T>) -> Self
3593        where
3594            T: std::convert::Into<crate::model::answer_query_request::SearchSpec>,
3595        {
3596            self.0.request.search_spec = v.map(|x| x.into());
3597            self
3598        }
3599
3600        /// Sets the value of [query_understanding_spec][crate::model::AnswerQueryRequest::query_understanding_spec].
3601        pub fn set_query_understanding_spec<T>(mut self, v: T) -> Self
3602        where
3603            T: std::convert::Into<crate::model::answer_query_request::QueryUnderstandingSpec>,
3604        {
3605            self.0.request.query_understanding_spec = std::option::Option::Some(v.into());
3606            self
3607        }
3608
3609        /// Sets or clears the value of [query_understanding_spec][crate::model::AnswerQueryRequest::query_understanding_spec].
3610        pub fn set_or_clear_query_understanding_spec<T>(mut self, v: std::option::Option<T>) -> Self
3611        where
3612            T: std::convert::Into<crate::model::answer_query_request::QueryUnderstandingSpec>,
3613        {
3614            self.0.request.query_understanding_spec = v.map(|x| x.into());
3615            self
3616        }
3617
3618        /// Sets the value of [asynchronous_mode][crate::model::AnswerQueryRequest::asynchronous_mode].
3619        #[deprecated]
3620        pub fn set_asynchronous_mode<T: Into<bool>>(mut self, v: T) -> Self {
3621            self.0.request.asynchronous_mode = v.into();
3622            self
3623        }
3624
3625        /// Sets the value of [user_pseudo_id][crate::model::AnswerQueryRequest::user_pseudo_id].
3626        pub fn set_user_pseudo_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
3627            self.0.request.user_pseudo_id = v.into();
3628            self
3629        }
3630
3631        /// Sets the value of [user_labels][crate::model::AnswerQueryRequest::user_labels].
3632        pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
3633        where
3634            T: std::iter::IntoIterator<Item = (K, V)>,
3635            K: std::convert::Into<std::string::String>,
3636            V: std::convert::Into<std::string::String>,
3637        {
3638            self.0.request.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
3639            self
3640        }
3641
3642        /// Sets the value of [end_user_spec][crate::model::AnswerQueryRequest::end_user_spec].
3643        pub fn set_end_user_spec<T>(mut self, v: T) -> Self
3644        where
3645            T: std::convert::Into<crate::model::answer_query_request::EndUserSpec>,
3646        {
3647            self.0.request.end_user_spec = std::option::Option::Some(v.into());
3648            self
3649        }
3650
3651        /// Sets or clears the value of [end_user_spec][crate::model::AnswerQueryRequest::end_user_spec].
3652        pub fn set_or_clear_end_user_spec<T>(mut self, v: std::option::Option<T>) -> Self
3653        where
3654            T: std::convert::Into<crate::model::answer_query_request::EndUserSpec>,
3655        {
3656            self.0.request.end_user_spec = v.map(|x| x.into());
3657            self
3658        }
3659    }
3660
3661    #[doc(hidden)]
3662    impl crate::RequestBuilder for AnswerQuery {
3663        fn request_options(&mut self) -> &mut crate::RequestOptions {
3664            &mut self.0.options
3665        }
3666    }
3667
3668    /// The request builder for [ConversationalSearchService::get_answer][crate::client::ConversationalSearchService::get_answer] calls.
3669    ///
3670    /// # Example
3671    /// ```
3672    /// # use google_cloud_discoveryengine_v1::builder::conversational_search_service::GetAnswer;
3673    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
3674    ///
3675    /// let builder = prepare_request_builder();
3676    /// let response = builder.send().await?;
3677    /// # Ok(()) }
3678    ///
3679    /// fn prepare_request_builder() -> GetAnswer {
3680    ///   # panic!();
3681    ///   // ... details omitted ...
3682    /// }
3683    /// ```
3684    #[derive(Clone, Debug)]
3685    pub struct GetAnswer(RequestBuilder<crate::model::GetAnswerRequest>);
3686
3687    impl GetAnswer {
3688        pub(crate) fn new(
3689            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3690        ) -> Self {
3691            Self(RequestBuilder::new(stub))
3692        }
3693
3694        /// Sets the full request, replacing any prior values.
3695        pub fn with_request<V: Into<crate::model::GetAnswerRequest>>(mut self, v: V) -> Self {
3696            self.0.request = v.into();
3697            self
3698        }
3699
3700        /// Sets all the options, replacing any prior values.
3701        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3702            self.0.options = v.into();
3703            self
3704        }
3705
3706        /// Sends the request.
3707        pub async fn send(self) -> Result<crate::model::Answer> {
3708            (*self.0.stub)
3709                .get_answer(self.0.request, self.0.options)
3710                .await
3711                .map(crate::Response::into_body)
3712        }
3713
3714        /// Sets the value of [name][crate::model::GetAnswerRequest::name].
3715        ///
3716        /// This is a **required** field for requests.
3717        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3718            self.0.request.name = v.into();
3719            self
3720        }
3721    }
3722
3723    #[doc(hidden)]
3724    impl crate::RequestBuilder for GetAnswer {
3725        fn request_options(&mut self) -> &mut crate::RequestOptions {
3726            &mut self.0.options
3727        }
3728    }
3729
3730    /// The request builder for [ConversationalSearchService::create_session][crate::client::ConversationalSearchService::create_session] calls.
3731    ///
3732    /// # Example
3733    /// ```
3734    /// # use google_cloud_discoveryengine_v1::builder::conversational_search_service::CreateSession;
3735    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
3736    ///
3737    /// let builder = prepare_request_builder();
3738    /// let response = builder.send().await?;
3739    /// # Ok(()) }
3740    ///
3741    /// fn prepare_request_builder() -> CreateSession {
3742    ///   # panic!();
3743    ///   // ... details omitted ...
3744    /// }
3745    /// ```
3746    #[derive(Clone, Debug)]
3747    pub struct CreateSession(RequestBuilder<crate::model::CreateSessionRequest>);
3748
3749    impl CreateSession {
3750        pub(crate) fn new(
3751            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3752        ) -> Self {
3753            Self(RequestBuilder::new(stub))
3754        }
3755
3756        /// Sets the full request, replacing any prior values.
3757        pub fn with_request<V: Into<crate::model::CreateSessionRequest>>(mut self, v: V) -> Self {
3758            self.0.request = v.into();
3759            self
3760        }
3761
3762        /// Sets all the options, replacing any prior values.
3763        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3764            self.0.options = v.into();
3765            self
3766        }
3767
3768        /// Sends the request.
3769        pub async fn send(self) -> Result<crate::model::Session> {
3770            (*self.0.stub)
3771                .create_session(self.0.request, self.0.options)
3772                .await
3773                .map(crate::Response::into_body)
3774        }
3775
3776        /// Sets the value of [parent][crate::model::CreateSessionRequest::parent].
3777        ///
3778        /// This is a **required** field for requests.
3779        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
3780            self.0.request.parent = v.into();
3781            self
3782        }
3783
3784        /// Sets the value of [session][crate::model::CreateSessionRequest::session].
3785        ///
3786        /// This is a **required** field for requests.
3787        pub fn set_session<T>(mut self, v: T) -> Self
3788        where
3789            T: std::convert::Into<crate::model::Session>,
3790        {
3791            self.0.request.session = std::option::Option::Some(v.into());
3792            self
3793        }
3794
3795        /// Sets or clears the value of [session][crate::model::CreateSessionRequest::session].
3796        ///
3797        /// This is a **required** field for requests.
3798        pub fn set_or_clear_session<T>(mut self, v: std::option::Option<T>) -> Self
3799        where
3800            T: std::convert::Into<crate::model::Session>,
3801        {
3802            self.0.request.session = v.map(|x| x.into());
3803            self
3804        }
3805    }
3806
3807    #[doc(hidden)]
3808    impl crate::RequestBuilder for CreateSession {
3809        fn request_options(&mut self) -> &mut crate::RequestOptions {
3810            &mut self.0.options
3811        }
3812    }
3813
3814    /// The request builder for [ConversationalSearchService::delete_session][crate::client::ConversationalSearchService::delete_session] calls.
3815    ///
3816    /// # Example
3817    /// ```
3818    /// # use google_cloud_discoveryengine_v1::builder::conversational_search_service::DeleteSession;
3819    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
3820    ///
3821    /// let builder = prepare_request_builder();
3822    /// let response = builder.send().await?;
3823    /// # Ok(()) }
3824    ///
3825    /// fn prepare_request_builder() -> DeleteSession {
3826    ///   # panic!();
3827    ///   // ... details omitted ...
3828    /// }
3829    /// ```
3830    #[derive(Clone, Debug)]
3831    pub struct DeleteSession(RequestBuilder<crate::model::DeleteSessionRequest>);
3832
3833    impl DeleteSession {
3834        pub(crate) fn new(
3835            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3836        ) -> Self {
3837            Self(RequestBuilder::new(stub))
3838        }
3839
3840        /// Sets the full request, replacing any prior values.
3841        pub fn with_request<V: Into<crate::model::DeleteSessionRequest>>(mut self, v: V) -> Self {
3842            self.0.request = v.into();
3843            self
3844        }
3845
3846        /// Sets all the options, replacing any prior values.
3847        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3848            self.0.options = v.into();
3849            self
3850        }
3851
3852        /// Sends the request.
3853        pub async fn send(self) -> Result<()> {
3854            (*self.0.stub)
3855                .delete_session(self.0.request, self.0.options)
3856                .await
3857                .map(crate::Response::into_body)
3858        }
3859
3860        /// Sets the value of [name][crate::model::DeleteSessionRequest::name].
3861        ///
3862        /// This is a **required** field for requests.
3863        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3864            self.0.request.name = v.into();
3865            self
3866        }
3867    }
3868
3869    #[doc(hidden)]
3870    impl crate::RequestBuilder for DeleteSession {
3871        fn request_options(&mut self) -> &mut crate::RequestOptions {
3872            &mut self.0.options
3873        }
3874    }
3875
3876    /// The request builder for [ConversationalSearchService::update_session][crate::client::ConversationalSearchService::update_session] calls.
3877    ///
3878    /// # Example
3879    /// ```
3880    /// # use google_cloud_discoveryengine_v1::builder::conversational_search_service::UpdateSession;
3881    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
3882    ///
3883    /// let builder = prepare_request_builder();
3884    /// let response = builder.send().await?;
3885    /// # Ok(()) }
3886    ///
3887    /// fn prepare_request_builder() -> UpdateSession {
3888    ///   # panic!();
3889    ///   // ... details omitted ...
3890    /// }
3891    /// ```
3892    #[derive(Clone, Debug)]
3893    pub struct UpdateSession(RequestBuilder<crate::model::UpdateSessionRequest>);
3894
3895    impl UpdateSession {
3896        pub(crate) fn new(
3897            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3898        ) -> Self {
3899            Self(RequestBuilder::new(stub))
3900        }
3901
3902        /// Sets the full request, replacing any prior values.
3903        pub fn with_request<V: Into<crate::model::UpdateSessionRequest>>(mut self, v: V) -> Self {
3904            self.0.request = v.into();
3905            self
3906        }
3907
3908        /// Sets all the options, replacing any prior values.
3909        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3910            self.0.options = v.into();
3911            self
3912        }
3913
3914        /// Sends the request.
3915        pub async fn send(self) -> Result<crate::model::Session> {
3916            (*self.0.stub)
3917                .update_session(self.0.request, self.0.options)
3918                .await
3919                .map(crate::Response::into_body)
3920        }
3921
3922        /// Sets the value of [session][crate::model::UpdateSessionRequest::session].
3923        ///
3924        /// This is a **required** field for requests.
3925        pub fn set_session<T>(mut self, v: T) -> Self
3926        where
3927            T: std::convert::Into<crate::model::Session>,
3928        {
3929            self.0.request.session = std::option::Option::Some(v.into());
3930            self
3931        }
3932
3933        /// Sets or clears the value of [session][crate::model::UpdateSessionRequest::session].
3934        ///
3935        /// This is a **required** field for requests.
3936        pub fn set_or_clear_session<T>(mut self, v: std::option::Option<T>) -> Self
3937        where
3938            T: std::convert::Into<crate::model::Session>,
3939        {
3940            self.0.request.session = v.map(|x| x.into());
3941            self
3942        }
3943
3944        /// Sets the value of [update_mask][crate::model::UpdateSessionRequest::update_mask].
3945        pub fn set_update_mask<T>(mut self, v: T) -> Self
3946        where
3947            T: std::convert::Into<wkt::FieldMask>,
3948        {
3949            self.0.request.update_mask = std::option::Option::Some(v.into());
3950            self
3951        }
3952
3953        /// Sets or clears the value of [update_mask][crate::model::UpdateSessionRequest::update_mask].
3954        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
3955        where
3956            T: std::convert::Into<wkt::FieldMask>,
3957        {
3958            self.0.request.update_mask = v.map(|x| x.into());
3959            self
3960        }
3961    }
3962
3963    #[doc(hidden)]
3964    impl crate::RequestBuilder for UpdateSession {
3965        fn request_options(&mut self) -> &mut crate::RequestOptions {
3966            &mut self.0.options
3967        }
3968    }
3969
3970    /// The request builder for [ConversationalSearchService::get_session][crate::client::ConversationalSearchService::get_session] calls.
3971    ///
3972    /// # Example
3973    /// ```
3974    /// # use google_cloud_discoveryengine_v1::builder::conversational_search_service::GetSession;
3975    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
3976    ///
3977    /// let builder = prepare_request_builder();
3978    /// let response = builder.send().await?;
3979    /// # Ok(()) }
3980    ///
3981    /// fn prepare_request_builder() -> GetSession {
3982    ///   # panic!();
3983    ///   // ... details omitted ...
3984    /// }
3985    /// ```
3986    #[derive(Clone, Debug)]
3987    pub struct GetSession(RequestBuilder<crate::model::GetSessionRequest>);
3988
3989    impl GetSession {
3990        pub(crate) fn new(
3991            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3992        ) -> Self {
3993            Self(RequestBuilder::new(stub))
3994        }
3995
3996        /// Sets the full request, replacing any prior values.
3997        pub fn with_request<V: Into<crate::model::GetSessionRequest>>(mut self, v: V) -> Self {
3998            self.0.request = v.into();
3999            self
4000        }
4001
4002        /// Sets all the options, replacing any prior values.
4003        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4004            self.0.options = v.into();
4005            self
4006        }
4007
4008        /// Sends the request.
4009        pub async fn send(self) -> Result<crate::model::Session> {
4010            (*self.0.stub)
4011                .get_session(self.0.request, self.0.options)
4012                .await
4013                .map(crate::Response::into_body)
4014        }
4015
4016        /// Sets the value of [name][crate::model::GetSessionRequest::name].
4017        ///
4018        /// This is a **required** field for requests.
4019        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4020            self.0.request.name = v.into();
4021            self
4022        }
4023
4024        /// Sets the value of [include_answer_details][crate::model::GetSessionRequest::include_answer_details].
4025        pub fn set_include_answer_details<T: Into<bool>>(mut self, v: T) -> Self {
4026            self.0.request.include_answer_details = v.into();
4027            self
4028        }
4029    }
4030
4031    #[doc(hidden)]
4032    impl crate::RequestBuilder for GetSession {
4033        fn request_options(&mut self) -> &mut crate::RequestOptions {
4034            &mut self.0.options
4035        }
4036    }
4037
4038    /// The request builder for [ConversationalSearchService::list_sessions][crate::client::ConversationalSearchService::list_sessions] calls.
4039    ///
4040    /// # Example
4041    /// ```
4042    /// # use google_cloud_discoveryengine_v1::builder::conversational_search_service::ListSessions;
4043    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
4044    /// use google_cloud_gax::paginator::ItemPaginator;
4045    ///
4046    /// let builder = prepare_request_builder();
4047    /// let mut items = builder.by_item();
4048    /// while let Some(result) = items.next().await {
4049    ///   let item = result?;
4050    /// }
4051    /// # Ok(()) }
4052    ///
4053    /// fn prepare_request_builder() -> ListSessions {
4054    ///   # panic!();
4055    ///   // ... details omitted ...
4056    /// }
4057    /// ```
4058    #[derive(Clone, Debug)]
4059    pub struct ListSessions(RequestBuilder<crate::model::ListSessionsRequest>);
4060
4061    impl ListSessions {
4062        pub(crate) fn new(
4063            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
4064        ) -> Self {
4065            Self(RequestBuilder::new(stub))
4066        }
4067
4068        /// Sets the full request, replacing any prior values.
4069        pub fn with_request<V: Into<crate::model::ListSessionsRequest>>(mut self, v: V) -> Self {
4070            self.0.request = v.into();
4071            self
4072        }
4073
4074        /// Sets all the options, replacing any prior values.
4075        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4076            self.0.options = v.into();
4077            self
4078        }
4079
4080        /// Sends the request.
4081        pub async fn send(self) -> Result<crate::model::ListSessionsResponse> {
4082            (*self.0.stub)
4083                .list_sessions(self.0.request, self.0.options)
4084                .await
4085                .map(crate::Response::into_body)
4086        }
4087
4088        /// Streams each page in the collection.
4089        pub fn by_page(
4090            self,
4091        ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListSessionsResponse, crate::Error>
4092        {
4093            use std::clone::Clone;
4094            let token = self.0.request.page_token.clone();
4095            let execute = move |token: String| {
4096                let mut builder = self.clone();
4097                builder.0.request = builder.0.request.set_page_token(token);
4098                builder.send()
4099            };
4100            google_cloud_gax::paginator::internal::new_paginator(token, execute)
4101        }
4102
4103        /// Streams each item in the collection.
4104        pub fn by_item(
4105            self,
4106        ) -> impl google_cloud_gax::paginator::ItemPaginator<
4107            crate::model::ListSessionsResponse,
4108            crate::Error,
4109        > {
4110            use google_cloud_gax::paginator::Paginator;
4111            self.by_page().items()
4112        }
4113
4114        /// Sets the value of [parent][crate::model::ListSessionsRequest::parent].
4115        ///
4116        /// This is a **required** field for requests.
4117        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
4118            self.0.request.parent = v.into();
4119            self
4120        }
4121
4122        /// Sets the value of [page_size][crate::model::ListSessionsRequest::page_size].
4123        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
4124            self.0.request.page_size = v.into();
4125            self
4126        }
4127
4128        /// Sets the value of [page_token][crate::model::ListSessionsRequest::page_token].
4129        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
4130            self.0.request.page_token = v.into();
4131            self
4132        }
4133
4134        /// Sets the value of [filter][crate::model::ListSessionsRequest::filter].
4135        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
4136            self.0.request.filter = v.into();
4137            self
4138        }
4139
4140        /// Sets the value of [order_by][crate::model::ListSessionsRequest::order_by].
4141        pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
4142            self.0.request.order_by = v.into();
4143            self
4144        }
4145    }
4146
4147    #[doc(hidden)]
4148    impl crate::RequestBuilder for ListSessions {
4149        fn request_options(&mut self) -> &mut crate::RequestOptions {
4150            &mut self.0.options
4151        }
4152    }
4153
4154    /// The request builder for [ConversationalSearchService::list_operations][crate::client::ConversationalSearchService::list_operations] calls.
4155    ///
4156    /// # Example
4157    /// ```
4158    /// # use google_cloud_discoveryengine_v1::builder::conversational_search_service::ListOperations;
4159    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
4160    /// use google_cloud_gax::paginator::ItemPaginator;
4161    ///
4162    /// let builder = prepare_request_builder();
4163    /// let mut items = builder.by_item();
4164    /// while let Some(result) = items.next().await {
4165    ///   let item = result?;
4166    /// }
4167    /// # Ok(()) }
4168    ///
4169    /// fn prepare_request_builder() -> ListOperations {
4170    ///   # panic!();
4171    ///   // ... details omitted ...
4172    /// }
4173    /// ```
4174    #[derive(Clone, Debug)]
4175    pub struct ListOperations(
4176        RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
4177    );
4178
4179    impl ListOperations {
4180        pub(crate) fn new(
4181            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
4182        ) -> Self {
4183            Self(RequestBuilder::new(stub))
4184        }
4185
4186        /// Sets the full request, replacing any prior values.
4187        pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
4188            mut self,
4189            v: V,
4190        ) -> Self {
4191            self.0.request = v.into();
4192            self
4193        }
4194
4195        /// Sets all the options, replacing any prior values.
4196        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4197            self.0.options = v.into();
4198            self
4199        }
4200
4201        /// Sends the request.
4202        pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
4203            (*self.0.stub)
4204                .list_operations(self.0.request, self.0.options)
4205                .await
4206                .map(crate::Response::into_body)
4207        }
4208
4209        /// Streams each page in the collection.
4210        pub fn by_page(
4211            self,
4212        ) -> impl google_cloud_gax::paginator::Paginator<
4213            google_cloud_longrunning::model::ListOperationsResponse,
4214            crate::Error,
4215        > {
4216            use std::clone::Clone;
4217            let token = self.0.request.page_token.clone();
4218            let execute = move |token: String| {
4219                let mut builder = self.clone();
4220                builder.0.request = builder.0.request.set_page_token(token);
4221                builder.send()
4222            };
4223            google_cloud_gax::paginator::internal::new_paginator(token, execute)
4224        }
4225
4226        /// Streams each item in the collection.
4227        pub fn by_item(
4228            self,
4229        ) -> impl google_cloud_gax::paginator::ItemPaginator<
4230            google_cloud_longrunning::model::ListOperationsResponse,
4231            crate::Error,
4232        > {
4233            use google_cloud_gax::paginator::Paginator;
4234            self.by_page().items()
4235        }
4236
4237        /// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
4238        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4239            self.0.request.name = v.into();
4240            self
4241        }
4242
4243        /// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::filter].
4244        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
4245            self.0.request.filter = v.into();
4246            self
4247        }
4248
4249        /// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
4250        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
4251            self.0.request.page_size = v.into();
4252            self
4253        }
4254
4255        /// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
4256        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
4257            self.0.request.page_token = v.into();
4258            self
4259        }
4260
4261        /// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
4262        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
4263            self.0.request.return_partial_success = v.into();
4264            self
4265        }
4266    }
4267
4268    #[doc(hidden)]
4269    impl crate::RequestBuilder for ListOperations {
4270        fn request_options(&mut self) -> &mut crate::RequestOptions {
4271            &mut self.0.options
4272        }
4273    }
4274
4275    /// The request builder for [ConversationalSearchService::get_operation][crate::client::ConversationalSearchService::get_operation] calls.
4276    ///
4277    /// # Example
4278    /// ```
4279    /// # use google_cloud_discoveryengine_v1::builder::conversational_search_service::GetOperation;
4280    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
4281    ///
4282    /// let builder = prepare_request_builder();
4283    /// let response = builder.send().await?;
4284    /// # Ok(()) }
4285    ///
4286    /// fn prepare_request_builder() -> GetOperation {
4287    ///   # panic!();
4288    ///   // ... details omitted ...
4289    /// }
4290    /// ```
4291    #[derive(Clone, Debug)]
4292    pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
4293
4294    impl GetOperation {
4295        pub(crate) fn new(
4296            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
4297        ) -> Self {
4298            Self(RequestBuilder::new(stub))
4299        }
4300
4301        /// Sets the full request, replacing any prior values.
4302        pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
4303            mut self,
4304            v: V,
4305        ) -> Self {
4306            self.0.request = v.into();
4307            self
4308        }
4309
4310        /// Sets all the options, replacing any prior values.
4311        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4312            self.0.options = v.into();
4313            self
4314        }
4315
4316        /// Sends the request.
4317        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
4318            (*self.0.stub)
4319                .get_operation(self.0.request, self.0.options)
4320                .await
4321                .map(crate::Response::into_body)
4322        }
4323
4324        /// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
4325        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4326            self.0.request.name = v.into();
4327            self
4328        }
4329    }
4330
4331    #[doc(hidden)]
4332    impl crate::RequestBuilder for GetOperation {
4333        fn request_options(&mut self) -> &mut crate::RequestOptions {
4334            &mut self.0.options
4335        }
4336    }
4337
4338    /// The request builder for [ConversationalSearchService::cancel_operation][crate::client::ConversationalSearchService::cancel_operation] calls.
4339    ///
4340    /// # Example
4341    /// ```
4342    /// # use google_cloud_discoveryengine_v1::builder::conversational_search_service::CancelOperation;
4343    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
4344    ///
4345    /// let builder = prepare_request_builder();
4346    /// let response = builder.send().await?;
4347    /// # Ok(()) }
4348    ///
4349    /// fn prepare_request_builder() -> CancelOperation {
4350    ///   # panic!();
4351    ///   // ... details omitted ...
4352    /// }
4353    /// ```
4354    #[derive(Clone, Debug)]
4355    pub struct CancelOperation(
4356        RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
4357    );
4358
4359    impl CancelOperation {
4360        pub(crate) fn new(
4361            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
4362        ) -> Self {
4363            Self(RequestBuilder::new(stub))
4364        }
4365
4366        /// Sets the full request, replacing any prior values.
4367        pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
4368            mut self,
4369            v: V,
4370        ) -> Self {
4371            self.0.request = v.into();
4372            self
4373        }
4374
4375        /// Sets all the options, replacing any prior values.
4376        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4377            self.0.options = v.into();
4378            self
4379        }
4380
4381        /// Sends the request.
4382        pub async fn send(self) -> Result<()> {
4383            (*self.0.stub)
4384                .cancel_operation(self.0.request, self.0.options)
4385                .await
4386                .map(crate::Response::into_body)
4387        }
4388
4389        /// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::name].
4390        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4391            self.0.request.name = v.into();
4392            self
4393        }
4394    }
4395
4396    #[doc(hidden)]
4397    impl crate::RequestBuilder for CancelOperation {
4398        fn request_options(&mut self) -> &mut crate::RequestOptions {
4399            &mut self.0.options
4400        }
4401    }
4402}
4403
4404/// Request and client builders for [DataStoreService][crate::client::DataStoreService].
4405#[cfg(feature = "data-store-service")]
4406#[cfg_attr(docsrs, doc(cfg(feature = "data-store-service")))]
4407pub mod data_store_service {
4408    use crate::Result;
4409
4410    /// A builder for [DataStoreService][crate::client::DataStoreService].
4411    ///
4412    /// ```
4413    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
4414    /// # use google_cloud_discoveryengine_v1::*;
4415    /// # use builder::data_store_service::ClientBuilder;
4416    /// # use client::DataStoreService;
4417    /// let builder : ClientBuilder = DataStoreService::builder();
4418    /// let client = builder
4419    ///     .with_endpoint("https://discoveryengine.googleapis.com")
4420    ///     .build().await?;
4421    /// # Ok(()) }
4422    /// ```
4423    pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
4424
4425    pub(crate) mod client {
4426        use super::super::super::client::DataStoreService;
4427        pub struct Factory;
4428        impl crate::ClientFactory for Factory {
4429            type Client = DataStoreService;
4430            type Credentials = gaxi::options::Credentials;
4431            async fn build(
4432                self,
4433                config: gaxi::options::ClientConfig,
4434            ) -> crate::ClientBuilderResult<Self::Client> {
4435                Self::Client::new(config).await
4436            }
4437        }
4438    }
4439
4440    /// Common implementation for [crate::client::DataStoreService] request builders.
4441    #[derive(Clone, Debug)]
4442    pub(crate) struct RequestBuilder<R: std::default::Default> {
4443        stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
4444        request: R,
4445        options: crate::RequestOptions,
4446    }
4447
4448    impl<R> RequestBuilder<R>
4449    where
4450        R: std::default::Default,
4451    {
4452        pub(crate) fn new(
4453            stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
4454        ) -> Self {
4455            Self {
4456                stub,
4457                request: R::default(),
4458                options: crate::RequestOptions::default(),
4459            }
4460        }
4461    }
4462
4463    /// The request builder for [DataStoreService::create_data_store][crate::client::DataStoreService::create_data_store] calls.
4464    ///
4465    /// # Example
4466    /// ```
4467    /// # use google_cloud_discoveryengine_v1::builder::data_store_service::CreateDataStore;
4468    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
4469    /// use google_cloud_lro::Poller;
4470    ///
4471    /// let builder = prepare_request_builder();
4472    /// let response = builder.poller().until_done().await?;
4473    /// # Ok(()) }
4474    ///
4475    /// fn prepare_request_builder() -> CreateDataStore {
4476    ///   # panic!();
4477    ///   // ... details omitted ...
4478    /// }
4479    /// ```
4480    #[derive(Clone, Debug)]
4481    pub struct CreateDataStore(RequestBuilder<crate::model::CreateDataStoreRequest>);
4482
4483    impl CreateDataStore {
4484        pub(crate) fn new(
4485            stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
4486        ) -> Self {
4487            Self(RequestBuilder::new(stub))
4488        }
4489
4490        /// Sets the full request, replacing any prior values.
4491        pub fn with_request<V: Into<crate::model::CreateDataStoreRequest>>(mut self, v: V) -> Self {
4492            self.0.request = v.into();
4493            self
4494        }
4495
4496        /// Sets all the options, replacing any prior values.
4497        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4498            self.0.options = v.into();
4499            self
4500        }
4501
4502        /// Sends the request.
4503        ///
4504        /// # Long running operations
4505        ///
4506        /// This starts, but does not poll, a longrunning operation. More information
4507        /// on [create_data_store][crate::client::DataStoreService::create_data_store].
4508        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
4509            (*self.0.stub)
4510                .create_data_store(self.0.request, self.0.options)
4511                .await
4512                .map(crate::Response::into_body)
4513        }
4514
4515        /// Creates a [Poller][google_cloud_lro::Poller] to work with `create_data_store`.
4516        pub fn poller(
4517            self,
4518        ) -> impl google_cloud_lro::Poller<crate::model::DataStore, crate::model::CreateDataStoreMetadata>
4519        {
4520            type Operation = google_cloud_lro::internal::Operation<
4521                crate::model::DataStore,
4522                crate::model::CreateDataStoreMetadata,
4523            >;
4524            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
4525            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
4526            let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
4527            if let Some(ref mut details) = poller_options.tracing {
4528                details.method_name = "google_cloud_discoveryengine_v1::client::DataStoreService::create_data_store::until_done";
4529            }
4530
4531            let stub = self.0.stub.clone();
4532            let mut options = self.0.options.clone();
4533            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
4534            let query = move |name| {
4535                let stub = stub.clone();
4536                let options = options.clone();
4537                async {
4538                    let op = GetOperation::new(stub)
4539                        .set_name(name)
4540                        .with_options(options)
4541                        .send()
4542                        .await?;
4543                    Ok(Operation::new(op))
4544                }
4545            };
4546
4547            let start = move || async {
4548                let op = self.send().await?;
4549                Ok(Operation::new(op))
4550            };
4551
4552            use google_cloud_lro::internal::PollerExt;
4553            {
4554                google_cloud_lro::internal::new_poller(
4555                    polling_error_policy,
4556                    polling_backoff_policy,
4557                    start,
4558                    query,
4559                )
4560            }
4561            .with_options(poller_options)
4562        }
4563
4564        /// Sets the value of [parent][crate::model::CreateDataStoreRequest::parent].
4565        ///
4566        /// This is a **required** field for requests.
4567        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
4568            self.0.request.parent = v.into();
4569            self
4570        }
4571
4572        /// Sets the value of [data_store][crate::model::CreateDataStoreRequest::data_store].
4573        ///
4574        /// This is a **required** field for requests.
4575        pub fn set_data_store<T>(mut self, v: T) -> Self
4576        where
4577            T: std::convert::Into<crate::model::DataStore>,
4578        {
4579            self.0.request.data_store = std::option::Option::Some(v.into());
4580            self
4581        }
4582
4583        /// Sets or clears the value of [data_store][crate::model::CreateDataStoreRequest::data_store].
4584        ///
4585        /// This is a **required** field for requests.
4586        pub fn set_or_clear_data_store<T>(mut self, v: std::option::Option<T>) -> Self
4587        where
4588            T: std::convert::Into<crate::model::DataStore>,
4589        {
4590            self.0.request.data_store = v.map(|x| x.into());
4591            self
4592        }
4593
4594        /// Sets the value of [data_store_id][crate::model::CreateDataStoreRequest::data_store_id].
4595        ///
4596        /// This is a **required** field for requests.
4597        pub fn set_data_store_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
4598            self.0.request.data_store_id = v.into();
4599            self
4600        }
4601
4602        /// Sets the value of [create_advanced_site_search][crate::model::CreateDataStoreRequest::create_advanced_site_search].
4603        pub fn set_create_advanced_site_search<T: Into<bool>>(mut self, v: T) -> Self {
4604            self.0.request.create_advanced_site_search = v.into();
4605            self
4606        }
4607
4608        /// Sets the value of [skip_default_schema_creation][crate::model::CreateDataStoreRequest::skip_default_schema_creation].
4609        pub fn set_skip_default_schema_creation<T: Into<bool>>(mut self, v: T) -> Self {
4610            self.0.request.skip_default_schema_creation = v.into();
4611            self
4612        }
4613
4614        /// Sets the value of [cmek_options][crate::model::CreateDataStoreRequest::cmek_options].
4615        ///
4616        /// Note that all the setters affecting `cmek_options` are
4617        /// mutually exclusive.
4618        pub fn set_cmek_options<
4619            T: Into<Option<crate::model::create_data_store_request::CmekOptions>>,
4620        >(
4621            mut self,
4622            v: T,
4623        ) -> Self {
4624            self.0.request.cmek_options = v.into();
4625            self
4626        }
4627
4628        /// Sets the value of [cmek_options][crate::model::CreateDataStoreRequest::cmek_options]
4629        /// to hold a `CmekConfigName`.
4630        ///
4631        /// Note that all the setters affecting `cmek_options` are
4632        /// mutually exclusive.
4633        pub fn set_cmek_config_name<T: std::convert::Into<std::string::String>>(
4634            mut self,
4635            v: T,
4636        ) -> Self {
4637            self.0.request = self.0.request.set_cmek_config_name(v);
4638            self
4639        }
4640
4641        /// Sets the value of [cmek_options][crate::model::CreateDataStoreRequest::cmek_options]
4642        /// to hold a `DisableCmek`.
4643        ///
4644        /// Note that all the setters affecting `cmek_options` are
4645        /// mutually exclusive.
4646        pub fn set_disable_cmek<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4647            self.0.request = self.0.request.set_disable_cmek(v);
4648            self
4649        }
4650    }
4651
4652    #[doc(hidden)]
4653    impl crate::RequestBuilder for CreateDataStore {
4654        fn request_options(&mut self) -> &mut crate::RequestOptions {
4655            &mut self.0.options
4656        }
4657    }
4658
4659    /// The request builder for [DataStoreService::get_data_store][crate::client::DataStoreService::get_data_store] calls.
4660    ///
4661    /// # Example
4662    /// ```
4663    /// # use google_cloud_discoveryengine_v1::builder::data_store_service::GetDataStore;
4664    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
4665    ///
4666    /// let builder = prepare_request_builder();
4667    /// let response = builder.send().await?;
4668    /// # Ok(()) }
4669    ///
4670    /// fn prepare_request_builder() -> GetDataStore {
4671    ///   # panic!();
4672    ///   // ... details omitted ...
4673    /// }
4674    /// ```
4675    #[derive(Clone, Debug)]
4676    pub struct GetDataStore(RequestBuilder<crate::model::GetDataStoreRequest>);
4677
4678    impl GetDataStore {
4679        pub(crate) fn new(
4680            stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
4681        ) -> Self {
4682            Self(RequestBuilder::new(stub))
4683        }
4684
4685        /// Sets the full request, replacing any prior values.
4686        pub fn with_request<V: Into<crate::model::GetDataStoreRequest>>(mut self, v: V) -> Self {
4687            self.0.request = v.into();
4688            self
4689        }
4690
4691        /// Sets all the options, replacing any prior values.
4692        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4693            self.0.options = v.into();
4694            self
4695        }
4696
4697        /// Sends the request.
4698        pub async fn send(self) -> Result<crate::model::DataStore> {
4699            (*self.0.stub)
4700                .get_data_store(self.0.request, self.0.options)
4701                .await
4702                .map(crate::Response::into_body)
4703        }
4704
4705        /// Sets the value of [name][crate::model::GetDataStoreRequest::name].
4706        ///
4707        /// This is a **required** field for requests.
4708        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4709            self.0.request.name = v.into();
4710            self
4711        }
4712    }
4713
4714    #[doc(hidden)]
4715    impl crate::RequestBuilder for GetDataStore {
4716        fn request_options(&mut self) -> &mut crate::RequestOptions {
4717            &mut self.0.options
4718        }
4719    }
4720
4721    /// The request builder for [DataStoreService::list_data_stores][crate::client::DataStoreService::list_data_stores] calls.
4722    ///
4723    /// # Example
4724    /// ```
4725    /// # use google_cloud_discoveryengine_v1::builder::data_store_service::ListDataStores;
4726    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
4727    /// use google_cloud_gax::paginator::ItemPaginator;
4728    ///
4729    /// let builder = prepare_request_builder();
4730    /// let mut items = builder.by_item();
4731    /// while let Some(result) = items.next().await {
4732    ///   let item = result?;
4733    /// }
4734    /// # Ok(()) }
4735    ///
4736    /// fn prepare_request_builder() -> ListDataStores {
4737    ///   # panic!();
4738    ///   // ... details omitted ...
4739    /// }
4740    /// ```
4741    #[derive(Clone, Debug)]
4742    pub struct ListDataStores(RequestBuilder<crate::model::ListDataStoresRequest>);
4743
4744    impl ListDataStores {
4745        pub(crate) fn new(
4746            stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
4747        ) -> Self {
4748            Self(RequestBuilder::new(stub))
4749        }
4750
4751        /// Sets the full request, replacing any prior values.
4752        pub fn with_request<V: Into<crate::model::ListDataStoresRequest>>(mut self, v: V) -> Self {
4753            self.0.request = v.into();
4754            self
4755        }
4756
4757        /// Sets all the options, replacing any prior values.
4758        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4759            self.0.options = v.into();
4760            self
4761        }
4762
4763        /// Sends the request.
4764        pub async fn send(self) -> Result<crate::model::ListDataStoresResponse> {
4765            (*self.0.stub)
4766                .list_data_stores(self.0.request, self.0.options)
4767                .await
4768                .map(crate::Response::into_body)
4769        }
4770
4771        /// Streams each page in the collection.
4772        pub fn by_page(
4773            self,
4774        ) -> impl google_cloud_gax::paginator::Paginator<
4775            crate::model::ListDataStoresResponse,
4776            crate::Error,
4777        > {
4778            use std::clone::Clone;
4779            let token = self.0.request.page_token.clone();
4780            let execute = move |token: String| {
4781                let mut builder = self.clone();
4782                builder.0.request = builder.0.request.set_page_token(token);
4783                builder.send()
4784            };
4785            google_cloud_gax::paginator::internal::new_paginator(token, execute)
4786        }
4787
4788        /// Streams each item in the collection.
4789        pub fn by_item(
4790            self,
4791        ) -> impl google_cloud_gax::paginator::ItemPaginator<
4792            crate::model::ListDataStoresResponse,
4793            crate::Error,
4794        > {
4795            use google_cloud_gax::paginator::Paginator;
4796            self.by_page().items()
4797        }
4798
4799        /// Sets the value of [parent][crate::model::ListDataStoresRequest::parent].
4800        ///
4801        /// This is a **required** field for requests.
4802        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
4803            self.0.request.parent = v.into();
4804            self
4805        }
4806
4807        /// Sets the value of [page_size][crate::model::ListDataStoresRequest::page_size].
4808        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
4809            self.0.request.page_size = v.into();
4810            self
4811        }
4812
4813        /// Sets the value of [page_token][crate::model::ListDataStoresRequest::page_token].
4814        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
4815            self.0.request.page_token = v.into();
4816            self
4817        }
4818
4819        /// Sets the value of [filter][crate::model::ListDataStoresRequest::filter].
4820        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
4821            self.0.request.filter = v.into();
4822            self
4823        }
4824    }
4825
4826    #[doc(hidden)]
4827    impl crate::RequestBuilder for ListDataStores {
4828        fn request_options(&mut self) -> &mut crate::RequestOptions {
4829            &mut self.0.options
4830        }
4831    }
4832
4833    /// The request builder for [DataStoreService::delete_data_store][crate::client::DataStoreService::delete_data_store] calls.
4834    ///
4835    /// # Example
4836    /// ```
4837    /// # use google_cloud_discoveryengine_v1::builder::data_store_service::DeleteDataStore;
4838    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
4839    /// use google_cloud_lro::Poller;
4840    ///
4841    /// let builder = prepare_request_builder();
4842    /// let response = builder.poller().until_done().await?;
4843    /// # Ok(()) }
4844    ///
4845    /// fn prepare_request_builder() -> DeleteDataStore {
4846    ///   # panic!();
4847    ///   // ... details omitted ...
4848    /// }
4849    /// ```
4850    #[derive(Clone, Debug)]
4851    pub struct DeleteDataStore(RequestBuilder<crate::model::DeleteDataStoreRequest>);
4852
4853    impl DeleteDataStore {
4854        pub(crate) fn new(
4855            stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
4856        ) -> Self {
4857            Self(RequestBuilder::new(stub))
4858        }
4859
4860        /// Sets the full request, replacing any prior values.
4861        pub fn with_request<V: Into<crate::model::DeleteDataStoreRequest>>(mut self, v: V) -> Self {
4862            self.0.request = v.into();
4863            self
4864        }
4865
4866        /// Sets all the options, replacing any prior values.
4867        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4868            self.0.options = v.into();
4869            self
4870        }
4871
4872        /// Sends the request.
4873        ///
4874        /// # Long running operations
4875        ///
4876        /// This starts, but does not poll, a longrunning operation. More information
4877        /// on [delete_data_store][crate::client::DataStoreService::delete_data_store].
4878        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
4879            (*self.0.stub)
4880                .delete_data_store(self.0.request, self.0.options)
4881                .await
4882                .map(crate::Response::into_body)
4883        }
4884
4885        /// Creates a [Poller][google_cloud_lro::Poller] to work with `delete_data_store`.
4886        pub fn poller(
4887            self,
4888        ) -> impl google_cloud_lro::Poller<(), crate::model::DeleteDataStoreMetadata> {
4889            type Operation = google_cloud_lro::internal::Operation<
4890                wkt::Empty,
4891                crate::model::DeleteDataStoreMetadata,
4892            >;
4893            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
4894            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
4895            let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
4896            if let Some(ref mut details) = poller_options.tracing {
4897                details.method_name = "google_cloud_discoveryengine_v1::client::DataStoreService::delete_data_store::until_done";
4898            }
4899
4900            let stub = self.0.stub.clone();
4901            let mut options = self.0.options.clone();
4902            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
4903            let query = move |name| {
4904                let stub = stub.clone();
4905                let options = options.clone();
4906                async {
4907                    let op = GetOperation::new(stub)
4908                        .set_name(name)
4909                        .with_options(options)
4910                        .send()
4911                        .await?;
4912                    Ok(Operation::new(op))
4913                }
4914            };
4915
4916            let start = move || async {
4917                let op = self.send().await?;
4918                Ok(Operation::new(op))
4919            };
4920
4921            use google_cloud_lro::internal::PollerExt;
4922            {
4923                google_cloud_lro::internal::new_unit_response_poller(
4924                    polling_error_policy,
4925                    polling_backoff_policy,
4926                    start,
4927                    query,
4928                )
4929            }
4930            .with_options(poller_options)
4931        }
4932
4933        /// Sets the value of [name][crate::model::DeleteDataStoreRequest::name].
4934        ///
4935        /// This is a **required** field for requests.
4936        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4937            self.0.request.name = v.into();
4938            self
4939        }
4940    }
4941
4942    #[doc(hidden)]
4943    impl crate::RequestBuilder for DeleteDataStore {
4944        fn request_options(&mut self) -> &mut crate::RequestOptions {
4945            &mut self.0.options
4946        }
4947    }
4948
4949    /// The request builder for [DataStoreService::update_data_store][crate::client::DataStoreService::update_data_store] calls.
4950    ///
4951    /// # Example
4952    /// ```
4953    /// # use google_cloud_discoveryengine_v1::builder::data_store_service::UpdateDataStore;
4954    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
4955    ///
4956    /// let builder = prepare_request_builder();
4957    /// let response = builder.send().await?;
4958    /// # Ok(()) }
4959    ///
4960    /// fn prepare_request_builder() -> UpdateDataStore {
4961    ///   # panic!();
4962    ///   // ... details omitted ...
4963    /// }
4964    /// ```
4965    #[derive(Clone, Debug)]
4966    pub struct UpdateDataStore(RequestBuilder<crate::model::UpdateDataStoreRequest>);
4967
4968    impl UpdateDataStore {
4969        pub(crate) fn new(
4970            stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
4971        ) -> Self {
4972            Self(RequestBuilder::new(stub))
4973        }
4974
4975        /// Sets the full request, replacing any prior values.
4976        pub fn with_request<V: Into<crate::model::UpdateDataStoreRequest>>(mut self, v: V) -> Self {
4977            self.0.request = v.into();
4978            self
4979        }
4980
4981        /// Sets all the options, replacing any prior values.
4982        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4983            self.0.options = v.into();
4984            self
4985        }
4986
4987        /// Sends the request.
4988        pub async fn send(self) -> Result<crate::model::DataStore> {
4989            (*self.0.stub)
4990                .update_data_store(self.0.request, self.0.options)
4991                .await
4992                .map(crate::Response::into_body)
4993        }
4994
4995        /// Sets the value of [data_store][crate::model::UpdateDataStoreRequest::data_store].
4996        ///
4997        /// This is a **required** field for requests.
4998        pub fn set_data_store<T>(mut self, v: T) -> Self
4999        where
5000            T: std::convert::Into<crate::model::DataStore>,
5001        {
5002            self.0.request.data_store = std::option::Option::Some(v.into());
5003            self
5004        }
5005
5006        /// Sets or clears the value of [data_store][crate::model::UpdateDataStoreRequest::data_store].
5007        ///
5008        /// This is a **required** field for requests.
5009        pub fn set_or_clear_data_store<T>(mut self, v: std::option::Option<T>) -> Self
5010        where
5011            T: std::convert::Into<crate::model::DataStore>,
5012        {
5013            self.0.request.data_store = v.map(|x| x.into());
5014            self
5015        }
5016
5017        /// Sets the value of [update_mask][crate::model::UpdateDataStoreRequest::update_mask].
5018        pub fn set_update_mask<T>(mut self, v: T) -> Self
5019        where
5020            T: std::convert::Into<wkt::FieldMask>,
5021        {
5022            self.0.request.update_mask = std::option::Option::Some(v.into());
5023            self
5024        }
5025
5026        /// Sets or clears the value of [update_mask][crate::model::UpdateDataStoreRequest::update_mask].
5027        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
5028        where
5029            T: std::convert::Into<wkt::FieldMask>,
5030        {
5031            self.0.request.update_mask = v.map(|x| x.into());
5032            self
5033        }
5034    }
5035
5036    #[doc(hidden)]
5037    impl crate::RequestBuilder for UpdateDataStore {
5038        fn request_options(&mut self) -> &mut crate::RequestOptions {
5039            &mut self.0.options
5040        }
5041    }
5042
5043    /// The request builder for [DataStoreService::list_operations][crate::client::DataStoreService::list_operations] calls.
5044    ///
5045    /// # Example
5046    /// ```
5047    /// # use google_cloud_discoveryengine_v1::builder::data_store_service::ListOperations;
5048    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
5049    /// use google_cloud_gax::paginator::ItemPaginator;
5050    ///
5051    /// let builder = prepare_request_builder();
5052    /// let mut items = builder.by_item();
5053    /// while let Some(result) = items.next().await {
5054    ///   let item = result?;
5055    /// }
5056    /// # Ok(()) }
5057    ///
5058    /// fn prepare_request_builder() -> ListOperations {
5059    ///   # panic!();
5060    ///   // ... details omitted ...
5061    /// }
5062    /// ```
5063    #[derive(Clone, Debug)]
5064    pub struct ListOperations(
5065        RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
5066    );
5067
5068    impl ListOperations {
5069        pub(crate) fn new(
5070            stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
5071        ) -> Self {
5072            Self(RequestBuilder::new(stub))
5073        }
5074
5075        /// Sets the full request, replacing any prior values.
5076        pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
5077            mut self,
5078            v: V,
5079        ) -> Self {
5080            self.0.request = v.into();
5081            self
5082        }
5083
5084        /// Sets all the options, replacing any prior values.
5085        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5086            self.0.options = v.into();
5087            self
5088        }
5089
5090        /// Sends the request.
5091        pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
5092            (*self.0.stub)
5093                .list_operations(self.0.request, self.0.options)
5094                .await
5095                .map(crate::Response::into_body)
5096        }
5097
5098        /// Streams each page in the collection.
5099        pub fn by_page(
5100            self,
5101        ) -> impl google_cloud_gax::paginator::Paginator<
5102            google_cloud_longrunning::model::ListOperationsResponse,
5103            crate::Error,
5104        > {
5105            use std::clone::Clone;
5106            let token = self.0.request.page_token.clone();
5107            let execute = move |token: String| {
5108                let mut builder = self.clone();
5109                builder.0.request = builder.0.request.set_page_token(token);
5110                builder.send()
5111            };
5112            google_cloud_gax::paginator::internal::new_paginator(token, execute)
5113        }
5114
5115        /// Streams each item in the collection.
5116        pub fn by_item(
5117            self,
5118        ) -> impl google_cloud_gax::paginator::ItemPaginator<
5119            google_cloud_longrunning::model::ListOperationsResponse,
5120            crate::Error,
5121        > {
5122            use google_cloud_gax::paginator::Paginator;
5123            self.by_page().items()
5124        }
5125
5126        /// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
5127        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5128            self.0.request.name = v.into();
5129            self
5130        }
5131
5132        /// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::filter].
5133        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
5134            self.0.request.filter = v.into();
5135            self
5136        }
5137
5138        /// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
5139        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
5140            self.0.request.page_size = v.into();
5141            self
5142        }
5143
5144        /// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
5145        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
5146            self.0.request.page_token = v.into();
5147            self
5148        }
5149
5150        /// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
5151        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
5152            self.0.request.return_partial_success = v.into();
5153            self
5154        }
5155    }
5156
5157    #[doc(hidden)]
5158    impl crate::RequestBuilder for ListOperations {
5159        fn request_options(&mut self) -> &mut crate::RequestOptions {
5160            &mut self.0.options
5161        }
5162    }
5163
5164    /// The request builder for [DataStoreService::get_operation][crate::client::DataStoreService::get_operation] calls.
5165    ///
5166    /// # Example
5167    /// ```
5168    /// # use google_cloud_discoveryengine_v1::builder::data_store_service::GetOperation;
5169    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
5170    ///
5171    /// let builder = prepare_request_builder();
5172    /// let response = builder.send().await?;
5173    /// # Ok(()) }
5174    ///
5175    /// fn prepare_request_builder() -> GetOperation {
5176    ///   # panic!();
5177    ///   // ... details omitted ...
5178    /// }
5179    /// ```
5180    #[derive(Clone, Debug)]
5181    pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
5182
5183    impl GetOperation {
5184        pub(crate) fn new(
5185            stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
5186        ) -> Self {
5187            Self(RequestBuilder::new(stub))
5188        }
5189
5190        /// Sets the full request, replacing any prior values.
5191        pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
5192            mut self,
5193            v: V,
5194        ) -> Self {
5195            self.0.request = v.into();
5196            self
5197        }
5198
5199        /// Sets all the options, replacing any prior values.
5200        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5201            self.0.options = v.into();
5202            self
5203        }
5204
5205        /// Sends the request.
5206        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
5207            (*self.0.stub)
5208                .get_operation(self.0.request, self.0.options)
5209                .await
5210                .map(crate::Response::into_body)
5211        }
5212
5213        /// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
5214        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5215            self.0.request.name = v.into();
5216            self
5217        }
5218    }
5219
5220    #[doc(hidden)]
5221    impl crate::RequestBuilder for GetOperation {
5222        fn request_options(&mut self) -> &mut crate::RequestOptions {
5223            &mut self.0.options
5224        }
5225    }
5226
5227    /// The request builder for [DataStoreService::cancel_operation][crate::client::DataStoreService::cancel_operation] calls.
5228    ///
5229    /// # Example
5230    /// ```
5231    /// # use google_cloud_discoveryengine_v1::builder::data_store_service::CancelOperation;
5232    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
5233    ///
5234    /// let builder = prepare_request_builder();
5235    /// let response = builder.send().await?;
5236    /// # Ok(()) }
5237    ///
5238    /// fn prepare_request_builder() -> CancelOperation {
5239    ///   # panic!();
5240    ///   // ... details omitted ...
5241    /// }
5242    /// ```
5243    #[derive(Clone, Debug)]
5244    pub struct CancelOperation(
5245        RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
5246    );
5247
5248    impl CancelOperation {
5249        pub(crate) fn new(
5250            stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
5251        ) -> Self {
5252            Self(RequestBuilder::new(stub))
5253        }
5254
5255        /// Sets the full request, replacing any prior values.
5256        pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
5257            mut self,
5258            v: V,
5259        ) -> Self {
5260            self.0.request = v.into();
5261            self
5262        }
5263
5264        /// Sets all the options, replacing any prior values.
5265        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5266            self.0.options = v.into();
5267            self
5268        }
5269
5270        /// Sends the request.
5271        pub async fn send(self) -> Result<()> {
5272            (*self.0.stub)
5273                .cancel_operation(self.0.request, self.0.options)
5274                .await
5275                .map(crate::Response::into_body)
5276        }
5277
5278        /// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::name].
5279        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5280            self.0.request.name = v.into();
5281            self
5282        }
5283    }
5284
5285    #[doc(hidden)]
5286    impl crate::RequestBuilder for CancelOperation {
5287        fn request_options(&mut self) -> &mut crate::RequestOptions {
5288            &mut self.0.options
5289        }
5290    }
5291}
5292
5293/// Request and client builders for [DocumentService][crate::client::DocumentService].
5294#[cfg(feature = "document-service")]
5295#[cfg_attr(docsrs, doc(cfg(feature = "document-service")))]
5296pub mod document_service {
5297    use crate::Result;
5298
5299    /// A builder for [DocumentService][crate::client::DocumentService].
5300    ///
5301    /// ```
5302    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
5303    /// # use google_cloud_discoveryengine_v1::*;
5304    /// # use builder::document_service::ClientBuilder;
5305    /// # use client::DocumentService;
5306    /// let builder : ClientBuilder = DocumentService::builder();
5307    /// let client = builder
5308    ///     .with_endpoint("https://discoveryengine.googleapis.com")
5309    ///     .build().await?;
5310    /// # Ok(()) }
5311    /// ```
5312    pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
5313
5314    pub(crate) mod client {
5315        use super::super::super::client::DocumentService;
5316        pub struct Factory;
5317        impl crate::ClientFactory for Factory {
5318            type Client = DocumentService;
5319            type Credentials = gaxi::options::Credentials;
5320            async fn build(
5321                self,
5322                config: gaxi::options::ClientConfig,
5323            ) -> crate::ClientBuilderResult<Self::Client> {
5324                Self::Client::new(config).await
5325            }
5326        }
5327    }
5328
5329    /// Common implementation for [crate::client::DocumentService] request builders.
5330    #[derive(Clone, Debug)]
5331    pub(crate) struct RequestBuilder<R: std::default::Default> {
5332        stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
5333        request: R,
5334        options: crate::RequestOptions,
5335    }
5336
5337    impl<R> RequestBuilder<R>
5338    where
5339        R: std::default::Default,
5340    {
5341        pub(crate) fn new(
5342            stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
5343        ) -> Self {
5344            Self {
5345                stub,
5346                request: R::default(),
5347                options: crate::RequestOptions::default(),
5348            }
5349        }
5350    }
5351
5352    /// The request builder for [DocumentService::get_document][crate::client::DocumentService::get_document] calls.
5353    ///
5354    /// # Example
5355    /// ```
5356    /// # use google_cloud_discoveryengine_v1::builder::document_service::GetDocument;
5357    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
5358    ///
5359    /// let builder = prepare_request_builder();
5360    /// let response = builder.send().await?;
5361    /// # Ok(()) }
5362    ///
5363    /// fn prepare_request_builder() -> GetDocument {
5364    ///   # panic!();
5365    ///   // ... details omitted ...
5366    /// }
5367    /// ```
5368    #[derive(Clone, Debug)]
5369    pub struct GetDocument(RequestBuilder<crate::model::GetDocumentRequest>);
5370
5371    impl GetDocument {
5372        pub(crate) fn new(
5373            stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
5374        ) -> Self {
5375            Self(RequestBuilder::new(stub))
5376        }
5377
5378        /// Sets the full request, replacing any prior values.
5379        pub fn with_request<V: Into<crate::model::GetDocumentRequest>>(mut self, v: V) -> Self {
5380            self.0.request = v.into();
5381            self
5382        }
5383
5384        /// Sets all the options, replacing any prior values.
5385        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5386            self.0.options = v.into();
5387            self
5388        }
5389
5390        /// Sends the request.
5391        pub async fn send(self) -> Result<crate::model::Document> {
5392            (*self.0.stub)
5393                .get_document(self.0.request, self.0.options)
5394                .await
5395                .map(crate::Response::into_body)
5396        }
5397
5398        /// Sets the value of [name][crate::model::GetDocumentRequest::name].
5399        ///
5400        /// This is a **required** field for requests.
5401        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5402            self.0.request.name = v.into();
5403            self
5404        }
5405    }
5406
5407    #[doc(hidden)]
5408    impl crate::RequestBuilder for GetDocument {
5409        fn request_options(&mut self) -> &mut crate::RequestOptions {
5410            &mut self.0.options
5411        }
5412    }
5413
5414    /// The request builder for [DocumentService::list_documents][crate::client::DocumentService::list_documents] calls.
5415    ///
5416    /// # Example
5417    /// ```
5418    /// # use google_cloud_discoveryengine_v1::builder::document_service::ListDocuments;
5419    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
5420    /// use google_cloud_gax::paginator::ItemPaginator;
5421    ///
5422    /// let builder = prepare_request_builder();
5423    /// let mut items = builder.by_item();
5424    /// while let Some(result) = items.next().await {
5425    ///   let item = result?;
5426    /// }
5427    /// # Ok(()) }
5428    ///
5429    /// fn prepare_request_builder() -> ListDocuments {
5430    ///   # panic!();
5431    ///   // ... details omitted ...
5432    /// }
5433    /// ```
5434    #[derive(Clone, Debug)]
5435    pub struct ListDocuments(RequestBuilder<crate::model::ListDocumentsRequest>);
5436
5437    impl ListDocuments {
5438        pub(crate) fn new(
5439            stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
5440        ) -> Self {
5441            Self(RequestBuilder::new(stub))
5442        }
5443
5444        /// Sets the full request, replacing any prior values.
5445        pub fn with_request<V: Into<crate::model::ListDocumentsRequest>>(mut self, v: V) -> Self {
5446            self.0.request = v.into();
5447            self
5448        }
5449
5450        /// Sets all the options, replacing any prior values.
5451        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5452            self.0.options = v.into();
5453            self
5454        }
5455
5456        /// Sends the request.
5457        pub async fn send(self) -> Result<crate::model::ListDocumentsResponse> {
5458            (*self.0.stub)
5459                .list_documents(self.0.request, self.0.options)
5460                .await
5461                .map(crate::Response::into_body)
5462        }
5463
5464        /// Streams each page in the collection.
5465        pub fn by_page(
5466            self,
5467        ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListDocumentsResponse, crate::Error>
5468        {
5469            use std::clone::Clone;
5470            let token = self.0.request.page_token.clone();
5471            let execute = move |token: String| {
5472                let mut builder = self.clone();
5473                builder.0.request = builder.0.request.set_page_token(token);
5474                builder.send()
5475            };
5476            google_cloud_gax::paginator::internal::new_paginator(token, execute)
5477        }
5478
5479        /// Streams each item in the collection.
5480        pub fn by_item(
5481            self,
5482        ) -> impl google_cloud_gax::paginator::ItemPaginator<
5483            crate::model::ListDocumentsResponse,
5484            crate::Error,
5485        > {
5486            use google_cloud_gax::paginator::Paginator;
5487            self.by_page().items()
5488        }
5489
5490        /// Sets the value of [parent][crate::model::ListDocumentsRequest::parent].
5491        ///
5492        /// This is a **required** field for requests.
5493        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
5494            self.0.request.parent = v.into();
5495            self
5496        }
5497
5498        /// Sets the value of [page_size][crate::model::ListDocumentsRequest::page_size].
5499        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
5500            self.0.request.page_size = v.into();
5501            self
5502        }
5503
5504        /// Sets the value of [page_token][crate::model::ListDocumentsRequest::page_token].
5505        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
5506            self.0.request.page_token = v.into();
5507            self
5508        }
5509    }
5510
5511    #[doc(hidden)]
5512    impl crate::RequestBuilder for ListDocuments {
5513        fn request_options(&mut self) -> &mut crate::RequestOptions {
5514            &mut self.0.options
5515        }
5516    }
5517
5518    /// The request builder for [DocumentService::create_document][crate::client::DocumentService::create_document] calls.
5519    ///
5520    /// # Example
5521    /// ```
5522    /// # use google_cloud_discoveryengine_v1::builder::document_service::CreateDocument;
5523    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
5524    ///
5525    /// let builder = prepare_request_builder();
5526    /// let response = builder.send().await?;
5527    /// # Ok(()) }
5528    ///
5529    /// fn prepare_request_builder() -> CreateDocument {
5530    ///   # panic!();
5531    ///   // ... details omitted ...
5532    /// }
5533    /// ```
5534    #[derive(Clone, Debug)]
5535    pub struct CreateDocument(RequestBuilder<crate::model::CreateDocumentRequest>);
5536
5537    impl CreateDocument {
5538        pub(crate) fn new(
5539            stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
5540        ) -> Self {
5541            Self(RequestBuilder::new(stub))
5542        }
5543
5544        /// Sets the full request, replacing any prior values.
5545        pub fn with_request<V: Into<crate::model::CreateDocumentRequest>>(mut self, v: V) -> Self {
5546            self.0.request = v.into();
5547            self
5548        }
5549
5550        /// Sets all the options, replacing any prior values.
5551        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5552            self.0.options = v.into();
5553            self
5554        }
5555
5556        /// Sends the request.
5557        pub async fn send(self) -> Result<crate::model::Document> {
5558            (*self.0.stub)
5559                .create_document(self.0.request, self.0.options)
5560                .await
5561                .map(crate::Response::into_body)
5562        }
5563
5564        /// Sets the value of [parent][crate::model::CreateDocumentRequest::parent].
5565        ///
5566        /// This is a **required** field for requests.
5567        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
5568            self.0.request.parent = v.into();
5569            self
5570        }
5571
5572        /// Sets the value of [document][crate::model::CreateDocumentRequest::document].
5573        ///
5574        /// This is a **required** field for requests.
5575        pub fn set_document<T>(mut self, v: T) -> Self
5576        where
5577            T: std::convert::Into<crate::model::Document>,
5578        {
5579            self.0.request.document = std::option::Option::Some(v.into());
5580            self
5581        }
5582
5583        /// Sets or clears the value of [document][crate::model::CreateDocumentRequest::document].
5584        ///
5585        /// This is a **required** field for requests.
5586        pub fn set_or_clear_document<T>(mut self, v: std::option::Option<T>) -> Self
5587        where
5588            T: std::convert::Into<crate::model::Document>,
5589        {
5590            self.0.request.document = v.map(|x| x.into());
5591            self
5592        }
5593
5594        /// Sets the value of [document_id][crate::model::CreateDocumentRequest::document_id].
5595        ///
5596        /// This is a **required** field for requests.
5597        pub fn set_document_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
5598            self.0.request.document_id = v.into();
5599            self
5600        }
5601    }
5602
5603    #[doc(hidden)]
5604    impl crate::RequestBuilder for CreateDocument {
5605        fn request_options(&mut self) -> &mut crate::RequestOptions {
5606            &mut self.0.options
5607        }
5608    }
5609
5610    /// The request builder for [DocumentService::update_document][crate::client::DocumentService::update_document] calls.
5611    ///
5612    /// # Example
5613    /// ```
5614    /// # use google_cloud_discoveryengine_v1::builder::document_service::UpdateDocument;
5615    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
5616    ///
5617    /// let builder = prepare_request_builder();
5618    /// let response = builder.send().await?;
5619    /// # Ok(()) }
5620    ///
5621    /// fn prepare_request_builder() -> UpdateDocument {
5622    ///   # panic!();
5623    ///   // ... details omitted ...
5624    /// }
5625    /// ```
5626    #[derive(Clone, Debug)]
5627    pub struct UpdateDocument(RequestBuilder<crate::model::UpdateDocumentRequest>);
5628
5629    impl UpdateDocument {
5630        pub(crate) fn new(
5631            stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
5632        ) -> Self {
5633            Self(RequestBuilder::new(stub))
5634        }
5635
5636        /// Sets the full request, replacing any prior values.
5637        pub fn with_request<V: Into<crate::model::UpdateDocumentRequest>>(mut self, v: V) -> Self {
5638            self.0.request = v.into();
5639            self
5640        }
5641
5642        /// Sets all the options, replacing any prior values.
5643        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5644            self.0.options = v.into();
5645            self
5646        }
5647
5648        /// Sends the request.
5649        pub async fn send(self) -> Result<crate::model::Document> {
5650            (*self.0.stub)
5651                .update_document(self.0.request, self.0.options)
5652                .await
5653                .map(crate::Response::into_body)
5654        }
5655
5656        /// Sets the value of [document][crate::model::UpdateDocumentRequest::document].
5657        ///
5658        /// This is a **required** field for requests.
5659        pub fn set_document<T>(mut self, v: T) -> Self
5660        where
5661            T: std::convert::Into<crate::model::Document>,
5662        {
5663            self.0.request.document = std::option::Option::Some(v.into());
5664            self
5665        }
5666
5667        /// Sets or clears the value of [document][crate::model::UpdateDocumentRequest::document].
5668        ///
5669        /// This is a **required** field for requests.
5670        pub fn set_or_clear_document<T>(mut self, v: std::option::Option<T>) -> Self
5671        where
5672            T: std::convert::Into<crate::model::Document>,
5673        {
5674            self.0.request.document = v.map(|x| x.into());
5675            self
5676        }
5677
5678        /// Sets the value of [allow_missing][crate::model::UpdateDocumentRequest::allow_missing].
5679        pub fn set_allow_missing<T: Into<bool>>(mut self, v: T) -> Self {
5680            self.0.request.allow_missing = v.into();
5681            self
5682        }
5683
5684        /// Sets the value of [update_mask][crate::model::UpdateDocumentRequest::update_mask].
5685        pub fn set_update_mask<T>(mut self, v: T) -> Self
5686        where
5687            T: std::convert::Into<wkt::FieldMask>,
5688        {
5689            self.0.request.update_mask = std::option::Option::Some(v.into());
5690            self
5691        }
5692
5693        /// Sets or clears the value of [update_mask][crate::model::UpdateDocumentRequest::update_mask].
5694        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
5695        where
5696            T: std::convert::Into<wkt::FieldMask>,
5697        {
5698            self.0.request.update_mask = v.map(|x| x.into());
5699            self
5700        }
5701    }
5702
5703    #[doc(hidden)]
5704    impl crate::RequestBuilder for UpdateDocument {
5705        fn request_options(&mut self) -> &mut crate::RequestOptions {
5706            &mut self.0.options
5707        }
5708    }
5709
5710    /// The request builder for [DocumentService::delete_document][crate::client::DocumentService::delete_document] calls.
5711    ///
5712    /// # Example
5713    /// ```
5714    /// # use google_cloud_discoveryengine_v1::builder::document_service::DeleteDocument;
5715    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
5716    ///
5717    /// let builder = prepare_request_builder();
5718    /// let response = builder.send().await?;
5719    /// # Ok(()) }
5720    ///
5721    /// fn prepare_request_builder() -> DeleteDocument {
5722    ///   # panic!();
5723    ///   // ... details omitted ...
5724    /// }
5725    /// ```
5726    #[derive(Clone, Debug)]
5727    pub struct DeleteDocument(RequestBuilder<crate::model::DeleteDocumentRequest>);
5728
5729    impl DeleteDocument {
5730        pub(crate) fn new(
5731            stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
5732        ) -> Self {
5733            Self(RequestBuilder::new(stub))
5734        }
5735
5736        /// Sets the full request, replacing any prior values.
5737        pub fn with_request<V: Into<crate::model::DeleteDocumentRequest>>(mut self, v: V) -> Self {
5738            self.0.request = v.into();
5739            self
5740        }
5741
5742        /// Sets all the options, replacing any prior values.
5743        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5744            self.0.options = v.into();
5745            self
5746        }
5747
5748        /// Sends the request.
5749        pub async fn send(self) -> Result<()> {
5750            (*self.0.stub)
5751                .delete_document(self.0.request, self.0.options)
5752                .await
5753                .map(crate::Response::into_body)
5754        }
5755
5756        /// Sets the value of [name][crate::model::DeleteDocumentRequest::name].
5757        ///
5758        /// This is a **required** field for requests.
5759        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5760            self.0.request.name = v.into();
5761            self
5762        }
5763    }
5764
5765    #[doc(hidden)]
5766    impl crate::RequestBuilder for DeleteDocument {
5767        fn request_options(&mut self) -> &mut crate::RequestOptions {
5768            &mut self.0.options
5769        }
5770    }
5771
5772    /// The request builder for [DocumentService::import_documents][crate::client::DocumentService::import_documents] calls.
5773    ///
5774    /// # Example
5775    /// ```
5776    /// # use google_cloud_discoveryengine_v1::builder::document_service::ImportDocuments;
5777    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
5778    /// use google_cloud_lro::Poller;
5779    ///
5780    /// let builder = prepare_request_builder();
5781    /// let response = builder.poller().until_done().await?;
5782    /// # Ok(()) }
5783    ///
5784    /// fn prepare_request_builder() -> ImportDocuments {
5785    ///   # panic!();
5786    ///   // ... details omitted ...
5787    /// }
5788    /// ```
5789    #[derive(Clone, Debug)]
5790    pub struct ImportDocuments(RequestBuilder<crate::model::ImportDocumentsRequest>);
5791
5792    impl ImportDocuments {
5793        pub(crate) fn new(
5794            stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
5795        ) -> Self {
5796            Self(RequestBuilder::new(stub))
5797        }
5798
5799        /// Sets the full request, replacing any prior values.
5800        pub fn with_request<V: Into<crate::model::ImportDocumentsRequest>>(mut self, v: V) -> Self {
5801            self.0.request = v.into();
5802            self
5803        }
5804
5805        /// Sets all the options, replacing any prior values.
5806        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5807            self.0.options = v.into();
5808            self
5809        }
5810
5811        /// Sends the request.
5812        ///
5813        /// # Long running operations
5814        ///
5815        /// This starts, but does not poll, a longrunning operation. More information
5816        /// on [import_documents][crate::client::DocumentService::import_documents].
5817        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
5818            (*self.0.stub)
5819                .import_documents(self.0.request, self.0.options)
5820                .await
5821                .map(crate::Response::into_body)
5822        }
5823
5824        /// Creates a [Poller][google_cloud_lro::Poller] to work with `import_documents`.
5825        pub fn poller(
5826            self,
5827        ) -> impl google_cloud_lro::Poller<
5828            crate::model::ImportDocumentsResponse,
5829            crate::model::ImportDocumentsMetadata,
5830        > {
5831            type Operation = google_cloud_lro::internal::Operation<
5832                crate::model::ImportDocumentsResponse,
5833                crate::model::ImportDocumentsMetadata,
5834            >;
5835            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
5836            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
5837            let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
5838            if let Some(ref mut details) = poller_options.tracing {
5839                details.method_name = "google_cloud_discoveryengine_v1::client::DocumentService::import_documents::until_done";
5840            }
5841
5842            let stub = self.0.stub.clone();
5843            let mut options = self.0.options.clone();
5844            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
5845            let query = move |name| {
5846                let stub = stub.clone();
5847                let options = options.clone();
5848                async {
5849                    let op = GetOperation::new(stub)
5850                        .set_name(name)
5851                        .with_options(options)
5852                        .send()
5853                        .await?;
5854                    Ok(Operation::new(op))
5855                }
5856            };
5857
5858            let start = move || async {
5859                let op = self.send().await?;
5860                Ok(Operation::new(op))
5861            };
5862
5863            use google_cloud_lro::internal::PollerExt;
5864            {
5865                google_cloud_lro::internal::new_poller(
5866                    polling_error_policy,
5867                    polling_backoff_policy,
5868                    start,
5869                    query,
5870                )
5871            }
5872            .with_options(poller_options)
5873        }
5874
5875        /// Sets the value of [parent][crate::model::ImportDocumentsRequest::parent].
5876        ///
5877        /// This is a **required** field for requests.
5878        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
5879            self.0.request.parent = v.into();
5880            self
5881        }
5882
5883        /// Sets the value of [error_config][crate::model::ImportDocumentsRequest::error_config].
5884        pub fn set_error_config<T>(mut self, v: T) -> Self
5885        where
5886            T: std::convert::Into<crate::model::ImportErrorConfig>,
5887        {
5888            self.0.request.error_config = std::option::Option::Some(v.into());
5889            self
5890        }
5891
5892        /// Sets or clears the value of [error_config][crate::model::ImportDocumentsRequest::error_config].
5893        pub fn set_or_clear_error_config<T>(mut self, v: std::option::Option<T>) -> Self
5894        where
5895            T: std::convert::Into<crate::model::ImportErrorConfig>,
5896        {
5897            self.0.request.error_config = v.map(|x| x.into());
5898            self
5899        }
5900
5901        /// Sets the value of [reconciliation_mode][crate::model::ImportDocumentsRequest::reconciliation_mode].
5902        pub fn set_reconciliation_mode<
5903            T: Into<crate::model::import_documents_request::ReconciliationMode>,
5904        >(
5905            mut self,
5906            v: T,
5907        ) -> Self {
5908            self.0.request.reconciliation_mode = v.into();
5909            self
5910        }
5911
5912        /// Sets the value of [update_mask][crate::model::ImportDocumentsRequest::update_mask].
5913        pub fn set_update_mask<T>(mut self, v: T) -> Self
5914        where
5915            T: std::convert::Into<wkt::FieldMask>,
5916        {
5917            self.0.request.update_mask = std::option::Option::Some(v.into());
5918            self
5919        }
5920
5921        /// Sets or clears the value of [update_mask][crate::model::ImportDocumentsRequest::update_mask].
5922        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
5923        where
5924            T: std::convert::Into<wkt::FieldMask>,
5925        {
5926            self.0.request.update_mask = v.map(|x| x.into());
5927            self
5928        }
5929
5930        /// Sets the value of [auto_generate_ids][crate::model::ImportDocumentsRequest::auto_generate_ids].
5931        pub fn set_auto_generate_ids<T: Into<bool>>(mut self, v: T) -> Self {
5932            self.0.request.auto_generate_ids = v.into();
5933            self
5934        }
5935
5936        /// Sets the value of [id_field][crate::model::ImportDocumentsRequest::id_field].
5937        pub fn set_id_field<T: Into<std::string::String>>(mut self, v: T) -> Self {
5938            self.0.request.id_field = v.into();
5939            self
5940        }
5941
5942        /// Sets the value of [force_refresh_content][crate::model::ImportDocumentsRequest::force_refresh_content].
5943        pub fn set_force_refresh_content<T: Into<bool>>(mut self, v: T) -> Self {
5944            self.0.request.force_refresh_content = v.into();
5945            self
5946        }
5947
5948        /// Sets the value of [source][crate::model::ImportDocumentsRequest::source].
5949        ///
5950        /// Note that all the setters affecting `source` are
5951        /// mutually exclusive.
5952        pub fn set_source<T: Into<Option<crate::model::import_documents_request::Source>>>(
5953            mut self,
5954            v: T,
5955        ) -> Self {
5956            self.0.request.source = v.into();
5957            self
5958        }
5959
5960        /// Sets the value of [source][crate::model::ImportDocumentsRequest::source]
5961        /// to hold a `InlineSource`.
5962        ///
5963        /// Note that all the setters affecting `source` are
5964        /// mutually exclusive.
5965        pub fn set_inline_source<
5966            T: std::convert::Into<
5967                    std::boxed::Box<crate::model::import_documents_request::InlineSource>,
5968                >,
5969        >(
5970            mut self,
5971            v: T,
5972        ) -> Self {
5973            self.0.request = self.0.request.set_inline_source(v);
5974            self
5975        }
5976
5977        /// Sets the value of [source][crate::model::ImportDocumentsRequest::source]
5978        /// to hold a `GcsSource`.
5979        ///
5980        /// Note that all the setters affecting `source` are
5981        /// mutually exclusive.
5982        pub fn set_gcs_source<T: std::convert::Into<std::boxed::Box<crate::model::GcsSource>>>(
5983            mut self,
5984            v: T,
5985        ) -> Self {
5986            self.0.request = self.0.request.set_gcs_source(v);
5987            self
5988        }
5989
5990        /// Sets the value of [source][crate::model::ImportDocumentsRequest::source]
5991        /// to hold a `BigquerySource`.
5992        ///
5993        /// Note that all the setters affecting `source` are
5994        /// mutually exclusive.
5995        pub fn set_bigquery_source<
5996            T: std::convert::Into<std::boxed::Box<crate::model::BigQuerySource>>,
5997        >(
5998            mut self,
5999            v: T,
6000        ) -> Self {
6001            self.0.request = self.0.request.set_bigquery_source(v);
6002            self
6003        }
6004
6005        /// Sets the value of [source][crate::model::ImportDocumentsRequest::source]
6006        /// to hold a `FhirStoreSource`.
6007        ///
6008        /// Note that all the setters affecting `source` are
6009        /// mutually exclusive.
6010        pub fn set_fhir_store_source<
6011            T: std::convert::Into<std::boxed::Box<crate::model::FhirStoreSource>>,
6012        >(
6013            mut self,
6014            v: T,
6015        ) -> Self {
6016            self.0.request = self.0.request.set_fhir_store_source(v);
6017            self
6018        }
6019
6020        /// Sets the value of [source][crate::model::ImportDocumentsRequest::source]
6021        /// to hold a `SpannerSource`.
6022        ///
6023        /// Note that all the setters affecting `source` are
6024        /// mutually exclusive.
6025        pub fn set_spanner_source<
6026            T: std::convert::Into<std::boxed::Box<crate::model::SpannerSource>>,
6027        >(
6028            mut self,
6029            v: T,
6030        ) -> Self {
6031            self.0.request = self.0.request.set_spanner_source(v);
6032            self
6033        }
6034
6035        /// Sets the value of [source][crate::model::ImportDocumentsRequest::source]
6036        /// to hold a `CloudSqlSource`.
6037        ///
6038        /// Note that all the setters affecting `source` are
6039        /// mutually exclusive.
6040        pub fn set_cloud_sql_source<
6041            T: std::convert::Into<std::boxed::Box<crate::model::CloudSqlSource>>,
6042        >(
6043            mut self,
6044            v: T,
6045        ) -> Self {
6046            self.0.request = self.0.request.set_cloud_sql_source(v);
6047            self
6048        }
6049
6050        /// Sets the value of [source][crate::model::ImportDocumentsRequest::source]
6051        /// to hold a `FirestoreSource`.
6052        ///
6053        /// Note that all the setters affecting `source` are
6054        /// mutually exclusive.
6055        pub fn set_firestore_source<
6056            T: std::convert::Into<std::boxed::Box<crate::model::FirestoreSource>>,
6057        >(
6058            mut self,
6059            v: T,
6060        ) -> Self {
6061            self.0.request = self.0.request.set_firestore_source(v);
6062            self
6063        }
6064
6065        /// Sets the value of [source][crate::model::ImportDocumentsRequest::source]
6066        /// to hold a `AlloyDbSource`.
6067        ///
6068        /// Note that all the setters affecting `source` are
6069        /// mutually exclusive.
6070        pub fn set_alloy_db_source<
6071            T: std::convert::Into<std::boxed::Box<crate::model::AlloyDbSource>>,
6072        >(
6073            mut self,
6074            v: T,
6075        ) -> Self {
6076            self.0.request = self.0.request.set_alloy_db_source(v);
6077            self
6078        }
6079
6080        /// Sets the value of [source][crate::model::ImportDocumentsRequest::source]
6081        /// to hold a `BigtableSource`.
6082        ///
6083        /// Note that all the setters affecting `source` are
6084        /// mutually exclusive.
6085        pub fn set_bigtable_source<
6086            T: std::convert::Into<std::boxed::Box<crate::model::BigtableSource>>,
6087        >(
6088            mut self,
6089            v: T,
6090        ) -> Self {
6091            self.0.request = self.0.request.set_bigtable_source(v);
6092            self
6093        }
6094    }
6095
6096    #[doc(hidden)]
6097    impl crate::RequestBuilder for ImportDocuments {
6098        fn request_options(&mut self) -> &mut crate::RequestOptions {
6099            &mut self.0.options
6100        }
6101    }
6102
6103    /// The request builder for [DocumentService::purge_documents][crate::client::DocumentService::purge_documents] calls.
6104    ///
6105    /// # Example
6106    /// ```
6107    /// # use google_cloud_discoveryengine_v1::builder::document_service::PurgeDocuments;
6108    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
6109    /// use google_cloud_lro::Poller;
6110    ///
6111    /// let builder = prepare_request_builder();
6112    /// let response = builder.poller().until_done().await?;
6113    /// # Ok(()) }
6114    ///
6115    /// fn prepare_request_builder() -> PurgeDocuments {
6116    ///   # panic!();
6117    ///   // ... details omitted ...
6118    /// }
6119    /// ```
6120    #[derive(Clone, Debug)]
6121    pub struct PurgeDocuments(RequestBuilder<crate::model::PurgeDocumentsRequest>);
6122
6123    impl PurgeDocuments {
6124        pub(crate) fn new(
6125            stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
6126        ) -> Self {
6127            Self(RequestBuilder::new(stub))
6128        }
6129
6130        /// Sets the full request, replacing any prior values.
6131        pub fn with_request<V: Into<crate::model::PurgeDocumentsRequest>>(mut self, v: V) -> Self {
6132            self.0.request = v.into();
6133            self
6134        }
6135
6136        /// Sets all the options, replacing any prior values.
6137        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6138            self.0.options = v.into();
6139            self
6140        }
6141
6142        /// Sends the request.
6143        ///
6144        /// # Long running operations
6145        ///
6146        /// This starts, but does not poll, a longrunning operation. More information
6147        /// on [purge_documents][crate::client::DocumentService::purge_documents].
6148        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
6149            (*self.0.stub)
6150                .purge_documents(self.0.request, self.0.options)
6151                .await
6152                .map(crate::Response::into_body)
6153        }
6154
6155        /// Creates a [Poller][google_cloud_lro::Poller] to work with `purge_documents`.
6156        pub fn poller(
6157            self,
6158        ) -> impl google_cloud_lro::Poller<
6159            crate::model::PurgeDocumentsResponse,
6160            crate::model::PurgeDocumentsMetadata,
6161        > {
6162            type Operation = google_cloud_lro::internal::Operation<
6163                crate::model::PurgeDocumentsResponse,
6164                crate::model::PurgeDocumentsMetadata,
6165            >;
6166            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
6167            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
6168            let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
6169            if let Some(ref mut details) = poller_options.tracing {
6170                details.method_name = "google_cloud_discoveryengine_v1::client::DocumentService::purge_documents::until_done";
6171            }
6172
6173            let stub = self.0.stub.clone();
6174            let mut options = self.0.options.clone();
6175            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
6176            let query = move |name| {
6177                let stub = stub.clone();
6178                let options = options.clone();
6179                async {
6180                    let op = GetOperation::new(stub)
6181                        .set_name(name)
6182                        .with_options(options)
6183                        .send()
6184                        .await?;
6185                    Ok(Operation::new(op))
6186                }
6187            };
6188
6189            let start = move || async {
6190                let op = self.send().await?;
6191                Ok(Operation::new(op))
6192            };
6193
6194            use google_cloud_lro::internal::PollerExt;
6195            {
6196                google_cloud_lro::internal::new_poller(
6197                    polling_error_policy,
6198                    polling_backoff_policy,
6199                    start,
6200                    query,
6201                )
6202            }
6203            .with_options(poller_options)
6204        }
6205
6206        /// Sets the value of [parent][crate::model::PurgeDocumentsRequest::parent].
6207        ///
6208        /// This is a **required** field for requests.
6209        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
6210            self.0.request.parent = v.into();
6211            self
6212        }
6213
6214        /// Sets the value of [filter][crate::model::PurgeDocumentsRequest::filter].
6215        ///
6216        /// This is a **required** field for requests.
6217        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
6218            self.0.request.filter = v.into();
6219            self
6220        }
6221
6222        /// Sets the value of [error_config][crate::model::PurgeDocumentsRequest::error_config].
6223        pub fn set_error_config<T>(mut self, v: T) -> Self
6224        where
6225            T: std::convert::Into<crate::model::PurgeErrorConfig>,
6226        {
6227            self.0.request.error_config = std::option::Option::Some(v.into());
6228            self
6229        }
6230
6231        /// Sets or clears the value of [error_config][crate::model::PurgeDocumentsRequest::error_config].
6232        pub fn set_or_clear_error_config<T>(mut self, v: std::option::Option<T>) -> Self
6233        where
6234            T: std::convert::Into<crate::model::PurgeErrorConfig>,
6235        {
6236            self.0.request.error_config = v.map(|x| x.into());
6237            self
6238        }
6239
6240        /// Sets the value of [force][crate::model::PurgeDocumentsRequest::force].
6241        pub fn set_force<T: Into<bool>>(mut self, v: T) -> Self {
6242            self.0.request.force = v.into();
6243            self
6244        }
6245
6246        /// Sets the value of [source][crate::model::PurgeDocumentsRequest::source].
6247        ///
6248        /// Note that all the setters affecting `source` are
6249        /// mutually exclusive.
6250        pub fn set_source<T: Into<Option<crate::model::purge_documents_request::Source>>>(
6251            mut self,
6252            v: T,
6253        ) -> Self {
6254            self.0.request.source = v.into();
6255            self
6256        }
6257
6258        /// Sets the value of [source][crate::model::PurgeDocumentsRequest::source]
6259        /// to hold a `GcsSource`.
6260        ///
6261        /// Note that all the setters affecting `source` are
6262        /// mutually exclusive.
6263        pub fn set_gcs_source<T: std::convert::Into<std::boxed::Box<crate::model::GcsSource>>>(
6264            mut self,
6265            v: T,
6266        ) -> Self {
6267            self.0.request = self.0.request.set_gcs_source(v);
6268            self
6269        }
6270
6271        /// Sets the value of [source][crate::model::PurgeDocumentsRequest::source]
6272        /// to hold a `InlineSource`.
6273        ///
6274        /// Note that all the setters affecting `source` are
6275        /// mutually exclusive.
6276        pub fn set_inline_source<
6277            T: std::convert::Into<
6278                    std::boxed::Box<crate::model::purge_documents_request::InlineSource>,
6279                >,
6280        >(
6281            mut self,
6282            v: T,
6283        ) -> Self {
6284            self.0.request = self.0.request.set_inline_source(v);
6285            self
6286        }
6287    }
6288
6289    #[doc(hidden)]
6290    impl crate::RequestBuilder for PurgeDocuments {
6291        fn request_options(&mut self) -> &mut crate::RequestOptions {
6292            &mut self.0.options
6293        }
6294    }
6295
6296    /// The request builder for [DocumentService::batch_get_documents_metadata][crate::client::DocumentService::batch_get_documents_metadata] calls.
6297    ///
6298    /// # Example
6299    /// ```
6300    /// # use google_cloud_discoveryengine_v1::builder::document_service::BatchGetDocumentsMetadata;
6301    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
6302    ///
6303    /// let builder = prepare_request_builder();
6304    /// let response = builder.send().await?;
6305    /// # Ok(()) }
6306    ///
6307    /// fn prepare_request_builder() -> BatchGetDocumentsMetadata {
6308    ///   # panic!();
6309    ///   // ... details omitted ...
6310    /// }
6311    /// ```
6312    #[derive(Clone, Debug)]
6313    pub struct BatchGetDocumentsMetadata(
6314        RequestBuilder<crate::model::BatchGetDocumentsMetadataRequest>,
6315    );
6316
6317    impl BatchGetDocumentsMetadata {
6318        pub(crate) fn new(
6319            stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
6320        ) -> Self {
6321            Self(RequestBuilder::new(stub))
6322        }
6323
6324        /// Sets the full request, replacing any prior values.
6325        pub fn with_request<V: Into<crate::model::BatchGetDocumentsMetadataRequest>>(
6326            mut self,
6327            v: V,
6328        ) -> Self {
6329            self.0.request = v.into();
6330            self
6331        }
6332
6333        /// Sets all the options, replacing any prior values.
6334        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6335            self.0.options = v.into();
6336            self
6337        }
6338
6339        /// Sends the request.
6340        pub async fn send(self) -> Result<crate::model::BatchGetDocumentsMetadataResponse> {
6341            (*self.0.stub)
6342                .batch_get_documents_metadata(self.0.request, self.0.options)
6343                .await
6344                .map(crate::Response::into_body)
6345        }
6346
6347        /// Sets the value of [parent][crate::model::BatchGetDocumentsMetadataRequest::parent].
6348        ///
6349        /// This is a **required** field for requests.
6350        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
6351            self.0.request.parent = v.into();
6352            self
6353        }
6354
6355        /// Sets the value of [matcher][crate::model::BatchGetDocumentsMetadataRequest::matcher].
6356        ///
6357        /// This is a **required** field for requests.
6358        pub fn set_matcher<T>(mut self, v: T) -> Self
6359        where
6360            T: std::convert::Into<crate::model::batch_get_documents_metadata_request::Matcher>,
6361        {
6362            self.0.request.matcher = std::option::Option::Some(v.into());
6363            self
6364        }
6365
6366        /// Sets or clears the value of [matcher][crate::model::BatchGetDocumentsMetadataRequest::matcher].
6367        ///
6368        /// This is a **required** field for requests.
6369        pub fn set_or_clear_matcher<T>(mut self, v: std::option::Option<T>) -> Self
6370        where
6371            T: std::convert::Into<crate::model::batch_get_documents_metadata_request::Matcher>,
6372        {
6373            self.0.request.matcher = v.map(|x| x.into());
6374            self
6375        }
6376    }
6377
6378    #[doc(hidden)]
6379    impl crate::RequestBuilder for BatchGetDocumentsMetadata {
6380        fn request_options(&mut self) -> &mut crate::RequestOptions {
6381            &mut self.0.options
6382        }
6383    }
6384
6385    /// The request builder for [DocumentService::list_operations][crate::client::DocumentService::list_operations] calls.
6386    ///
6387    /// # Example
6388    /// ```
6389    /// # use google_cloud_discoveryengine_v1::builder::document_service::ListOperations;
6390    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
6391    /// use google_cloud_gax::paginator::ItemPaginator;
6392    ///
6393    /// let builder = prepare_request_builder();
6394    /// let mut items = builder.by_item();
6395    /// while let Some(result) = items.next().await {
6396    ///   let item = result?;
6397    /// }
6398    /// # Ok(()) }
6399    ///
6400    /// fn prepare_request_builder() -> ListOperations {
6401    ///   # panic!();
6402    ///   // ... details omitted ...
6403    /// }
6404    /// ```
6405    #[derive(Clone, Debug)]
6406    pub struct ListOperations(
6407        RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
6408    );
6409
6410    impl ListOperations {
6411        pub(crate) fn new(
6412            stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
6413        ) -> Self {
6414            Self(RequestBuilder::new(stub))
6415        }
6416
6417        /// Sets the full request, replacing any prior values.
6418        pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
6419            mut self,
6420            v: V,
6421        ) -> Self {
6422            self.0.request = v.into();
6423            self
6424        }
6425
6426        /// Sets all the options, replacing any prior values.
6427        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6428            self.0.options = v.into();
6429            self
6430        }
6431
6432        /// Sends the request.
6433        pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
6434            (*self.0.stub)
6435                .list_operations(self.0.request, self.0.options)
6436                .await
6437                .map(crate::Response::into_body)
6438        }
6439
6440        /// Streams each page in the collection.
6441        pub fn by_page(
6442            self,
6443        ) -> impl google_cloud_gax::paginator::Paginator<
6444            google_cloud_longrunning::model::ListOperationsResponse,
6445            crate::Error,
6446        > {
6447            use std::clone::Clone;
6448            let token = self.0.request.page_token.clone();
6449            let execute = move |token: String| {
6450                let mut builder = self.clone();
6451                builder.0.request = builder.0.request.set_page_token(token);
6452                builder.send()
6453            };
6454            google_cloud_gax::paginator::internal::new_paginator(token, execute)
6455        }
6456
6457        /// Streams each item in the collection.
6458        pub fn by_item(
6459            self,
6460        ) -> impl google_cloud_gax::paginator::ItemPaginator<
6461            google_cloud_longrunning::model::ListOperationsResponse,
6462            crate::Error,
6463        > {
6464            use google_cloud_gax::paginator::Paginator;
6465            self.by_page().items()
6466        }
6467
6468        /// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
6469        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6470            self.0.request.name = v.into();
6471            self
6472        }
6473
6474        /// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::filter].
6475        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
6476            self.0.request.filter = v.into();
6477            self
6478        }
6479
6480        /// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
6481        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
6482            self.0.request.page_size = v.into();
6483            self
6484        }
6485
6486        /// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
6487        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
6488            self.0.request.page_token = v.into();
6489            self
6490        }
6491
6492        /// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
6493        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
6494            self.0.request.return_partial_success = v.into();
6495            self
6496        }
6497    }
6498
6499    #[doc(hidden)]
6500    impl crate::RequestBuilder for ListOperations {
6501        fn request_options(&mut self) -> &mut crate::RequestOptions {
6502            &mut self.0.options
6503        }
6504    }
6505
6506    /// The request builder for [DocumentService::get_operation][crate::client::DocumentService::get_operation] calls.
6507    ///
6508    /// # Example
6509    /// ```
6510    /// # use google_cloud_discoveryengine_v1::builder::document_service::GetOperation;
6511    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
6512    ///
6513    /// let builder = prepare_request_builder();
6514    /// let response = builder.send().await?;
6515    /// # Ok(()) }
6516    ///
6517    /// fn prepare_request_builder() -> GetOperation {
6518    ///   # panic!();
6519    ///   // ... details omitted ...
6520    /// }
6521    /// ```
6522    #[derive(Clone, Debug)]
6523    pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
6524
6525    impl GetOperation {
6526        pub(crate) fn new(
6527            stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
6528        ) -> Self {
6529            Self(RequestBuilder::new(stub))
6530        }
6531
6532        /// Sets the full request, replacing any prior values.
6533        pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
6534            mut self,
6535            v: V,
6536        ) -> Self {
6537            self.0.request = v.into();
6538            self
6539        }
6540
6541        /// Sets all the options, replacing any prior values.
6542        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6543            self.0.options = v.into();
6544            self
6545        }
6546
6547        /// Sends the request.
6548        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
6549            (*self.0.stub)
6550                .get_operation(self.0.request, self.0.options)
6551                .await
6552                .map(crate::Response::into_body)
6553        }
6554
6555        /// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
6556        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6557            self.0.request.name = v.into();
6558            self
6559        }
6560    }
6561
6562    #[doc(hidden)]
6563    impl crate::RequestBuilder for GetOperation {
6564        fn request_options(&mut self) -> &mut crate::RequestOptions {
6565            &mut self.0.options
6566        }
6567    }
6568
6569    /// The request builder for [DocumentService::cancel_operation][crate::client::DocumentService::cancel_operation] calls.
6570    ///
6571    /// # Example
6572    /// ```
6573    /// # use google_cloud_discoveryengine_v1::builder::document_service::CancelOperation;
6574    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
6575    ///
6576    /// let builder = prepare_request_builder();
6577    /// let response = builder.send().await?;
6578    /// # Ok(()) }
6579    ///
6580    /// fn prepare_request_builder() -> CancelOperation {
6581    ///   # panic!();
6582    ///   // ... details omitted ...
6583    /// }
6584    /// ```
6585    #[derive(Clone, Debug)]
6586    pub struct CancelOperation(
6587        RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
6588    );
6589
6590    impl CancelOperation {
6591        pub(crate) fn new(
6592            stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
6593        ) -> Self {
6594            Self(RequestBuilder::new(stub))
6595        }
6596
6597        /// Sets the full request, replacing any prior values.
6598        pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
6599            mut self,
6600            v: V,
6601        ) -> Self {
6602            self.0.request = v.into();
6603            self
6604        }
6605
6606        /// Sets all the options, replacing any prior values.
6607        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6608            self.0.options = v.into();
6609            self
6610        }
6611
6612        /// Sends the request.
6613        pub async fn send(self) -> Result<()> {
6614            (*self.0.stub)
6615                .cancel_operation(self.0.request, self.0.options)
6616                .await
6617                .map(crate::Response::into_body)
6618        }
6619
6620        /// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::name].
6621        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6622            self.0.request.name = v.into();
6623            self
6624        }
6625    }
6626
6627    #[doc(hidden)]
6628    impl crate::RequestBuilder for CancelOperation {
6629        fn request_options(&mut self) -> &mut crate::RequestOptions {
6630            &mut self.0.options
6631        }
6632    }
6633}
6634
6635/// Request and client builders for [EngineService][crate::client::EngineService].
6636#[cfg(feature = "engine-service")]
6637#[cfg_attr(docsrs, doc(cfg(feature = "engine-service")))]
6638pub mod engine_service {
6639    use crate::Result;
6640
6641    /// A builder for [EngineService][crate::client::EngineService].
6642    ///
6643    /// ```
6644    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
6645    /// # use google_cloud_discoveryengine_v1::*;
6646    /// # use builder::engine_service::ClientBuilder;
6647    /// # use client::EngineService;
6648    /// let builder : ClientBuilder = EngineService::builder();
6649    /// let client = builder
6650    ///     .with_endpoint("https://discoveryengine.googleapis.com")
6651    ///     .build().await?;
6652    /// # Ok(()) }
6653    /// ```
6654    pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
6655
6656    pub(crate) mod client {
6657        use super::super::super::client::EngineService;
6658        pub struct Factory;
6659        impl crate::ClientFactory for Factory {
6660            type Client = EngineService;
6661            type Credentials = gaxi::options::Credentials;
6662            async fn build(
6663                self,
6664                config: gaxi::options::ClientConfig,
6665            ) -> crate::ClientBuilderResult<Self::Client> {
6666                Self::Client::new(config).await
6667            }
6668        }
6669    }
6670
6671    /// Common implementation for [crate::client::EngineService] request builders.
6672    #[derive(Clone, Debug)]
6673    pub(crate) struct RequestBuilder<R: std::default::Default> {
6674        stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
6675        request: R,
6676        options: crate::RequestOptions,
6677    }
6678
6679    impl<R> RequestBuilder<R>
6680    where
6681        R: std::default::Default,
6682    {
6683        pub(crate) fn new(
6684            stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
6685        ) -> Self {
6686            Self {
6687                stub,
6688                request: R::default(),
6689                options: crate::RequestOptions::default(),
6690            }
6691        }
6692    }
6693
6694    /// The request builder for [EngineService::create_engine][crate::client::EngineService::create_engine] calls.
6695    ///
6696    /// # Example
6697    /// ```
6698    /// # use google_cloud_discoveryengine_v1::builder::engine_service::CreateEngine;
6699    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
6700    /// use google_cloud_lro::Poller;
6701    ///
6702    /// let builder = prepare_request_builder();
6703    /// let response = builder.poller().until_done().await?;
6704    /// # Ok(()) }
6705    ///
6706    /// fn prepare_request_builder() -> CreateEngine {
6707    ///   # panic!();
6708    ///   // ... details omitted ...
6709    /// }
6710    /// ```
6711    #[derive(Clone, Debug)]
6712    pub struct CreateEngine(RequestBuilder<crate::model::CreateEngineRequest>);
6713
6714    impl CreateEngine {
6715        pub(crate) fn new(
6716            stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
6717        ) -> Self {
6718            Self(RequestBuilder::new(stub))
6719        }
6720
6721        /// Sets the full request, replacing any prior values.
6722        pub fn with_request<V: Into<crate::model::CreateEngineRequest>>(mut self, v: V) -> Self {
6723            self.0.request = v.into();
6724            self
6725        }
6726
6727        /// Sets all the options, replacing any prior values.
6728        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6729            self.0.options = v.into();
6730            self
6731        }
6732
6733        /// Sends the request.
6734        ///
6735        /// # Long running operations
6736        ///
6737        /// This starts, but does not poll, a longrunning operation. More information
6738        /// on [create_engine][crate::client::EngineService::create_engine].
6739        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
6740            (*self.0.stub)
6741                .create_engine(self.0.request, self.0.options)
6742                .await
6743                .map(crate::Response::into_body)
6744        }
6745
6746        /// Creates a [Poller][google_cloud_lro::Poller] to work with `create_engine`.
6747        pub fn poller(
6748            self,
6749        ) -> impl google_cloud_lro::Poller<crate::model::Engine, crate::model::CreateEngineMetadata>
6750        {
6751            type Operation = google_cloud_lro::internal::Operation<
6752                crate::model::Engine,
6753                crate::model::CreateEngineMetadata,
6754            >;
6755            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
6756            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
6757            let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
6758            if let Some(ref mut details) = poller_options.tracing {
6759                details.method_name = "google_cloud_discoveryengine_v1::client::EngineService::create_engine::until_done";
6760            }
6761
6762            let stub = self.0.stub.clone();
6763            let mut options = self.0.options.clone();
6764            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
6765            let query = move |name| {
6766                let stub = stub.clone();
6767                let options = options.clone();
6768                async {
6769                    let op = GetOperation::new(stub)
6770                        .set_name(name)
6771                        .with_options(options)
6772                        .send()
6773                        .await?;
6774                    Ok(Operation::new(op))
6775                }
6776            };
6777
6778            let start = move || async {
6779                let op = self.send().await?;
6780                Ok(Operation::new(op))
6781            };
6782
6783            use google_cloud_lro::internal::PollerExt;
6784            {
6785                google_cloud_lro::internal::new_poller(
6786                    polling_error_policy,
6787                    polling_backoff_policy,
6788                    start,
6789                    query,
6790                )
6791            }
6792            .with_options(poller_options)
6793        }
6794
6795        /// Sets the value of [parent][crate::model::CreateEngineRequest::parent].
6796        ///
6797        /// This is a **required** field for requests.
6798        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
6799            self.0.request.parent = v.into();
6800            self
6801        }
6802
6803        /// Sets the value of [engine][crate::model::CreateEngineRequest::engine].
6804        ///
6805        /// This is a **required** field for requests.
6806        pub fn set_engine<T>(mut self, v: T) -> Self
6807        where
6808            T: std::convert::Into<crate::model::Engine>,
6809        {
6810            self.0.request.engine = std::option::Option::Some(v.into());
6811            self
6812        }
6813
6814        /// Sets or clears the value of [engine][crate::model::CreateEngineRequest::engine].
6815        ///
6816        /// This is a **required** field for requests.
6817        pub fn set_or_clear_engine<T>(mut self, v: std::option::Option<T>) -> Self
6818        where
6819            T: std::convert::Into<crate::model::Engine>,
6820        {
6821            self.0.request.engine = v.map(|x| x.into());
6822            self
6823        }
6824
6825        /// Sets the value of [engine_id][crate::model::CreateEngineRequest::engine_id].
6826        ///
6827        /// This is a **required** field for requests.
6828        pub fn set_engine_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
6829            self.0.request.engine_id = v.into();
6830            self
6831        }
6832    }
6833
6834    #[doc(hidden)]
6835    impl crate::RequestBuilder for CreateEngine {
6836        fn request_options(&mut self) -> &mut crate::RequestOptions {
6837            &mut self.0.options
6838        }
6839    }
6840
6841    /// The request builder for [EngineService::delete_engine][crate::client::EngineService::delete_engine] calls.
6842    ///
6843    /// # Example
6844    /// ```
6845    /// # use google_cloud_discoveryengine_v1::builder::engine_service::DeleteEngine;
6846    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
6847    /// use google_cloud_lro::Poller;
6848    ///
6849    /// let builder = prepare_request_builder();
6850    /// let response = builder.poller().until_done().await?;
6851    /// # Ok(()) }
6852    ///
6853    /// fn prepare_request_builder() -> DeleteEngine {
6854    ///   # panic!();
6855    ///   // ... details omitted ...
6856    /// }
6857    /// ```
6858    #[derive(Clone, Debug)]
6859    pub struct DeleteEngine(RequestBuilder<crate::model::DeleteEngineRequest>);
6860
6861    impl DeleteEngine {
6862        pub(crate) fn new(
6863            stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
6864        ) -> Self {
6865            Self(RequestBuilder::new(stub))
6866        }
6867
6868        /// Sets the full request, replacing any prior values.
6869        pub fn with_request<V: Into<crate::model::DeleteEngineRequest>>(mut self, v: V) -> Self {
6870            self.0.request = v.into();
6871            self
6872        }
6873
6874        /// Sets all the options, replacing any prior values.
6875        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6876            self.0.options = v.into();
6877            self
6878        }
6879
6880        /// Sends the request.
6881        ///
6882        /// # Long running operations
6883        ///
6884        /// This starts, but does not poll, a longrunning operation. More information
6885        /// on [delete_engine][crate::client::EngineService::delete_engine].
6886        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
6887            (*self.0.stub)
6888                .delete_engine(self.0.request, self.0.options)
6889                .await
6890                .map(crate::Response::into_body)
6891        }
6892
6893        /// Creates a [Poller][google_cloud_lro::Poller] to work with `delete_engine`.
6894        pub fn poller(
6895            self,
6896        ) -> impl google_cloud_lro::Poller<(), crate::model::DeleteEngineMetadata> {
6897            type Operation = google_cloud_lro::internal::Operation<
6898                wkt::Empty,
6899                crate::model::DeleteEngineMetadata,
6900            >;
6901            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
6902            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
6903            let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
6904            if let Some(ref mut details) = poller_options.tracing {
6905                details.method_name = "google_cloud_discoveryengine_v1::client::EngineService::delete_engine::until_done";
6906            }
6907
6908            let stub = self.0.stub.clone();
6909            let mut options = self.0.options.clone();
6910            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
6911            let query = move |name| {
6912                let stub = stub.clone();
6913                let options = options.clone();
6914                async {
6915                    let op = GetOperation::new(stub)
6916                        .set_name(name)
6917                        .with_options(options)
6918                        .send()
6919                        .await?;
6920                    Ok(Operation::new(op))
6921                }
6922            };
6923
6924            let start = move || async {
6925                let op = self.send().await?;
6926                Ok(Operation::new(op))
6927            };
6928
6929            use google_cloud_lro::internal::PollerExt;
6930            {
6931                google_cloud_lro::internal::new_unit_response_poller(
6932                    polling_error_policy,
6933                    polling_backoff_policy,
6934                    start,
6935                    query,
6936                )
6937            }
6938            .with_options(poller_options)
6939        }
6940
6941        /// Sets the value of [name][crate::model::DeleteEngineRequest::name].
6942        ///
6943        /// This is a **required** field for requests.
6944        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6945            self.0.request.name = v.into();
6946            self
6947        }
6948    }
6949
6950    #[doc(hidden)]
6951    impl crate::RequestBuilder for DeleteEngine {
6952        fn request_options(&mut self) -> &mut crate::RequestOptions {
6953            &mut self.0.options
6954        }
6955    }
6956
6957    /// The request builder for [EngineService::update_engine][crate::client::EngineService::update_engine] calls.
6958    ///
6959    /// # Example
6960    /// ```
6961    /// # use google_cloud_discoveryengine_v1::builder::engine_service::UpdateEngine;
6962    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
6963    ///
6964    /// let builder = prepare_request_builder();
6965    /// let response = builder.send().await?;
6966    /// # Ok(()) }
6967    ///
6968    /// fn prepare_request_builder() -> UpdateEngine {
6969    ///   # panic!();
6970    ///   // ... details omitted ...
6971    /// }
6972    /// ```
6973    #[derive(Clone, Debug)]
6974    pub struct UpdateEngine(RequestBuilder<crate::model::UpdateEngineRequest>);
6975
6976    impl UpdateEngine {
6977        pub(crate) fn new(
6978            stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
6979        ) -> Self {
6980            Self(RequestBuilder::new(stub))
6981        }
6982
6983        /// Sets the full request, replacing any prior values.
6984        pub fn with_request<V: Into<crate::model::UpdateEngineRequest>>(mut self, v: V) -> Self {
6985            self.0.request = v.into();
6986            self
6987        }
6988
6989        /// Sets all the options, replacing any prior values.
6990        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6991            self.0.options = v.into();
6992            self
6993        }
6994
6995        /// Sends the request.
6996        pub async fn send(self) -> Result<crate::model::Engine> {
6997            (*self.0.stub)
6998                .update_engine(self.0.request, self.0.options)
6999                .await
7000                .map(crate::Response::into_body)
7001        }
7002
7003        /// Sets the value of [engine][crate::model::UpdateEngineRequest::engine].
7004        ///
7005        /// This is a **required** field for requests.
7006        pub fn set_engine<T>(mut self, v: T) -> Self
7007        where
7008            T: std::convert::Into<crate::model::Engine>,
7009        {
7010            self.0.request.engine = std::option::Option::Some(v.into());
7011            self
7012        }
7013
7014        /// Sets or clears the value of [engine][crate::model::UpdateEngineRequest::engine].
7015        ///
7016        /// This is a **required** field for requests.
7017        pub fn set_or_clear_engine<T>(mut self, v: std::option::Option<T>) -> Self
7018        where
7019            T: std::convert::Into<crate::model::Engine>,
7020        {
7021            self.0.request.engine = v.map(|x| x.into());
7022            self
7023        }
7024
7025        /// Sets the value of [update_mask][crate::model::UpdateEngineRequest::update_mask].
7026        pub fn set_update_mask<T>(mut self, v: T) -> Self
7027        where
7028            T: std::convert::Into<wkt::FieldMask>,
7029        {
7030            self.0.request.update_mask = std::option::Option::Some(v.into());
7031            self
7032        }
7033
7034        /// Sets or clears the value of [update_mask][crate::model::UpdateEngineRequest::update_mask].
7035        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
7036        where
7037            T: std::convert::Into<wkt::FieldMask>,
7038        {
7039            self.0.request.update_mask = v.map(|x| x.into());
7040            self
7041        }
7042    }
7043
7044    #[doc(hidden)]
7045    impl crate::RequestBuilder for UpdateEngine {
7046        fn request_options(&mut self) -> &mut crate::RequestOptions {
7047            &mut self.0.options
7048        }
7049    }
7050
7051    /// The request builder for [EngineService::get_engine][crate::client::EngineService::get_engine] calls.
7052    ///
7053    /// # Example
7054    /// ```
7055    /// # use google_cloud_discoveryengine_v1::builder::engine_service::GetEngine;
7056    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
7057    ///
7058    /// let builder = prepare_request_builder();
7059    /// let response = builder.send().await?;
7060    /// # Ok(()) }
7061    ///
7062    /// fn prepare_request_builder() -> GetEngine {
7063    ///   # panic!();
7064    ///   // ... details omitted ...
7065    /// }
7066    /// ```
7067    #[derive(Clone, Debug)]
7068    pub struct GetEngine(RequestBuilder<crate::model::GetEngineRequest>);
7069
7070    impl GetEngine {
7071        pub(crate) fn new(
7072            stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
7073        ) -> Self {
7074            Self(RequestBuilder::new(stub))
7075        }
7076
7077        /// Sets the full request, replacing any prior values.
7078        pub fn with_request<V: Into<crate::model::GetEngineRequest>>(mut self, v: V) -> Self {
7079            self.0.request = v.into();
7080            self
7081        }
7082
7083        /// Sets all the options, replacing any prior values.
7084        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7085            self.0.options = v.into();
7086            self
7087        }
7088
7089        /// Sends the request.
7090        pub async fn send(self) -> Result<crate::model::Engine> {
7091            (*self.0.stub)
7092                .get_engine(self.0.request, self.0.options)
7093                .await
7094                .map(crate::Response::into_body)
7095        }
7096
7097        /// Sets the value of [name][crate::model::GetEngineRequest::name].
7098        ///
7099        /// This is a **required** field for requests.
7100        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7101            self.0.request.name = v.into();
7102            self
7103        }
7104    }
7105
7106    #[doc(hidden)]
7107    impl crate::RequestBuilder for GetEngine {
7108        fn request_options(&mut self) -> &mut crate::RequestOptions {
7109            &mut self.0.options
7110        }
7111    }
7112
7113    /// The request builder for [EngineService::list_engines][crate::client::EngineService::list_engines] calls.
7114    ///
7115    /// # Example
7116    /// ```
7117    /// # use google_cloud_discoveryengine_v1::builder::engine_service::ListEngines;
7118    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
7119    /// use google_cloud_gax::paginator::ItemPaginator;
7120    ///
7121    /// let builder = prepare_request_builder();
7122    /// let mut items = builder.by_item();
7123    /// while let Some(result) = items.next().await {
7124    ///   let item = result?;
7125    /// }
7126    /// # Ok(()) }
7127    ///
7128    /// fn prepare_request_builder() -> ListEngines {
7129    ///   # panic!();
7130    ///   // ... details omitted ...
7131    /// }
7132    /// ```
7133    #[derive(Clone, Debug)]
7134    pub struct ListEngines(RequestBuilder<crate::model::ListEnginesRequest>);
7135
7136    impl ListEngines {
7137        pub(crate) fn new(
7138            stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
7139        ) -> Self {
7140            Self(RequestBuilder::new(stub))
7141        }
7142
7143        /// Sets the full request, replacing any prior values.
7144        pub fn with_request<V: Into<crate::model::ListEnginesRequest>>(mut self, v: V) -> Self {
7145            self.0.request = v.into();
7146            self
7147        }
7148
7149        /// Sets all the options, replacing any prior values.
7150        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7151            self.0.options = v.into();
7152            self
7153        }
7154
7155        /// Sends the request.
7156        pub async fn send(self) -> Result<crate::model::ListEnginesResponse> {
7157            (*self.0.stub)
7158                .list_engines(self.0.request, self.0.options)
7159                .await
7160                .map(crate::Response::into_body)
7161        }
7162
7163        /// Streams each page in the collection.
7164        pub fn by_page(
7165            self,
7166        ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListEnginesResponse, crate::Error>
7167        {
7168            use std::clone::Clone;
7169            let token = self.0.request.page_token.clone();
7170            let execute = move |token: String| {
7171                let mut builder = self.clone();
7172                builder.0.request = builder.0.request.set_page_token(token);
7173                builder.send()
7174            };
7175            google_cloud_gax::paginator::internal::new_paginator(token, execute)
7176        }
7177
7178        /// Streams each item in the collection.
7179        pub fn by_item(
7180            self,
7181        ) -> impl google_cloud_gax::paginator::ItemPaginator<
7182            crate::model::ListEnginesResponse,
7183            crate::Error,
7184        > {
7185            use google_cloud_gax::paginator::Paginator;
7186            self.by_page().items()
7187        }
7188
7189        /// Sets the value of [parent][crate::model::ListEnginesRequest::parent].
7190        ///
7191        /// This is a **required** field for requests.
7192        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
7193            self.0.request.parent = v.into();
7194            self
7195        }
7196
7197        /// Sets the value of [page_size][crate::model::ListEnginesRequest::page_size].
7198        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
7199            self.0.request.page_size = v.into();
7200            self
7201        }
7202
7203        /// Sets the value of [page_token][crate::model::ListEnginesRequest::page_token].
7204        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
7205            self.0.request.page_token = v.into();
7206            self
7207        }
7208
7209        /// Sets the value of [filter][crate::model::ListEnginesRequest::filter].
7210        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
7211            self.0.request.filter = v.into();
7212            self
7213        }
7214    }
7215
7216    #[doc(hidden)]
7217    impl crate::RequestBuilder for ListEngines {
7218        fn request_options(&mut self) -> &mut crate::RequestOptions {
7219            &mut self.0.options
7220        }
7221    }
7222
7223    /// The request builder for [EngineService::list_operations][crate::client::EngineService::list_operations] calls.
7224    ///
7225    /// # Example
7226    /// ```
7227    /// # use google_cloud_discoveryengine_v1::builder::engine_service::ListOperations;
7228    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
7229    /// use google_cloud_gax::paginator::ItemPaginator;
7230    ///
7231    /// let builder = prepare_request_builder();
7232    /// let mut items = builder.by_item();
7233    /// while let Some(result) = items.next().await {
7234    ///   let item = result?;
7235    /// }
7236    /// # Ok(()) }
7237    ///
7238    /// fn prepare_request_builder() -> ListOperations {
7239    ///   # panic!();
7240    ///   // ... details omitted ...
7241    /// }
7242    /// ```
7243    #[derive(Clone, Debug)]
7244    pub struct ListOperations(
7245        RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
7246    );
7247
7248    impl ListOperations {
7249        pub(crate) fn new(
7250            stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
7251        ) -> Self {
7252            Self(RequestBuilder::new(stub))
7253        }
7254
7255        /// Sets the full request, replacing any prior values.
7256        pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
7257            mut self,
7258            v: V,
7259        ) -> Self {
7260            self.0.request = v.into();
7261            self
7262        }
7263
7264        /// Sets all the options, replacing any prior values.
7265        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7266            self.0.options = v.into();
7267            self
7268        }
7269
7270        /// Sends the request.
7271        pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
7272            (*self.0.stub)
7273                .list_operations(self.0.request, self.0.options)
7274                .await
7275                .map(crate::Response::into_body)
7276        }
7277
7278        /// Streams each page in the collection.
7279        pub fn by_page(
7280            self,
7281        ) -> impl google_cloud_gax::paginator::Paginator<
7282            google_cloud_longrunning::model::ListOperationsResponse,
7283            crate::Error,
7284        > {
7285            use std::clone::Clone;
7286            let token = self.0.request.page_token.clone();
7287            let execute = move |token: String| {
7288                let mut builder = self.clone();
7289                builder.0.request = builder.0.request.set_page_token(token);
7290                builder.send()
7291            };
7292            google_cloud_gax::paginator::internal::new_paginator(token, execute)
7293        }
7294
7295        /// Streams each item in the collection.
7296        pub fn by_item(
7297            self,
7298        ) -> impl google_cloud_gax::paginator::ItemPaginator<
7299            google_cloud_longrunning::model::ListOperationsResponse,
7300            crate::Error,
7301        > {
7302            use google_cloud_gax::paginator::Paginator;
7303            self.by_page().items()
7304        }
7305
7306        /// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
7307        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7308            self.0.request.name = v.into();
7309            self
7310        }
7311
7312        /// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::filter].
7313        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
7314            self.0.request.filter = v.into();
7315            self
7316        }
7317
7318        /// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
7319        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
7320            self.0.request.page_size = v.into();
7321            self
7322        }
7323
7324        /// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
7325        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
7326            self.0.request.page_token = v.into();
7327            self
7328        }
7329
7330        /// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
7331        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
7332            self.0.request.return_partial_success = v.into();
7333            self
7334        }
7335    }
7336
7337    #[doc(hidden)]
7338    impl crate::RequestBuilder for ListOperations {
7339        fn request_options(&mut self) -> &mut crate::RequestOptions {
7340            &mut self.0.options
7341        }
7342    }
7343
7344    /// The request builder for [EngineService::get_operation][crate::client::EngineService::get_operation] calls.
7345    ///
7346    /// # Example
7347    /// ```
7348    /// # use google_cloud_discoveryengine_v1::builder::engine_service::GetOperation;
7349    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
7350    ///
7351    /// let builder = prepare_request_builder();
7352    /// let response = builder.send().await?;
7353    /// # Ok(()) }
7354    ///
7355    /// fn prepare_request_builder() -> GetOperation {
7356    ///   # panic!();
7357    ///   // ... details omitted ...
7358    /// }
7359    /// ```
7360    #[derive(Clone, Debug)]
7361    pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
7362
7363    impl GetOperation {
7364        pub(crate) fn new(
7365            stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
7366        ) -> Self {
7367            Self(RequestBuilder::new(stub))
7368        }
7369
7370        /// Sets the full request, replacing any prior values.
7371        pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
7372            mut self,
7373            v: V,
7374        ) -> Self {
7375            self.0.request = v.into();
7376            self
7377        }
7378
7379        /// Sets all the options, replacing any prior values.
7380        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7381            self.0.options = v.into();
7382            self
7383        }
7384
7385        /// Sends the request.
7386        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
7387            (*self.0.stub)
7388                .get_operation(self.0.request, self.0.options)
7389                .await
7390                .map(crate::Response::into_body)
7391        }
7392
7393        /// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
7394        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7395            self.0.request.name = v.into();
7396            self
7397        }
7398    }
7399
7400    #[doc(hidden)]
7401    impl crate::RequestBuilder for GetOperation {
7402        fn request_options(&mut self) -> &mut crate::RequestOptions {
7403            &mut self.0.options
7404        }
7405    }
7406
7407    /// The request builder for [EngineService::cancel_operation][crate::client::EngineService::cancel_operation] calls.
7408    ///
7409    /// # Example
7410    /// ```
7411    /// # use google_cloud_discoveryengine_v1::builder::engine_service::CancelOperation;
7412    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
7413    ///
7414    /// let builder = prepare_request_builder();
7415    /// let response = builder.send().await?;
7416    /// # Ok(()) }
7417    ///
7418    /// fn prepare_request_builder() -> CancelOperation {
7419    ///   # panic!();
7420    ///   // ... details omitted ...
7421    /// }
7422    /// ```
7423    #[derive(Clone, Debug)]
7424    pub struct CancelOperation(
7425        RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
7426    );
7427
7428    impl CancelOperation {
7429        pub(crate) fn new(
7430            stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
7431        ) -> Self {
7432            Self(RequestBuilder::new(stub))
7433        }
7434
7435        /// Sets the full request, replacing any prior values.
7436        pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
7437            mut self,
7438            v: V,
7439        ) -> Self {
7440            self.0.request = v.into();
7441            self
7442        }
7443
7444        /// Sets all the options, replacing any prior values.
7445        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7446            self.0.options = v.into();
7447            self
7448        }
7449
7450        /// Sends the request.
7451        pub async fn send(self) -> Result<()> {
7452            (*self.0.stub)
7453                .cancel_operation(self.0.request, self.0.options)
7454                .await
7455                .map(crate::Response::into_body)
7456        }
7457
7458        /// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::name].
7459        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7460            self.0.request.name = v.into();
7461            self
7462        }
7463    }
7464
7465    #[doc(hidden)]
7466    impl crate::RequestBuilder for CancelOperation {
7467        fn request_options(&mut self) -> &mut crate::RequestOptions {
7468            &mut self.0.options
7469        }
7470    }
7471}
7472
7473/// Request and client builders for [GroundedGenerationService][crate::client::GroundedGenerationService].
7474#[cfg(feature = "grounded-generation-service")]
7475#[cfg_attr(docsrs, doc(cfg(feature = "grounded-generation-service")))]
7476pub mod grounded_generation_service {
7477    use crate::Result;
7478
7479    /// A builder for [GroundedGenerationService][crate::client::GroundedGenerationService].
7480    ///
7481    /// ```
7482    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
7483    /// # use google_cloud_discoveryengine_v1::*;
7484    /// # use builder::grounded_generation_service::ClientBuilder;
7485    /// # use client::GroundedGenerationService;
7486    /// let builder : ClientBuilder = GroundedGenerationService::builder();
7487    /// let client = builder
7488    ///     .with_endpoint("https://discoveryengine.googleapis.com")
7489    ///     .build().await?;
7490    /// # Ok(()) }
7491    /// ```
7492    pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
7493
7494    pub(crate) mod client {
7495        use super::super::super::client::GroundedGenerationService;
7496        pub struct Factory;
7497        impl crate::ClientFactory for Factory {
7498            type Client = GroundedGenerationService;
7499            type Credentials = gaxi::options::Credentials;
7500            async fn build(
7501                self,
7502                config: gaxi::options::ClientConfig,
7503            ) -> crate::ClientBuilderResult<Self::Client> {
7504                Self::Client::new(config).await
7505            }
7506        }
7507    }
7508
7509    /// Common implementation for [crate::client::GroundedGenerationService] request builders.
7510    #[derive(Clone, Debug)]
7511    pub(crate) struct RequestBuilder<R: std::default::Default> {
7512        stub: std::sync::Arc<dyn super::super::stub::dynamic::GroundedGenerationService>,
7513        request: R,
7514        options: crate::RequestOptions,
7515    }
7516
7517    impl<R> RequestBuilder<R>
7518    where
7519        R: std::default::Default,
7520    {
7521        pub(crate) fn new(
7522            stub: std::sync::Arc<dyn super::super::stub::dynamic::GroundedGenerationService>,
7523        ) -> Self {
7524            Self {
7525                stub,
7526                request: R::default(),
7527                options: crate::RequestOptions::default(),
7528            }
7529        }
7530    }
7531
7532    /// The request builder for [GroundedGenerationService::generate_grounded_content][crate::client::GroundedGenerationService::generate_grounded_content] calls.
7533    ///
7534    /// # Example
7535    /// ```
7536    /// # use google_cloud_discoveryengine_v1::builder::grounded_generation_service::GenerateGroundedContent;
7537    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
7538    ///
7539    /// let builder = prepare_request_builder();
7540    /// let response = builder.send().await?;
7541    /// # Ok(()) }
7542    ///
7543    /// fn prepare_request_builder() -> GenerateGroundedContent {
7544    ///   # panic!();
7545    ///   // ... details omitted ...
7546    /// }
7547    /// ```
7548    #[derive(Clone, Debug)]
7549    pub struct GenerateGroundedContent(
7550        RequestBuilder<crate::model::GenerateGroundedContentRequest>,
7551    );
7552
7553    impl GenerateGroundedContent {
7554        pub(crate) fn new(
7555            stub: std::sync::Arc<dyn super::super::stub::dynamic::GroundedGenerationService>,
7556        ) -> Self {
7557            Self(RequestBuilder::new(stub))
7558        }
7559
7560        /// Sets the full request, replacing any prior values.
7561        pub fn with_request<V: Into<crate::model::GenerateGroundedContentRequest>>(
7562            mut self,
7563            v: V,
7564        ) -> Self {
7565            self.0.request = v.into();
7566            self
7567        }
7568
7569        /// Sets all the options, replacing any prior values.
7570        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7571            self.0.options = v.into();
7572            self
7573        }
7574
7575        /// Sends the request.
7576        pub async fn send(self) -> Result<crate::model::GenerateGroundedContentResponse> {
7577            (*self.0.stub)
7578                .generate_grounded_content(self.0.request, self.0.options)
7579                .await
7580                .map(crate::Response::into_body)
7581        }
7582
7583        /// Sets the value of [location][crate::model::GenerateGroundedContentRequest::location].
7584        ///
7585        /// This is a **required** field for requests.
7586        pub fn set_location<T: Into<std::string::String>>(mut self, v: T) -> Self {
7587            self.0.request.location = v.into();
7588            self
7589        }
7590
7591        /// Sets the value of [system_instruction][crate::model::GenerateGroundedContentRequest::system_instruction].
7592        pub fn set_system_instruction<T>(mut self, v: T) -> Self
7593        where
7594            T: std::convert::Into<crate::model::GroundedGenerationContent>,
7595        {
7596            self.0.request.system_instruction = std::option::Option::Some(v.into());
7597            self
7598        }
7599
7600        /// Sets or clears the value of [system_instruction][crate::model::GenerateGroundedContentRequest::system_instruction].
7601        pub fn set_or_clear_system_instruction<T>(mut self, v: std::option::Option<T>) -> Self
7602        where
7603            T: std::convert::Into<crate::model::GroundedGenerationContent>,
7604        {
7605            self.0.request.system_instruction = v.map(|x| x.into());
7606            self
7607        }
7608
7609        /// Sets the value of [contents][crate::model::GenerateGroundedContentRequest::contents].
7610        pub fn set_contents<T, V>(mut self, v: T) -> Self
7611        where
7612            T: std::iter::IntoIterator<Item = V>,
7613            V: std::convert::Into<crate::model::GroundedGenerationContent>,
7614        {
7615            use std::iter::Iterator;
7616            self.0.request.contents = v.into_iter().map(|i| i.into()).collect();
7617            self
7618        }
7619
7620        /// Sets the value of [generation_spec][crate::model::GenerateGroundedContentRequest::generation_spec].
7621        pub fn set_generation_spec<T>(mut self, v: T) -> Self
7622        where
7623            T: std::convert::Into<crate::model::generate_grounded_content_request::GenerationSpec>,
7624        {
7625            self.0.request.generation_spec = std::option::Option::Some(v.into());
7626            self
7627        }
7628
7629        /// Sets or clears the value of [generation_spec][crate::model::GenerateGroundedContentRequest::generation_spec].
7630        pub fn set_or_clear_generation_spec<T>(mut self, v: std::option::Option<T>) -> Self
7631        where
7632            T: std::convert::Into<crate::model::generate_grounded_content_request::GenerationSpec>,
7633        {
7634            self.0.request.generation_spec = v.map(|x| x.into());
7635            self
7636        }
7637
7638        /// Sets the value of [grounding_spec][crate::model::GenerateGroundedContentRequest::grounding_spec].
7639        pub fn set_grounding_spec<T>(mut self, v: T) -> Self
7640        where
7641            T: std::convert::Into<crate::model::generate_grounded_content_request::GroundingSpec>,
7642        {
7643            self.0.request.grounding_spec = std::option::Option::Some(v.into());
7644            self
7645        }
7646
7647        /// Sets or clears the value of [grounding_spec][crate::model::GenerateGroundedContentRequest::grounding_spec].
7648        pub fn set_or_clear_grounding_spec<T>(mut self, v: std::option::Option<T>) -> Self
7649        where
7650            T: std::convert::Into<crate::model::generate_grounded_content_request::GroundingSpec>,
7651        {
7652            self.0.request.grounding_spec = v.map(|x| x.into());
7653            self
7654        }
7655
7656        /// Sets the value of [user_labels][crate::model::GenerateGroundedContentRequest::user_labels].
7657        pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
7658        where
7659            T: std::iter::IntoIterator<Item = (K, V)>,
7660            K: std::convert::Into<std::string::String>,
7661            V: std::convert::Into<std::string::String>,
7662        {
7663            self.0.request.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
7664            self
7665        }
7666    }
7667
7668    #[doc(hidden)]
7669    impl crate::RequestBuilder for GenerateGroundedContent {
7670        fn request_options(&mut self) -> &mut crate::RequestOptions {
7671            &mut self.0.options
7672        }
7673    }
7674
7675    /// The request builder for [GroundedGenerationService::check_grounding][crate::client::GroundedGenerationService::check_grounding] calls.
7676    ///
7677    /// # Example
7678    /// ```
7679    /// # use google_cloud_discoveryengine_v1::builder::grounded_generation_service::CheckGrounding;
7680    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
7681    ///
7682    /// let builder = prepare_request_builder();
7683    /// let response = builder.send().await?;
7684    /// # Ok(()) }
7685    ///
7686    /// fn prepare_request_builder() -> CheckGrounding {
7687    ///   # panic!();
7688    ///   // ... details omitted ...
7689    /// }
7690    /// ```
7691    #[derive(Clone, Debug)]
7692    pub struct CheckGrounding(RequestBuilder<crate::model::CheckGroundingRequest>);
7693
7694    impl CheckGrounding {
7695        pub(crate) fn new(
7696            stub: std::sync::Arc<dyn super::super::stub::dynamic::GroundedGenerationService>,
7697        ) -> Self {
7698            Self(RequestBuilder::new(stub))
7699        }
7700
7701        /// Sets the full request, replacing any prior values.
7702        pub fn with_request<V: Into<crate::model::CheckGroundingRequest>>(mut self, v: V) -> Self {
7703            self.0.request = v.into();
7704            self
7705        }
7706
7707        /// Sets all the options, replacing any prior values.
7708        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7709            self.0.options = v.into();
7710            self
7711        }
7712
7713        /// Sends the request.
7714        pub async fn send(self) -> Result<crate::model::CheckGroundingResponse> {
7715            (*self.0.stub)
7716                .check_grounding(self.0.request, self.0.options)
7717                .await
7718                .map(crate::Response::into_body)
7719        }
7720
7721        /// Sets the value of [grounding_config][crate::model::CheckGroundingRequest::grounding_config].
7722        ///
7723        /// This is a **required** field for requests.
7724        pub fn set_grounding_config<T: Into<std::string::String>>(mut self, v: T) -> Self {
7725            self.0.request.grounding_config = v.into();
7726            self
7727        }
7728
7729        /// Sets the value of [answer_candidate][crate::model::CheckGroundingRequest::answer_candidate].
7730        pub fn set_answer_candidate<T: Into<std::string::String>>(mut self, v: T) -> Self {
7731            self.0.request.answer_candidate = v.into();
7732            self
7733        }
7734
7735        /// Sets the value of [facts][crate::model::CheckGroundingRequest::facts].
7736        pub fn set_facts<T, V>(mut self, v: T) -> Self
7737        where
7738            T: std::iter::IntoIterator<Item = V>,
7739            V: std::convert::Into<crate::model::GroundingFact>,
7740        {
7741            use std::iter::Iterator;
7742            self.0.request.facts = v.into_iter().map(|i| i.into()).collect();
7743            self
7744        }
7745
7746        /// Sets the value of [grounding_spec][crate::model::CheckGroundingRequest::grounding_spec].
7747        pub fn set_grounding_spec<T>(mut self, v: T) -> Self
7748        where
7749            T: std::convert::Into<crate::model::CheckGroundingSpec>,
7750        {
7751            self.0.request.grounding_spec = std::option::Option::Some(v.into());
7752            self
7753        }
7754
7755        /// Sets or clears the value of [grounding_spec][crate::model::CheckGroundingRequest::grounding_spec].
7756        pub fn set_or_clear_grounding_spec<T>(mut self, v: std::option::Option<T>) -> Self
7757        where
7758            T: std::convert::Into<crate::model::CheckGroundingSpec>,
7759        {
7760            self.0.request.grounding_spec = v.map(|x| x.into());
7761            self
7762        }
7763
7764        /// Sets the value of [user_labels][crate::model::CheckGroundingRequest::user_labels].
7765        pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
7766        where
7767            T: std::iter::IntoIterator<Item = (K, V)>,
7768            K: std::convert::Into<std::string::String>,
7769            V: std::convert::Into<std::string::String>,
7770        {
7771            self.0.request.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
7772            self
7773        }
7774    }
7775
7776    #[doc(hidden)]
7777    impl crate::RequestBuilder for CheckGrounding {
7778        fn request_options(&mut self) -> &mut crate::RequestOptions {
7779            &mut self.0.options
7780        }
7781    }
7782
7783    /// The request builder for [GroundedGenerationService::list_operations][crate::client::GroundedGenerationService::list_operations] calls.
7784    ///
7785    /// # Example
7786    /// ```
7787    /// # use google_cloud_discoveryengine_v1::builder::grounded_generation_service::ListOperations;
7788    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
7789    /// use google_cloud_gax::paginator::ItemPaginator;
7790    ///
7791    /// let builder = prepare_request_builder();
7792    /// let mut items = builder.by_item();
7793    /// while let Some(result) = items.next().await {
7794    ///   let item = result?;
7795    /// }
7796    /// # Ok(()) }
7797    ///
7798    /// fn prepare_request_builder() -> ListOperations {
7799    ///   # panic!();
7800    ///   // ... details omitted ...
7801    /// }
7802    /// ```
7803    #[derive(Clone, Debug)]
7804    pub struct ListOperations(
7805        RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
7806    );
7807
7808    impl ListOperations {
7809        pub(crate) fn new(
7810            stub: std::sync::Arc<dyn super::super::stub::dynamic::GroundedGenerationService>,
7811        ) -> Self {
7812            Self(RequestBuilder::new(stub))
7813        }
7814
7815        /// Sets the full request, replacing any prior values.
7816        pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
7817            mut self,
7818            v: V,
7819        ) -> Self {
7820            self.0.request = v.into();
7821            self
7822        }
7823
7824        /// Sets all the options, replacing any prior values.
7825        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7826            self.0.options = v.into();
7827            self
7828        }
7829
7830        /// Sends the request.
7831        pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
7832            (*self.0.stub)
7833                .list_operations(self.0.request, self.0.options)
7834                .await
7835                .map(crate::Response::into_body)
7836        }
7837
7838        /// Streams each page in the collection.
7839        pub fn by_page(
7840            self,
7841        ) -> impl google_cloud_gax::paginator::Paginator<
7842            google_cloud_longrunning::model::ListOperationsResponse,
7843            crate::Error,
7844        > {
7845            use std::clone::Clone;
7846            let token = self.0.request.page_token.clone();
7847            let execute = move |token: String| {
7848                let mut builder = self.clone();
7849                builder.0.request = builder.0.request.set_page_token(token);
7850                builder.send()
7851            };
7852            google_cloud_gax::paginator::internal::new_paginator(token, execute)
7853        }
7854
7855        /// Streams each item in the collection.
7856        pub fn by_item(
7857            self,
7858        ) -> impl google_cloud_gax::paginator::ItemPaginator<
7859            google_cloud_longrunning::model::ListOperationsResponse,
7860            crate::Error,
7861        > {
7862            use google_cloud_gax::paginator::Paginator;
7863            self.by_page().items()
7864        }
7865
7866        /// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
7867        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7868            self.0.request.name = v.into();
7869            self
7870        }
7871
7872        /// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::filter].
7873        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
7874            self.0.request.filter = v.into();
7875            self
7876        }
7877
7878        /// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
7879        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
7880            self.0.request.page_size = v.into();
7881            self
7882        }
7883
7884        /// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
7885        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
7886            self.0.request.page_token = v.into();
7887            self
7888        }
7889
7890        /// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
7891        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
7892            self.0.request.return_partial_success = v.into();
7893            self
7894        }
7895    }
7896
7897    #[doc(hidden)]
7898    impl crate::RequestBuilder for ListOperations {
7899        fn request_options(&mut self) -> &mut crate::RequestOptions {
7900            &mut self.0.options
7901        }
7902    }
7903
7904    /// The request builder for [GroundedGenerationService::get_operation][crate::client::GroundedGenerationService::get_operation] calls.
7905    ///
7906    /// # Example
7907    /// ```
7908    /// # use google_cloud_discoveryengine_v1::builder::grounded_generation_service::GetOperation;
7909    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
7910    ///
7911    /// let builder = prepare_request_builder();
7912    /// let response = builder.send().await?;
7913    /// # Ok(()) }
7914    ///
7915    /// fn prepare_request_builder() -> GetOperation {
7916    ///   # panic!();
7917    ///   // ... details omitted ...
7918    /// }
7919    /// ```
7920    #[derive(Clone, Debug)]
7921    pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
7922
7923    impl GetOperation {
7924        pub(crate) fn new(
7925            stub: std::sync::Arc<dyn super::super::stub::dynamic::GroundedGenerationService>,
7926        ) -> Self {
7927            Self(RequestBuilder::new(stub))
7928        }
7929
7930        /// Sets the full request, replacing any prior values.
7931        pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
7932            mut self,
7933            v: V,
7934        ) -> Self {
7935            self.0.request = v.into();
7936            self
7937        }
7938
7939        /// Sets all the options, replacing any prior values.
7940        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7941            self.0.options = v.into();
7942            self
7943        }
7944
7945        /// Sends the request.
7946        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
7947            (*self.0.stub)
7948                .get_operation(self.0.request, self.0.options)
7949                .await
7950                .map(crate::Response::into_body)
7951        }
7952
7953        /// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
7954        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7955            self.0.request.name = v.into();
7956            self
7957        }
7958    }
7959
7960    #[doc(hidden)]
7961    impl crate::RequestBuilder for GetOperation {
7962        fn request_options(&mut self) -> &mut crate::RequestOptions {
7963            &mut self.0.options
7964        }
7965    }
7966
7967    /// The request builder for [GroundedGenerationService::cancel_operation][crate::client::GroundedGenerationService::cancel_operation] calls.
7968    ///
7969    /// # Example
7970    /// ```
7971    /// # use google_cloud_discoveryengine_v1::builder::grounded_generation_service::CancelOperation;
7972    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
7973    ///
7974    /// let builder = prepare_request_builder();
7975    /// let response = builder.send().await?;
7976    /// # Ok(()) }
7977    ///
7978    /// fn prepare_request_builder() -> CancelOperation {
7979    ///   # panic!();
7980    ///   // ... details omitted ...
7981    /// }
7982    /// ```
7983    #[derive(Clone, Debug)]
7984    pub struct CancelOperation(
7985        RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
7986    );
7987
7988    impl CancelOperation {
7989        pub(crate) fn new(
7990            stub: std::sync::Arc<dyn super::super::stub::dynamic::GroundedGenerationService>,
7991        ) -> Self {
7992            Self(RequestBuilder::new(stub))
7993        }
7994
7995        /// Sets the full request, replacing any prior values.
7996        pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
7997            mut self,
7998            v: V,
7999        ) -> Self {
8000            self.0.request = v.into();
8001            self
8002        }
8003
8004        /// Sets all the options, replacing any prior values.
8005        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
8006            self.0.options = v.into();
8007            self
8008        }
8009
8010        /// Sends the request.
8011        pub async fn send(self) -> Result<()> {
8012            (*self.0.stub)
8013                .cancel_operation(self.0.request, self.0.options)
8014                .await
8015                .map(crate::Response::into_body)
8016        }
8017
8018        /// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::name].
8019        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
8020            self.0.request.name = v.into();
8021            self
8022        }
8023    }
8024
8025    #[doc(hidden)]
8026    impl crate::RequestBuilder for CancelOperation {
8027        fn request_options(&mut self) -> &mut crate::RequestOptions {
8028            &mut self.0.options
8029        }
8030    }
8031}
8032
8033/// Request and client builders for [IdentityMappingStoreService][crate::client::IdentityMappingStoreService].
8034#[cfg(feature = "identity-mapping-store-service")]
8035#[cfg_attr(docsrs, doc(cfg(feature = "identity-mapping-store-service")))]
8036pub mod identity_mapping_store_service {
8037    use crate::Result;
8038
8039    /// A builder for [IdentityMappingStoreService][crate::client::IdentityMappingStoreService].
8040    ///
8041    /// ```
8042    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
8043    /// # use google_cloud_discoveryengine_v1::*;
8044    /// # use builder::identity_mapping_store_service::ClientBuilder;
8045    /// # use client::IdentityMappingStoreService;
8046    /// let builder : ClientBuilder = IdentityMappingStoreService::builder();
8047    /// let client = builder
8048    ///     .with_endpoint("https://discoveryengine.googleapis.com")
8049    ///     .build().await?;
8050    /// # Ok(()) }
8051    /// ```
8052    pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
8053
8054    pub(crate) mod client {
8055        use super::super::super::client::IdentityMappingStoreService;
8056        pub struct Factory;
8057        impl crate::ClientFactory for Factory {
8058            type Client = IdentityMappingStoreService;
8059            type Credentials = gaxi::options::Credentials;
8060            async fn build(
8061                self,
8062                config: gaxi::options::ClientConfig,
8063            ) -> crate::ClientBuilderResult<Self::Client> {
8064                Self::Client::new(config).await
8065            }
8066        }
8067    }
8068
8069    /// Common implementation for [crate::client::IdentityMappingStoreService] request builders.
8070    #[derive(Clone, Debug)]
8071    pub(crate) struct RequestBuilder<R: std::default::Default> {
8072        stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
8073        request: R,
8074        options: crate::RequestOptions,
8075    }
8076
8077    impl<R> RequestBuilder<R>
8078    where
8079        R: std::default::Default,
8080    {
8081        pub(crate) fn new(
8082            stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
8083        ) -> Self {
8084            Self {
8085                stub,
8086                request: R::default(),
8087                options: crate::RequestOptions::default(),
8088            }
8089        }
8090    }
8091
8092    /// The request builder for [IdentityMappingStoreService::create_identity_mapping_store][crate::client::IdentityMappingStoreService::create_identity_mapping_store] calls.
8093    ///
8094    /// # Example
8095    /// ```
8096    /// # use google_cloud_discoveryengine_v1::builder::identity_mapping_store_service::CreateIdentityMappingStore;
8097    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
8098    ///
8099    /// let builder = prepare_request_builder();
8100    /// let response = builder.send().await?;
8101    /// # Ok(()) }
8102    ///
8103    /// fn prepare_request_builder() -> CreateIdentityMappingStore {
8104    ///   # panic!();
8105    ///   // ... details omitted ...
8106    /// }
8107    /// ```
8108    #[derive(Clone, Debug)]
8109    pub struct CreateIdentityMappingStore(
8110        RequestBuilder<crate::model::CreateIdentityMappingStoreRequest>,
8111    );
8112
8113    impl CreateIdentityMappingStore {
8114        pub(crate) fn new(
8115            stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
8116        ) -> Self {
8117            Self(RequestBuilder::new(stub))
8118        }
8119
8120        /// Sets the full request, replacing any prior values.
8121        pub fn with_request<V: Into<crate::model::CreateIdentityMappingStoreRequest>>(
8122            mut self,
8123            v: V,
8124        ) -> Self {
8125            self.0.request = v.into();
8126            self
8127        }
8128
8129        /// Sets all the options, replacing any prior values.
8130        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
8131            self.0.options = v.into();
8132            self
8133        }
8134
8135        /// Sends the request.
8136        pub async fn send(self) -> Result<crate::model::IdentityMappingStore> {
8137            (*self.0.stub)
8138                .create_identity_mapping_store(self.0.request, self.0.options)
8139                .await
8140                .map(crate::Response::into_body)
8141        }
8142
8143        /// Sets the value of [parent][crate::model::CreateIdentityMappingStoreRequest::parent].
8144        ///
8145        /// This is a **required** field for requests.
8146        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
8147            self.0.request.parent = v.into();
8148            self
8149        }
8150
8151        /// Sets the value of [identity_mapping_store_id][crate::model::CreateIdentityMappingStoreRequest::identity_mapping_store_id].
8152        ///
8153        /// This is a **required** field for requests.
8154        pub fn set_identity_mapping_store_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
8155            self.0.request.identity_mapping_store_id = v.into();
8156            self
8157        }
8158
8159        /// Sets the value of [identity_mapping_store][crate::model::CreateIdentityMappingStoreRequest::identity_mapping_store].
8160        ///
8161        /// This is a **required** field for requests.
8162        pub fn set_identity_mapping_store<T>(mut self, v: T) -> Self
8163        where
8164            T: std::convert::Into<crate::model::IdentityMappingStore>,
8165        {
8166            self.0.request.identity_mapping_store = std::option::Option::Some(v.into());
8167            self
8168        }
8169
8170        /// Sets or clears the value of [identity_mapping_store][crate::model::CreateIdentityMappingStoreRequest::identity_mapping_store].
8171        ///
8172        /// This is a **required** field for requests.
8173        pub fn set_or_clear_identity_mapping_store<T>(mut self, v: std::option::Option<T>) -> Self
8174        where
8175            T: std::convert::Into<crate::model::IdentityMappingStore>,
8176        {
8177            self.0.request.identity_mapping_store = v.map(|x| x.into());
8178            self
8179        }
8180
8181        /// Sets the value of [cmek_options][crate::model::CreateIdentityMappingStoreRequest::cmek_options].
8182        ///
8183        /// Note that all the setters affecting `cmek_options` are
8184        /// mutually exclusive.
8185        pub fn set_cmek_options<
8186            T: Into<Option<crate::model::create_identity_mapping_store_request::CmekOptions>>,
8187        >(
8188            mut self,
8189            v: T,
8190        ) -> Self {
8191            self.0.request.cmek_options = v.into();
8192            self
8193        }
8194
8195        /// Sets the value of [cmek_options][crate::model::CreateIdentityMappingStoreRequest::cmek_options]
8196        /// to hold a `CmekConfigName`.
8197        ///
8198        /// Note that all the setters affecting `cmek_options` are
8199        /// mutually exclusive.
8200        pub fn set_cmek_config_name<T: std::convert::Into<std::string::String>>(
8201            mut self,
8202            v: T,
8203        ) -> Self {
8204            self.0.request = self.0.request.set_cmek_config_name(v);
8205            self
8206        }
8207
8208        /// Sets the value of [cmek_options][crate::model::CreateIdentityMappingStoreRequest::cmek_options]
8209        /// to hold a `DisableCmek`.
8210        ///
8211        /// Note that all the setters affecting `cmek_options` are
8212        /// mutually exclusive.
8213        pub fn set_disable_cmek<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
8214            self.0.request = self.0.request.set_disable_cmek(v);
8215            self
8216        }
8217    }
8218
8219    #[doc(hidden)]
8220    impl crate::RequestBuilder for CreateIdentityMappingStore {
8221        fn request_options(&mut self) -> &mut crate::RequestOptions {
8222            &mut self.0.options
8223        }
8224    }
8225
8226    /// The request builder for [IdentityMappingStoreService::get_identity_mapping_store][crate::client::IdentityMappingStoreService::get_identity_mapping_store] calls.
8227    ///
8228    /// # Example
8229    /// ```
8230    /// # use google_cloud_discoveryengine_v1::builder::identity_mapping_store_service::GetIdentityMappingStore;
8231    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
8232    ///
8233    /// let builder = prepare_request_builder();
8234    /// let response = builder.send().await?;
8235    /// # Ok(()) }
8236    ///
8237    /// fn prepare_request_builder() -> GetIdentityMappingStore {
8238    ///   # panic!();
8239    ///   // ... details omitted ...
8240    /// }
8241    /// ```
8242    #[derive(Clone, Debug)]
8243    pub struct GetIdentityMappingStore(
8244        RequestBuilder<crate::model::GetIdentityMappingStoreRequest>,
8245    );
8246
8247    impl GetIdentityMappingStore {
8248        pub(crate) fn new(
8249            stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
8250        ) -> Self {
8251            Self(RequestBuilder::new(stub))
8252        }
8253
8254        /// Sets the full request, replacing any prior values.
8255        pub fn with_request<V: Into<crate::model::GetIdentityMappingStoreRequest>>(
8256            mut self,
8257            v: V,
8258        ) -> Self {
8259            self.0.request = v.into();
8260            self
8261        }
8262
8263        /// Sets all the options, replacing any prior values.
8264        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
8265            self.0.options = v.into();
8266            self
8267        }
8268
8269        /// Sends the request.
8270        pub async fn send(self) -> Result<crate::model::IdentityMappingStore> {
8271            (*self.0.stub)
8272                .get_identity_mapping_store(self.0.request, self.0.options)
8273                .await
8274                .map(crate::Response::into_body)
8275        }
8276
8277        /// Sets the value of [name][crate::model::GetIdentityMappingStoreRequest::name].
8278        ///
8279        /// This is a **required** field for requests.
8280        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
8281            self.0.request.name = v.into();
8282            self
8283        }
8284    }
8285
8286    #[doc(hidden)]
8287    impl crate::RequestBuilder for GetIdentityMappingStore {
8288        fn request_options(&mut self) -> &mut crate::RequestOptions {
8289            &mut self.0.options
8290        }
8291    }
8292
8293    /// The request builder for [IdentityMappingStoreService::delete_identity_mapping_store][crate::client::IdentityMappingStoreService::delete_identity_mapping_store] calls.
8294    ///
8295    /// # Example
8296    /// ```
8297    /// # use google_cloud_discoveryengine_v1::builder::identity_mapping_store_service::DeleteIdentityMappingStore;
8298    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
8299    /// use google_cloud_lro::Poller;
8300    ///
8301    /// let builder = prepare_request_builder();
8302    /// let response = builder.poller().until_done().await?;
8303    /// # Ok(()) }
8304    ///
8305    /// fn prepare_request_builder() -> DeleteIdentityMappingStore {
8306    ///   # panic!();
8307    ///   // ... details omitted ...
8308    /// }
8309    /// ```
8310    #[derive(Clone, Debug)]
8311    pub struct DeleteIdentityMappingStore(
8312        RequestBuilder<crate::model::DeleteIdentityMappingStoreRequest>,
8313    );
8314
8315    impl DeleteIdentityMappingStore {
8316        pub(crate) fn new(
8317            stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
8318        ) -> Self {
8319            Self(RequestBuilder::new(stub))
8320        }
8321
8322        /// Sets the full request, replacing any prior values.
8323        pub fn with_request<V: Into<crate::model::DeleteIdentityMappingStoreRequest>>(
8324            mut self,
8325            v: V,
8326        ) -> Self {
8327            self.0.request = v.into();
8328            self
8329        }
8330
8331        /// Sets all the options, replacing any prior values.
8332        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
8333            self.0.options = v.into();
8334            self
8335        }
8336
8337        /// Sends the request.
8338        ///
8339        /// # Long running operations
8340        ///
8341        /// This starts, but does not poll, a longrunning operation. More information
8342        /// on [delete_identity_mapping_store][crate::client::IdentityMappingStoreService::delete_identity_mapping_store].
8343        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
8344            (*self.0.stub)
8345                .delete_identity_mapping_store(self.0.request, self.0.options)
8346                .await
8347                .map(crate::Response::into_body)
8348        }
8349
8350        /// Creates a [Poller][google_cloud_lro::Poller] to work with `delete_identity_mapping_store`.
8351        pub fn poller(
8352            self,
8353        ) -> impl google_cloud_lro::Poller<(), crate::model::DeleteIdentityMappingStoreMetadata>
8354        {
8355            type Operation = google_cloud_lro::internal::Operation<
8356                wkt::Empty,
8357                crate::model::DeleteIdentityMappingStoreMetadata,
8358            >;
8359            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
8360            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
8361            let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
8362            if let Some(ref mut details) = poller_options.tracing {
8363                details.method_name = "google_cloud_discoveryengine_v1::client::IdentityMappingStoreService::delete_identity_mapping_store::until_done";
8364            }
8365
8366            let stub = self.0.stub.clone();
8367            let mut options = self.0.options.clone();
8368            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
8369            let query = move |name| {
8370                let stub = stub.clone();
8371                let options = options.clone();
8372                async {
8373                    let op = GetOperation::new(stub)
8374                        .set_name(name)
8375                        .with_options(options)
8376                        .send()
8377                        .await?;
8378                    Ok(Operation::new(op))
8379                }
8380            };
8381
8382            let start = move || async {
8383                let op = self.send().await?;
8384                Ok(Operation::new(op))
8385            };
8386
8387            use google_cloud_lro::internal::PollerExt;
8388            {
8389                google_cloud_lro::internal::new_unit_response_poller(
8390                    polling_error_policy,
8391                    polling_backoff_policy,
8392                    start,
8393                    query,
8394                )
8395            }
8396            .with_options(poller_options)
8397        }
8398
8399        /// Sets the value of [name][crate::model::DeleteIdentityMappingStoreRequest::name].
8400        ///
8401        /// This is a **required** field for requests.
8402        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
8403            self.0.request.name = v.into();
8404            self
8405        }
8406    }
8407
8408    #[doc(hidden)]
8409    impl crate::RequestBuilder for DeleteIdentityMappingStore {
8410        fn request_options(&mut self) -> &mut crate::RequestOptions {
8411            &mut self.0.options
8412        }
8413    }
8414
8415    /// The request builder for [IdentityMappingStoreService::import_identity_mappings][crate::client::IdentityMappingStoreService::import_identity_mappings] calls.
8416    ///
8417    /// # Example
8418    /// ```
8419    /// # use google_cloud_discoveryengine_v1::builder::identity_mapping_store_service::ImportIdentityMappings;
8420    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
8421    /// use google_cloud_lro::Poller;
8422    ///
8423    /// let builder = prepare_request_builder();
8424    /// let response = builder.poller().until_done().await?;
8425    /// # Ok(()) }
8426    ///
8427    /// fn prepare_request_builder() -> ImportIdentityMappings {
8428    ///   # panic!();
8429    ///   // ... details omitted ...
8430    /// }
8431    /// ```
8432    #[derive(Clone, Debug)]
8433    pub struct ImportIdentityMappings(RequestBuilder<crate::model::ImportIdentityMappingsRequest>);
8434
8435    impl ImportIdentityMappings {
8436        pub(crate) fn new(
8437            stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
8438        ) -> Self {
8439            Self(RequestBuilder::new(stub))
8440        }
8441
8442        /// Sets the full request, replacing any prior values.
8443        pub fn with_request<V: Into<crate::model::ImportIdentityMappingsRequest>>(
8444            mut self,
8445            v: V,
8446        ) -> Self {
8447            self.0.request = v.into();
8448            self
8449        }
8450
8451        /// Sets all the options, replacing any prior values.
8452        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
8453            self.0.options = v.into();
8454            self
8455        }
8456
8457        /// Sends the request.
8458        ///
8459        /// # Long running operations
8460        ///
8461        /// This starts, but does not poll, a longrunning operation. More information
8462        /// on [import_identity_mappings][crate::client::IdentityMappingStoreService::import_identity_mappings].
8463        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
8464            (*self.0.stub)
8465                .import_identity_mappings(self.0.request, self.0.options)
8466                .await
8467                .map(crate::Response::into_body)
8468        }
8469
8470        /// Creates a [Poller][google_cloud_lro::Poller] to work with `import_identity_mappings`.
8471        pub fn poller(
8472            self,
8473        ) -> impl google_cloud_lro::Poller<
8474            crate::model::ImportIdentityMappingsResponse,
8475            crate::model::IdentityMappingEntryOperationMetadata,
8476        > {
8477            type Operation = google_cloud_lro::internal::Operation<
8478                crate::model::ImportIdentityMappingsResponse,
8479                crate::model::IdentityMappingEntryOperationMetadata,
8480            >;
8481            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
8482            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
8483            let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
8484            if let Some(ref mut details) = poller_options.tracing {
8485                details.method_name = "google_cloud_discoveryengine_v1::client::IdentityMappingStoreService::import_identity_mappings::until_done";
8486            }
8487
8488            let stub = self.0.stub.clone();
8489            let mut options = self.0.options.clone();
8490            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
8491            let query = move |name| {
8492                let stub = stub.clone();
8493                let options = options.clone();
8494                async {
8495                    let op = GetOperation::new(stub)
8496                        .set_name(name)
8497                        .with_options(options)
8498                        .send()
8499                        .await?;
8500                    Ok(Operation::new(op))
8501                }
8502            };
8503
8504            let start = move || async {
8505                let op = self.send().await?;
8506                Ok(Operation::new(op))
8507            };
8508
8509            use google_cloud_lro::internal::PollerExt;
8510            {
8511                google_cloud_lro::internal::new_poller(
8512                    polling_error_policy,
8513                    polling_backoff_policy,
8514                    start,
8515                    query,
8516                )
8517            }
8518            .with_options(poller_options)
8519        }
8520
8521        /// Sets the value of [identity_mapping_store][crate::model::ImportIdentityMappingsRequest::identity_mapping_store].
8522        ///
8523        /// This is a **required** field for requests.
8524        pub fn set_identity_mapping_store<T: Into<std::string::String>>(mut self, v: T) -> Self {
8525            self.0.request.identity_mapping_store = v.into();
8526            self
8527        }
8528
8529        /// Sets the value of [source][crate::model::ImportIdentityMappingsRequest::source].
8530        ///
8531        /// Note that all the setters affecting `source` are
8532        /// mutually exclusive.
8533        pub fn set_source<
8534            T: Into<Option<crate::model::import_identity_mappings_request::Source>>,
8535        >(
8536            mut self,
8537            v: T,
8538        ) -> Self {
8539            self.0.request.source = v.into();
8540            self
8541        }
8542
8543        /// Sets the value of [source][crate::model::ImportIdentityMappingsRequest::source]
8544        /// to hold a `InlineSource`.
8545        ///
8546        /// Note that all the setters affecting `source` are
8547        /// mutually exclusive.
8548        pub fn set_inline_source<
8549            T: std::convert::Into<
8550                    std::boxed::Box<crate::model::import_identity_mappings_request::InlineSource>,
8551                >,
8552        >(
8553            mut self,
8554            v: T,
8555        ) -> Self {
8556            self.0.request = self.0.request.set_inline_source(v);
8557            self
8558        }
8559    }
8560
8561    #[doc(hidden)]
8562    impl crate::RequestBuilder for ImportIdentityMappings {
8563        fn request_options(&mut self) -> &mut crate::RequestOptions {
8564            &mut self.0.options
8565        }
8566    }
8567
8568    /// The request builder for [IdentityMappingStoreService::purge_identity_mappings][crate::client::IdentityMappingStoreService::purge_identity_mappings] calls.
8569    ///
8570    /// # Example
8571    /// ```
8572    /// # use google_cloud_discoveryengine_v1::builder::identity_mapping_store_service::PurgeIdentityMappings;
8573    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
8574    /// use google_cloud_lro::Poller;
8575    ///
8576    /// let builder = prepare_request_builder();
8577    /// let response = builder.poller().until_done().await?;
8578    /// # Ok(()) }
8579    ///
8580    /// fn prepare_request_builder() -> PurgeIdentityMappings {
8581    ///   # panic!();
8582    ///   // ... details omitted ...
8583    /// }
8584    /// ```
8585    #[derive(Clone, Debug)]
8586    pub struct PurgeIdentityMappings(RequestBuilder<crate::model::PurgeIdentityMappingsRequest>);
8587
8588    impl PurgeIdentityMappings {
8589        pub(crate) fn new(
8590            stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
8591        ) -> Self {
8592            Self(RequestBuilder::new(stub))
8593        }
8594
8595        /// Sets the full request, replacing any prior values.
8596        pub fn with_request<V: Into<crate::model::PurgeIdentityMappingsRequest>>(
8597            mut self,
8598            v: V,
8599        ) -> Self {
8600            self.0.request = v.into();
8601            self
8602        }
8603
8604        /// Sets all the options, replacing any prior values.
8605        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
8606            self.0.options = v.into();
8607            self
8608        }
8609
8610        /// Sends the request.
8611        ///
8612        /// # Long running operations
8613        ///
8614        /// This starts, but does not poll, a longrunning operation. More information
8615        /// on [purge_identity_mappings][crate::client::IdentityMappingStoreService::purge_identity_mappings].
8616        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
8617            (*self.0.stub)
8618                .purge_identity_mappings(self.0.request, self.0.options)
8619                .await
8620                .map(crate::Response::into_body)
8621        }
8622
8623        /// Creates a [Poller][google_cloud_lro::Poller] to work with `purge_identity_mappings`.
8624        pub fn poller(
8625            self,
8626        ) -> impl google_cloud_lro::Poller<(), crate::model::IdentityMappingEntryOperationMetadata>
8627        {
8628            type Operation = google_cloud_lro::internal::Operation<
8629                wkt::Empty,
8630                crate::model::IdentityMappingEntryOperationMetadata,
8631            >;
8632            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
8633            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
8634            let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
8635            if let Some(ref mut details) = poller_options.tracing {
8636                details.method_name = "google_cloud_discoveryengine_v1::client::IdentityMappingStoreService::purge_identity_mappings::until_done";
8637            }
8638
8639            let stub = self.0.stub.clone();
8640            let mut options = self.0.options.clone();
8641            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
8642            let query = move |name| {
8643                let stub = stub.clone();
8644                let options = options.clone();
8645                async {
8646                    let op = GetOperation::new(stub)
8647                        .set_name(name)
8648                        .with_options(options)
8649                        .send()
8650                        .await?;
8651                    Ok(Operation::new(op))
8652                }
8653            };
8654
8655            let start = move || async {
8656                let op = self.send().await?;
8657                Ok(Operation::new(op))
8658            };
8659
8660            use google_cloud_lro::internal::PollerExt;
8661            {
8662                google_cloud_lro::internal::new_unit_response_poller(
8663                    polling_error_policy,
8664                    polling_backoff_policy,
8665                    start,
8666                    query,
8667                )
8668            }
8669            .with_options(poller_options)
8670        }
8671
8672        /// Sets the value of [identity_mapping_store][crate::model::PurgeIdentityMappingsRequest::identity_mapping_store].
8673        ///
8674        /// This is a **required** field for requests.
8675        pub fn set_identity_mapping_store<T: Into<std::string::String>>(mut self, v: T) -> Self {
8676            self.0.request.identity_mapping_store = v.into();
8677            self
8678        }
8679
8680        /// Sets the value of [filter][crate::model::PurgeIdentityMappingsRequest::filter].
8681        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
8682            self.0.request.filter = v.into();
8683            self
8684        }
8685
8686        /// Sets the value of [force][crate::model::PurgeIdentityMappingsRequest::force].
8687        pub fn set_force<T>(mut self, v: T) -> Self
8688        where
8689            T: std::convert::Into<bool>,
8690        {
8691            self.0.request.force = std::option::Option::Some(v.into());
8692            self
8693        }
8694
8695        /// Sets or clears the value of [force][crate::model::PurgeIdentityMappingsRequest::force].
8696        pub fn set_or_clear_force<T>(mut self, v: std::option::Option<T>) -> Self
8697        where
8698            T: std::convert::Into<bool>,
8699        {
8700            self.0.request.force = v.map(|x| x.into());
8701            self
8702        }
8703
8704        /// Sets the value of [source][crate::model::PurgeIdentityMappingsRequest::source].
8705        ///
8706        /// Note that all the setters affecting `source` are
8707        /// mutually exclusive.
8708        pub fn set_source<
8709            T: Into<Option<crate::model::purge_identity_mappings_request::Source>>,
8710        >(
8711            mut self,
8712            v: T,
8713        ) -> Self {
8714            self.0.request.source = v.into();
8715            self
8716        }
8717
8718        /// Sets the value of [source][crate::model::PurgeIdentityMappingsRequest::source]
8719        /// to hold a `InlineSource`.
8720        ///
8721        /// Note that all the setters affecting `source` are
8722        /// mutually exclusive.
8723        pub fn set_inline_source<
8724            T: std::convert::Into<
8725                    std::boxed::Box<crate::model::purge_identity_mappings_request::InlineSource>,
8726                >,
8727        >(
8728            mut self,
8729            v: T,
8730        ) -> Self {
8731            self.0.request = self.0.request.set_inline_source(v);
8732            self
8733        }
8734    }
8735
8736    #[doc(hidden)]
8737    impl crate::RequestBuilder for PurgeIdentityMappings {
8738        fn request_options(&mut self) -> &mut crate::RequestOptions {
8739            &mut self.0.options
8740        }
8741    }
8742
8743    /// The request builder for [IdentityMappingStoreService::list_identity_mappings][crate::client::IdentityMappingStoreService::list_identity_mappings] calls.
8744    ///
8745    /// # Example
8746    /// ```
8747    /// # use google_cloud_discoveryengine_v1::builder::identity_mapping_store_service::ListIdentityMappings;
8748    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
8749    /// use google_cloud_gax::paginator::ItemPaginator;
8750    ///
8751    /// let builder = prepare_request_builder();
8752    /// let mut items = builder.by_item();
8753    /// while let Some(result) = items.next().await {
8754    ///   let item = result?;
8755    /// }
8756    /// # Ok(()) }
8757    ///
8758    /// fn prepare_request_builder() -> ListIdentityMappings {
8759    ///   # panic!();
8760    ///   // ... details omitted ...
8761    /// }
8762    /// ```
8763    #[derive(Clone, Debug)]
8764    pub struct ListIdentityMappings(RequestBuilder<crate::model::ListIdentityMappingsRequest>);
8765
8766    impl ListIdentityMappings {
8767        pub(crate) fn new(
8768            stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
8769        ) -> Self {
8770            Self(RequestBuilder::new(stub))
8771        }
8772
8773        /// Sets the full request, replacing any prior values.
8774        pub fn with_request<V: Into<crate::model::ListIdentityMappingsRequest>>(
8775            mut self,
8776            v: V,
8777        ) -> Self {
8778            self.0.request = v.into();
8779            self
8780        }
8781
8782        /// Sets all the options, replacing any prior values.
8783        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
8784            self.0.options = v.into();
8785            self
8786        }
8787
8788        /// Sends the request.
8789        pub async fn send(self) -> Result<crate::model::ListIdentityMappingsResponse> {
8790            (*self.0.stub)
8791                .list_identity_mappings(self.0.request, self.0.options)
8792                .await
8793                .map(crate::Response::into_body)
8794        }
8795
8796        /// Streams each page in the collection.
8797        pub fn by_page(
8798            self,
8799        ) -> impl google_cloud_gax::paginator::Paginator<
8800            crate::model::ListIdentityMappingsResponse,
8801            crate::Error,
8802        > {
8803            use std::clone::Clone;
8804            let token = self.0.request.page_token.clone();
8805            let execute = move |token: String| {
8806                let mut builder = self.clone();
8807                builder.0.request = builder.0.request.set_page_token(token);
8808                builder.send()
8809            };
8810            google_cloud_gax::paginator::internal::new_paginator(token, execute)
8811        }
8812
8813        /// Streams each item in the collection.
8814        pub fn by_item(
8815            self,
8816        ) -> impl google_cloud_gax::paginator::ItemPaginator<
8817            crate::model::ListIdentityMappingsResponse,
8818            crate::Error,
8819        > {
8820            use google_cloud_gax::paginator::Paginator;
8821            self.by_page().items()
8822        }
8823
8824        /// Sets the value of [identity_mapping_store][crate::model::ListIdentityMappingsRequest::identity_mapping_store].
8825        ///
8826        /// This is a **required** field for requests.
8827        pub fn set_identity_mapping_store<T: Into<std::string::String>>(mut self, v: T) -> Self {
8828            self.0.request.identity_mapping_store = v.into();
8829            self
8830        }
8831
8832        /// Sets the value of [page_size][crate::model::ListIdentityMappingsRequest::page_size].
8833        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
8834            self.0.request.page_size = v.into();
8835            self
8836        }
8837
8838        /// Sets the value of [page_token][crate::model::ListIdentityMappingsRequest::page_token].
8839        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
8840            self.0.request.page_token = v.into();
8841            self
8842        }
8843    }
8844
8845    #[doc(hidden)]
8846    impl crate::RequestBuilder for ListIdentityMappings {
8847        fn request_options(&mut self) -> &mut crate::RequestOptions {
8848            &mut self.0.options
8849        }
8850    }
8851
8852    /// The request builder for [IdentityMappingStoreService::list_identity_mapping_stores][crate::client::IdentityMappingStoreService::list_identity_mapping_stores] calls.
8853    ///
8854    /// # Example
8855    /// ```
8856    /// # use google_cloud_discoveryengine_v1::builder::identity_mapping_store_service::ListIdentityMappingStores;
8857    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
8858    /// use google_cloud_gax::paginator::ItemPaginator;
8859    ///
8860    /// let builder = prepare_request_builder();
8861    /// let mut items = builder.by_item();
8862    /// while let Some(result) = items.next().await {
8863    ///   let item = result?;
8864    /// }
8865    /// # Ok(()) }
8866    ///
8867    /// fn prepare_request_builder() -> ListIdentityMappingStores {
8868    ///   # panic!();
8869    ///   // ... details omitted ...
8870    /// }
8871    /// ```
8872    #[derive(Clone, Debug)]
8873    pub struct ListIdentityMappingStores(
8874        RequestBuilder<crate::model::ListIdentityMappingStoresRequest>,
8875    );
8876
8877    impl ListIdentityMappingStores {
8878        pub(crate) fn new(
8879            stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
8880        ) -> Self {
8881            Self(RequestBuilder::new(stub))
8882        }
8883
8884        /// Sets the full request, replacing any prior values.
8885        pub fn with_request<V: Into<crate::model::ListIdentityMappingStoresRequest>>(
8886            mut self,
8887            v: V,
8888        ) -> Self {
8889            self.0.request = v.into();
8890            self
8891        }
8892
8893        /// Sets all the options, replacing any prior values.
8894        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
8895            self.0.options = v.into();
8896            self
8897        }
8898
8899        /// Sends the request.
8900        pub async fn send(self) -> Result<crate::model::ListIdentityMappingStoresResponse> {
8901            (*self.0.stub)
8902                .list_identity_mapping_stores(self.0.request, self.0.options)
8903                .await
8904                .map(crate::Response::into_body)
8905        }
8906
8907        /// Streams each page in the collection.
8908        pub fn by_page(
8909            self,
8910        ) -> impl google_cloud_gax::paginator::Paginator<
8911            crate::model::ListIdentityMappingStoresResponse,
8912            crate::Error,
8913        > {
8914            use std::clone::Clone;
8915            let token = self.0.request.page_token.clone();
8916            let execute = move |token: String| {
8917                let mut builder = self.clone();
8918                builder.0.request = builder.0.request.set_page_token(token);
8919                builder.send()
8920            };
8921            google_cloud_gax::paginator::internal::new_paginator(token, execute)
8922        }
8923
8924        /// Streams each item in the collection.
8925        pub fn by_item(
8926            self,
8927        ) -> impl google_cloud_gax::paginator::ItemPaginator<
8928            crate::model::ListIdentityMappingStoresResponse,
8929            crate::Error,
8930        > {
8931            use google_cloud_gax::paginator::Paginator;
8932            self.by_page().items()
8933        }
8934
8935        /// Sets the value of [parent][crate::model::ListIdentityMappingStoresRequest::parent].
8936        ///
8937        /// This is a **required** field for requests.
8938        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
8939            self.0.request.parent = v.into();
8940            self
8941        }
8942
8943        /// Sets the value of [page_size][crate::model::ListIdentityMappingStoresRequest::page_size].
8944        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
8945            self.0.request.page_size = v.into();
8946            self
8947        }
8948
8949        /// Sets the value of [page_token][crate::model::ListIdentityMappingStoresRequest::page_token].
8950        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
8951            self.0.request.page_token = v.into();
8952            self
8953        }
8954    }
8955
8956    #[doc(hidden)]
8957    impl crate::RequestBuilder for ListIdentityMappingStores {
8958        fn request_options(&mut self) -> &mut crate::RequestOptions {
8959            &mut self.0.options
8960        }
8961    }
8962
8963    /// The request builder for [IdentityMappingStoreService::list_operations][crate::client::IdentityMappingStoreService::list_operations] calls.
8964    ///
8965    /// # Example
8966    /// ```
8967    /// # use google_cloud_discoveryengine_v1::builder::identity_mapping_store_service::ListOperations;
8968    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
8969    /// use google_cloud_gax::paginator::ItemPaginator;
8970    ///
8971    /// let builder = prepare_request_builder();
8972    /// let mut items = builder.by_item();
8973    /// while let Some(result) = items.next().await {
8974    ///   let item = result?;
8975    /// }
8976    /// # Ok(()) }
8977    ///
8978    /// fn prepare_request_builder() -> ListOperations {
8979    ///   # panic!();
8980    ///   // ... details omitted ...
8981    /// }
8982    /// ```
8983    #[derive(Clone, Debug)]
8984    pub struct ListOperations(
8985        RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
8986    );
8987
8988    impl ListOperations {
8989        pub(crate) fn new(
8990            stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
8991        ) -> Self {
8992            Self(RequestBuilder::new(stub))
8993        }
8994
8995        /// Sets the full request, replacing any prior values.
8996        pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
8997            mut self,
8998            v: V,
8999        ) -> Self {
9000            self.0.request = v.into();
9001            self
9002        }
9003
9004        /// Sets all the options, replacing any prior values.
9005        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
9006            self.0.options = v.into();
9007            self
9008        }
9009
9010        /// Sends the request.
9011        pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
9012            (*self.0.stub)
9013                .list_operations(self.0.request, self.0.options)
9014                .await
9015                .map(crate::Response::into_body)
9016        }
9017
9018        /// Streams each page in the collection.
9019        pub fn by_page(
9020            self,
9021        ) -> impl google_cloud_gax::paginator::Paginator<
9022            google_cloud_longrunning::model::ListOperationsResponse,
9023            crate::Error,
9024        > {
9025            use std::clone::Clone;
9026            let token = self.0.request.page_token.clone();
9027            let execute = move |token: String| {
9028                let mut builder = self.clone();
9029                builder.0.request = builder.0.request.set_page_token(token);
9030                builder.send()
9031            };
9032            google_cloud_gax::paginator::internal::new_paginator(token, execute)
9033        }
9034
9035        /// Streams each item in the collection.
9036        pub fn by_item(
9037            self,
9038        ) -> impl google_cloud_gax::paginator::ItemPaginator<
9039            google_cloud_longrunning::model::ListOperationsResponse,
9040            crate::Error,
9041        > {
9042            use google_cloud_gax::paginator::Paginator;
9043            self.by_page().items()
9044        }
9045
9046        /// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
9047        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9048            self.0.request.name = v.into();
9049            self
9050        }
9051
9052        /// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::filter].
9053        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
9054            self.0.request.filter = v.into();
9055            self
9056        }
9057
9058        /// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
9059        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
9060            self.0.request.page_size = v.into();
9061            self
9062        }
9063
9064        /// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
9065        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
9066            self.0.request.page_token = v.into();
9067            self
9068        }
9069
9070        /// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
9071        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
9072            self.0.request.return_partial_success = v.into();
9073            self
9074        }
9075    }
9076
9077    #[doc(hidden)]
9078    impl crate::RequestBuilder for ListOperations {
9079        fn request_options(&mut self) -> &mut crate::RequestOptions {
9080            &mut self.0.options
9081        }
9082    }
9083
9084    /// The request builder for [IdentityMappingStoreService::get_operation][crate::client::IdentityMappingStoreService::get_operation] calls.
9085    ///
9086    /// # Example
9087    /// ```
9088    /// # use google_cloud_discoveryengine_v1::builder::identity_mapping_store_service::GetOperation;
9089    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
9090    ///
9091    /// let builder = prepare_request_builder();
9092    /// let response = builder.send().await?;
9093    /// # Ok(()) }
9094    ///
9095    /// fn prepare_request_builder() -> GetOperation {
9096    ///   # panic!();
9097    ///   // ... details omitted ...
9098    /// }
9099    /// ```
9100    #[derive(Clone, Debug)]
9101    pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
9102
9103    impl GetOperation {
9104        pub(crate) fn new(
9105            stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
9106        ) -> Self {
9107            Self(RequestBuilder::new(stub))
9108        }
9109
9110        /// Sets the full request, replacing any prior values.
9111        pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
9112            mut self,
9113            v: V,
9114        ) -> Self {
9115            self.0.request = v.into();
9116            self
9117        }
9118
9119        /// Sets all the options, replacing any prior values.
9120        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
9121            self.0.options = v.into();
9122            self
9123        }
9124
9125        /// Sends the request.
9126        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
9127            (*self.0.stub)
9128                .get_operation(self.0.request, self.0.options)
9129                .await
9130                .map(crate::Response::into_body)
9131        }
9132
9133        /// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
9134        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9135            self.0.request.name = v.into();
9136            self
9137        }
9138    }
9139
9140    #[doc(hidden)]
9141    impl crate::RequestBuilder for GetOperation {
9142        fn request_options(&mut self) -> &mut crate::RequestOptions {
9143            &mut self.0.options
9144        }
9145    }
9146
9147    /// The request builder for [IdentityMappingStoreService::cancel_operation][crate::client::IdentityMappingStoreService::cancel_operation] calls.
9148    ///
9149    /// # Example
9150    /// ```
9151    /// # use google_cloud_discoveryengine_v1::builder::identity_mapping_store_service::CancelOperation;
9152    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
9153    ///
9154    /// let builder = prepare_request_builder();
9155    /// let response = builder.send().await?;
9156    /// # Ok(()) }
9157    ///
9158    /// fn prepare_request_builder() -> CancelOperation {
9159    ///   # panic!();
9160    ///   // ... details omitted ...
9161    /// }
9162    /// ```
9163    #[derive(Clone, Debug)]
9164    pub struct CancelOperation(
9165        RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
9166    );
9167
9168    impl CancelOperation {
9169        pub(crate) fn new(
9170            stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
9171        ) -> Self {
9172            Self(RequestBuilder::new(stub))
9173        }
9174
9175        /// Sets the full request, replacing any prior values.
9176        pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
9177            mut self,
9178            v: V,
9179        ) -> Self {
9180            self.0.request = v.into();
9181            self
9182        }
9183
9184        /// Sets all the options, replacing any prior values.
9185        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
9186            self.0.options = v.into();
9187            self
9188        }
9189
9190        /// Sends the request.
9191        pub async fn send(self) -> Result<()> {
9192            (*self.0.stub)
9193                .cancel_operation(self.0.request, self.0.options)
9194                .await
9195                .map(crate::Response::into_body)
9196        }
9197
9198        /// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::name].
9199        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9200            self.0.request.name = v.into();
9201            self
9202        }
9203    }
9204
9205    #[doc(hidden)]
9206    impl crate::RequestBuilder for CancelOperation {
9207        fn request_options(&mut self) -> &mut crate::RequestOptions {
9208            &mut self.0.options
9209        }
9210    }
9211}
9212
9213/// Request and client builders for [ProjectService][crate::client::ProjectService].
9214#[cfg(feature = "project-service")]
9215#[cfg_attr(docsrs, doc(cfg(feature = "project-service")))]
9216pub mod project_service {
9217    use crate::Result;
9218
9219    /// A builder for [ProjectService][crate::client::ProjectService].
9220    ///
9221    /// ```
9222    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
9223    /// # use google_cloud_discoveryengine_v1::*;
9224    /// # use builder::project_service::ClientBuilder;
9225    /// # use client::ProjectService;
9226    /// let builder : ClientBuilder = ProjectService::builder();
9227    /// let client = builder
9228    ///     .with_endpoint("https://discoveryengine.googleapis.com")
9229    ///     .build().await?;
9230    /// # Ok(()) }
9231    /// ```
9232    pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
9233
9234    pub(crate) mod client {
9235        use super::super::super::client::ProjectService;
9236        pub struct Factory;
9237        impl crate::ClientFactory for Factory {
9238            type Client = ProjectService;
9239            type Credentials = gaxi::options::Credentials;
9240            async fn build(
9241                self,
9242                config: gaxi::options::ClientConfig,
9243            ) -> crate::ClientBuilderResult<Self::Client> {
9244                Self::Client::new(config).await
9245            }
9246        }
9247    }
9248
9249    /// Common implementation for [crate::client::ProjectService] request builders.
9250    #[derive(Clone, Debug)]
9251    pub(crate) struct RequestBuilder<R: std::default::Default> {
9252        stub: std::sync::Arc<dyn super::super::stub::dynamic::ProjectService>,
9253        request: R,
9254        options: crate::RequestOptions,
9255    }
9256
9257    impl<R> RequestBuilder<R>
9258    where
9259        R: std::default::Default,
9260    {
9261        pub(crate) fn new(
9262            stub: std::sync::Arc<dyn super::super::stub::dynamic::ProjectService>,
9263        ) -> Self {
9264            Self {
9265                stub,
9266                request: R::default(),
9267                options: crate::RequestOptions::default(),
9268            }
9269        }
9270    }
9271
9272    /// The request builder for [ProjectService::provision_project][crate::client::ProjectService::provision_project] calls.
9273    ///
9274    /// # Example
9275    /// ```
9276    /// # use google_cloud_discoveryengine_v1::builder::project_service::ProvisionProject;
9277    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
9278    /// use google_cloud_lro::Poller;
9279    ///
9280    /// let builder = prepare_request_builder();
9281    /// let response = builder.poller().until_done().await?;
9282    /// # Ok(()) }
9283    ///
9284    /// fn prepare_request_builder() -> ProvisionProject {
9285    ///   # panic!();
9286    ///   // ... details omitted ...
9287    /// }
9288    /// ```
9289    #[derive(Clone, Debug)]
9290    pub struct ProvisionProject(RequestBuilder<crate::model::ProvisionProjectRequest>);
9291
9292    impl ProvisionProject {
9293        pub(crate) fn new(
9294            stub: std::sync::Arc<dyn super::super::stub::dynamic::ProjectService>,
9295        ) -> Self {
9296            Self(RequestBuilder::new(stub))
9297        }
9298
9299        /// Sets the full request, replacing any prior values.
9300        pub fn with_request<V: Into<crate::model::ProvisionProjectRequest>>(
9301            mut self,
9302            v: V,
9303        ) -> Self {
9304            self.0.request = v.into();
9305            self
9306        }
9307
9308        /// Sets all the options, replacing any prior values.
9309        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
9310            self.0.options = v.into();
9311            self
9312        }
9313
9314        /// Sends the request.
9315        ///
9316        /// # Long running operations
9317        ///
9318        /// This starts, but does not poll, a longrunning operation. More information
9319        /// on [provision_project][crate::client::ProjectService::provision_project].
9320        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
9321            (*self.0.stub)
9322                .provision_project(self.0.request, self.0.options)
9323                .await
9324                .map(crate::Response::into_body)
9325        }
9326
9327        /// Creates a [Poller][google_cloud_lro::Poller] to work with `provision_project`.
9328        pub fn poller(
9329            self,
9330        ) -> impl google_cloud_lro::Poller<crate::model::Project, crate::model::ProvisionProjectMetadata>
9331        {
9332            type Operation = google_cloud_lro::internal::Operation<
9333                crate::model::Project,
9334                crate::model::ProvisionProjectMetadata,
9335            >;
9336            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
9337            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
9338            let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
9339            if let Some(ref mut details) = poller_options.tracing {
9340                details.method_name = "google_cloud_discoveryengine_v1::client::ProjectService::provision_project::until_done";
9341            }
9342
9343            let stub = self.0.stub.clone();
9344            let mut options = self.0.options.clone();
9345            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
9346            let query = move |name| {
9347                let stub = stub.clone();
9348                let options = options.clone();
9349                async {
9350                    let op = GetOperation::new(stub)
9351                        .set_name(name)
9352                        .with_options(options)
9353                        .send()
9354                        .await?;
9355                    Ok(Operation::new(op))
9356                }
9357            };
9358
9359            let start = move || async {
9360                let op = self.send().await?;
9361                Ok(Operation::new(op))
9362            };
9363
9364            use google_cloud_lro::internal::PollerExt;
9365            {
9366                google_cloud_lro::internal::new_poller(
9367                    polling_error_policy,
9368                    polling_backoff_policy,
9369                    start,
9370                    query,
9371                )
9372            }
9373            .with_options(poller_options)
9374        }
9375
9376        /// Sets the value of [name][crate::model::ProvisionProjectRequest::name].
9377        ///
9378        /// This is a **required** field for requests.
9379        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9380            self.0.request.name = v.into();
9381            self
9382        }
9383
9384        /// Sets the value of [accept_data_use_terms][crate::model::ProvisionProjectRequest::accept_data_use_terms].
9385        ///
9386        /// This is a **required** field for requests.
9387        pub fn set_accept_data_use_terms<T: Into<bool>>(mut self, v: T) -> Self {
9388            self.0.request.accept_data_use_terms = v.into();
9389            self
9390        }
9391
9392        /// Sets the value of [data_use_terms_version][crate::model::ProvisionProjectRequest::data_use_terms_version].
9393        ///
9394        /// This is a **required** field for requests.
9395        pub fn set_data_use_terms_version<T: Into<std::string::String>>(mut self, v: T) -> Self {
9396            self.0.request.data_use_terms_version = v.into();
9397            self
9398        }
9399    }
9400
9401    #[doc(hidden)]
9402    impl crate::RequestBuilder for ProvisionProject {
9403        fn request_options(&mut self) -> &mut crate::RequestOptions {
9404            &mut self.0.options
9405        }
9406    }
9407
9408    /// The request builder for [ProjectService::list_operations][crate::client::ProjectService::list_operations] calls.
9409    ///
9410    /// # Example
9411    /// ```
9412    /// # use google_cloud_discoveryengine_v1::builder::project_service::ListOperations;
9413    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
9414    /// use google_cloud_gax::paginator::ItemPaginator;
9415    ///
9416    /// let builder = prepare_request_builder();
9417    /// let mut items = builder.by_item();
9418    /// while let Some(result) = items.next().await {
9419    ///   let item = result?;
9420    /// }
9421    /// # Ok(()) }
9422    ///
9423    /// fn prepare_request_builder() -> ListOperations {
9424    ///   # panic!();
9425    ///   // ... details omitted ...
9426    /// }
9427    /// ```
9428    #[derive(Clone, Debug)]
9429    pub struct ListOperations(
9430        RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
9431    );
9432
9433    impl ListOperations {
9434        pub(crate) fn new(
9435            stub: std::sync::Arc<dyn super::super::stub::dynamic::ProjectService>,
9436        ) -> Self {
9437            Self(RequestBuilder::new(stub))
9438        }
9439
9440        /// Sets the full request, replacing any prior values.
9441        pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
9442            mut self,
9443            v: V,
9444        ) -> Self {
9445            self.0.request = v.into();
9446            self
9447        }
9448
9449        /// Sets all the options, replacing any prior values.
9450        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
9451            self.0.options = v.into();
9452            self
9453        }
9454
9455        /// Sends the request.
9456        pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
9457            (*self.0.stub)
9458                .list_operations(self.0.request, self.0.options)
9459                .await
9460                .map(crate::Response::into_body)
9461        }
9462
9463        /// Streams each page in the collection.
9464        pub fn by_page(
9465            self,
9466        ) -> impl google_cloud_gax::paginator::Paginator<
9467            google_cloud_longrunning::model::ListOperationsResponse,
9468            crate::Error,
9469        > {
9470            use std::clone::Clone;
9471            let token = self.0.request.page_token.clone();
9472            let execute = move |token: String| {
9473                let mut builder = self.clone();
9474                builder.0.request = builder.0.request.set_page_token(token);
9475                builder.send()
9476            };
9477            google_cloud_gax::paginator::internal::new_paginator(token, execute)
9478        }
9479
9480        /// Streams each item in the collection.
9481        pub fn by_item(
9482            self,
9483        ) -> impl google_cloud_gax::paginator::ItemPaginator<
9484            google_cloud_longrunning::model::ListOperationsResponse,
9485            crate::Error,
9486        > {
9487            use google_cloud_gax::paginator::Paginator;
9488            self.by_page().items()
9489        }
9490
9491        /// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
9492        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9493            self.0.request.name = v.into();
9494            self
9495        }
9496
9497        /// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::filter].
9498        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
9499            self.0.request.filter = v.into();
9500            self
9501        }
9502
9503        /// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
9504        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
9505            self.0.request.page_size = v.into();
9506            self
9507        }
9508
9509        /// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
9510        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
9511            self.0.request.page_token = v.into();
9512            self
9513        }
9514
9515        /// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
9516        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
9517            self.0.request.return_partial_success = v.into();
9518            self
9519        }
9520    }
9521
9522    #[doc(hidden)]
9523    impl crate::RequestBuilder for ListOperations {
9524        fn request_options(&mut self) -> &mut crate::RequestOptions {
9525            &mut self.0.options
9526        }
9527    }
9528
9529    /// The request builder for [ProjectService::get_operation][crate::client::ProjectService::get_operation] calls.
9530    ///
9531    /// # Example
9532    /// ```
9533    /// # use google_cloud_discoveryengine_v1::builder::project_service::GetOperation;
9534    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
9535    ///
9536    /// let builder = prepare_request_builder();
9537    /// let response = builder.send().await?;
9538    /// # Ok(()) }
9539    ///
9540    /// fn prepare_request_builder() -> GetOperation {
9541    ///   # panic!();
9542    ///   // ... details omitted ...
9543    /// }
9544    /// ```
9545    #[derive(Clone, Debug)]
9546    pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
9547
9548    impl GetOperation {
9549        pub(crate) fn new(
9550            stub: std::sync::Arc<dyn super::super::stub::dynamic::ProjectService>,
9551        ) -> Self {
9552            Self(RequestBuilder::new(stub))
9553        }
9554
9555        /// Sets the full request, replacing any prior values.
9556        pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
9557            mut self,
9558            v: V,
9559        ) -> Self {
9560            self.0.request = v.into();
9561            self
9562        }
9563
9564        /// Sets all the options, replacing any prior values.
9565        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
9566            self.0.options = v.into();
9567            self
9568        }
9569
9570        /// Sends the request.
9571        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
9572            (*self.0.stub)
9573                .get_operation(self.0.request, self.0.options)
9574                .await
9575                .map(crate::Response::into_body)
9576        }
9577
9578        /// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
9579        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9580            self.0.request.name = v.into();
9581            self
9582        }
9583    }
9584
9585    #[doc(hidden)]
9586    impl crate::RequestBuilder for GetOperation {
9587        fn request_options(&mut self) -> &mut crate::RequestOptions {
9588            &mut self.0.options
9589        }
9590    }
9591
9592    /// The request builder for [ProjectService::cancel_operation][crate::client::ProjectService::cancel_operation] calls.
9593    ///
9594    /// # Example
9595    /// ```
9596    /// # use google_cloud_discoveryengine_v1::builder::project_service::CancelOperation;
9597    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
9598    ///
9599    /// let builder = prepare_request_builder();
9600    /// let response = builder.send().await?;
9601    /// # Ok(()) }
9602    ///
9603    /// fn prepare_request_builder() -> CancelOperation {
9604    ///   # panic!();
9605    ///   // ... details omitted ...
9606    /// }
9607    /// ```
9608    #[derive(Clone, Debug)]
9609    pub struct CancelOperation(
9610        RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
9611    );
9612
9613    impl CancelOperation {
9614        pub(crate) fn new(
9615            stub: std::sync::Arc<dyn super::super::stub::dynamic::ProjectService>,
9616        ) -> Self {
9617            Self(RequestBuilder::new(stub))
9618        }
9619
9620        /// Sets the full request, replacing any prior values.
9621        pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
9622            mut self,
9623            v: V,
9624        ) -> Self {
9625            self.0.request = v.into();
9626            self
9627        }
9628
9629        /// Sets all the options, replacing any prior values.
9630        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
9631            self.0.options = v.into();
9632            self
9633        }
9634
9635        /// Sends the request.
9636        pub async fn send(self) -> Result<()> {
9637            (*self.0.stub)
9638                .cancel_operation(self.0.request, self.0.options)
9639                .await
9640                .map(crate::Response::into_body)
9641        }
9642
9643        /// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::name].
9644        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9645            self.0.request.name = v.into();
9646            self
9647        }
9648    }
9649
9650    #[doc(hidden)]
9651    impl crate::RequestBuilder for CancelOperation {
9652        fn request_options(&mut self) -> &mut crate::RequestOptions {
9653            &mut self.0.options
9654        }
9655    }
9656}
9657
9658/// Request and client builders for [RankService][crate::client::RankService].
9659#[cfg(feature = "rank-service")]
9660#[cfg_attr(docsrs, doc(cfg(feature = "rank-service")))]
9661pub mod rank_service {
9662    use crate::Result;
9663
9664    /// A builder for [RankService][crate::client::RankService].
9665    ///
9666    /// ```
9667    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
9668    /// # use google_cloud_discoveryengine_v1::*;
9669    /// # use builder::rank_service::ClientBuilder;
9670    /// # use client::RankService;
9671    /// let builder : ClientBuilder = RankService::builder();
9672    /// let client = builder
9673    ///     .with_endpoint("https://discoveryengine.googleapis.com")
9674    ///     .build().await?;
9675    /// # Ok(()) }
9676    /// ```
9677    pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
9678
9679    pub(crate) mod client {
9680        use super::super::super::client::RankService;
9681        pub struct Factory;
9682        impl crate::ClientFactory for Factory {
9683            type Client = RankService;
9684            type Credentials = gaxi::options::Credentials;
9685            async fn build(
9686                self,
9687                config: gaxi::options::ClientConfig,
9688            ) -> crate::ClientBuilderResult<Self::Client> {
9689                Self::Client::new(config).await
9690            }
9691        }
9692    }
9693
9694    /// Common implementation for [crate::client::RankService] request builders.
9695    #[derive(Clone, Debug)]
9696    pub(crate) struct RequestBuilder<R: std::default::Default> {
9697        stub: std::sync::Arc<dyn super::super::stub::dynamic::RankService>,
9698        request: R,
9699        options: crate::RequestOptions,
9700    }
9701
9702    impl<R> RequestBuilder<R>
9703    where
9704        R: std::default::Default,
9705    {
9706        pub(crate) fn new(
9707            stub: std::sync::Arc<dyn super::super::stub::dynamic::RankService>,
9708        ) -> Self {
9709            Self {
9710                stub,
9711                request: R::default(),
9712                options: crate::RequestOptions::default(),
9713            }
9714        }
9715    }
9716
9717    /// The request builder for [RankService::rank][crate::client::RankService::rank] calls.
9718    ///
9719    /// # Example
9720    /// ```
9721    /// # use google_cloud_discoveryengine_v1::builder::rank_service::Rank;
9722    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
9723    ///
9724    /// let builder = prepare_request_builder();
9725    /// let response = builder.send().await?;
9726    /// # Ok(()) }
9727    ///
9728    /// fn prepare_request_builder() -> Rank {
9729    ///   # panic!();
9730    ///   // ... details omitted ...
9731    /// }
9732    /// ```
9733    #[derive(Clone, Debug)]
9734    pub struct Rank(RequestBuilder<crate::model::RankRequest>);
9735
9736    impl Rank {
9737        pub(crate) fn new(
9738            stub: std::sync::Arc<dyn super::super::stub::dynamic::RankService>,
9739        ) -> Self {
9740            Self(RequestBuilder::new(stub))
9741        }
9742
9743        /// Sets the full request, replacing any prior values.
9744        pub fn with_request<V: Into<crate::model::RankRequest>>(mut self, v: V) -> Self {
9745            self.0.request = v.into();
9746            self
9747        }
9748
9749        /// Sets all the options, replacing any prior values.
9750        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
9751            self.0.options = v.into();
9752            self
9753        }
9754
9755        /// Sends the request.
9756        pub async fn send(self) -> Result<crate::model::RankResponse> {
9757            (*self.0.stub)
9758                .rank(self.0.request, self.0.options)
9759                .await
9760                .map(crate::Response::into_body)
9761        }
9762
9763        /// Sets the value of [ranking_config][crate::model::RankRequest::ranking_config].
9764        ///
9765        /// This is a **required** field for requests.
9766        pub fn set_ranking_config<T: Into<std::string::String>>(mut self, v: T) -> Self {
9767            self.0.request.ranking_config = v.into();
9768            self
9769        }
9770
9771        /// Sets the value of [model][crate::model::RankRequest::model].
9772        pub fn set_model<T: Into<std::string::String>>(mut self, v: T) -> Self {
9773            self.0.request.model = v.into();
9774            self
9775        }
9776
9777        /// Sets the value of [top_n][crate::model::RankRequest::top_n].
9778        pub fn set_top_n<T: Into<i32>>(mut self, v: T) -> Self {
9779            self.0.request.top_n = v.into();
9780            self
9781        }
9782
9783        /// Sets the value of [query][crate::model::RankRequest::query].
9784        pub fn set_query<T: Into<std::string::String>>(mut self, v: T) -> Self {
9785            self.0.request.query = v.into();
9786            self
9787        }
9788
9789        /// Sets the value of [records][crate::model::RankRequest::records].
9790        ///
9791        /// This is a **required** field for requests.
9792        pub fn set_records<T, V>(mut self, v: T) -> Self
9793        where
9794            T: std::iter::IntoIterator<Item = V>,
9795            V: std::convert::Into<crate::model::RankingRecord>,
9796        {
9797            use std::iter::Iterator;
9798            self.0.request.records = v.into_iter().map(|i| i.into()).collect();
9799            self
9800        }
9801
9802        /// Sets the value of [ignore_record_details_in_response][crate::model::RankRequest::ignore_record_details_in_response].
9803        pub fn set_ignore_record_details_in_response<T: Into<bool>>(mut self, v: T) -> Self {
9804            self.0.request.ignore_record_details_in_response = v.into();
9805            self
9806        }
9807
9808        /// Sets the value of [user_labels][crate::model::RankRequest::user_labels].
9809        pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
9810        where
9811            T: std::iter::IntoIterator<Item = (K, V)>,
9812            K: std::convert::Into<std::string::String>,
9813            V: std::convert::Into<std::string::String>,
9814        {
9815            self.0.request.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
9816            self
9817        }
9818    }
9819
9820    #[doc(hidden)]
9821    impl crate::RequestBuilder for Rank {
9822        fn request_options(&mut self) -> &mut crate::RequestOptions {
9823            &mut self.0.options
9824        }
9825    }
9826
9827    /// The request builder for [RankService::list_operations][crate::client::RankService::list_operations] calls.
9828    ///
9829    /// # Example
9830    /// ```
9831    /// # use google_cloud_discoveryengine_v1::builder::rank_service::ListOperations;
9832    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
9833    /// use google_cloud_gax::paginator::ItemPaginator;
9834    ///
9835    /// let builder = prepare_request_builder();
9836    /// let mut items = builder.by_item();
9837    /// while let Some(result) = items.next().await {
9838    ///   let item = result?;
9839    /// }
9840    /// # Ok(()) }
9841    ///
9842    /// fn prepare_request_builder() -> ListOperations {
9843    ///   # panic!();
9844    ///   // ... details omitted ...
9845    /// }
9846    /// ```
9847    #[derive(Clone, Debug)]
9848    pub struct ListOperations(
9849        RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
9850    );
9851
9852    impl ListOperations {
9853        pub(crate) fn new(
9854            stub: std::sync::Arc<dyn super::super::stub::dynamic::RankService>,
9855        ) -> Self {
9856            Self(RequestBuilder::new(stub))
9857        }
9858
9859        /// Sets the full request, replacing any prior values.
9860        pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
9861            mut self,
9862            v: V,
9863        ) -> Self {
9864            self.0.request = v.into();
9865            self
9866        }
9867
9868        /// Sets all the options, replacing any prior values.
9869        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
9870            self.0.options = v.into();
9871            self
9872        }
9873
9874        /// Sends the request.
9875        pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
9876            (*self.0.stub)
9877                .list_operations(self.0.request, self.0.options)
9878                .await
9879                .map(crate::Response::into_body)
9880        }
9881
9882        /// Streams each page in the collection.
9883        pub fn by_page(
9884            self,
9885        ) -> impl google_cloud_gax::paginator::Paginator<
9886            google_cloud_longrunning::model::ListOperationsResponse,
9887            crate::Error,
9888        > {
9889            use std::clone::Clone;
9890            let token = self.0.request.page_token.clone();
9891            let execute = move |token: String| {
9892                let mut builder = self.clone();
9893                builder.0.request = builder.0.request.set_page_token(token);
9894                builder.send()
9895            };
9896            google_cloud_gax::paginator::internal::new_paginator(token, execute)
9897        }
9898
9899        /// Streams each item in the collection.
9900        pub fn by_item(
9901            self,
9902        ) -> impl google_cloud_gax::paginator::ItemPaginator<
9903            google_cloud_longrunning::model::ListOperationsResponse,
9904            crate::Error,
9905        > {
9906            use google_cloud_gax::paginator::Paginator;
9907            self.by_page().items()
9908        }
9909
9910        /// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
9911        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9912            self.0.request.name = v.into();
9913            self
9914        }
9915
9916        /// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::filter].
9917        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
9918            self.0.request.filter = v.into();
9919            self
9920        }
9921
9922        /// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
9923        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
9924            self.0.request.page_size = v.into();
9925            self
9926        }
9927
9928        /// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
9929        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
9930            self.0.request.page_token = v.into();
9931            self
9932        }
9933
9934        /// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
9935        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
9936            self.0.request.return_partial_success = v.into();
9937            self
9938        }
9939    }
9940
9941    #[doc(hidden)]
9942    impl crate::RequestBuilder for ListOperations {
9943        fn request_options(&mut self) -> &mut crate::RequestOptions {
9944            &mut self.0.options
9945        }
9946    }
9947
9948    /// The request builder for [RankService::get_operation][crate::client::RankService::get_operation] calls.
9949    ///
9950    /// # Example
9951    /// ```
9952    /// # use google_cloud_discoveryengine_v1::builder::rank_service::GetOperation;
9953    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
9954    ///
9955    /// let builder = prepare_request_builder();
9956    /// let response = builder.send().await?;
9957    /// # Ok(()) }
9958    ///
9959    /// fn prepare_request_builder() -> GetOperation {
9960    ///   # panic!();
9961    ///   // ... details omitted ...
9962    /// }
9963    /// ```
9964    #[derive(Clone, Debug)]
9965    pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
9966
9967    impl GetOperation {
9968        pub(crate) fn new(
9969            stub: std::sync::Arc<dyn super::super::stub::dynamic::RankService>,
9970        ) -> Self {
9971            Self(RequestBuilder::new(stub))
9972        }
9973
9974        /// Sets the full request, replacing any prior values.
9975        pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
9976            mut self,
9977            v: V,
9978        ) -> Self {
9979            self.0.request = v.into();
9980            self
9981        }
9982
9983        /// Sets all the options, replacing any prior values.
9984        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
9985            self.0.options = v.into();
9986            self
9987        }
9988
9989        /// Sends the request.
9990        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
9991            (*self.0.stub)
9992                .get_operation(self.0.request, self.0.options)
9993                .await
9994                .map(crate::Response::into_body)
9995        }
9996
9997        /// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
9998        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9999            self.0.request.name = v.into();
10000            self
10001        }
10002    }
10003
10004    #[doc(hidden)]
10005    impl crate::RequestBuilder for GetOperation {
10006        fn request_options(&mut self) -> &mut crate::RequestOptions {
10007            &mut self.0.options
10008        }
10009    }
10010
10011    /// The request builder for [RankService::cancel_operation][crate::client::RankService::cancel_operation] calls.
10012    ///
10013    /// # Example
10014    /// ```
10015    /// # use google_cloud_discoveryengine_v1::builder::rank_service::CancelOperation;
10016    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
10017    ///
10018    /// let builder = prepare_request_builder();
10019    /// let response = builder.send().await?;
10020    /// # Ok(()) }
10021    ///
10022    /// fn prepare_request_builder() -> CancelOperation {
10023    ///   # panic!();
10024    ///   // ... details omitted ...
10025    /// }
10026    /// ```
10027    #[derive(Clone, Debug)]
10028    pub struct CancelOperation(
10029        RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
10030    );
10031
10032    impl CancelOperation {
10033        pub(crate) fn new(
10034            stub: std::sync::Arc<dyn super::super::stub::dynamic::RankService>,
10035        ) -> Self {
10036            Self(RequestBuilder::new(stub))
10037        }
10038
10039        /// Sets the full request, replacing any prior values.
10040        pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
10041            mut self,
10042            v: V,
10043        ) -> Self {
10044            self.0.request = v.into();
10045            self
10046        }
10047
10048        /// Sets all the options, replacing any prior values.
10049        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
10050            self.0.options = v.into();
10051            self
10052        }
10053
10054        /// Sends the request.
10055        pub async fn send(self) -> Result<()> {
10056            (*self.0.stub)
10057                .cancel_operation(self.0.request, self.0.options)
10058                .await
10059                .map(crate::Response::into_body)
10060        }
10061
10062        /// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::name].
10063        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
10064            self.0.request.name = v.into();
10065            self
10066        }
10067    }
10068
10069    #[doc(hidden)]
10070    impl crate::RequestBuilder for CancelOperation {
10071        fn request_options(&mut self) -> &mut crate::RequestOptions {
10072            &mut self.0.options
10073        }
10074    }
10075}
10076
10077/// Request and client builders for [RecommendationService][crate::client::RecommendationService].
10078#[cfg(feature = "recommendation-service")]
10079#[cfg_attr(docsrs, doc(cfg(feature = "recommendation-service")))]
10080pub mod recommendation_service {
10081    use crate::Result;
10082
10083    /// A builder for [RecommendationService][crate::client::RecommendationService].
10084    ///
10085    /// ```
10086    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
10087    /// # use google_cloud_discoveryengine_v1::*;
10088    /// # use builder::recommendation_service::ClientBuilder;
10089    /// # use client::RecommendationService;
10090    /// let builder : ClientBuilder = RecommendationService::builder();
10091    /// let client = builder
10092    ///     .with_endpoint("https://discoveryengine.googleapis.com")
10093    ///     .build().await?;
10094    /// # Ok(()) }
10095    /// ```
10096    pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
10097
10098    pub(crate) mod client {
10099        use super::super::super::client::RecommendationService;
10100        pub struct Factory;
10101        impl crate::ClientFactory for Factory {
10102            type Client = RecommendationService;
10103            type Credentials = gaxi::options::Credentials;
10104            async fn build(
10105                self,
10106                config: gaxi::options::ClientConfig,
10107            ) -> crate::ClientBuilderResult<Self::Client> {
10108                Self::Client::new(config).await
10109            }
10110        }
10111    }
10112
10113    /// Common implementation for [crate::client::RecommendationService] request builders.
10114    #[derive(Clone, Debug)]
10115    pub(crate) struct RequestBuilder<R: std::default::Default> {
10116        stub: std::sync::Arc<dyn super::super::stub::dynamic::RecommendationService>,
10117        request: R,
10118        options: crate::RequestOptions,
10119    }
10120
10121    impl<R> RequestBuilder<R>
10122    where
10123        R: std::default::Default,
10124    {
10125        pub(crate) fn new(
10126            stub: std::sync::Arc<dyn super::super::stub::dynamic::RecommendationService>,
10127        ) -> Self {
10128            Self {
10129                stub,
10130                request: R::default(),
10131                options: crate::RequestOptions::default(),
10132            }
10133        }
10134    }
10135
10136    /// The request builder for [RecommendationService::recommend][crate::client::RecommendationService::recommend] calls.
10137    ///
10138    /// # Example
10139    /// ```
10140    /// # use google_cloud_discoveryengine_v1::builder::recommendation_service::Recommend;
10141    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
10142    ///
10143    /// let builder = prepare_request_builder();
10144    /// let response = builder.send().await?;
10145    /// # Ok(()) }
10146    ///
10147    /// fn prepare_request_builder() -> Recommend {
10148    ///   # panic!();
10149    ///   // ... details omitted ...
10150    /// }
10151    /// ```
10152    #[derive(Clone, Debug)]
10153    pub struct Recommend(RequestBuilder<crate::model::RecommendRequest>);
10154
10155    impl Recommend {
10156        pub(crate) fn new(
10157            stub: std::sync::Arc<dyn super::super::stub::dynamic::RecommendationService>,
10158        ) -> Self {
10159            Self(RequestBuilder::new(stub))
10160        }
10161
10162        /// Sets the full request, replacing any prior values.
10163        pub fn with_request<V: Into<crate::model::RecommendRequest>>(mut self, v: V) -> Self {
10164            self.0.request = v.into();
10165            self
10166        }
10167
10168        /// Sets all the options, replacing any prior values.
10169        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
10170            self.0.options = v.into();
10171            self
10172        }
10173
10174        /// Sends the request.
10175        pub async fn send(self) -> Result<crate::model::RecommendResponse> {
10176            (*self.0.stub)
10177                .recommend(self.0.request, self.0.options)
10178                .await
10179                .map(crate::Response::into_body)
10180        }
10181
10182        /// Sets the value of [serving_config][crate::model::RecommendRequest::serving_config].
10183        ///
10184        /// This is a **required** field for requests.
10185        pub fn set_serving_config<T: Into<std::string::String>>(mut self, v: T) -> Self {
10186            self.0.request.serving_config = v.into();
10187            self
10188        }
10189
10190        /// Sets the value of [user_event][crate::model::RecommendRequest::user_event].
10191        ///
10192        /// This is a **required** field for requests.
10193        pub fn set_user_event<T>(mut self, v: T) -> Self
10194        where
10195            T: std::convert::Into<crate::model::UserEvent>,
10196        {
10197            self.0.request.user_event = std::option::Option::Some(v.into());
10198            self
10199        }
10200
10201        /// Sets or clears the value of [user_event][crate::model::RecommendRequest::user_event].
10202        ///
10203        /// This is a **required** field for requests.
10204        pub fn set_or_clear_user_event<T>(mut self, v: std::option::Option<T>) -> Self
10205        where
10206            T: std::convert::Into<crate::model::UserEvent>,
10207        {
10208            self.0.request.user_event = v.map(|x| x.into());
10209            self
10210        }
10211
10212        /// Sets the value of [page_size][crate::model::RecommendRequest::page_size].
10213        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
10214            self.0.request.page_size = v.into();
10215            self
10216        }
10217
10218        /// Sets the value of [filter][crate::model::RecommendRequest::filter].
10219        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
10220            self.0.request.filter = v.into();
10221            self
10222        }
10223
10224        /// Sets the value of [validate_only][crate::model::RecommendRequest::validate_only].
10225        pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
10226            self.0.request.validate_only = v.into();
10227            self
10228        }
10229
10230        /// Sets the value of [params][crate::model::RecommendRequest::params].
10231        pub fn set_params<T, K, V>(mut self, v: T) -> Self
10232        where
10233            T: std::iter::IntoIterator<Item = (K, V)>,
10234            K: std::convert::Into<std::string::String>,
10235            V: std::convert::Into<wkt::Value>,
10236        {
10237            self.0.request.params = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
10238            self
10239        }
10240
10241        /// Sets the value of [user_labels][crate::model::RecommendRequest::user_labels].
10242        pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
10243        where
10244            T: std::iter::IntoIterator<Item = (K, V)>,
10245            K: std::convert::Into<std::string::String>,
10246            V: std::convert::Into<std::string::String>,
10247        {
10248            self.0.request.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
10249            self
10250        }
10251    }
10252
10253    #[doc(hidden)]
10254    impl crate::RequestBuilder for Recommend {
10255        fn request_options(&mut self) -> &mut crate::RequestOptions {
10256            &mut self.0.options
10257        }
10258    }
10259
10260    /// The request builder for [RecommendationService::list_operations][crate::client::RecommendationService::list_operations] calls.
10261    ///
10262    /// # Example
10263    /// ```
10264    /// # use google_cloud_discoveryengine_v1::builder::recommendation_service::ListOperations;
10265    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
10266    /// use google_cloud_gax::paginator::ItemPaginator;
10267    ///
10268    /// let builder = prepare_request_builder();
10269    /// let mut items = builder.by_item();
10270    /// while let Some(result) = items.next().await {
10271    ///   let item = result?;
10272    /// }
10273    /// # Ok(()) }
10274    ///
10275    /// fn prepare_request_builder() -> ListOperations {
10276    ///   # panic!();
10277    ///   // ... details omitted ...
10278    /// }
10279    /// ```
10280    #[derive(Clone, Debug)]
10281    pub struct ListOperations(
10282        RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
10283    );
10284
10285    impl ListOperations {
10286        pub(crate) fn new(
10287            stub: std::sync::Arc<dyn super::super::stub::dynamic::RecommendationService>,
10288        ) -> Self {
10289            Self(RequestBuilder::new(stub))
10290        }
10291
10292        /// Sets the full request, replacing any prior values.
10293        pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
10294            mut self,
10295            v: V,
10296        ) -> Self {
10297            self.0.request = v.into();
10298            self
10299        }
10300
10301        /// Sets all the options, replacing any prior values.
10302        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
10303            self.0.options = v.into();
10304            self
10305        }
10306
10307        /// Sends the request.
10308        pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
10309            (*self.0.stub)
10310                .list_operations(self.0.request, self.0.options)
10311                .await
10312                .map(crate::Response::into_body)
10313        }
10314
10315        /// Streams each page in the collection.
10316        pub fn by_page(
10317            self,
10318        ) -> impl google_cloud_gax::paginator::Paginator<
10319            google_cloud_longrunning::model::ListOperationsResponse,
10320            crate::Error,
10321        > {
10322            use std::clone::Clone;
10323            let token = self.0.request.page_token.clone();
10324            let execute = move |token: String| {
10325                let mut builder = self.clone();
10326                builder.0.request = builder.0.request.set_page_token(token);
10327                builder.send()
10328            };
10329            google_cloud_gax::paginator::internal::new_paginator(token, execute)
10330        }
10331
10332        /// Streams each item in the collection.
10333        pub fn by_item(
10334            self,
10335        ) -> impl google_cloud_gax::paginator::ItemPaginator<
10336            google_cloud_longrunning::model::ListOperationsResponse,
10337            crate::Error,
10338        > {
10339            use google_cloud_gax::paginator::Paginator;
10340            self.by_page().items()
10341        }
10342
10343        /// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
10344        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
10345            self.0.request.name = v.into();
10346            self
10347        }
10348
10349        /// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::filter].
10350        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
10351            self.0.request.filter = v.into();
10352            self
10353        }
10354
10355        /// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
10356        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
10357            self.0.request.page_size = v.into();
10358            self
10359        }
10360
10361        /// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
10362        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
10363            self.0.request.page_token = v.into();
10364            self
10365        }
10366
10367        /// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
10368        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
10369            self.0.request.return_partial_success = v.into();
10370            self
10371        }
10372    }
10373
10374    #[doc(hidden)]
10375    impl crate::RequestBuilder for ListOperations {
10376        fn request_options(&mut self) -> &mut crate::RequestOptions {
10377            &mut self.0.options
10378        }
10379    }
10380
10381    /// The request builder for [RecommendationService::get_operation][crate::client::RecommendationService::get_operation] calls.
10382    ///
10383    /// # Example
10384    /// ```
10385    /// # use google_cloud_discoveryengine_v1::builder::recommendation_service::GetOperation;
10386    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
10387    ///
10388    /// let builder = prepare_request_builder();
10389    /// let response = builder.send().await?;
10390    /// # Ok(()) }
10391    ///
10392    /// fn prepare_request_builder() -> GetOperation {
10393    ///   # panic!();
10394    ///   // ... details omitted ...
10395    /// }
10396    /// ```
10397    #[derive(Clone, Debug)]
10398    pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
10399
10400    impl GetOperation {
10401        pub(crate) fn new(
10402            stub: std::sync::Arc<dyn super::super::stub::dynamic::RecommendationService>,
10403        ) -> Self {
10404            Self(RequestBuilder::new(stub))
10405        }
10406
10407        /// Sets the full request, replacing any prior values.
10408        pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
10409            mut self,
10410            v: V,
10411        ) -> Self {
10412            self.0.request = v.into();
10413            self
10414        }
10415
10416        /// Sets all the options, replacing any prior values.
10417        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
10418            self.0.options = v.into();
10419            self
10420        }
10421
10422        /// Sends the request.
10423        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
10424            (*self.0.stub)
10425                .get_operation(self.0.request, self.0.options)
10426                .await
10427                .map(crate::Response::into_body)
10428        }
10429
10430        /// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
10431        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
10432            self.0.request.name = v.into();
10433            self
10434        }
10435    }
10436
10437    #[doc(hidden)]
10438    impl crate::RequestBuilder for GetOperation {
10439        fn request_options(&mut self) -> &mut crate::RequestOptions {
10440            &mut self.0.options
10441        }
10442    }
10443
10444    /// The request builder for [RecommendationService::cancel_operation][crate::client::RecommendationService::cancel_operation] calls.
10445    ///
10446    /// # Example
10447    /// ```
10448    /// # use google_cloud_discoveryengine_v1::builder::recommendation_service::CancelOperation;
10449    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
10450    ///
10451    /// let builder = prepare_request_builder();
10452    /// let response = builder.send().await?;
10453    /// # Ok(()) }
10454    ///
10455    /// fn prepare_request_builder() -> CancelOperation {
10456    ///   # panic!();
10457    ///   // ... details omitted ...
10458    /// }
10459    /// ```
10460    #[derive(Clone, Debug)]
10461    pub struct CancelOperation(
10462        RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
10463    );
10464
10465    impl CancelOperation {
10466        pub(crate) fn new(
10467            stub: std::sync::Arc<dyn super::super::stub::dynamic::RecommendationService>,
10468        ) -> Self {
10469            Self(RequestBuilder::new(stub))
10470        }
10471
10472        /// Sets the full request, replacing any prior values.
10473        pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
10474            mut self,
10475            v: V,
10476        ) -> Self {
10477            self.0.request = v.into();
10478            self
10479        }
10480
10481        /// Sets all the options, replacing any prior values.
10482        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
10483            self.0.options = v.into();
10484            self
10485        }
10486
10487        /// Sends the request.
10488        pub async fn send(self) -> Result<()> {
10489            (*self.0.stub)
10490                .cancel_operation(self.0.request, self.0.options)
10491                .await
10492                .map(crate::Response::into_body)
10493        }
10494
10495        /// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::name].
10496        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
10497            self.0.request.name = v.into();
10498            self
10499        }
10500    }
10501
10502    #[doc(hidden)]
10503    impl crate::RequestBuilder for CancelOperation {
10504        fn request_options(&mut self) -> &mut crate::RequestOptions {
10505            &mut self.0.options
10506        }
10507    }
10508}
10509
10510/// Request and client builders for [SchemaService][crate::client::SchemaService].
10511#[cfg(feature = "schema-service")]
10512#[cfg_attr(docsrs, doc(cfg(feature = "schema-service")))]
10513pub mod schema_service {
10514    use crate::Result;
10515
10516    /// A builder for [SchemaService][crate::client::SchemaService].
10517    ///
10518    /// ```
10519    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
10520    /// # use google_cloud_discoveryengine_v1::*;
10521    /// # use builder::schema_service::ClientBuilder;
10522    /// # use client::SchemaService;
10523    /// let builder : ClientBuilder = SchemaService::builder();
10524    /// let client = builder
10525    ///     .with_endpoint("https://discoveryengine.googleapis.com")
10526    ///     .build().await?;
10527    /// # Ok(()) }
10528    /// ```
10529    pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
10530
10531    pub(crate) mod client {
10532        use super::super::super::client::SchemaService;
10533        pub struct Factory;
10534        impl crate::ClientFactory for Factory {
10535            type Client = SchemaService;
10536            type Credentials = gaxi::options::Credentials;
10537            async fn build(
10538                self,
10539                config: gaxi::options::ClientConfig,
10540            ) -> crate::ClientBuilderResult<Self::Client> {
10541                Self::Client::new(config).await
10542            }
10543        }
10544    }
10545
10546    /// Common implementation for [crate::client::SchemaService] request builders.
10547    #[derive(Clone, Debug)]
10548    pub(crate) struct RequestBuilder<R: std::default::Default> {
10549        stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
10550        request: R,
10551        options: crate::RequestOptions,
10552    }
10553
10554    impl<R> RequestBuilder<R>
10555    where
10556        R: std::default::Default,
10557    {
10558        pub(crate) fn new(
10559            stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
10560        ) -> Self {
10561            Self {
10562                stub,
10563                request: R::default(),
10564                options: crate::RequestOptions::default(),
10565            }
10566        }
10567    }
10568
10569    /// The request builder for [SchemaService::get_schema][crate::client::SchemaService::get_schema] calls.
10570    ///
10571    /// # Example
10572    /// ```
10573    /// # use google_cloud_discoveryengine_v1::builder::schema_service::GetSchema;
10574    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
10575    ///
10576    /// let builder = prepare_request_builder();
10577    /// let response = builder.send().await?;
10578    /// # Ok(()) }
10579    ///
10580    /// fn prepare_request_builder() -> GetSchema {
10581    ///   # panic!();
10582    ///   // ... details omitted ...
10583    /// }
10584    /// ```
10585    #[derive(Clone, Debug)]
10586    pub struct GetSchema(RequestBuilder<crate::model::GetSchemaRequest>);
10587
10588    impl GetSchema {
10589        pub(crate) fn new(
10590            stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
10591        ) -> Self {
10592            Self(RequestBuilder::new(stub))
10593        }
10594
10595        /// Sets the full request, replacing any prior values.
10596        pub fn with_request<V: Into<crate::model::GetSchemaRequest>>(mut self, v: V) -> Self {
10597            self.0.request = v.into();
10598            self
10599        }
10600
10601        /// Sets all the options, replacing any prior values.
10602        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
10603            self.0.options = v.into();
10604            self
10605        }
10606
10607        /// Sends the request.
10608        pub async fn send(self) -> Result<crate::model::Schema> {
10609            (*self.0.stub)
10610                .get_schema(self.0.request, self.0.options)
10611                .await
10612                .map(crate::Response::into_body)
10613        }
10614
10615        /// Sets the value of [name][crate::model::GetSchemaRequest::name].
10616        ///
10617        /// This is a **required** field for requests.
10618        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
10619            self.0.request.name = v.into();
10620            self
10621        }
10622    }
10623
10624    #[doc(hidden)]
10625    impl crate::RequestBuilder for GetSchema {
10626        fn request_options(&mut self) -> &mut crate::RequestOptions {
10627            &mut self.0.options
10628        }
10629    }
10630
10631    /// The request builder for [SchemaService::list_schemas][crate::client::SchemaService::list_schemas] calls.
10632    ///
10633    /// # Example
10634    /// ```
10635    /// # use google_cloud_discoveryengine_v1::builder::schema_service::ListSchemas;
10636    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
10637    /// use google_cloud_gax::paginator::ItemPaginator;
10638    ///
10639    /// let builder = prepare_request_builder();
10640    /// let mut items = builder.by_item();
10641    /// while let Some(result) = items.next().await {
10642    ///   let item = result?;
10643    /// }
10644    /// # Ok(()) }
10645    ///
10646    /// fn prepare_request_builder() -> ListSchemas {
10647    ///   # panic!();
10648    ///   // ... details omitted ...
10649    /// }
10650    /// ```
10651    #[derive(Clone, Debug)]
10652    pub struct ListSchemas(RequestBuilder<crate::model::ListSchemasRequest>);
10653
10654    impl ListSchemas {
10655        pub(crate) fn new(
10656            stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
10657        ) -> Self {
10658            Self(RequestBuilder::new(stub))
10659        }
10660
10661        /// Sets the full request, replacing any prior values.
10662        pub fn with_request<V: Into<crate::model::ListSchemasRequest>>(mut self, v: V) -> Self {
10663            self.0.request = v.into();
10664            self
10665        }
10666
10667        /// Sets all the options, replacing any prior values.
10668        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
10669            self.0.options = v.into();
10670            self
10671        }
10672
10673        /// Sends the request.
10674        pub async fn send(self) -> Result<crate::model::ListSchemasResponse> {
10675            (*self.0.stub)
10676                .list_schemas(self.0.request, self.0.options)
10677                .await
10678                .map(crate::Response::into_body)
10679        }
10680
10681        /// Streams each page in the collection.
10682        pub fn by_page(
10683            self,
10684        ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListSchemasResponse, crate::Error>
10685        {
10686            use std::clone::Clone;
10687            let token = self.0.request.page_token.clone();
10688            let execute = move |token: String| {
10689                let mut builder = self.clone();
10690                builder.0.request = builder.0.request.set_page_token(token);
10691                builder.send()
10692            };
10693            google_cloud_gax::paginator::internal::new_paginator(token, execute)
10694        }
10695
10696        /// Streams each item in the collection.
10697        pub fn by_item(
10698            self,
10699        ) -> impl google_cloud_gax::paginator::ItemPaginator<
10700            crate::model::ListSchemasResponse,
10701            crate::Error,
10702        > {
10703            use google_cloud_gax::paginator::Paginator;
10704            self.by_page().items()
10705        }
10706
10707        /// Sets the value of [parent][crate::model::ListSchemasRequest::parent].
10708        ///
10709        /// This is a **required** field for requests.
10710        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
10711            self.0.request.parent = v.into();
10712            self
10713        }
10714
10715        /// Sets the value of [page_size][crate::model::ListSchemasRequest::page_size].
10716        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
10717            self.0.request.page_size = v.into();
10718            self
10719        }
10720
10721        /// Sets the value of [page_token][crate::model::ListSchemasRequest::page_token].
10722        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
10723            self.0.request.page_token = v.into();
10724            self
10725        }
10726    }
10727
10728    #[doc(hidden)]
10729    impl crate::RequestBuilder for ListSchemas {
10730        fn request_options(&mut self) -> &mut crate::RequestOptions {
10731            &mut self.0.options
10732        }
10733    }
10734
10735    /// The request builder for [SchemaService::create_schema][crate::client::SchemaService::create_schema] calls.
10736    ///
10737    /// # Example
10738    /// ```
10739    /// # use google_cloud_discoveryengine_v1::builder::schema_service::CreateSchema;
10740    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
10741    /// use google_cloud_lro::Poller;
10742    ///
10743    /// let builder = prepare_request_builder();
10744    /// let response = builder.poller().until_done().await?;
10745    /// # Ok(()) }
10746    ///
10747    /// fn prepare_request_builder() -> CreateSchema {
10748    ///   # panic!();
10749    ///   // ... details omitted ...
10750    /// }
10751    /// ```
10752    #[derive(Clone, Debug)]
10753    pub struct CreateSchema(RequestBuilder<crate::model::CreateSchemaRequest>);
10754
10755    impl CreateSchema {
10756        pub(crate) fn new(
10757            stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
10758        ) -> Self {
10759            Self(RequestBuilder::new(stub))
10760        }
10761
10762        /// Sets the full request, replacing any prior values.
10763        pub fn with_request<V: Into<crate::model::CreateSchemaRequest>>(mut self, v: V) -> Self {
10764            self.0.request = v.into();
10765            self
10766        }
10767
10768        /// Sets all the options, replacing any prior values.
10769        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
10770            self.0.options = v.into();
10771            self
10772        }
10773
10774        /// Sends the request.
10775        ///
10776        /// # Long running operations
10777        ///
10778        /// This starts, but does not poll, a longrunning operation. More information
10779        /// on [create_schema][crate::client::SchemaService::create_schema].
10780        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
10781            (*self.0.stub)
10782                .create_schema(self.0.request, self.0.options)
10783                .await
10784                .map(crate::Response::into_body)
10785        }
10786
10787        /// Creates a [Poller][google_cloud_lro::Poller] to work with `create_schema`.
10788        pub fn poller(
10789            self,
10790        ) -> impl google_cloud_lro::Poller<crate::model::Schema, crate::model::CreateSchemaMetadata>
10791        {
10792            type Operation = google_cloud_lro::internal::Operation<
10793                crate::model::Schema,
10794                crate::model::CreateSchemaMetadata,
10795            >;
10796            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
10797            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
10798            let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
10799            if let Some(ref mut details) = poller_options.tracing {
10800                details.method_name = "google_cloud_discoveryengine_v1::client::SchemaService::create_schema::until_done";
10801            }
10802
10803            let stub = self.0.stub.clone();
10804            let mut options = self.0.options.clone();
10805            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
10806            let query = move |name| {
10807                let stub = stub.clone();
10808                let options = options.clone();
10809                async {
10810                    let op = GetOperation::new(stub)
10811                        .set_name(name)
10812                        .with_options(options)
10813                        .send()
10814                        .await?;
10815                    Ok(Operation::new(op))
10816                }
10817            };
10818
10819            let start = move || async {
10820                let op = self.send().await?;
10821                Ok(Operation::new(op))
10822            };
10823
10824            use google_cloud_lro::internal::PollerExt;
10825            {
10826                google_cloud_lro::internal::new_poller(
10827                    polling_error_policy,
10828                    polling_backoff_policy,
10829                    start,
10830                    query,
10831                )
10832            }
10833            .with_options(poller_options)
10834        }
10835
10836        /// Sets the value of [parent][crate::model::CreateSchemaRequest::parent].
10837        ///
10838        /// This is a **required** field for requests.
10839        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
10840            self.0.request.parent = v.into();
10841            self
10842        }
10843
10844        /// Sets the value of [schema][crate::model::CreateSchemaRequest::schema].
10845        ///
10846        /// This is a **required** field for requests.
10847        pub fn set_schema<T>(mut self, v: T) -> Self
10848        where
10849            T: std::convert::Into<crate::model::Schema>,
10850        {
10851            self.0.request.schema = std::option::Option::Some(v.into());
10852            self
10853        }
10854
10855        /// Sets or clears the value of [schema][crate::model::CreateSchemaRequest::schema].
10856        ///
10857        /// This is a **required** field for requests.
10858        pub fn set_or_clear_schema<T>(mut self, v: std::option::Option<T>) -> Self
10859        where
10860            T: std::convert::Into<crate::model::Schema>,
10861        {
10862            self.0.request.schema = v.map(|x| x.into());
10863            self
10864        }
10865
10866        /// Sets the value of [schema_id][crate::model::CreateSchemaRequest::schema_id].
10867        ///
10868        /// This is a **required** field for requests.
10869        pub fn set_schema_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
10870            self.0.request.schema_id = v.into();
10871            self
10872        }
10873    }
10874
10875    #[doc(hidden)]
10876    impl crate::RequestBuilder for CreateSchema {
10877        fn request_options(&mut self) -> &mut crate::RequestOptions {
10878            &mut self.0.options
10879        }
10880    }
10881
10882    /// The request builder for [SchemaService::update_schema][crate::client::SchemaService::update_schema] calls.
10883    ///
10884    /// # Example
10885    /// ```
10886    /// # use google_cloud_discoveryengine_v1::builder::schema_service::UpdateSchema;
10887    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
10888    /// use google_cloud_lro::Poller;
10889    ///
10890    /// let builder = prepare_request_builder();
10891    /// let response = builder.poller().until_done().await?;
10892    /// # Ok(()) }
10893    ///
10894    /// fn prepare_request_builder() -> UpdateSchema {
10895    ///   # panic!();
10896    ///   // ... details omitted ...
10897    /// }
10898    /// ```
10899    #[derive(Clone, Debug)]
10900    pub struct UpdateSchema(RequestBuilder<crate::model::UpdateSchemaRequest>);
10901
10902    impl UpdateSchema {
10903        pub(crate) fn new(
10904            stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
10905        ) -> Self {
10906            Self(RequestBuilder::new(stub))
10907        }
10908
10909        /// Sets the full request, replacing any prior values.
10910        pub fn with_request<V: Into<crate::model::UpdateSchemaRequest>>(mut self, v: V) -> Self {
10911            self.0.request = v.into();
10912            self
10913        }
10914
10915        /// Sets all the options, replacing any prior values.
10916        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
10917            self.0.options = v.into();
10918            self
10919        }
10920
10921        /// Sends the request.
10922        ///
10923        /// # Long running operations
10924        ///
10925        /// This starts, but does not poll, a longrunning operation. More information
10926        /// on [update_schema][crate::client::SchemaService::update_schema].
10927        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
10928            (*self.0.stub)
10929                .update_schema(self.0.request, self.0.options)
10930                .await
10931                .map(crate::Response::into_body)
10932        }
10933
10934        /// Creates a [Poller][google_cloud_lro::Poller] to work with `update_schema`.
10935        pub fn poller(
10936            self,
10937        ) -> impl google_cloud_lro::Poller<crate::model::Schema, crate::model::UpdateSchemaMetadata>
10938        {
10939            type Operation = google_cloud_lro::internal::Operation<
10940                crate::model::Schema,
10941                crate::model::UpdateSchemaMetadata,
10942            >;
10943            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
10944            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
10945            let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
10946            if let Some(ref mut details) = poller_options.tracing {
10947                details.method_name = "google_cloud_discoveryengine_v1::client::SchemaService::update_schema::until_done";
10948            }
10949
10950            let stub = self.0.stub.clone();
10951            let mut options = self.0.options.clone();
10952            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
10953            let query = move |name| {
10954                let stub = stub.clone();
10955                let options = options.clone();
10956                async {
10957                    let op = GetOperation::new(stub)
10958                        .set_name(name)
10959                        .with_options(options)
10960                        .send()
10961                        .await?;
10962                    Ok(Operation::new(op))
10963                }
10964            };
10965
10966            let start = move || async {
10967                let op = self.send().await?;
10968                Ok(Operation::new(op))
10969            };
10970
10971            use google_cloud_lro::internal::PollerExt;
10972            {
10973                google_cloud_lro::internal::new_poller(
10974                    polling_error_policy,
10975                    polling_backoff_policy,
10976                    start,
10977                    query,
10978                )
10979            }
10980            .with_options(poller_options)
10981        }
10982
10983        /// Sets the value of [schema][crate::model::UpdateSchemaRequest::schema].
10984        ///
10985        /// This is a **required** field for requests.
10986        pub fn set_schema<T>(mut self, v: T) -> Self
10987        where
10988            T: std::convert::Into<crate::model::Schema>,
10989        {
10990            self.0.request.schema = std::option::Option::Some(v.into());
10991            self
10992        }
10993
10994        /// Sets or clears the value of [schema][crate::model::UpdateSchemaRequest::schema].
10995        ///
10996        /// This is a **required** field for requests.
10997        pub fn set_or_clear_schema<T>(mut self, v: std::option::Option<T>) -> Self
10998        where
10999            T: std::convert::Into<crate::model::Schema>,
11000        {
11001            self.0.request.schema = v.map(|x| x.into());
11002            self
11003        }
11004
11005        /// Sets the value of [allow_missing][crate::model::UpdateSchemaRequest::allow_missing].
11006        pub fn set_allow_missing<T: Into<bool>>(mut self, v: T) -> Self {
11007            self.0.request.allow_missing = v.into();
11008            self
11009        }
11010    }
11011
11012    #[doc(hidden)]
11013    impl crate::RequestBuilder for UpdateSchema {
11014        fn request_options(&mut self) -> &mut crate::RequestOptions {
11015            &mut self.0.options
11016        }
11017    }
11018
11019    /// The request builder for [SchemaService::delete_schema][crate::client::SchemaService::delete_schema] calls.
11020    ///
11021    /// # Example
11022    /// ```
11023    /// # use google_cloud_discoveryengine_v1::builder::schema_service::DeleteSchema;
11024    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
11025    /// use google_cloud_lro::Poller;
11026    ///
11027    /// let builder = prepare_request_builder();
11028    /// let response = builder.poller().until_done().await?;
11029    /// # Ok(()) }
11030    ///
11031    /// fn prepare_request_builder() -> DeleteSchema {
11032    ///   # panic!();
11033    ///   // ... details omitted ...
11034    /// }
11035    /// ```
11036    #[derive(Clone, Debug)]
11037    pub struct DeleteSchema(RequestBuilder<crate::model::DeleteSchemaRequest>);
11038
11039    impl DeleteSchema {
11040        pub(crate) fn new(
11041            stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
11042        ) -> Self {
11043            Self(RequestBuilder::new(stub))
11044        }
11045
11046        /// Sets the full request, replacing any prior values.
11047        pub fn with_request<V: Into<crate::model::DeleteSchemaRequest>>(mut self, v: V) -> Self {
11048            self.0.request = v.into();
11049            self
11050        }
11051
11052        /// Sets all the options, replacing any prior values.
11053        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
11054            self.0.options = v.into();
11055            self
11056        }
11057
11058        /// Sends the request.
11059        ///
11060        /// # Long running operations
11061        ///
11062        /// This starts, but does not poll, a longrunning operation. More information
11063        /// on [delete_schema][crate::client::SchemaService::delete_schema].
11064        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
11065            (*self.0.stub)
11066                .delete_schema(self.0.request, self.0.options)
11067                .await
11068                .map(crate::Response::into_body)
11069        }
11070
11071        /// Creates a [Poller][google_cloud_lro::Poller] to work with `delete_schema`.
11072        pub fn poller(
11073            self,
11074        ) -> impl google_cloud_lro::Poller<(), crate::model::DeleteSchemaMetadata> {
11075            type Operation = google_cloud_lro::internal::Operation<
11076                wkt::Empty,
11077                crate::model::DeleteSchemaMetadata,
11078            >;
11079            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
11080            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
11081            let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
11082            if let Some(ref mut details) = poller_options.tracing {
11083                details.method_name = "google_cloud_discoveryengine_v1::client::SchemaService::delete_schema::until_done";
11084            }
11085
11086            let stub = self.0.stub.clone();
11087            let mut options = self.0.options.clone();
11088            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
11089            let query = move |name| {
11090                let stub = stub.clone();
11091                let options = options.clone();
11092                async {
11093                    let op = GetOperation::new(stub)
11094                        .set_name(name)
11095                        .with_options(options)
11096                        .send()
11097                        .await?;
11098                    Ok(Operation::new(op))
11099                }
11100            };
11101
11102            let start = move || async {
11103                let op = self.send().await?;
11104                Ok(Operation::new(op))
11105            };
11106
11107            use google_cloud_lro::internal::PollerExt;
11108            {
11109                google_cloud_lro::internal::new_unit_response_poller(
11110                    polling_error_policy,
11111                    polling_backoff_policy,
11112                    start,
11113                    query,
11114                )
11115            }
11116            .with_options(poller_options)
11117        }
11118
11119        /// Sets the value of [name][crate::model::DeleteSchemaRequest::name].
11120        ///
11121        /// This is a **required** field for requests.
11122        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
11123            self.0.request.name = v.into();
11124            self
11125        }
11126    }
11127
11128    #[doc(hidden)]
11129    impl crate::RequestBuilder for DeleteSchema {
11130        fn request_options(&mut self) -> &mut crate::RequestOptions {
11131            &mut self.0.options
11132        }
11133    }
11134
11135    /// The request builder for [SchemaService::list_operations][crate::client::SchemaService::list_operations] calls.
11136    ///
11137    /// # Example
11138    /// ```
11139    /// # use google_cloud_discoveryengine_v1::builder::schema_service::ListOperations;
11140    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
11141    /// use google_cloud_gax::paginator::ItemPaginator;
11142    ///
11143    /// let builder = prepare_request_builder();
11144    /// let mut items = builder.by_item();
11145    /// while let Some(result) = items.next().await {
11146    ///   let item = result?;
11147    /// }
11148    /// # Ok(()) }
11149    ///
11150    /// fn prepare_request_builder() -> ListOperations {
11151    ///   # panic!();
11152    ///   // ... details omitted ...
11153    /// }
11154    /// ```
11155    #[derive(Clone, Debug)]
11156    pub struct ListOperations(
11157        RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
11158    );
11159
11160    impl ListOperations {
11161        pub(crate) fn new(
11162            stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
11163        ) -> Self {
11164            Self(RequestBuilder::new(stub))
11165        }
11166
11167        /// Sets the full request, replacing any prior values.
11168        pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
11169            mut self,
11170            v: V,
11171        ) -> Self {
11172            self.0.request = v.into();
11173            self
11174        }
11175
11176        /// Sets all the options, replacing any prior values.
11177        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
11178            self.0.options = v.into();
11179            self
11180        }
11181
11182        /// Sends the request.
11183        pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
11184            (*self.0.stub)
11185                .list_operations(self.0.request, self.0.options)
11186                .await
11187                .map(crate::Response::into_body)
11188        }
11189
11190        /// Streams each page in the collection.
11191        pub fn by_page(
11192            self,
11193        ) -> impl google_cloud_gax::paginator::Paginator<
11194            google_cloud_longrunning::model::ListOperationsResponse,
11195            crate::Error,
11196        > {
11197            use std::clone::Clone;
11198            let token = self.0.request.page_token.clone();
11199            let execute = move |token: String| {
11200                let mut builder = self.clone();
11201                builder.0.request = builder.0.request.set_page_token(token);
11202                builder.send()
11203            };
11204            google_cloud_gax::paginator::internal::new_paginator(token, execute)
11205        }
11206
11207        /// Streams each item in the collection.
11208        pub fn by_item(
11209            self,
11210        ) -> impl google_cloud_gax::paginator::ItemPaginator<
11211            google_cloud_longrunning::model::ListOperationsResponse,
11212            crate::Error,
11213        > {
11214            use google_cloud_gax::paginator::Paginator;
11215            self.by_page().items()
11216        }
11217
11218        /// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
11219        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
11220            self.0.request.name = v.into();
11221            self
11222        }
11223
11224        /// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::filter].
11225        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
11226            self.0.request.filter = v.into();
11227            self
11228        }
11229
11230        /// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
11231        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
11232            self.0.request.page_size = v.into();
11233            self
11234        }
11235
11236        /// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
11237        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
11238            self.0.request.page_token = v.into();
11239            self
11240        }
11241
11242        /// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
11243        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
11244            self.0.request.return_partial_success = v.into();
11245            self
11246        }
11247    }
11248
11249    #[doc(hidden)]
11250    impl crate::RequestBuilder for ListOperations {
11251        fn request_options(&mut self) -> &mut crate::RequestOptions {
11252            &mut self.0.options
11253        }
11254    }
11255
11256    /// The request builder for [SchemaService::get_operation][crate::client::SchemaService::get_operation] calls.
11257    ///
11258    /// # Example
11259    /// ```
11260    /// # use google_cloud_discoveryengine_v1::builder::schema_service::GetOperation;
11261    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
11262    ///
11263    /// let builder = prepare_request_builder();
11264    /// let response = builder.send().await?;
11265    /// # Ok(()) }
11266    ///
11267    /// fn prepare_request_builder() -> GetOperation {
11268    ///   # panic!();
11269    ///   // ... details omitted ...
11270    /// }
11271    /// ```
11272    #[derive(Clone, Debug)]
11273    pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
11274
11275    impl GetOperation {
11276        pub(crate) fn new(
11277            stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
11278        ) -> Self {
11279            Self(RequestBuilder::new(stub))
11280        }
11281
11282        /// Sets the full request, replacing any prior values.
11283        pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
11284            mut self,
11285            v: V,
11286        ) -> Self {
11287            self.0.request = v.into();
11288            self
11289        }
11290
11291        /// Sets all the options, replacing any prior values.
11292        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
11293            self.0.options = v.into();
11294            self
11295        }
11296
11297        /// Sends the request.
11298        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
11299            (*self.0.stub)
11300                .get_operation(self.0.request, self.0.options)
11301                .await
11302                .map(crate::Response::into_body)
11303        }
11304
11305        /// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
11306        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
11307            self.0.request.name = v.into();
11308            self
11309        }
11310    }
11311
11312    #[doc(hidden)]
11313    impl crate::RequestBuilder for GetOperation {
11314        fn request_options(&mut self) -> &mut crate::RequestOptions {
11315            &mut self.0.options
11316        }
11317    }
11318
11319    /// The request builder for [SchemaService::cancel_operation][crate::client::SchemaService::cancel_operation] calls.
11320    ///
11321    /// # Example
11322    /// ```
11323    /// # use google_cloud_discoveryengine_v1::builder::schema_service::CancelOperation;
11324    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
11325    ///
11326    /// let builder = prepare_request_builder();
11327    /// let response = builder.send().await?;
11328    /// # Ok(()) }
11329    ///
11330    /// fn prepare_request_builder() -> CancelOperation {
11331    ///   # panic!();
11332    ///   // ... details omitted ...
11333    /// }
11334    /// ```
11335    #[derive(Clone, Debug)]
11336    pub struct CancelOperation(
11337        RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
11338    );
11339
11340    impl CancelOperation {
11341        pub(crate) fn new(
11342            stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
11343        ) -> Self {
11344            Self(RequestBuilder::new(stub))
11345        }
11346
11347        /// Sets the full request, replacing any prior values.
11348        pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
11349            mut self,
11350            v: V,
11351        ) -> Self {
11352            self.0.request = v.into();
11353            self
11354        }
11355
11356        /// Sets all the options, replacing any prior values.
11357        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
11358            self.0.options = v.into();
11359            self
11360        }
11361
11362        /// Sends the request.
11363        pub async fn send(self) -> Result<()> {
11364            (*self.0.stub)
11365                .cancel_operation(self.0.request, self.0.options)
11366                .await
11367                .map(crate::Response::into_body)
11368        }
11369
11370        /// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::name].
11371        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
11372            self.0.request.name = v.into();
11373            self
11374        }
11375    }
11376
11377    #[doc(hidden)]
11378    impl crate::RequestBuilder for CancelOperation {
11379        fn request_options(&mut self) -> &mut crate::RequestOptions {
11380            &mut self.0.options
11381        }
11382    }
11383}
11384
11385/// Request and client builders for [SearchService][crate::client::SearchService].
11386#[cfg(feature = "search-service")]
11387#[cfg_attr(docsrs, doc(cfg(feature = "search-service")))]
11388pub mod search_service {
11389    use crate::Result;
11390
11391    /// A builder for [SearchService][crate::client::SearchService].
11392    ///
11393    /// ```
11394    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
11395    /// # use google_cloud_discoveryengine_v1::*;
11396    /// # use builder::search_service::ClientBuilder;
11397    /// # use client::SearchService;
11398    /// let builder : ClientBuilder = SearchService::builder();
11399    /// let client = builder
11400    ///     .with_endpoint("https://discoveryengine.googleapis.com")
11401    ///     .build().await?;
11402    /// # Ok(()) }
11403    /// ```
11404    pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
11405
11406    pub(crate) mod client {
11407        use super::super::super::client::SearchService;
11408        pub struct Factory;
11409        impl crate::ClientFactory for Factory {
11410            type Client = SearchService;
11411            type Credentials = gaxi::options::Credentials;
11412            async fn build(
11413                self,
11414                config: gaxi::options::ClientConfig,
11415            ) -> crate::ClientBuilderResult<Self::Client> {
11416                Self::Client::new(config).await
11417            }
11418        }
11419    }
11420
11421    /// Common implementation for [crate::client::SearchService] request builders.
11422    #[derive(Clone, Debug)]
11423    pub(crate) struct RequestBuilder<R: std::default::Default> {
11424        stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchService>,
11425        request: R,
11426        options: crate::RequestOptions,
11427    }
11428
11429    impl<R> RequestBuilder<R>
11430    where
11431        R: std::default::Default,
11432    {
11433        pub(crate) fn new(
11434            stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchService>,
11435        ) -> Self {
11436            Self {
11437                stub,
11438                request: R::default(),
11439                options: crate::RequestOptions::default(),
11440            }
11441        }
11442    }
11443
11444    /// The request builder for [SearchService::search][crate::client::SearchService::search] calls.
11445    ///
11446    /// # Example
11447    /// ```
11448    /// # use google_cloud_discoveryengine_v1::builder::search_service::Search;
11449    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
11450    /// use google_cloud_gax::paginator::ItemPaginator;
11451    ///
11452    /// let builder = prepare_request_builder();
11453    /// let mut items = builder.by_item();
11454    /// while let Some(result) = items.next().await {
11455    ///   let item = result?;
11456    /// }
11457    /// # Ok(()) }
11458    ///
11459    /// fn prepare_request_builder() -> Search {
11460    ///   # panic!();
11461    ///   // ... details omitted ...
11462    /// }
11463    /// ```
11464    #[derive(Clone, Debug)]
11465    pub struct Search(RequestBuilder<crate::model::SearchRequest>);
11466
11467    impl Search {
11468        pub(crate) fn new(
11469            stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchService>,
11470        ) -> Self {
11471            Self(RequestBuilder::new(stub))
11472        }
11473
11474        /// Sets the full request, replacing any prior values.
11475        pub fn with_request<V: Into<crate::model::SearchRequest>>(mut self, v: V) -> Self {
11476            self.0.request = v.into();
11477            self
11478        }
11479
11480        /// Sets all the options, replacing any prior values.
11481        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
11482            self.0.options = v.into();
11483            self
11484        }
11485
11486        /// Sends the request.
11487        pub async fn send(self) -> Result<crate::model::SearchResponse> {
11488            (*self.0.stub)
11489                .search(self.0.request, self.0.options)
11490                .await
11491                .map(crate::Response::into_body)
11492        }
11493
11494        /// Streams each page in the collection.
11495        pub fn by_page(
11496            self,
11497        ) -> impl google_cloud_gax::paginator::Paginator<crate::model::SearchResponse, crate::Error>
11498        {
11499            use std::clone::Clone;
11500            let token = self.0.request.page_token.clone();
11501            let execute = move |token: String| {
11502                let mut builder = self.clone();
11503                builder.0.request = builder.0.request.set_page_token(token);
11504                builder.send()
11505            };
11506            google_cloud_gax::paginator::internal::new_paginator(token, execute)
11507        }
11508
11509        /// Streams each item in the collection.
11510        pub fn by_item(
11511            self,
11512        ) -> impl google_cloud_gax::paginator::ItemPaginator<crate::model::SearchResponse, crate::Error>
11513        {
11514            use google_cloud_gax::paginator::Paginator;
11515            self.by_page().items()
11516        }
11517
11518        /// Sets the value of [serving_config][crate::model::SearchRequest::serving_config].
11519        ///
11520        /// This is a **required** field for requests.
11521        pub fn set_serving_config<T: Into<std::string::String>>(mut self, v: T) -> Self {
11522            self.0.request.serving_config = v.into();
11523            self
11524        }
11525
11526        /// Sets the value of [branch][crate::model::SearchRequest::branch].
11527        pub fn set_branch<T: Into<std::string::String>>(mut self, v: T) -> Self {
11528            self.0.request.branch = v.into();
11529            self
11530        }
11531
11532        /// Sets the value of [query][crate::model::SearchRequest::query].
11533        pub fn set_query<T: Into<std::string::String>>(mut self, v: T) -> Self {
11534            self.0.request.query = v.into();
11535            self
11536        }
11537
11538        /// Sets the value of [page_categories][crate::model::SearchRequest::page_categories].
11539        pub fn set_page_categories<T, V>(mut self, v: T) -> Self
11540        where
11541            T: std::iter::IntoIterator<Item = V>,
11542            V: std::convert::Into<std::string::String>,
11543        {
11544            use std::iter::Iterator;
11545            self.0.request.page_categories = v.into_iter().map(|i| i.into()).collect();
11546            self
11547        }
11548
11549        /// Sets the value of [image_query][crate::model::SearchRequest::image_query].
11550        pub fn set_image_query<T>(mut self, v: T) -> Self
11551        where
11552            T: std::convert::Into<crate::model::search_request::ImageQuery>,
11553        {
11554            self.0.request.image_query = std::option::Option::Some(v.into());
11555            self
11556        }
11557
11558        /// Sets or clears the value of [image_query][crate::model::SearchRequest::image_query].
11559        pub fn set_or_clear_image_query<T>(mut self, v: std::option::Option<T>) -> Self
11560        where
11561            T: std::convert::Into<crate::model::search_request::ImageQuery>,
11562        {
11563            self.0.request.image_query = v.map(|x| x.into());
11564            self
11565        }
11566
11567        /// Sets the value of [page_size][crate::model::SearchRequest::page_size].
11568        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
11569            self.0.request.page_size = v.into();
11570            self
11571        }
11572
11573        /// Sets the value of [page_token][crate::model::SearchRequest::page_token].
11574        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
11575            self.0.request.page_token = v.into();
11576            self
11577        }
11578
11579        /// Sets the value of [offset][crate::model::SearchRequest::offset].
11580        pub fn set_offset<T: Into<i32>>(mut self, v: T) -> Self {
11581            self.0.request.offset = v.into();
11582            self
11583        }
11584
11585        /// Sets the value of [one_box_page_size][crate::model::SearchRequest::one_box_page_size].
11586        pub fn set_one_box_page_size<T: Into<i32>>(mut self, v: T) -> Self {
11587            self.0.request.one_box_page_size = v.into();
11588            self
11589        }
11590
11591        /// Sets the value of [data_store_specs][crate::model::SearchRequest::data_store_specs].
11592        pub fn set_data_store_specs<T, V>(mut self, v: T) -> Self
11593        where
11594            T: std::iter::IntoIterator<Item = V>,
11595            V: std::convert::Into<crate::model::search_request::DataStoreSpec>,
11596        {
11597            use std::iter::Iterator;
11598            self.0.request.data_store_specs = v.into_iter().map(|i| i.into()).collect();
11599            self
11600        }
11601
11602        /// Sets the value of [filter][crate::model::SearchRequest::filter].
11603        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
11604            self.0.request.filter = v.into();
11605            self
11606        }
11607
11608        /// Sets the value of [canonical_filter][crate::model::SearchRequest::canonical_filter].
11609        pub fn set_canonical_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
11610            self.0.request.canonical_filter = v.into();
11611            self
11612        }
11613
11614        /// Sets the value of [order_by][crate::model::SearchRequest::order_by].
11615        pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
11616            self.0.request.order_by = v.into();
11617            self
11618        }
11619
11620        /// Sets the value of [user_info][crate::model::SearchRequest::user_info].
11621        pub fn set_user_info<T>(mut self, v: T) -> Self
11622        where
11623            T: std::convert::Into<crate::model::UserInfo>,
11624        {
11625            self.0.request.user_info = std::option::Option::Some(v.into());
11626            self
11627        }
11628
11629        /// Sets or clears the value of [user_info][crate::model::SearchRequest::user_info].
11630        pub fn set_or_clear_user_info<T>(mut self, v: std::option::Option<T>) -> Self
11631        where
11632            T: std::convert::Into<crate::model::UserInfo>,
11633        {
11634            self.0.request.user_info = v.map(|x| x.into());
11635            self
11636        }
11637
11638        /// Sets the value of [language_code][crate::model::SearchRequest::language_code].
11639        pub fn set_language_code<T: Into<std::string::String>>(mut self, v: T) -> Self {
11640            self.0.request.language_code = v.into();
11641            self
11642        }
11643
11644        /// Sets the value of [facet_specs][crate::model::SearchRequest::facet_specs].
11645        pub fn set_facet_specs<T, V>(mut self, v: T) -> Self
11646        where
11647            T: std::iter::IntoIterator<Item = V>,
11648            V: std::convert::Into<crate::model::search_request::FacetSpec>,
11649        {
11650            use std::iter::Iterator;
11651            self.0.request.facet_specs = v.into_iter().map(|i| i.into()).collect();
11652            self
11653        }
11654
11655        /// Sets the value of [boost_spec][crate::model::SearchRequest::boost_spec].
11656        pub fn set_boost_spec<T>(mut self, v: T) -> Self
11657        where
11658            T: std::convert::Into<crate::model::search_request::BoostSpec>,
11659        {
11660            self.0.request.boost_spec = std::option::Option::Some(v.into());
11661            self
11662        }
11663
11664        /// Sets or clears the value of [boost_spec][crate::model::SearchRequest::boost_spec].
11665        pub fn set_or_clear_boost_spec<T>(mut self, v: std::option::Option<T>) -> Self
11666        where
11667            T: std::convert::Into<crate::model::search_request::BoostSpec>,
11668        {
11669            self.0.request.boost_spec = v.map(|x| x.into());
11670            self
11671        }
11672
11673        /// Sets the value of [params][crate::model::SearchRequest::params].
11674        pub fn set_params<T, K, V>(mut self, v: T) -> Self
11675        where
11676            T: std::iter::IntoIterator<Item = (K, V)>,
11677            K: std::convert::Into<std::string::String>,
11678            V: std::convert::Into<wkt::Value>,
11679        {
11680            self.0.request.params = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
11681            self
11682        }
11683
11684        /// Sets the value of [query_expansion_spec][crate::model::SearchRequest::query_expansion_spec].
11685        pub fn set_query_expansion_spec<T>(mut self, v: T) -> Self
11686        where
11687            T: std::convert::Into<crate::model::search_request::QueryExpansionSpec>,
11688        {
11689            self.0.request.query_expansion_spec = std::option::Option::Some(v.into());
11690            self
11691        }
11692
11693        /// Sets or clears the value of [query_expansion_spec][crate::model::SearchRequest::query_expansion_spec].
11694        pub fn set_or_clear_query_expansion_spec<T>(mut self, v: std::option::Option<T>) -> Self
11695        where
11696            T: std::convert::Into<crate::model::search_request::QueryExpansionSpec>,
11697        {
11698            self.0.request.query_expansion_spec = v.map(|x| x.into());
11699            self
11700        }
11701
11702        /// Sets the value of [spell_correction_spec][crate::model::SearchRequest::spell_correction_spec].
11703        pub fn set_spell_correction_spec<T>(mut self, v: T) -> Self
11704        where
11705            T: std::convert::Into<crate::model::search_request::SpellCorrectionSpec>,
11706        {
11707            self.0.request.spell_correction_spec = std::option::Option::Some(v.into());
11708            self
11709        }
11710
11711        /// Sets or clears the value of [spell_correction_spec][crate::model::SearchRequest::spell_correction_spec].
11712        pub fn set_or_clear_spell_correction_spec<T>(mut self, v: std::option::Option<T>) -> Self
11713        where
11714            T: std::convert::Into<crate::model::search_request::SpellCorrectionSpec>,
11715        {
11716            self.0.request.spell_correction_spec = v.map(|x| x.into());
11717            self
11718        }
11719
11720        /// Sets the value of [user_pseudo_id][crate::model::SearchRequest::user_pseudo_id].
11721        pub fn set_user_pseudo_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
11722            self.0.request.user_pseudo_id = v.into();
11723            self
11724        }
11725
11726        /// Sets the value of [content_search_spec][crate::model::SearchRequest::content_search_spec].
11727        pub fn set_content_search_spec<T>(mut self, v: T) -> Self
11728        where
11729            T: std::convert::Into<crate::model::search_request::ContentSearchSpec>,
11730        {
11731            self.0.request.content_search_spec = std::option::Option::Some(v.into());
11732            self
11733        }
11734
11735        /// Sets or clears the value of [content_search_spec][crate::model::SearchRequest::content_search_spec].
11736        pub fn set_or_clear_content_search_spec<T>(mut self, v: std::option::Option<T>) -> Self
11737        where
11738            T: std::convert::Into<crate::model::search_request::ContentSearchSpec>,
11739        {
11740            self.0.request.content_search_spec = v.map(|x| x.into());
11741            self
11742        }
11743
11744        /// Sets the value of [ranking_expression][crate::model::SearchRequest::ranking_expression].
11745        pub fn set_ranking_expression<T: Into<std::string::String>>(mut self, v: T) -> Self {
11746            self.0.request.ranking_expression = v.into();
11747            self
11748        }
11749
11750        /// Sets the value of [ranking_expression_backend][crate::model::SearchRequest::ranking_expression_backend].
11751        pub fn set_ranking_expression_backend<
11752            T: Into<crate::model::search_request::RankingExpressionBackend>,
11753        >(
11754            mut self,
11755            v: T,
11756        ) -> Self {
11757            self.0.request.ranking_expression_backend = v.into();
11758            self
11759        }
11760
11761        /// Sets the value of [safe_search][crate::model::SearchRequest::safe_search].
11762        pub fn set_safe_search<T: Into<bool>>(mut self, v: T) -> Self {
11763            self.0.request.safe_search = v.into();
11764            self
11765        }
11766
11767        /// Sets the value of [user_labels][crate::model::SearchRequest::user_labels].
11768        pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
11769        where
11770            T: std::iter::IntoIterator<Item = (K, V)>,
11771            K: std::convert::Into<std::string::String>,
11772            V: std::convert::Into<std::string::String>,
11773        {
11774            self.0.request.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
11775            self
11776        }
11777
11778        /// Sets the value of [natural_language_query_understanding_spec][crate::model::SearchRequest::natural_language_query_understanding_spec].
11779        pub fn set_natural_language_query_understanding_spec<T>(mut self, v: T) -> Self
11780        where
11781            T: std::convert::Into<
11782                    crate::model::search_request::NaturalLanguageQueryUnderstandingSpec,
11783                >,
11784        {
11785            self.0.request.natural_language_query_understanding_spec =
11786                std::option::Option::Some(v.into());
11787            self
11788        }
11789
11790        /// Sets or clears the value of [natural_language_query_understanding_spec][crate::model::SearchRequest::natural_language_query_understanding_spec].
11791        pub fn set_or_clear_natural_language_query_understanding_spec<T>(
11792            mut self,
11793            v: std::option::Option<T>,
11794        ) -> Self
11795        where
11796            T: std::convert::Into<
11797                    crate::model::search_request::NaturalLanguageQueryUnderstandingSpec,
11798                >,
11799        {
11800            self.0.request.natural_language_query_understanding_spec = v.map(|x| x.into());
11801            self
11802        }
11803
11804        /// Sets the value of [search_as_you_type_spec][crate::model::SearchRequest::search_as_you_type_spec].
11805        pub fn set_search_as_you_type_spec<T>(mut self, v: T) -> Self
11806        where
11807            T: std::convert::Into<crate::model::search_request::SearchAsYouTypeSpec>,
11808        {
11809            self.0.request.search_as_you_type_spec = std::option::Option::Some(v.into());
11810            self
11811        }
11812
11813        /// Sets or clears the value of [search_as_you_type_spec][crate::model::SearchRequest::search_as_you_type_spec].
11814        pub fn set_or_clear_search_as_you_type_spec<T>(mut self, v: std::option::Option<T>) -> Self
11815        where
11816            T: std::convert::Into<crate::model::search_request::SearchAsYouTypeSpec>,
11817        {
11818            self.0.request.search_as_you_type_spec = v.map(|x| x.into());
11819            self
11820        }
11821
11822        /// Sets the value of [display_spec][crate::model::SearchRequest::display_spec].
11823        pub fn set_display_spec<T>(mut self, v: T) -> Self
11824        where
11825            T: std::convert::Into<crate::model::search_request::DisplaySpec>,
11826        {
11827            self.0.request.display_spec = std::option::Option::Some(v.into());
11828            self
11829        }
11830
11831        /// Sets or clears the value of [display_spec][crate::model::SearchRequest::display_spec].
11832        pub fn set_or_clear_display_spec<T>(mut self, v: std::option::Option<T>) -> Self
11833        where
11834            T: std::convert::Into<crate::model::search_request::DisplaySpec>,
11835        {
11836            self.0.request.display_spec = v.map(|x| x.into());
11837            self
11838        }
11839
11840        /// Sets the value of [crowding_specs][crate::model::SearchRequest::crowding_specs].
11841        pub fn set_crowding_specs<T, V>(mut self, v: T) -> Self
11842        where
11843            T: std::iter::IntoIterator<Item = V>,
11844            V: std::convert::Into<crate::model::search_request::CrowdingSpec>,
11845        {
11846            use std::iter::Iterator;
11847            self.0.request.crowding_specs = v.into_iter().map(|i| i.into()).collect();
11848            self
11849        }
11850
11851        /// Sets the value of [session][crate::model::SearchRequest::session].
11852        pub fn set_session<T: Into<std::string::String>>(mut self, v: T) -> Self {
11853            self.0.request.session = v.into();
11854            self
11855        }
11856
11857        /// Sets the value of [session_spec][crate::model::SearchRequest::session_spec].
11858        pub fn set_session_spec<T>(mut self, v: T) -> Self
11859        where
11860            T: std::convert::Into<crate::model::search_request::SessionSpec>,
11861        {
11862            self.0.request.session_spec = std::option::Option::Some(v.into());
11863            self
11864        }
11865
11866        /// Sets or clears the value of [session_spec][crate::model::SearchRequest::session_spec].
11867        pub fn set_or_clear_session_spec<T>(mut self, v: std::option::Option<T>) -> Self
11868        where
11869            T: std::convert::Into<crate::model::search_request::SessionSpec>,
11870        {
11871            self.0.request.session_spec = v.map(|x| x.into());
11872            self
11873        }
11874
11875        /// Sets the value of [relevance_threshold][crate::model::SearchRequest::relevance_threshold].
11876        pub fn set_relevance_threshold<
11877            T: Into<crate::model::search_request::RelevanceThreshold>,
11878        >(
11879            mut self,
11880            v: T,
11881        ) -> Self {
11882            self.0.request.relevance_threshold = v.into();
11883            self
11884        }
11885
11886        /// Sets the value of [relevance_filter_spec][crate::model::SearchRequest::relevance_filter_spec].
11887        pub fn set_relevance_filter_spec<T>(mut self, v: T) -> Self
11888        where
11889            T: std::convert::Into<crate::model::search_request::RelevanceFilterSpec>,
11890        {
11891            self.0.request.relevance_filter_spec = std::option::Option::Some(v.into());
11892            self
11893        }
11894
11895        /// Sets or clears the value of [relevance_filter_spec][crate::model::SearchRequest::relevance_filter_spec].
11896        pub fn set_or_clear_relevance_filter_spec<T>(mut self, v: std::option::Option<T>) -> Self
11897        where
11898            T: std::convert::Into<crate::model::search_request::RelevanceFilterSpec>,
11899        {
11900            self.0.request.relevance_filter_spec = v.map(|x| x.into());
11901            self
11902        }
11903
11904        /// Sets the value of [relevance_score_spec][crate::model::SearchRequest::relevance_score_spec].
11905        pub fn set_relevance_score_spec<T>(mut self, v: T) -> Self
11906        where
11907            T: std::convert::Into<crate::model::search_request::RelevanceScoreSpec>,
11908        {
11909            self.0.request.relevance_score_spec = std::option::Option::Some(v.into());
11910            self
11911        }
11912
11913        /// Sets or clears the value of [relevance_score_spec][crate::model::SearchRequest::relevance_score_spec].
11914        pub fn set_or_clear_relevance_score_spec<T>(mut self, v: std::option::Option<T>) -> Self
11915        where
11916            T: std::convert::Into<crate::model::search_request::RelevanceScoreSpec>,
11917        {
11918            self.0.request.relevance_score_spec = v.map(|x| x.into());
11919            self
11920        }
11921    }
11922
11923    #[doc(hidden)]
11924    impl crate::RequestBuilder for Search {
11925        fn request_options(&mut self) -> &mut crate::RequestOptions {
11926            &mut self.0.options
11927        }
11928    }
11929
11930    /// The request builder for [SearchService::search_lite][crate::client::SearchService::search_lite] calls.
11931    ///
11932    /// # Example
11933    /// ```
11934    /// # use google_cloud_discoveryengine_v1::builder::search_service::SearchLite;
11935    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
11936    /// use google_cloud_gax::paginator::ItemPaginator;
11937    ///
11938    /// let builder = prepare_request_builder();
11939    /// let mut items = builder.by_item();
11940    /// while let Some(result) = items.next().await {
11941    ///   let item = result?;
11942    /// }
11943    /// # Ok(()) }
11944    ///
11945    /// fn prepare_request_builder() -> SearchLite {
11946    ///   # panic!();
11947    ///   // ... details omitted ...
11948    /// }
11949    /// ```
11950    #[derive(Clone, Debug)]
11951    pub struct SearchLite(RequestBuilder<crate::model::SearchRequest>);
11952
11953    impl SearchLite {
11954        pub(crate) fn new(
11955            stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchService>,
11956        ) -> Self {
11957            Self(RequestBuilder::new(stub))
11958        }
11959
11960        /// Sets the full request, replacing any prior values.
11961        pub fn with_request<V: Into<crate::model::SearchRequest>>(mut self, v: V) -> Self {
11962            self.0.request = v.into();
11963            self
11964        }
11965
11966        /// Sets all the options, replacing any prior values.
11967        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
11968            self.0.options = v.into();
11969            self
11970        }
11971
11972        /// Sends the request.
11973        pub async fn send(self) -> Result<crate::model::SearchResponse> {
11974            (*self.0.stub)
11975                .search_lite(self.0.request, self.0.options)
11976                .await
11977                .map(crate::Response::into_body)
11978        }
11979
11980        /// Streams each page in the collection.
11981        pub fn by_page(
11982            self,
11983        ) -> impl google_cloud_gax::paginator::Paginator<crate::model::SearchResponse, crate::Error>
11984        {
11985            use std::clone::Clone;
11986            let token = self.0.request.page_token.clone();
11987            let execute = move |token: String| {
11988                let mut builder = self.clone();
11989                builder.0.request = builder.0.request.set_page_token(token);
11990                builder.send()
11991            };
11992            google_cloud_gax::paginator::internal::new_paginator(token, execute)
11993        }
11994
11995        /// Streams each item in the collection.
11996        pub fn by_item(
11997            self,
11998        ) -> impl google_cloud_gax::paginator::ItemPaginator<crate::model::SearchResponse, crate::Error>
11999        {
12000            use google_cloud_gax::paginator::Paginator;
12001            self.by_page().items()
12002        }
12003
12004        /// Sets the value of [serving_config][crate::model::SearchRequest::serving_config].
12005        ///
12006        /// This is a **required** field for requests.
12007        pub fn set_serving_config<T: Into<std::string::String>>(mut self, v: T) -> Self {
12008            self.0.request.serving_config = v.into();
12009            self
12010        }
12011
12012        /// Sets the value of [branch][crate::model::SearchRequest::branch].
12013        pub fn set_branch<T: Into<std::string::String>>(mut self, v: T) -> Self {
12014            self.0.request.branch = v.into();
12015            self
12016        }
12017
12018        /// Sets the value of [query][crate::model::SearchRequest::query].
12019        pub fn set_query<T: Into<std::string::String>>(mut self, v: T) -> Self {
12020            self.0.request.query = v.into();
12021            self
12022        }
12023
12024        /// Sets the value of [page_categories][crate::model::SearchRequest::page_categories].
12025        pub fn set_page_categories<T, V>(mut self, v: T) -> Self
12026        where
12027            T: std::iter::IntoIterator<Item = V>,
12028            V: std::convert::Into<std::string::String>,
12029        {
12030            use std::iter::Iterator;
12031            self.0.request.page_categories = v.into_iter().map(|i| i.into()).collect();
12032            self
12033        }
12034
12035        /// Sets the value of [image_query][crate::model::SearchRequest::image_query].
12036        pub fn set_image_query<T>(mut self, v: T) -> Self
12037        where
12038            T: std::convert::Into<crate::model::search_request::ImageQuery>,
12039        {
12040            self.0.request.image_query = std::option::Option::Some(v.into());
12041            self
12042        }
12043
12044        /// Sets or clears the value of [image_query][crate::model::SearchRequest::image_query].
12045        pub fn set_or_clear_image_query<T>(mut self, v: std::option::Option<T>) -> Self
12046        where
12047            T: std::convert::Into<crate::model::search_request::ImageQuery>,
12048        {
12049            self.0.request.image_query = v.map(|x| x.into());
12050            self
12051        }
12052
12053        /// Sets the value of [page_size][crate::model::SearchRequest::page_size].
12054        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
12055            self.0.request.page_size = v.into();
12056            self
12057        }
12058
12059        /// Sets the value of [page_token][crate::model::SearchRequest::page_token].
12060        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
12061            self.0.request.page_token = v.into();
12062            self
12063        }
12064
12065        /// Sets the value of [offset][crate::model::SearchRequest::offset].
12066        pub fn set_offset<T: Into<i32>>(mut self, v: T) -> Self {
12067            self.0.request.offset = v.into();
12068            self
12069        }
12070
12071        /// Sets the value of [one_box_page_size][crate::model::SearchRequest::one_box_page_size].
12072        pub fn set_one_box_page_size<T: Into<i32>>(mut self, v: T) -> Self {
12073            self.0.request.one_box_page_size = v.into();
12074            self
12075        }
12076
12077        /// Sets the value of [data_store_specs][crate::model::SearchRequest::data_store_specs].
12078        pub fn set_data_store_specs<T, V>(mut self, v: T) -> Self
12079        where
12080            T: std::iter::IntoIterator<Item = V>,
12081            V: std::convert::Into<crate::model::search_request::DataStoreSpec>,
12082        {
12083            use std::iter::Iterator;
12084            self.0.request.data_store_specs = v.into_iter().map(|i| i.into()).collect();
12085            self
12086        }
12087
12088        /// Sets the value of [filter][crate::model::SearchRequest::filter].
12089        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
12090            self.0.request.filter = v.into();
12091            self
12092        }
12093
12094        /// Sets the value of [canonical_filter][crate::model::SearchRequest::canonical_filter].
12095        pub fn set_canonical_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
12096            self.0.request.canonical_filter = v.into();
12097            self
12098        }
12099
12100        /// Sets the value of [order_by][crate::model::SearchRequest::order_by].
12101        pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
12102            self.0.request.order_by = v.into();
12103            self
12104        }
12105
12106        /// Sets the value of [user_info][crate::model::SearchRequest::user_info].
12107        pub fn set_user_info<T>(mut self, v: T) -> Self
12108        where
12109            T: std::convert::Into<crate::model::UserInfo>,
12110        {
12111            self.0.request.user_info = std::option::Option::Some(v.into());
12112            self
12113        }
12114
12115        /// Sets or clears the value of [user_info][crate::model::SearchRequest::user_info].
12116        pub fn set_or_clear_user_info<T>(mut self, v: std::option::Option<T>) -> Self
12117        where
12118            T: std::convert::Into<crate::model::UserInfo>,
12119        {
12120            self.0.request.user_info = v.map(|x| x.into());
12121            self
12122        }
12123
12124        /// Sets the value of [language_code][crate::model::SearchRequest::language_code].
12125        pub fn set_language_code<T: Into<std::string::String>>(mut self, v: T) -> Self {
12126            self.0.request.language_code = v.into();
12127            self
12128        }
12129
12130        /// Sets the value of [facet_specs][crate::model::SearchRequest::facet_specs].
12131        pub fn set_facet_specs<T, V>(mut self, v: T) -> Self
12132        where
12133            T: std::iter::IntoIterator<Item = V>,
12134            V: std::convert::Into<crate::model::search_request::FacetSpec>,
12135        {
12136            use std::iter::Iterator;
12137            self.0.request.facet_specs = v.into_iter().map(|i| i.into()).collect();
12138            self
12139        }
12140
12141        /// Sets the value of [boost_spec][crate::model::SearchRequest::boost_spec].
12142        pub fn set_boost_spec<T>(mut self, v: T) -> Self
12143        where
12144            T: std::convert::Into<crate::model::search_request::BoostSpec>,
12145        {
12146            self.0.request.boost_spec = std::option::Option::Some(v.into());
12147            self
12148        }
12149
12150        /// Sets or clears the value of [boost_spec][crate::model::SearchRequest::boost_spec].
12151        pub fn set_or_clear_boost_spec<T>(mut self, v: std::option::Option<T>) -> Self
12152        where
12153            T: std::convert::Into<crate::model::search_request::BoostSpec>,
12154        {
12155            self.0.request.boost_spec = v.map(|x| x.into());
12156            self
12157        }
12158
12159        /// Sets the value of [params][crate::model::SearchRequest::params].
12160        pub fn set_params<T, K, V>(mut self, v: T) -> Self
12161        where
12162            T: std::iter::IntoIterator<Item = (K, V)>,
12163            K: std::convert::Into<std::string::String>,
12164            V: std::convert::Into<wkt::Value>,
12165        {
12166            self.0.request.params = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
12167            self
12168        }
12169
12170        /// Sets the value of [query_expansion_spec][crate::model::SearchRequest::query_expansion_spec].
12171        pub fn set_query_expansion_spec<T>(mut self, v: T) -> Self
12172        where
12173            T: std::convert::Into<crate::model::search_request::QueryExpansionSpec>,
12174        {
12175            self.0.request.query_expansion_spec = std::option::Option::Some(v.into());
12176            self
12177        }
12178
12179        /// Sets or clears the value of [query_expansion_spec][crate::model::SearchRequest::query_expansion_spec].
12180        pub fn set_or_clear_query_expansion_spec<T>(mut self, v: std::option::Option<T>) -> Self
12181        where
12182            T: std::convert::Into<crate::model::search_request::QueryExpansionSpec>,
12183        {
12184            self.0.request.query_expansion_spec = v.map(|x| x.into());
12185            self
12186        }
12187
12188        /// Sets the value of [spell_correction_spec][crate::model::SearchRequest::spell_correction_spec].
12189        pub fn set_spell_correction_spec<T>(mut self, v: T) -> Self
12190        where
12191            T: std::convert::Into<crate::model::search_request::SpellCorrectionSpec>,
12192        {
12193            self.0.request.spell_correction_spec = std::option::Option::Some(v.into());
12194            self
12195        }
12196
12197        /// Sets or clears the value of [spell_correction_spec][crate::model::SearchRequest::spell_correction_spec].
12198        pub fn set_or_clear_spell_correction_spec<T>(mut self, v: std::option::Option<T>) -> Self
12199        where
12200            T: std::convert::Into<crate::model::search_request::SpellCorrectionSpec>,
12201        {
12202            self.0.request.spell_correction_spec = v.map(|x| x.into());
12203            self
12204        }
12205
12206        /// Sets the value of [user_pseudo_id][crate::model::SearchRequest::user_pseudo_id].
12207        pub fn set_user_pseudo_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
12208            self.0.request.user_pseudo_id = v.into();
12209            self
12210        }
12211
12212        /// Sets the value of [content_search_spec][crate::model::SearchRequest::content_search_spec].
12213        pub fn set_content_search_spec<T>(mut self, v: T) -> Self
12214        where
12215            T: std::convert::Into<crate::model::search_request::ContentSearchSpec>,
12216        {
12217            self.0.request.content_search_spec = std::option::Option::Some(v.into());
12218            self
12219        }
12220
12221        /// Sets or clears the value of [content_search_spec][crate::model::SearchRequest::content_search_spec].
12222        pub fn set_or_clear_content_search_spec<T>(mut self, v: std::option::Option<T>) -> Self
12223        where
12224            T: std::convert::Into<crate::model::search_request::ContentSearchSpec>,
12225        {
12226            self.0.request.content_search_spec = v.map(|x| x.into());
12227            self
12228        }
12229
12230        /// Sets the value of [ranking_expression][crate::model::SearchRequest::ranking_expression].
12231        pub fn set_ranking_expression<T: Into<std::string::String>>(mut self, v: T) -> Self {
12232            self.0.request.ranking_expression = v.into();
12233            self
12234        }
12235
12236        /// Sets the value of [ranking_expression_backend][crate::model::SearchRequest::ranking_expression_backend].
12237        pub fn set_ranking_expression_backend<
12238            T: Into<crate::model::search_request::RankingExpressionBackend>,
12239        >(
12240            mut self,
12241            v: T,
12242        ) -> Self {
12243            self.0.request.ranking_expression_backend = v.into();
12244            self
12245        }
12246
12247        /// Sets the value of [safe_search][crate::model::SearchRequest::safe_search].
12248        pub fn set_safe_search<T: Into<bool>>(mut self, v: T) -> Self {
12249            self.0.request.safe_search = v.into();
12250            self
12251        }
12252
12253        /// Sets the value of [user_labels][crate::model::SearchRequest::user_labels].
12254        pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
12255        where
12256            T: std::iter::IntoIterator<Item = (K, V)>,
12257            K: std::convert::Into<std::string::String>,
12258            V: std::convert::Into<std::string::String>,
12259        {
12260            self.0.request.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
12261            self
12262        }
12263
12264        /// Sets the value of [natural_language_query_understanding_spec][crate::model::SearchRequest::natural_language_query_understanding_spec].
12265        pub fn set_natural_language_query_understanding_spec<T>(mut self, v: T) -> Self
12266        where
12267            T: std::convert::Into<
12268                    crate::model::search_request::NaturalLanguageQueryUnderstandingSpec,
12269                >,
12270        {
12271            self.0.request.natural_language_query_understanding_spec =
12272                std::option::Option::Some(v.into());
12273            self
12274        }
12275
12276        /// Sets or clears the value of [natural_language_query_understanding_spec][crate::model::SearchRequest::natural_language_query_understanding_spec].
12277        pub fn set_or_clear_natural_language_query_understanding_spec<T>(
12278            mut self,
12279            v: std::option::Option<T>,
12280        ) -> Self
12281        where
12282            T: std::convert::Into<
12283                    crate::model::search_request::NaturalLanguageQueryUnderstandingSpec,
12284                >,
12285        {
12286            self.0.request.natural_language_query_understanding_spec = v.map(|x| x.into());
12287            self
12288        }
12289
12290        /// Sets the value of [search_as_you_type_spec][crate::model::SearchRequest::search_as_you_type_spec].
12291        pub fn set_search_as_you_type_spec<T>(mut self, v: T) -> Self
12292        where
12293            T: std::convert::Into<crate::model::search_request::SearchAsYouTypeSpec>,
12294        {
12295            self.0.request.search_as_you_type_spec = std::option::Option::Some(v.into());
12296            self
12297        }
12298
12299        /// Sets or clears the value of [search_as_you_type_spec][crate::model::SearchRequest::search_as_you_type_spec].
12300        pub fn set_or_clear_search_as_you_type_spec<T>(mut self, v: std::option::Option<T>) -> Self
12301        where
12302            T: std::convert::Into<crate::model::search_request::SearchAsYouTypeSpec>,
12303        {
12304            self.0.request.search_as_you_type_spec = v.map(|x| x.into());
12305            self
12306        }
12307
12308        /// Sets the value of [display_spec][crate::model::SearchRequest::display_spec].
12309        pub fn set_display_spec<T>(mut self, v: T) -> Self
12310        where
12311            T: std::convert::Into<crate::model::search_request::DisplaySpec>,
12312        {
12313            self.0.request.display_spec = std::option::Option::Some(v.into());
12314            self
12315        }
12316
12317        /// Sets or clears the value of [display_spec][crate::model::SearchRequest::display_spec].
12318        pub fn set_or_clear_display_spec<T>(mut self, v: std::option::Option<T>) -> Self
12319        where
12320            T: std::convert::Into<crate::model::search_request::DisplaySpec>,
12321        {
12322            self.0.request.display_spec = v.map(|x| x.into());
12323            self
12324        }
12325
12326        /// Sets the value of [crowding_specs][crate::model::SearchRequest::crowding_specs].
12327        pub fn set_crowding_specs<T, V>(mut self, v: T) -> Self
12328        where
12329            T: std::iter::IntoIterator<Item = V>,
12330            V: std::convert::Into<crate::model::search_request::CrowdingSpec>,
12331        {
12332            use std::iter::Iterator;
12333            self.0.request.crowding_specs = v.into_iter().map(|i| i.into()).collect();
12334            self
12335        }
12336
12337        /// Sets the value of [session][crate::model::SearchRequest::session].
12338        pub fn set_session<T: Into<std::string::String>>(mut self, v: T) -> Self {
12339            self.0.request.session = v.into();
12340            self
12341        }
12342
12343        /// Sets the value of [session_spec][crate::model::SearchRequest::session_spec].
12344        pub fn set_session_spec<T>(mut self, v: T) -> Self
12345        where
12346            T: std::convert::Into<crate::model::search_request::SessionSpec>,
12347        {
12348            self.0.request.session_spec = std::option::Option::Some(v.into());
12349            self
12350        }
12351
12352        /// Sets or clears the value of [session_spec][crate::model::SearchRequest::session_spec].
12353        pub fn set_or_clear_session_spec<T>(mut self, v: std::option::Option<T>) -> Self
12354        where
12355            T: std::convert::Into<crate::model::search_request::SessionSpec>,
12356        {
12357            self.0.request.session_spec = v.map(|x| x.into());
12358            self
12359        }
12360
12361        /// Sets the value of [relevance_threshold][crate::model::SearchRequest::relevance_threshold].
12362        pub fn set_relevance_threshold<
12363            T: Into<crate::model::search_request::RelevanceThreshold>,
12364        >(
12365            mut self,
12366            v: T,
12367        ) -> Self {
12368            self.0.request.relevance_threshold = v.into();
12369            self
12370        }
12371
12372        /// Sets the value of [relevance_filter_spec][crate::model::SearchRequest::relevance_filter_spec].
12373        pub fn set_relevance_filter_spec<T>(mut self, v: T) -> Self
12374        where
12375            T: std::convert::Into<crate::model::search_request::RelevanceFilterSpec>,
12376        {
12377            self.0.request.relevance_filter_spec = std::option::Option::Some(v.into());
12378            self
12379        }
12380
12381        /// Sets or clears the value of [relevance_filter_spec][crate::model::SearchRequest::relevance_filter_spec].
12382        pub fn set_or_clear_relevance_filter_spec<T>(mut self, v: std::option::Option<T>) -> Self
12383        where
12384            T: std::convert::Into<crate::model::search_request::RelevanceFilterSpec>,
12385        {
12386            self.0.request.relevance_filter_spec = v.map(|x| x.into());
12387            self
12388        }
12389
12390        /// Sets the value of [relevance_score_spec][crate::model::SearchRequest::relevance_score_spec].
12391        pub fn set_relevance_score_spec<T>(mut self, v: T) -> Self
12392        where
12393            T: std::convert::Into<crate::model::search_request::RelevanceScoreSpec>,
12394        {
12395            self.0.request.relevance_score_spec = std::option::Option::Some(v.into());
12396            self
12397        }
12398
12399        /// Sets or clears the value of [relevance_score_spec][crate::model::SearchRequest::relevance_score_spec].
12400        pub fn set_or_clear_relevance_score_spec<T>(mut self, v: std::option::Option<T>) -> Self
12401        where
12402            T: std::convert::Into<crate::model::search_request::RelevanceScoreSpec>,
12403        {
12404            self.0.request.relevance_score_spec = v.map(|x| x.into());
12405            self
12406        }
12407    }
12408
12409    #[doc(hidden)]
12410    impl crate::RequestBuilder for SearchLite {
12411        fn request_options(&mut self) -> &mut crate::RequestOptions {
12412            &mut self.0.options
12413        }
12414    }
12415
12416    /// The request builder for [SearchService::list_operations][crate::client::SearchService::list_operations] calls.
12417    ///
12418    /// # Example
12419    /// ```
12420    /// # use google_cloud_discoveryengine_v1::builder::search_service::ListOperations;
12421    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
12422    /// use google_cloud_gax::paginator::ItemPaginator;
12423    ///
12424    /// let builder = prepare_request_builder();
12425    /// let mut items = builder.by_item();
12426    /// while let Some(result) = items.next().await {
12427    ///   let item = result?;
12428    /// }
12429    /// # Ok(()) }
12430    ///
12431    /// fn prepare_request_builder() -> ListOperations {
12432    ///   # panic!();
12433    ///   // ... details omitted ...
12434    /// }
12435    /// ```
12436    #[derive(Clone, Debug)]
12437    pub struct ListOperations(
12438        RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
12439    );
12440
12441    impl ListOperations {
12442        pub(crate) fn new(
12443            stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchService>,
12444        ) -> Self {
12445            Self(RequestBuilder::new(stub))
12446        }
12447
12448        /// Sets the full request, replacing any prior values.
12449        pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
12450            mut self,
12451            v: V,
12452        ) -> Self {
12453            self.0.request = v.into();
12454            self
12455        }
12456
12457        /// Sets all the options, replacing any prior values.
12458        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
12459            self.0.options = v.into();
12460            self
12461        }
12462
12463        /// Sends the request.
12464        pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
12465            (*self.0.stub)
12466                .list_operations(self.0.request, self.0.options)
12467                .await
12468                .map(crate::Response::into_body)
12469        }
12470
12471        /// Streams each page in the collection.
12472        pub fn by_page(
12473            self,
12474        ) -> impl google_cloud_gax::paginator::Paginator<
12475            google_cloud_longrunning::model::ListOperationsResponse,
12476            crate::Error,
12477        > {
12478            use std::clone::Clone;
12479            let token = self.0.request.page_token.clone();
12480            let execute = move |token: String| {
12481                let mut builder = self.clone();
12482                builder.0.request = builder.0.request.set_page_token(token);
12483                builder.send()
12484            };
12485            google_cloud_gax::paginator::internal::new_paginator(token, execute)
12486        }
12487
12488        /// Streams each item in the collection.
12489        pub fn by_item(
12490            self,
12491        ) -> impl google_cloud_gax::paginator::ItemPaginator<
12492            google_cloud_longrunning::model::ListOperationsResponse,
12493            crate::Error,
12494        > {
12495            use google_cloud_gax::paginator::Paginator;
12496            self.by_page().items()
12497        }
12498
12499        /// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
12500        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
12501            self.0.request.name = v.into();
12502            self
12503        }
12504
12505        /// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::filter].
12506        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
12507            self.0.request.filter = v.into();
12508            self
12509        }
12510
12511        /// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
12512        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
12513            self.0.request.page_size = v.into();
12514            self
12515        }
12516
12517        /// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
12518        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
12519            self.0.request.page_token = v.into();
12520            self
12521        }
12522
12523        /// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
12524        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
12525            self.0.request.return_partial_success = v.into();
12526            self
12527        }
12528    }
12529
12530    #[doc(hidden)]
12531    impl crate::RequestBuilder for ListOperations {
12532        fn request_options(&mut self) -> &mut crate::RequestOptions {
12533            &mut self.0.options
12534        }
12535    }
12536
12537    /// The request builder for [SearchService::get_operation][crate::client::SearchService::get_operation] calls.
12538    ///
12539    /// # Example
12540    /// ```
12541    /// # use google_cloud_discoveryengine_v1::builder::search_service::GetOperation;
12542    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
12543    ///
12544    /// let builder = prepare_request_builder();
12545    /// let response = builder.send().await?;
12546    /// # Ok(()) }
12547    ///
12548    /// fn prepare_request_builder() -> GetOperation {
12549    ///   # panic!();
12550    ///   // ... details omitted ...
12551    /// }
12552    /// ```
12553    #[derive(Clone, Debug)]
12554    pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
12555
12556    impl GetOperation {
12557        pub(crate) fn new(
12558            stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchService>,
12559        ) -> Self {
12560            Self(RequestBuilder::new(stub))
12561        }
12562
12563        /// Sets the full request, replacing any prior values.
12564        pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
12565            mut self,
12566            v: V,
12567        ) -> Self {
12568            self.0.request = v.into();
12569            self
12570        }
12571
12572        /// Sets all the options, replacing any prior values.
12573        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
12574            self.0.options = v.into();
12575            self
12576        }
12577
12578        /// Sends the request.
12579        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
12580            (*self.0.stub)
12581                .get_operation(self.0.request, self.0.options)
12582                .await
12583                .map(crate::Response::into_body)
12584        }
12585
12586        /// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
12587        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
12588            self.0.request.name = v.into();
12589            self
12590        }
12591    }
12592
12593    #[doc(hidden)]
12594    impl crate::RequestBuilder for GetOperation {
12595        fn request_options(&mut self) -> &mut crate::RequestOptions {
12596            &mut self.0.options
12597        }
12598    }
12599
12600    /// The request builder for [SearchService::cancel_operation][crate::client::SearchService::cancel_operation] calls.
12601    ///
12602    /// # Example
12603    /// ```
12604    /// # use google_cloud_discoveryengine_v1::builder::search_service::CancelOperation;
12605    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
12606    ///
12607    /// let builder = prepare_request_builder();
12608    /// let response = builder.send().await?;
12609    /// # Ok(()) }
12610    ///
12611    /// fn prepare_request_builder() -> CancelOperation {
12612    ///   # panic!();
12613    ///   // ... details omitted ...
12614    /// }
12615    /// ```
12616    #[derive(Clone, Debug)]
12617    pub struct CancelOperation(
12618        RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
12619    );
12620
12621    impl CancelOperation {
12622        pub(crate) fn new(
12623            stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchService>,
12624        ) -> Self {
12625            Self(RequestBuilder::new(stub))
12626        }
12627
12628        /// Sets the full request, replacing any prior values.
12629        pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
12630            mut self,
12631            v: V,
12632        ) -> Self {
12633            self.0.request = v.into();
12634            self
12635        }
12636
12637        /// Sets all the options, replacing any prior values.
12638        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
12639            self.0.options = v.into();
12640            self
12641        }
12642
12643        /// Sends the request.
12644        pub async fn send(self) -> Result<()> {
12645            (*self.0.stub)
12646                .cancel_operation(self.0.request, self.0.options)
12647                .await
12648                .map(crate::Response::into_body)
12649        }
12650
12651        /// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::name].
12652        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
12653            self.0.request.name = v.into();
12654            self
12655        }
12656    }
12657
12658    #[doc(hidden)]
12659    impl crate::RequestBuilder for CancelOperation {
12660        fn request_options(&mut self) -> &mut crate::RequestOptions {
12661            &mut self.0.options
12662        }
12663    }
12664}
12665
12666/// Request and client builders for [SearchTuningService][crate::client::SearchTuningService].
12667#[cfg(feature = "search-tuning-service")]
12668#[cfg_attr(docsrs, doc(cfg(feature = "search-tuning-service")))]
12669pub mod search_tuning_service {
12670    use crate::Result;
12671
12672    /// A builder for [SearchTuningService][crate::client::SearchTuningService].
12673    ///
12674    /// ```
12675    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
12676    /// # use google_cloud_discoveryengine_v1::*;
12677    /// # use builder::search_tuning_service::ClientBuilder;
12678    /// # use client::SearchTuningService;
12679    /// let builder : ClientBuilder = SearchTuningService::builder();
12680    /// let client = builder
12681    ///     .with_endpoint("https://discoveryengine.googleapis.com")
12682    ///     .build().await?;
12683    /// # Ok(()) }
12684    /// ```
12685    pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
12686
12687    pub(crate) mod client {
12688        use super::super::super::client::SearchTuningService;
12689        pub struct Factory;
12690        impl crate::ClientFactory for Factory {
12691            type Client = SearchTuningService;
12692            type Credentials = gaxi::options::Credentials;
12693            async fn build(
12694                self,
12695                config: gaxi::options::ClientConfig,
12696            ) -> crate::ClientBuilderResult<Self::Client> {
12697                Self::Client::new(config).await
12698            }
12699        }
12700    }
12701
12702    /// Common implementation for [crate::client::SearchTuningService] request builders.
12703    #[derive(Clone, Debug)]
12704    pub(crate) struct RequestBuilder<R: std::default::Default> {
12705        stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchTuningService>,
12706        request: R,
12707        options: crate::RequestOptions,
12708    }
12709
12710    impl<R> RequestBuilder<R>
12711    where
12712        R: std::default::Default,
12713    {
12714        pub(crate) fn new(
12715            stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchTuningService>,
12716        ) -> Self {
12717            Self {
12718                stub,
12719                request: R::default(),
12720                options: crate::RequestOptions::default(),
12721            }
12722        }
12723    }
12724
12725    /// The request builder for [SearchTuningService::train_custom_model][crate::client::SearchTuningService::train_custom_model] calls.
12726    ///
12727    /// # Example
12728    /// ```
12729    /// # use google_cloud_discoveryengine_v1::builder::search_tuning_service::TrainCustomModel;
12730    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
12731    /// use google_cloud_lro::Poller;
12732    ///
12733    /// let builder = prepare_request_builder();
12734    /// let response = builder.poller().until_done().await?;
12735    /// # Ok(()) }
12736    ///
12737    /// fn prepare_request_builder() -> TrainCustomModel {
12738    ///   # panic!();
12739    ///   // ... details omitted ...
12740    /// }
12741    /// ```
12742    #[derive(Clone, Debug)]
12743    pub struct TrainCustomModel(RequestBuilder<crate::model::TrainCustomModelRequest>);
12744
12745    impl TrainCustomModel {
12746        pub(crate) fn new(
12747            stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchTuningService>,
12748        ) -> Self {
12749            Self(RequestBuilder::new(stub))
12750        }
12751
12752        /// Sets the full request, replacing any prior values.
12753        pub fn with_request<V: Into<crate::model::TrainCustomModelRequest>>(
12754            mut self,
12755            v: V,
12756        ) -> Self {
12757            self.0.request = v.into();
12758            self
12759        }
12760
12761        /// Sets all the options, replacing any prior values.
12762        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
12763            self.0.options = v.into();
12764            self
12765        }
12766
12767        /// Sends the request.
12768        ///
12769        /// # Long running operations
12770        ///
12771        /// This starts, but does not poll, a longrunning operation. More information
12772        /// on [train_custom_model][crate::client::SearchTuningService::train_custom_model].
12773        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
12774            (*self.0.stub)
12775                .train_custom_model(self.0.request, self.0.options)
12776                .await
12777                .map(crate::Response::into_body)
12778        }
12779
12780        /// Creates a [Poller][google_cloud_lro::Poller] to work with `train_custom_model`.
12781        pub fn poller(
12782            self,
12783        ) -> impl google_cloud_lro::Poller<
12784            crate::model::TrainCustomModelResponse,
12785            crate::model::TrainCustomModelMetadata,
12786        > {
12787            type Operation = google_cloud_lro::internal::Operation<
12788                crate::model::TrainCustomModelResponse,
12789                crate::model::TrainCustomModelMetadata,
12790            >;
12791            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
12792            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
12793            let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
12794            if let Some(ref mut details) = poller_options.tracing {
12795                details.method_name = "google_cloud_discoveryengine_v1::client::SearchTuningService::train_custom_model::until_done";
12796            }
12797
12798            let stub = self.0.stub.clone();
12799            let mut options = self.0.options.clone();
12800            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
12801            let query = move |name| {
12802                let stub = stub.clone();
12803                let options = options.clone();
12804                async {
12805                    let op = GetOperation::new(stub)
12806                        .set_name(name)
12807                        .with_options(options)
12808                        .send()
12809                        .await?;
12810                    Ok(Operation::new(op))
12811                }
12812            };
12813
12814            let start = move || async {
12815                let op = self.send().await?;
12816                Ok(Operation::new(op))
12817            };
12818
12819            use google_cloud_lro::internal::PollerExt;
12820            {
12821                google_cloud_lro::internal::new_poller(
12822                    polling_error_policy,
12823                    polling_backoff_policy,
12824                    start,
12825                    query,
12826                )
12827            }
12828            .with_options(poller_options)
12829        }
12830
12831        /// Sets the value of [data_store][crate::model::TrainCustomModelRequest::data_store].
12832        ///
12833        /// This is a **required** field for requests.
12834        pub fn set_data_store<T: Into<std::string::String>>(mut self, v: T) -> Self {
12835            self.0.request.data_store = v.into();
12836            self
12837        }
12838
12839        /// Sets the value of [model_type][crate::model::TrainCustomModelRequest::model_type].
12840        pub fn set_model_type<T: Into<std::string::String>>(mut self, v: T) -> Self {
12841            self.0.request.model_type = v.into();
12842            self
12843        }
12844
12845        /// Sets the value of [error_config][crate::model::TrainCustomModelRequest::error_config].
12846        pub fn set_error_config<T>(mut self, v: T) -> Self
12847        where
12848            T: std::convert::Into<crate::model::ImportErrorConfig>,
12849        {
12850            self.0.request.error_config = std::option::Option::Some(v.into());
12851            self
12852        }
12853
12854        /// Sets or clears the value of [error_config][crate::model::TrainCustomModelRequest::error_config].
12855        pub fn set_or_clear_error_config<T>(mut self, v: std::option::Option<T>) -> Self
12856        where
12857            T: std::convert::Into<crate::model::ImportErrorConfig>,
12858        {
12859            self.0.request.error_config = v.map(|x| x.into());
12860            self
12861        }
12862
12863        /// Sets the value of [model_id][crate::model::TrainCustomModelRequest::model_id].
12864        pub fn set_model_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
12865            self.0.request.model_id = v.into();
12866            self
12867        }
12868
12869        /// Sets the value of [training_input][crate::model::TrainCustomModelRequest::training_input].
12870        ///
12871        /// Note that all the setters affecting `training_input` are
12872        /// mutually exclusive.
12873        pub fn set_training_input<
12874            T: Into<Option<crate::model::train_custom_model_request::TrainingInput>>,
12875        >(
12876            mut self,
12877            v: T,
12878        ) -> Self {
12879            self.0.request.training_input = v.into();
12880            self
12881        }
12882
12883        /// Sets the value of [training_input][crate::model::TrainCustomModelRequest::training_input]
12884        /// to hold a `GcsTrainingInput`.
12885        ///
12886        /// Note that all the setters affecting `training_input` are
12887        /// mutually exclusive.
12888        pub fn set_gcs_training_input<
12889            T: std::convert::Into<
12890                    std::boxed::Box<crate::model::train_custom_model_request::GcsTrainingInput>,
12891                >,
12892        >(
12893            mut self,
12894            v: T,
12895        ) -> Self {
12896            self.0.request = self.0.request.set_gcs_training_input(v);
12897            self
12898        }
12899    }
12900
12901    #[doc(hidden)]
12902    impl crate::RequestBuilder for TrainCustomModel {
12903        fn request_options(&mut self) -> &mut crate::RequestOptions {
12904            &mut self.0.options
12905        }
12906    }
12907
12908    /// The request builder for [SearchTuningService::list_custom_models][crate::client::SearchTuningService::list_custom_models] calls.
12909    ///
12910    /// # Example
12911    /// ```
12912    /// # use google_cloud_discoveryengine_v1::builder::search_tuning_service::ListCustomModels;
12913    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
12914    ///
12915    /// let builder = prepare_request_builder();
12916    /// let response = builder.send().await?;
12917    /// # Ok(()) }
12918    ///
12919    /// fn prepare_request_builder() -> ListCustomModels {
12920    ///   # panic!();
12921    ///   // ... details omitted ...
12922    /// }
12923    /// ```
12924    #[derive(Clone, Debug)]
12925    pub struct ListCustomModels(RequestBuilder<crate::model::ListCustomModelsRequest>);
12926
12927    impl ListCustomModels {
12928        pub(crate) fn new(
12929            stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchTuningService>,
12930        ) -> Self {
12931            Self(RequestBuilder::new(stub))
12932        }
12933
12934        /// Sets the full request, replacing any prior values.
12935        pub fn with_request<V: Into<crate::model::ListCustomModelsRequest>>(
12936            mut self,
12937            v: V,
12938        ) -> Self {
12939            self.0.request = v.into();
12940            self
12941        }
12942
12943        /// Sets all the options, replacing any prior values.
12944        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
12945            self.0.options = v.into();
12946            self
12947        }
12948
12949        /// Sends the request.
12950        pub async fn send(self) -> Result<crate::model::ListCustomModelsResponse> {
12951            (*self.0.stub)
12952                .list_custom_models(self.0.request, self.0.options)
12953                .await
12954                .map(crate::Response::into_body)
12955        }
12956
12957        /// Sets the value of [data_store][crate::model::ListCustomModelsRequest::data_store].
12958        ///
12959        /// This is a **required** field for requests.
12960        pub fn set_data_store<T: Into<std::string::String>>(mut self, v: T) -> Self {
12961            self.0.request.data_store = v.into();
12962            self
12963        }
12964    }
12965
12966    #[doc(hidden)]
12967    impl crate::RequestBuilder for ListCustomModels {
12968        fn request_options(&mut self) -> &mut crate::RequestOptions {
12969            &mut self.0.options
12970        }
12971    }
12972
12973    /// The request builder for [SearchTuningService::list_operations][crate::client::SearchTuningService::list_operations] calls.
12974    ///
12975    /// # Example
12976    /// ```
12977    /// # use google_cloud_discoveryengine_v1::builder::search_tuning_service::ListOperations;
12978    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
12979    /// use google_cloud_gax::paginator::ItemPaginator;
12980    ///
12981    /// let builder = prepare_request_builder();
12982    /// let mut items = builder.by_item();
12983    /// while let Some(result) = items.next().await {
12984    ///   let item = result?;
12985    /// }
12986    /// # Ok(()) }
12987    ///
12988    /// fn prepare_request_builder() -> ListOperations {
12989    ///   # panic!();
12990    ///   // ... details omitted ...
12991    /// }
12992    /// ```
12993    #[derive(Clone, Debug)]
12994    pub struct ListOperations(
12995        RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
12996    );
12997
12998    impl ListOperations {
12999        pub(crate) fn new(
13000            stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchTuningService>,
13001        ) -> Self {
13002            Self(RequestBuilder::new(stub))
13003        }
13004
13005        /// Sets the full request, replacing any prior values.
13006        pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
13007            mut self,
13008            v: V,
13009        ) -> Self {
13010            self.0.request = v.into();
13011            self
13012        }
13013
13014        /// Sets all the options, replacing any prior values.
13015        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
13016            self.0.options = v.into();
13017            self
13018        }
13019
13020        /// Sends the request.
13021        pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
13022            (*self.0.stub)
13023                .list_operations(self.0.request, self.0.options)
13024                .await
13025                .map(crate::Response::into_body)
13026        }
13027
13028        /// Streams each page in the collection.
13029        pub fn by_page(
13030            self,
13031        ) -> impl google_cloud_gax::paginator::Paginator<
13032            google_cloud_longrunning::model::ListOperationsResponse,
13033            crate::Error,
13034        > {
13035            use std::clone::Clone;
13036            let token = self.0.request.page_token.clone();
13037            let execute = move |token: String| {
13038                let mut builder = self.clone();
13039                builder.0.request = builder.0.request.set_page_token(token);
13040                builder.send()
13041            };
13042            google_cloud_gax::paginator::internal::new_paginator(token, execute)
13043        }
13044
13045        /// Streams each item in the collection.
13046        pub fn by_item(
13047            self,
13048        ) -> impl google_cloud_gax::paginator::ItemPaginator<
13049            google_cloud_longrunning::model::ListOperationsResponse,
13050            crate::Error,
13051        > {
13052            use google_cloud_gax::paginator::Paginator;
13053            self.by_page().items()
13054        }
13055
13056        /// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
13057        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13058            self.0.request.name = v.into();
13059            self
13060        }
13061
13062        /// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::filter].
13063        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
13064            self.0.request.filter = v.into();
13065            self
13066        }
13067
13068        /// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
13069        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
13070            self.0.request.page_size = v.into();
13071            self
13072        }
13073
13074        /// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
13075        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
13076            self.0.request.page_token = v.into();
13077            self
13078        }
13079
13080        /// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
13081        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
13082            self.0.request.return_partial_success = v.into();
13083            self
13084        }
13085    }
13086
13087    #[doc(hidden)]
13088    impl crate::RequestBuilder for ListOperations {
13089        fn request_options(&mut self) -> &mut crate::RequestOptions {
13090            &mut self.0.options
13091        }
13092    }
13093
13094    /// The request builder for [SearchTuningService::get_operation][crate::client::SearchTuningService::get_operation] calls.
13095    ///
13096    /// # Example
13097    /// ```
13098    /// # use google_cloud_discoveryengine_v1::builder::search_tuning_service::GetOperation;
13099    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
13100    ///
13101    /// let builder = prepare_request_builder();
13102    /// let response = builder.send().await?;
13103    /// # Ok(()) }
13104    ///
13105    /// fn prepare_request_builder() -> GetOperation {
13106    ///   # panic!();
13107    ///   // ... details omitted ...
13108    /// }
13109    /// ```
13110    #[derive(Clone, Debug)]
13111    pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
13112
13113    impl GetOperation {
13114        pub(crate) fn new(
13115            stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchTuningService>,
13116        ) -> Self {
13117            Self(RequestBuilder::new(stub))
13118        }
13119
13120        /// Sets the full request, replacing any prior values.
13121        pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
13122            mut self,
13123            v: V,
13124        ) -> Self {
13125            self.0.request = v.into();
13126            self
13127        }
13128
13129        /// Sets all the options, replacing any prior values.
13130        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
13131            self.0.options = v.into();
13132            self
13133        }
13134
13135        /// Sends the request.
13136        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
13137            (*self.0.stub)
13138                .get_operation(self.0.request, self.0.options)
13139                .await
13140                .map(crate::Response::into_body)
13141        }
13142
13143        /// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
13144        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13145            self.0.request.name = v.into();
13146            self
13147        }
13148    }
13149
13150    #[doc(hidden)]
13151    impl crate::RequestBuilder for GetOperation {
13152        fn request_options(&mut self) -> &mut crate::RequestOptions {
13153            &mut self.0.options
13154        }
13155    }
13156
13157    /// The request builder for [SearchTuningService::cancel_operation][crate::client::SearchTuningService::cancel_operation] calls.
13158    ///
13159    /// # Example
13160    /// ```
13161    /// # use google_cloud_discoveryengine_v1::builder::search_tuning_service::CancelOperation;
13162    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
13163    ///
13164    /// let builder = prepare_request_builder();
13165    /// let response = builder.send().await?;
13166    /// # Ok(()) }
13167    ///
13168    /// fn prepare_request_builder() -> CancelOperation {
13169    ///   # panic!();
13170    ///   // ... details omitted ...
13171    /// }
13172    /// ```
13173    #[derive(Clone, Debug)]
13174    pub struct CancelOperation(
13175        RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
13176    );
13177
13178    impl CancelOperation {
13179        pub(crate) fn new(
13180            stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchTuningService>,
13181        ) -> Self {
13182            Self(RequestBuilder::new(stub))
13183        }
13184
13185        /// Sets the full request, replacing any prior values.
13186        pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
13187            mut self,
13188            v: V,
13189        ) -> Self {
13190            self.0.request = v.into();
13191            self
13192        }
13193
13194        /// Sets all the options, replacing any prior values.
13195        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
13196            self.0.options = v.into();
13197            self
13198        }
13199
13200        /// Sends the request.
13201        pub async fn send(self) -> Result<()> {
13202            (*self.0.stub)
13203                .cancel_operation(self.0.request, self.0.options)
13204                .await
13205                .map(crate::Response::into_body)
13206        }
13207
13208        /// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::name].
13209        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13210            self.0.request.name = v.into();
13211            self
13212        }
13213    }
13214
13215    #[doc(hidden)]
13216    impl crate::RequestBuilder for CancelOperation {
13217        fn request_options(&mut self) -> &mut crate::RequestOptions {
13218            &mut self.0.options
13219        }
13220    }
13221}
13222
13223/// Request and client builders for [ServingConfigService][crate::client::ServingConfigService].
13224#[cfg(feature = "serving-config-service")]
13225#[cfg_attr(docsrs, doc(cfg(feature = "serving-config-service")))]
13226pub mod serving_config_service {
13227    use crate::Result;
13228
13229    /// A builder for [ServingConfigService][crate::client::ServingConfigService].
13230    ///
13231    /// ```
13232    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
13233    /// # use google_cloud_discoveryengine_v1::*;
13234    /// # use builder::serving_config_service::ClientBuilder;
13235    /// # use client::ServingConfigService;
13236    /// let builder : ClientBuilder = ServingConfigService::builder();
13237    /// let client = builder
13238    ///     .with_endpoint("https://discoveryengine.googleapis.com")
13239    ///     .build().await?;
13240    /// # Ok(()) }
13241    /// ```
13242    pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
13243
13244    pub(crate) mod client {
13245        use super::super::super::client::ServingConfigService;
13246        pub struct Factory;
13247        impl crate::ClientFactory for Factory {
13248            type Client = ServingConfigService;
13249            type Credentials = gaxi::options::Credentials;
13250            async fn build(
13251                self,
13252                config: gaxi::options::ClientConfig,
13253            ) -> crate::ClientBuilderResult<Self::Client> {
13254                Self::Client::new(config).await
13255            }
13256        }
13257    }
13258
13259    /// Common implementation for [crate::client::ServingConfigService] request builders.
13260    #[derive(Clone, Debug)]
13261    pub(crate) struct RequestBuilder<R: std::default::Default> {
13262        stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
13263        request: R,
13264        options: crate::RequestOptions,
13265    }
13266
13267    impl<R> RequestBuilder<R>
13268    where
13269        R: std::default::Default,
13270    {
13271        pub(crate) fn new(
13272            stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
13273        ) -> Self {
13274            Self {
13275                stub,
13276                request: R::default(),
13277                options: crate::RequestOptions::default(),
13278            }
13279        }
13280    }
13281
13282    /// The request builder for [ServingConfigService::update_serving_config][crate::client::ServingConfigService::update_serving_config] calls.
13283    ///
13284    /// # Example
13285    /// ```
13286    /// # use google_cloud_discoveryengine_v1::builder::serving_config_service::UpdateServingConfig;
13287    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
13288    ///
13289    /// let builder = prepare_request_builder();
13290    /// let response = builder.send().await?;
13291    /// # Ok(()) }
13292    ///
13293    /// fn prepare_request_builder() -> UpdateServingConfig {
13294    ///   # panic!();
13295    ///   // ... details omitted ...
13296    /// }
13297    /// ```
13298    #[derive(Clone, Debug)]
13299    pub struct UpdateServingConfig(RequestBuilder<crate::model::UpdateServingConfigRequest>);
13300
13301    impl UpdateServingConfig {
13302        pub(crate) fn new(
13303            stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
13304        ) -> Self {
13305            Self(RequestBuilder::new(stub))
13306        }
13307
13308        /// Sets the full request, replacing any prior values.
13309        pub fn with_request<V: Into<crate::model::UpdateServingConfigRequest>>(
13310            mut self,
13311            v: V,
13312        ) -> Self {
13313            self.0.request = v.into();
13314            self
13315        }
13316
13317        /// Sets all the options, replacing any prior values.
13318        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
13319            self.0.options = v.into();
13320            self
13321        }
13322
13323        /// Sends the request.
13324        pub async fn send(self) -> Result<crate::model::ServingConfig> {
13325            (*self.0.stub)
13326                .update_serving_config(self.0.request, self.0.options)
13327                .await
13328                .map(crate::Response::into_body)
13329        }
13330
13331        /// Sets the value of [serving_config][crate::model::UpdateServingConfigRequest::serving_config].
13332        ///
13333        /// This is a **required** field for requests.
13334        pub fn set_serving_config<T>(mut self, v: T) -> Self
13335        where
13336            T: std::convert::Into<crate::model::ServingConfig>,
13337        {
13338            self.0.request.serving_config = std::option::Option::Some(v.into());
13339            self
13340        }
13341
13342        /// Sets or clears the value of [serving_config][crate::model::UpdateServingConfigRequest::serving_config].
13343        ///
13344        /// This is a **required** field for requests.
13345        pub fn set_or_clear_serving_config<T>(mut self, v: std::option::Option<T>) -> Self
13346        where
13347            T: std::convert::Into<crate::model::ServingConfig>,
13348        {
13349            self.0.request.serving_config = v.map(|x| x.into());
13350            self
13351        }
13352
13353        /// Sets the value of [update_mask][crate::model::UpdateServingConfigRequest::update_mask].
13354        pub fn set_update_mask<T>(mut self, v: T) -> Self
13355        where
13356            T: std::convert::Into<wkt::FieldMask>,
13357        {
13358            self.0.request.update_mask = std::option::Option::Some(v.into());
13359            self
13360        }
13361
13362        /// Sets or clears the value of [update_mask][crate::model::UpdateServingConfigRequest::update_mask].
13363        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
13364        where
13365            T: std::convert::Into<wkt::FieldMask>,
13366        {
13367            self.0.request.update_mask = v.map(|x| x.into());
13368            self
13369        }
13370    }
13371
13372    #[doc(hidden)]
13373    impl crate::RequestBuilder for UpdateServingConfig {
13374        fn request_options(&mut self) -> &mut crate::RequestOptions {
13375            &mut self.0.options
13376        }
13377    }
13378
13379    /// The request builder for [ServingConfigService::list_operations][crate::client::ServingConfigService::list_operations] calls.
13380    ///
13381    /// # Example
13382    /// ```
13383    /// # use google_cloud_discoveryengine_v1::builder::serving_config_service::ListOperations;
13384    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
13385    /// use google_cloud_gax::paginator::ItemPaginator;
13386    ///
13387    /// let builder = prepare_request_builder();
13388    /// let mut items = builder.by_item();
13389    /// while let Some(result) = items.next().await {
13390    ///   let item = result?;
13391    /// }
13392    /// # Ok(()) }
13393    ///
13394    /// fn prepare_request_builder() -> ListOperations {
13395    ///   # panic!();
13396    ///   // ... details omitted ...
13397    /// }
13398    /// ```
13399    #[derive(Clone, Debug)]
13400    pub struct ListOperations(
13401        RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
13402    );
13403
13404    impl ListOperations {
13405        pub(crate) fn new(
13406            stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
13407        ) -> Self {
13408            Self(RequestBuilder::new(stub))
13409        }
13410
13411        /// Sets the full request, replacing any prior values.
13412        pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
13413            mut self,
13414            v: V,
13415        ) -> Self {
13416            self.0.request = v.into();
13417            self
13418        }
13419
13420        /// Sets all the options, replacing any prior values.
13421        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
13422            self.0.options = v.into();
13423            self
13424        }
13425
13426        /// Sends the request.
13427        pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
13428            (*self.0.stub)
13429                .list_operations(self.0.request, self.0.options)
13430                .await
13431                .map(crate::Response::into_body)
13432        }
13433
13434        /// Streams each page in the collection.
13435        pub fn by_page(
13436            self,
13437        ) -> impl google_cloud_gax::paginator::Paginator<
13438            google_cloud_longrunning::model::ListOperationsResponse,
13439            crate::Error,
13440        > {
13441            use std::clone::Clone;
13442            let token = self.0.request.page_token.clone();
13443            let execute = move |token: String| {
13444                let mut builder = self.clone();
13445                builder.0.request = builder.0.request.set_page_token(token);
13446                builder.send()
13447            };
13448            google_cloud_gax::paginator::internal::new_paginator(token, execute)
13449        }
13450
13451        /// Streams each item in the collection.
13452        pub fn by_item(
13453            self,
13454        ) -> impl google_cloud_gax::paginator::ItemPaginator<
13455            google_cloud_longrunning::model::ListOperationsResponse,
13456            crate::Error,
13457        > {
13458            use google_cloud_gax::paginator::Paginator;
13459            self.by_page().items()
13460        }
13461
13462        /// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
13463        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13464            self.0.request.name = v.into();
13465            self
13466        }
13467
13468        /// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::filter].
13469        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
13470            self.0.request.filter = v.into();
13471            self
13472        }
13473
13474        /// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
13475        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
13476            self.0.request.page_size = v.into();
13477            self
13478        }
13479
13480        /// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
13481        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
13482            self.0.request.page_token = v.into();
13483            self
13484        }
13485
13486        /// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
13487        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
13488            self.0.request.return_partial_success = v.into();
13489            self
13490        }
13491    }
13492
13493    #[doc(hidden)]
13494    impl crate::RequestBuilder for ListOperations {
13495        fn request_options(&mut self) -> &mut crate::RequestOptions {
13496            &mut self.0.options
13497        }
13498    }
13499
13500    /// The request builder for [ServingConfigService::get_operation][crate::client::ServingConfigService::get_operation] calls.
13501    ///
13502    /// # Example
13503    /// ```
13504    /// # use google_cloud_discoveryengine_v1::builder::serving_config_service::GetOperation;
13505    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
13506    ///
13507    /// let builder = prepare_request_builder();
13508    /// let response = builder.send().await?;
13509    /// # Ok(()) }
13510    ///
13511    /// fn prepare_request_builder() -> GetOperation {
13512    ///   # panic!();
13513    ///   // ... details omitted ...
13514    /// }
13515    /// ```
13516    #[derive(Clone, Debug)]
13517    pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
13518
13519    impl GetOperation {
13520        pub(crate) fn new(
13521            stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
13522        ) -> Self {
13523            Self(RequestBuilder::new(stub))
13524        }
13525
13526        /// Sets the full request, replacing any prior values.
13527        pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
13528            mut self,
13529            v: V,
13530        ) -> Self {
13531            self.0.request = v.into();
13532            self
13533        }
13534
13535        /// Sets all the options, replacing any prior values.
13536        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
13537            self.0.options = v.into();
13538            self
13539        }
13540
13541        /// Sends the request.
13542        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
13543            (*self.0.stub)
13544                .get_operation(self.0.request, self.0.options)
13545                .await
13546                .map(crate::Response::into_body)
13547        }
13548
13549        /// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
13550        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13551            self.0.request.name = v.into();
13552            self
13553        }
13554    }
13555
13556    #[doc(hidden)]
13557    impl crate::RequestBuilder for GetOperation {
13558        fn request_options(&mut self) -> &mut crate::RequestOptions {
13559            &mut self.0.options
13560        }
13561    }
13562
13563    /// The request builder for [ServingConfigService::cancel_operation][crate::client::ServingConfigService::cancel_operation] calls.
13564    ///
13565    /// # Example
13566    /// ```
13567    /// # use google_cloud_discoveryengine_v1::builder::serving_config_service::CancelOperation;
13568    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
13569    ///
13570    /// let builder = prepare_request_builder();
13571    /// let response = builder.send().await?;
13572    /// # Ok(()) }
13573    ///
13574    /// fn prepare_request_builder() -> CancelOperation {
13575    ///   # panic!();
13576    ///   // ... details omitted ...
13577    /// }
13578    /// ```
13579    #[derive(Clone, Debug)]
13580    pub struct CancelOperation(
13581        RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
13582    );
13583
13584    impl CancelOperation {
13585        pub(crate) fn new(
13586            stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
13587        ) -> Self {
13588            Self(RequestBuilder::new(stub))
13589        }
13590
13591        /// Sets the full request, replacing any prior values.
13592        pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
13593            mut self,
13594            v: V,
13595        ) -> Self {
13596            self.0.request = v.into();
13597            self
13598        }
13599
13600        /// Sets all the options, replacing any prior values.
13601        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
13602            self.0.options = v.into();
13603            self
13604        }
13605
13606        /// Sends the request.
13607        pub async fn send(self) -> Result<()> {
13608            (*self.0.stub)
13609                .cancel_operation(self.0.request, self.0.options)
13610                .await
13611                .map(crate::Response::into_body)
13612        }
13613
13614        /// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::name].
13615        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13616            self.0.request.name = v.into();
13617            self
13618        }
13619    }
13620
13621    #[doc(hidden)]
13622    impl crate::RequestBuilder for CancelOperation {
13623        fn request_options(&mut self) -> &mut crate::RequestOptions {
13624            &mut self.0.options
13625        }
13626    }
13627}
13628
13629/// Request and client builders for [SessionService][crate::client::SessionService].
13630#[cfg(feature = "session-service")]
13631#[cfg_attr(docsrs, doc(cfg(feature = "session-service")))]
13632pub mod session_service {
13633    use crate::Result;
13634
13635    /// A builder for [SessionService][crate::client::SessionService].
13636    ///
13637    /// ```
13638    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
13639    /// # use google_cloud_discoveryengine_v1::*;
13640    /// # use builder::session_service::ClientBuilder;
13641    /// # use client::SessionService;
13642    /// let builder : ClientBuilder = SessionService::builder();
13643    /// let client = builder
13644    ///     .with_endpoint("https://discoveryengine.googleapis.com")
13645    ///     .build().await?;
13646    /// # Ok(()) }
13647    /// ```
13648    pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
13649
13650    pub(crate) mod client {
13651        use super::super::super::client::SessionService;
13652        pub struct Factory;
13653        impl crate::ClientFactory for Factory {
13654            type Client = SessionService;
13655            type Credentials = gaxi::options::Credentials;
13656            async fn build(
13657                self,
13658                config: gaxi::options::ClientConfig,
13659            ) -> crate::ClientBuilderResult<Self::Client> {
13660                Self::Client::new(config).await
13661            }
13662        }
13663    }
13664
13665    /// Common implementation for [crate::client::SessionService] request builders.
13666    #[derive(Clone, Debug)]
13667    pub(crate) struct RequestBuilder<R: std::default::Default> {
13668        stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
13669        request: R,
13670        options: crate::RequestOptions,
13671    }
13672
13673    impl<R> RequestBuilder<R>
13674    where
13675        R: std::default::Default,
13676    {
13677        pub(crate) fn new(
13678            stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
13679        ) -> Self {
13680            Self {
13681                stub,
13682                request: R::default(),
13683                options: crate::RequestOptions::default(),
13684            }
13685        }
13686    }
13687
13688    /// The request builder for [SessionService::create_session][crate::client::SessionService::create_session] calls.
13689    ///
13690    /// # Example
13691    /// ```
13692    /// # use google_cloud_discoveryengine_v1::builder::session_service::CreateSession;
13693    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
13694    ///
13695    /// let builder = prepare_request_builder();
13696    /// let response = builder.send().await?;
13697    /// # Ok(()) }
13698    ///
13699    /// fn prepare_request_builder() -> CreateSession {
13700    ///   # panic!();
13701    ///   // ... details omitted ...
13702    /// }
13703    /// ```
13704    #[derive(Clone, Debug)]
13705    pub struct CreateSession(RequestBuilder<crate::model::CreateSessionRequest>);
13706
13707    impl CreateSession {
13708        pub(crate) fn new(
13709            stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
13710        ) -> Self {
13711            Self(RequestBuilder::new(stub))
13712        }
13713
13714        /// Sets the full request, replacing any prior values.
13715        pub fn with_request<V: Into<crate::model::CreateSessionRequest>>(mut self, v: V) -> Self {
13716            self.0.request = v.into();
13717            self
13718        }
13719
13720        /// Sets all the options, replacing any prior values.
13721        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
13722            self.0.options = v.into();
13723            self
13724        }
13725
13726        /// Sends the request.
13727        pub async fn send(self) -> Result<crate::model::Session> {
13728            (*self.0.stub)
13729                .create_session(self.0.request, self.0.options)
13730                .await
13731                .map(crate::Response::into_body)
13732        }
13733
13734        /// Sets the value of [parent][crate::model::CreateSessionRequest::parent].
13735        ///
13736        /// This is a **required** field for requests.
13737        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
13738            self.0.request.parent = v.into();
13739            self
13740        }
13741
13742        /// Sets the value of [session][crate::model::CreateSessionRequest::session].
13743        ///
13744        /// This is a **required** field for requests.
13745        pub fn set_session<T>(mut self, v: T) -> Self
13746        where
13747            T: std::convert::Into<crate::model::Session>,
13748        {
13749            self.0.request.session = std::option::Option::Some(v.into());
13750            self
13751        }
13752
13753        /// Sets or clears the value of [session][crate::model::CreateSessionRequest::session].
13754        ///
13755        /// This is a **required** field for requests.
13756        pub fn set_or_clear_session<T>(mut self, v: std::option::Option<T>) -> Self
13757        where
13758            T: std::convert::Into<crate::model::Session>,
13759        {
13760            self.0.request.session = v.map(|x| x.into());
13761            self
13762        }
13763    }
13764
13765    #[doc(hidden)]
13766    impl crate::RequestBuilder for CreateSession {
13767        fn request_options(&mut self) -> &mut crate::RequestOptions {
13768            &mut self.0.options
13769        }
13770    }
13771
13772    /// The request builder for [SessionService::delete_session][crate::client::SessionService::delete_session] calls.
13773    ///
13774    /// # Example
13775    /// ```
13776    /// # use google_cloud_discoveryengine_v1::builder::session_service::DeleteSession;
13777    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
13778    ///
13779    /// let builder = prepare_request_builder();
13780    /// let response = builder.send().await?;
13781    /// # Ok(()) }
13782    ///
13783    /// fn prepare_request_builder() -> DeleteSession {
13784    ///   # panic!();
13785    ///   // ... details omitted ...
13786    /// }
13787    /// ```
13788    #[derive(Clone, Debug)]
13789    pub struct DeleteSession(RequestBuilder<crate::model::DeleteSessionRequest>);
13790
13791    impl DeleteSession {
13792        pub(crate) fn new(
13793            stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
13794        ) -> Self {
13795            Self(RequestBuilder::new(stub))
13796        }
13797
13798        /// Sets the full request, replacing any prior values.
13799        pub fn with_request<V: Into<crate::model::DeleteSessionRequest>>(mut self, v: V) -> Self {
13800            self.0.request = v.into();
13801            self
13802        }
13803
13804        /// Sets all the options, replacing any prior values.
13805        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
13806            self.0.options = v.into();
13807            self
13808        }
13809
13810        /// Sends the request.
13811        pub async fn send(self) -> Result<()> {
13812            (*self.0.stub)
13813                .delete_session(self.0.request, self.0.options)
13814                .await
13815                .map(crate::Response::into_body)
13816        }
13817
13818        /// Sets the value of [name][crate::model::DeleteSessionRequest::name].
13819        ///
13820        /// This is a **required** field for requests.
13821        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13822            self.0.request.name = v.into();
13823            self
13824        }
13825    }
13826
13827    #[doc(hidden)]
13828    impl crate::RequestBuilder for DeleteSession {
13829        fn request_options(&mut self) -> &mut crate::RequestOptions {
13830            &mut self.0.options
13831        }
13832    }
13833
13834    /// The request builder for [SessionService::update_session][crate::client::SessionService::update_session] calls.
13835    ///
13836    /// # Example
13837    /// ```
13838    /// # use google_cloud_discoveryengine_v1::builder::session_service::UpdateSession;
13839    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
13840    ///
13841    /// let builder = prepare_request_builder();
13842    /// let response = builder.send().await?;
13843    /// # Ok(()) }
13844    ///
13845    /// fn prepare_request_builder() -> UpdateSession {
13846    ///   # panic!();
13847    ///   // ... details omitted ...
13848    /// }
13849    /// ```
13850    #[derive(Clone, Debug)]
13851    pub struct UpdateSession(RequestBuilder<crate::model::UpdateSessionRequest>);
13852
13853    impl UpdateSession {
13854        pub(crate) fn new(
13855            stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
13856        ) -> Self {
13857            Self(RequestBuilder::new(stub))
13858        }
13859
13860        /// Sets the full request, replacing any prior values.
13861        pub fn with_request<V: Into<crate::model::UpdateSessionRequest>>(mut self, v: V) -> Self {
13862            self.0.request = v.into();
13863            self
13864        }
13865
13866        /// Sets all the options, replacing any prior values.
13867        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
13868            self.0.options = v.into();
13869            self
13870        }
13871
13872        /// Sends the request.
13873        pub async fn send(self) -> Result<crate::model::Session> {
13874            (*self.0.stub)
13875                .update_session(self.0.request, self.0.options)
13876                .await
13877                .map(crate::Response::into_body)
13878        }
13879
13880        /// Sets the value of [session][crate::model::UpdateSessionRequest::session].
13881        ///
13882        /// This is a **required** field for requests.
13883        pub fn set_session<T>(mut self, v: T) -> Self
13884        where
13885            T: std::convert::Into<crate::model::Session>,
13886        {
13887            self.0.request.session = std::option::Option::Some(v.into());
13888            self
13889        }
13890
13891        /// Sets or clears the value of [session][crate::model::UpdateSessionRequest::session].
13892        ///
13893        /// This is a **required** field for requests.
13894        pub fn set_or_clear_session<T>(mut self, v: std::option::Option<T>) -> Self
13895        where
13896            T: std::convert::Into<crate::model::Session>,
13897        {
13898            self.0.request.session = v.map(|x| x.into());
13899            self
13900        }
13901
13902        /// Sets the value of [update_mask][crate::model::UpdateSessionRequest::update_mask].
13903        pub fn set_update_mask<T>(mut self, v: T) -> Self
13904        where
13905            T: std::convert::Into<wkt::FieldMask>,
13906        {
13907            self.0.request.update_mask = std::option::Option::Some(v.into());
13908            self
13909        }
13910
13911        /// Sets or clears the value of [update_mask][crate::model::UpdateSessionRequest::update_mask].
13912        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
13913        where
13914            T: std::convert::Into<wkt::FieldMask>,
13915        {
13916            self.0.request.update_mask = v.map(|x| x.into());
13917            self
13918        }
13919    }
13920
13921    #[doc(hidden)]
13922    impl crate::RequestBuilder for UpdateSession {
13923        fn request_options(&mut self) -> &mut crate::RequestOptions {
13924            &mut self.0.options
13925        }
13926    }
13927
13928    /// The request builder for [SessionService::get_session][crate::client::SessionService::get_session] calls.
13929    ///
13930    /// # Example
13931    /// ```
13932    /// # use google_cloud_discoveryengine_v1::builder::session_service::GetSession;
13933    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
13934    ///
13935    /// let builder = prepare_request_builder();
13936    /// let response = builder.send().await?;
13937    /// # Ok(()) }
13938    ///
13939    /// fn prepare_request_builder() -> GetSession {
13940    ///   # panic!();
13941    ///   // ... details omitted ...
13942    /// }
13943    /// ```
13944    #[derive(Clone, Debug)]
13945    pub struct GetSession(RequestBuilder<crate::model::GetSessionRequest>);
13946
13947    impl GetSession {
13948        pub(crate) fn new(
13949            stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
13950        ) -> Self {
13951            Self(RequestBuilder::new(stub))
13952        }
13953
13954        /// Sets the full request, replacing any prior values.
13955        pub fn with_request<V: Into<crate::model::GetSessionRequest>>(mut self, v: V) -> Self {
13956            self.0.request = v.into();
13957            self
13958        }
13959
13960        /// Sets all the options, replacing any prior values.
13961        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
13962            self.0.options = v.into();
13963            self
13964        }
13965
13966        /// Sends the request.
13967        pub async fn send(self) -> Result<crate::model::Session> {
13968            (*self.0.stub)
13969                .get_session(self.0.request, self.0.options)
13970                .await
13971                .map(crate::Response::into_body)
13972        }
13973
13974        /// Sets the value of [name][crate::model::GetSessionRequest::name].
13975        ///
13976        /// This is a **required** field for requests.
13977        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13978            self.0.request.name = v.into();
13979            self
13980        }
13981
13982        /// Sets the value of [include_answer_details][crate::model::GetSessionRequest::include_answer_details].
13983        pub fn set_include_answer_details<T: Into<bool>>(mut self, v: T) -> Self {
13984            self.0.request.include_answer_details = v.into();
13985            self
13986        }
13987    }
13988
13989    #[doc(hidden)]
13990    impl crate::RequestBuilder for GetSession {
13991        fn request_options(&mut self) -> &mut crate::RequestOptions {
13992            &mut self.0.options
13993        }
13994    }
13995
13996    /// The request builder for [SessionService::list_sessions][crate::client::SessionService::list_sessions] calls.
13997    ///
13998    /// # Example
13999    /// ```
14000    /// # use google_cloud_discoveryengine_v1::builder::session_service::ListSessions;
14001    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
14002    /// use google_cloud_gax::paginator::ItemPaginator;
14003    ///
14004    /// let builder = prepare_request_builder();
14005    /// let mut items = builder.by_item();
14006    /// while let Some(result) = items.next().await {
14007    ///   let item = result?;
14008    /// }
14009    /// # Ok(()) }
14010    ///
14011    /// fn prepare_request_builder() -> ListSessions {
14012    ///   # panic!();
14013    ///   // ... details omitted ...
14014    /// }
14015    /// ```
14016    #[derive(Clone, Debug)]
14017    pub struct ListSessions(RequestBuilder<crate::model::ListSessionsRequest>);
14018
14019    impl ListSessions {
14020        pub(crate) fn new(
14021            stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
14022        ) -> Self {
14023            Self(RequestBuilder::new(stub))
14024        }
14025
14026        /// Sets the full request, replacing any prior values.
14027        pub fn with_request<V: Into<crate::model::ListSessionsRequest>>(mut self, v: V) -> Self {
14028            self.0.request = v.into();
14029            self
14030        }
14031
14032        /// Sets all the options, replacing any prior values.
14033        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
14034            self.0.options = v.into();
14035            self
14036        }
14037
14038        /// Sends the request.
14039        pub async fn send(self) -> Result<crate::model::ListSessionsResponse> {
14040            (*self.0.stub)
14041                .list_sessions(self.0.request, self.0.options)
14042                .await
14043                .map(crate::Response::into_body)
14044        }
14045
14046        /// Streams each page in the collection.
14047        pub fn by_page(
14048            self,
14049        ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListSessionsResponse, crate::Error>
14050        {
14051            use std::clone::Clone;
14052            let token = self.0.request.page_token.clone();
14053            let execute = move |token: String| {
14054                let mut builder = self.clone();
14055                builder.0.request = builder.0.request.set_page_token(token);
14056                builder.send()
14057            };
14058            google_cloud_gax::paginator::internal::new_paginator(token, execute)
14059        }
14060
14061        /// Streams each item in the collection.
14062        pub fn by_item(
14063            self,
14064        ) -> impl google_cloud_gax::paginator::ItemPaginator<
14065            crate::model::ListSessionsResponse,
14066            crate::Error,
14067        > {
14068            use google_cloud_gax::paginator::Paginator;
14069            self.by_page().items()
14070        }
14071
14072        /// Sets the value of [parent][crate::model::ListSessionsRequest::parent].
14073        ///
14074        /// This is a **required** field for requests.
14075        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
14076            self.0.request.parent = v.into();
14077            self
14078        }
14079
14080        /// Sets the value of [page_size][crate::model::ListSessionsRequest::page_size].
14081        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
14082            self.0.request.page_size = v.into();
14083            self
14084        }
14085
14086        /// Sets the value of [page_token][crate::model::ListSessionsRequest::page_token].
14087        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
14088            self.0.request.page_token = v.into();
14089            self
14090        }
14091
14092        /// Sets the value of [filter][crate::model::ListSessionsRequest::filter].
14093        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
14094            self.0.request.filter = v.into();
14095            self
14096        }
14097
14098        /// Sets the value of [order_by][crate::model::ListSessionsRequest::order_by].
14099        pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
14100            self.0.request.order_by = v.into();
14101            self
14102        }
14103    }
14104
14105    #[doc(hidden)]
14106    impl crate::RequestBuilder for ListSessions {
14107        fn request_options(&mut self) -> &mut crate::RequestOptions {
14108            &mut self.0.options
14109        }
14110    }
14111
14112    /// The request builder for [SessionService::list_operations][crate::client::SessionService::list_operations] calls.
14113    ///
14114    /// # Example
14115    /// ```
14116    /// # use google_cloud_discoveryengine_v1::builder::session_service::ListOperations;
14117    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
14118    /// use google_cloud_gax::paginator::ItemPaginator;
14119    ///
14120    /// let builder = prepare_request_builder();
14121    /// let mut items = builder.by_item();
14122    /// while let Some(result) = items.next().await {
14123    ///   let item = result?;
14124    /// }
14125    /// # Ok(()) }
14126    ///
14127    /// fn prepare_request_builder() -> ListOperations {
14128    ///   # panic!();
14129    ///   // ... details omitted ...
14130    /// }
14131    /// ```
14132    #[derive(Clone, Debug)]
14133    pub struct ListOperations(
14134        RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
14135    );
14136
14137    impl ListOperations {
14138        pub(crate) fn new(
14139            stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
14140        ) -> Self {
14141            Self(RequestBuilder::new(stub))
14142        }
14143
14144        /// Sets the full request, replacing any prior values.
14145        pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
14146            mut self,
14147            v: V,
14148        ) -> Self {
14149            self.0.request = v.into();
14150            self
14151        }
14152
14153        /// Sets all the options, replacing any prior values.
14154        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
14155            self.0.options = v.into();
14156            self
14157        }
14158
14159        /// Sends the request.
14160        pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
14161            (*self.0.stub)
14162                .list_operations(self.0.request, self.0.options)
14163                .await
14164                .map(crate::Response::into_body)
14165        }
14166
14167        /// Streams each page in the collection.
14168        pub fn by_page(
14169            self,
14170        ) -> impl google_cloud_gax::paginator::Paginator<
14171            google_cloud_longrunning::model::ListOperationsResponse,
14172            crate::Error,
14173        > {
14174            use std::clone::Clone;
14175            let token = self.0.request.page_token.clone();
14176            let execute = move |token: String| {
14177                let mut builder = self.clone();
14178                builder.0.request = builder.0.request.set_page_token(token);
14179                builder.send()
14180            };
14181            google_cloud_gax::paginator::internal::new_paginator(token, execute)
14182        }
14183
14184        /// Streams each item in the collection.
14185        pub fn by_item(
14186            self,
14187        ) -> impl google_cloud_gax::paginator::ItemPaginator<
14188            google_cloud_longrunning::model::ListOperationsResponse,
14189            crate::Error,
14190        > {
14191            use google_cloud_gax::paginator::Paginator;
14192            self.by_page().items()
14193        }
14194
14195        /// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
14196        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
14197            self.0.request.name = v.into();
14198            self
14199        }
14200
14201        /// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::filter].
14202        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
14203            self.0.request.filter = v.into();
14204            self
14205        }
14206
14207        /// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
14208        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
14209            self.0.request.page_size = v.into();
14210            self
14211        }
14212
14213        /// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
14214        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
14215            self.0.request.page_token = v.into();
14216            self
14217        }
14218
14219        /// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
14220        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
14221            self.0.request.return_partial_success = v.into();
14222            self
14223        }
14224    }
14225
14226    #[doc(hidden)]
14227    impl crate::RequestBuilder for ListOperations {
14228        fn request_options(&mut self) -> &mut crate::RequestOptions {
14229            &mut self.0.options
14230        }
14231    }
14232
14233    /// The request builder for [SessionService::get_operation][crate::client::SessionService::get_operation] calls.
14234    ///
14235    /// # Example
14236    /// ```
14237    /// # use google_cloud_discoveryengine_v1::builder::session_service::GetOperation;
14238    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
14239    ///
14240    /// let builder = prepare_request_builder();
14241    /// let response = builder.send().await?;
14242    /// # Ok(()) }
14243    ///
14244    /// fn prepare_request_builder() -> GetOperation {
14245    ///   # panic!();
14246    ///   // ... details omitted ...
14247    /// }
14248    /// ```
14249    #[derive(Clone, Debug)]
14250    pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
14251
14252    impl GetOperation {
14253        pub(crate) fn new(
14254            stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
14255        ) -> Self {
14256            Self(RequestBuilder::new(stub))
14257        }
14258
14259        /// Sets the full request, replacing any prior values.
14260        pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
14261            mut self,
14262            v: V,
14263        ) -> Self {
14264            self.0.request = v.into();
14265            self
14266        }
14267
14268        /// Sets all the options, replacing any prior values.
14269        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
14270            self.0.options = v.into();
14271            self
14272        }
14273
14274        /// Sends the request.
14275        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
14276            (*self.0.stub)
14277                .get_operation(self.0.request, self.0.options)
14278                .await
14279                .map(crate::Response::into_body)
14280        }
14281
14282        /// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
14283        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
14284            self.0.request.name = v.into();
14285            self
14286        }
14287    }
14288
14289    #[doc(hidden)]
14290    impl crate::RequestBuilder for GetOperation {
14291        fn request_options(&mut self) -> &mut crate::RequestOptions {
14292            &mut self.0.options
14293        }
14294    }
14295
14296    /// The request builder for [SessionService::cancel_operation][crate::client::SessionService::cancel_operation] calls.
14297    ///
14298    /// # Example
14299    /// ```
14300    /// # use google_cloud_discoveryengine_v1::builder::session_service::CancelOperation;
14301    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
14302    ///
14303    /// let builder = prepare_request_builder();
14304    /// let response = builder.send().await?;
14305    /// # Ok(()) }
14306    ///
14307    /// fn prepare_request_builder() -> CancelOperation {
14308    ///   # panic!();
14309    ///   // ... details omitted ...
14310    /// }
14311    /// ```
14312    #[derive(Clone, Debug)]
14313    pub struct CancelOperation(
14314        RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
14315    );
14316
14317    impl CancelOperation {
14318        pub(crate) fn new(
14319            stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
14320        ) -> Self {
14321            Self(RequestBuilder::new(stub))
14322        }
14323
14324        /// Sets the full request, replacing any prior values.
14325        pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
14326            mut self,
14327            v: V,
14328        ) -> Self {
14329            self.0.request = v.into();
14330            self
14331        }
14332
14333        /// Sets all the options, replacing any prior values.
14334        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
14335            self.0.options = v.into();
14336            self
14337        }
14338
14339        /// Sends the request.
14340        pub async fn send(self) -> Result<()> {
14341            (*self.0.stub)
14342                .cancel_operation(self.0.request, self.0.options)
14343                .await
14344                .map(crate::Response::into_body)
14345        }
14346
14347        /// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::name].
14348        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
14349            self.0.request.name = v.into();
14350            self
14351        }
14352    }
14353
14354    #[doc(hidden)]
14355    impl crate::RequestBuilder for CancelOperation {
14356        fn request_options(&mut self) -> &mut crate::RequestOptions {
14357            &mut self.0.options
14358        }
14359    }
14360}
14361
14362/// Request and client builders for [SiteSearchEngineService][crate::client::SiteSearchEngineService].
14363#[cfg(feature = "site-search-engine-service")]
14364#[cfg_attr(docsrs, doc(cfg(feature = "site-search-engine-service")))]
14365pub mod site_search_engine_service {
14366    use crate::Result;
14367
14368    /// A builder for [SiteSearchEngineService][crate::client::SiteSearchEngineService].
14369    ///
14370    /// ```
14371    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
14372    /// # use google_cloud_discoveryengine_v1::*;
14373    /// # use builder::site_search_engine_service::ClientBuilder;
14374    /// # use client::SiteSearchEngineService;
14375    /// let builder : ClientBuilder = SiteSearchEngineService::builder();
14376    /// let client = builder
14377    ///     .with_endpoint("https://discoveryengine.googleapis.com")
14378    ///     .build().await?;
14379    /// # Ok(()) }
14380    /// ```
14381    pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
14382
14383    pub(crate) mod client {
14384        use super::super::super::client::SiteSearchEngineService;
14385        pub struct Factory;
14386        impl crate::ClientFactory for Factory {
14387            type Client = SiteSearchEngineService;
14388            type Credentials = gaxi::options::Credentials;
14389            async fn build(
14390                self,
14391                config: gaxi::options::ClientConfig,
14392            ) -> crate::ClientBuilderResult<Self::Client> {
14393                Self::Client::new(config).await
14394            }
14395        }
14396    }
14397
14398    /// Common implementation for [crate::client::SiteSearchEngineService] request builders.
14399    #[derive(Clone, Debug)]
14400    pub(crate) struct RequestBuilder<R: std::default::Default> {
14401        stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14402        request: R,
14403        options: crate::RequestOptions,
14404    }
14405
14406    impl<R> RequestBuilder<R>
14407    where
14408        R: std::default::Default,
14409    {
14410        pub(crate) fn new(
14411            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14412        ) -> Self {
14413            Self {
14414                stub,
14415                request: R::default(),
14416                options: crate::RequestOptions::default(),
14417            }
14418        }
14419    }
14420
14421    /// The request builder for [SiteSearchEngineService::get_site_search_engine][crate::client::SiteSearchEngineService::get_site_search_engine] calls.
14422    ///
14423    /// # Example
14424    /// ```
14425    /// # use google_cloud_discoveryengine_v1::builder::site_search_engine_service::GetSiteSearchEngine;
14426    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
14427    ///
14428    /// let builder = prepare_request_builder();
14429    /// let response = builder.send().await?;
14430    /// # Ok(()) }
14431    ///
14432    /// fn prepare_request_builder() -> GetSiteSearchEngine {
14433    ///   # panic!();
14434    ///   // ... details omitted ...
14435    /// }
14436    /// ```
14437    #[derive(Clone, Debug)]
14438    pub struct GetSiteSearchEngine(RequestBuilder<crate::model::GetSiteSearchEngineRequest>);
14439
14440    impl GetSiteSearchEngine {
14441        pub(crate) fn new(
14442            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14443        ) -> Self {
14444            Self(RequestBuilder::new(stub))
14445        }
14446
14447        /// Sets the full request, replacing any prior values.
14448        pub fn with_request<V: Into<crate::model::GetSiteSearchEngineRequest>>(
14449            mut self,
14450            v: V,
14451        ) -> Self {
14452            self.0.request = v.into();
14453            self
14454        }
14455
14456        /// Sets all the options, replacing any prior values.
14457        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
14458            self.0.options = v.into();
14459            self
14460        }
14461
14462        /// Sends the request.
14463        pub async fn send(self) -> Result<crate::model::SiteSearchEngine> {
14464            (*self.0.stub)
14465                .get_site_search_engine(self.0.request, self.0.options)
14466                .await
14467                .map(crate::Response::into_body)
14468        }
14469
14470        /// Sets the value of [name][crate::model::GetSiteSearchEngineRequest::name].
14471        ///
14472        /// This is a **required** field for requests.
14473        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
14474            self.0.request.name = v.into();
14475            self
14476        }
14477    }
14478
14479    #[doc(hidden)]
14480    impl crate::RequestBuilder for GetSiteSearchEngine {
14481        fn request_options(&mut self) -> &mut crate::RequestOptions {
14482            &mut self.0.options
14483        }
14484    }
14485
14486    /// The request builder for [SiteSearchEngineService::create_target_site][crate::client::SiteSearchEngineService::create_target_site] calls.
14487    ///
14488    /// # Example
14489    /// ```
14490    /// # use google_cloud_discoveryengine_v1::builder::site_search_engine_service::CreateTargetSite;
14491    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
14492    /// use google_cloud_lro::Poller;
14493    ///
14494    /// let builder = prepare_request_builder();
14495    /// let response = builder.poller().until_done().await?;
14496    /// # Ok(()) }
14497    ///
14498    /// fn prepare_request_builder() -> CreateTargetSite {
14499    ///   # panic!();
14500    ///   // ... details omitted ...
14501    /// }
14502    /// ```
14503    #[derive(Clone, Debug)]
14504    pub struct CreateTargetSite(RequestBuilder<crate::model::CreateTargetSiteRequest>);
14505
14506    impl CreateTargetSite {
14507        pub(crate) fn new(
14508            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14509        ) -> Self {
14510            Self(RequestBuilder::new(stub))
14511        }
14512
14513        /// Sets the full request, replacing any prior values.
14514        pub fn with_request<V: Into<crate::model::CreateTargetSiteRequest>>(
14515            mut self,
14516            v: V,
14517        ) -> Self {
14518            self.0.request = v.into();
14519            self
14520        }
14521
14522        /// Sets all the options, replacing any prior values.
14523        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
14524            self.0.options = v.into();
14525            self
14526        }
14527
14528        /// Sends the request.
14529        ///
14530        /// # Long running operations
14531        ///
14532        /// This starts, but does not poll, a longrunning operation. More information
14533        /// on [create_target_site][crate::client::SiteSearchEngineService::create_target_site].
14534        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
14535            (*self.0.stub)
14536                .create_target_site(self.0.request, self.0.options)
14537                .await
14538                .map(crate::Response::into_body)
14539        }
14540
14541        /// Creates a [Poller][google_cloud_lro::Poller] to work with `create_target_site`.
14542        pub fn poller(
14543            self,
14544        ) -> impl google_cloud_lro::Poller<
14545            crate::model::TargetSite,
14546            crate::model::CreateTargetSiteMetadata,
14547        > {
14548            type Operation = google_cloud_lro::internal::Operation<
14549                crate::model::TargetSite,
14550                crate::model::CreateTargetSiteMetadata,
14551            >;
14552            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
14553            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
14554            let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
14555            if let Some(ref mut details) = poller_options.tracing {
14556                details.method_name = "google_cloud_discoveryengine_v1::client::SiteSearchEngineService::create_target_site::until_done";
14557            }
14558
14559            let stub = self.0.stub.clone();
14560            let mut options = self.0.options.clone();
14561            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
14562            let query = move |name| {
14563                let stub = stub.clone();
14564                let options = options.clone();
14565                async {
14566                    let op = GetOperation::new(stub)
14567                        .set_name(name)
14568                        .with_options(options)
14569                        .send()
14570                        .await?;
14571                    Ok(Operation::new(op))
14572                }
14573            };
14574
14575            let start = move || async {
14576                let op = self.send().await?;
14577                Ok(Operation::new(op))
14578            };
14579
14580            use google_cloud_lro::internal::PollerExt;
14581            {
14582                google_cloud_lro::internal::new_poller(
14583                    polling_error_policy,
14584                    polling_backoff_policy,
14585                    start,
14586                    query,
14587                )
14588            }
14589            .with_options(poller_options)
14590        }
14591
14592        /// Sets the value of [parent][crate::model::CreateTargetSiteRequest::parent].
14593        ///
14594        /// This is a **required** field for requests.
14595        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
14596            self.0.request.parent = v.into();
14597            self
14598        }
14599
14600        /// Sets the value of [target_site][crate::model::CreateTargetSiteRequest::target_site].
14601        ///
14602        /// This is a **required** field for requests.
14603        pub fn set_target_site<T>(mut self, v: T) -> Self
14604        where
14605            T: std::convert::Into<crate::model::TargetSite>,
14606        {
14607            self.0.request.target_site = std::option::Option::Some(v.into());
14608            self
14609        }
14610
14611        /// Sets or clears the value of [target_site][crate::model::CreateTargetSiteRequest::target_site].
14612        ///
14613        /// This is a **required** field for requests.
14614        pub fn set_or_clear_target_site<T>(mut self, v: std::option::Option<T>) -> Self
14615        where
14616            T: std::convert::Into<crate::model::TargetSite>,
14617        {
14618            self.0.request.target_site = v.map(|x| x.into());
14619            self
14620        }
14621    }
14622
14623    #[doc(hidden)]
14624    impl crate::RequestBuilder for CreateTargetSite {
14625        fn request_options(&mut self) -> &mut crate::RequestOptions {
14626            &mut self.0.options
14627        }
14628    }
14629
14630    /// The request builder for [SiteSearchEngineService::batch_create_target_sites][crate::client::SiteSearchEngineService::batch_create_target_sites] calls.
14631    ///
14632    /// # Example
14633    /// ```
14634    /// # use google_cloud_discoveryengine_v1::builder::site_search_engine_service::BatchCreateTargetSites;
14635    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
14636    /// use google_cloud_lro::Poller;
14637    ///
14638    /// let builder = prepare_request_builder();
14639    /// let response = builder.poller().until_done().await?;
14640    /// # Ok(()) }
14641    ///
14642    /// fn prepare_request_builder() -> BatchCreateTargetSites {
14643    ///   # panic!();
14644    ///   // ... details omitted ...
14645    /// }
14646    /// ```
14647    #[derive(Clone, Debug)]
14648    pub struct BatchCreateTargetSites(RequestBuilder<crate::model::BatchCreateTargetSitesRequest>);
14649
14650    impl BatchCreateTargetSites {
14651        pub(crate) fn new(
14652            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14653        ) -> Self {
14654            Self(RequestBuilder::new(stub))
14655        }
14656
14657        /// Sets the full request, replacing any prior values.
14658        pub fn with_request<V: Into<crate::model::BatchCreateTargetSitesRequest>>(
14659            mut self,
14660            v: V,
14661        ) -> Self {
14662            self.0.request = v.into();
14663            self
14664        }
14665
14666        /// Sets all the options, replacing any prior values.
14667        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
14668            self.0.options = v.into();
14669            self
14670        }
14671
14672        /// Sends the request.
14673        ///
14674        /// # Long running operations
14675        ///
14676        /// This starts, but does not poll, a longrunning operation. More information
14677        /// on [batch_create_target_sites][crate::client::SiteSearchEngineService::batch_create_target_sites].
14678        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
14679            (*self.0.stub)
14680                .batch_create_target_sites(self.0.request, self.0.options)
14681                .await
14682                .map(crate::Response::into_body)
14683        }
14684
14685        /// Creates a [Poller][google_cloud_lro::Poller] to work with `batch_create_target_sites`.
14686        pub fn poller(
14687            self,
14688        ) -> impl google_cloud_lro::Poller<
14689            crate::model::BatchCreateTargetSitesResponse,
14690            crate::model::BatchCreateTargetSiteMetadata,
14691        > {
14692            type Operation = google_cloud_lro::internal::Operation<
14693                crate::model::BatchCreateTargetSitesResponse,
14694                crate::model::BatchCreateTargetSiteMetadata,
14695            >;
14696            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
14697            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
14698            let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
14699            if let Some(ref mut details) = poller_options.tracing {
14700                details.method_name = "google_cloud_discoveryengine_v1::client::SiteSearchEngineService::batch_create_target_sites::until_done";
14701            }
14702
14703            let stub = self.0.stub.clone();
14704            let mut options = self.0.options.clone();
14705            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
14706            let query = move |name| {
14707                let stub = stub.clone();
14708                let options = options.clone();
14709                async {
14710                    let op = GetOperation::new(stub)
14711                        .set_name(name)
14712                        .with_options(options)
14713                        .send()
14714                        .await?;
14715                    Ok(Operation::new(op))
14716                }
14717            };
14718
14719            let start = move || async {
14720                let op = self.send().await?;
14721                Ok(Operation::new(op))
14722            };
14723
14724            use google_cloud_lro::internal::PollerExt;
14725            {
14726                google_cloud_lro::internal::new_poller(
14727                    polling_error_policy,
14728                    polling_backoff_policy,
14729                    start,
14730                    query,
14731                )
14732            }
14733            .with_options(poller_options)
14734        }
14735
14736        /// Sets the value of [parent][crate::model::BatchCreateTargetSitesRequest::parent].
14737        ///
14738        /// This is a **required** field for requests.
14739        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
14740            self.0.request.parent = v.into();
14741            self
14742        }
14743
14744        /// Sets the value of [requests][crate::model::BatchCreateTargetSitesRequest::requests].
14745        ///
14746        /// This is a **required** field for requests.
14747        pub fn set_requests<T, V>(mut self, v: T) -> Self
14748        where
14749            T: std::iter::IntoIterator<Item = V>,
14750            V: std::convert::Into<crate::model::CreateTargetSiteRequest>,
14751        {
14752            use std::iter::Iterator;
14753            self.0.request.requests = v.into_iter().map(|i| i.into()).collect();
14754            self
14755        }
14756    }
14757
14758    #[doc(hidden)]
14759    impl crate::RequestBuilder for BatchCreateTargetSites {
14760        fn request_options(&mut self) -> &mut crate::RequestOptions {
14761            &mut self.0.options
14762        }
14763    }
14764
14765    /// The request builder for [SiteSearchEngineService::get_target_site][crate::client::SiteSearchEngineService::get_target_site] calls.
14766    ///
14767    /// # Example
14768    /// ```
14769    /// # use google_cloud_discoveryengine_v1::builder::site_search_engine_service::GetTargetSite;
14770    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
14771    ///
14772    /// let builder = prepare_request_builder();
14773    /// let response = builder.send().await?;
14774    /// # Ok(()) }
14775    ///
14776    /// fn prepare_request_builder() -> GetTargetSite {
14777    ///   # panic!();
14778    ///   // ... details omitted ...
14779    /// }
14780    /// ```
14781    #[derive(Clone, Debug)]
14782    pub struct GetTargetSite(RequestBuilder<crate::model::GetTargetSiteRequest>);
14783
14784    impl GetTargetSite {
14785        pub(crate) fn new(
14786            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14787        ) -> Self {
14788            Self(RequestBuilder::new(stub))
14789        }
14790
14791        /// Sets the full request, replacing any prior values.
14792        pub fn with_request<V: Into<crate::model::GetTargetSiteRequest>>(mut self, v: V) -> Self {
14793            self.0.request = v.into();
14794            self
14795        }
14796
14797        /// Sets all the options, replacing any prior values.
14798        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
14799            self.0.options = v.into();
14800            self
14801        }
14802
14803        /// Sends the request.
14804        pub async fn send(self) -> Result<crate::model::TargetSite> {
14805            (*self.0.stub)
14806                .get_target_site(self.0.request, self.0.options)
14807                .await
14808                .map(crate::Response::into_body)
14809        }
14810
14811        /// Sets the value of [name][crate::model::GetTargetSiteRequest::name].
14812        ///
14813        /// This is a **required** field for requests.
14814        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
14815            self.0.request.name = v.into();
14816            self
14817        }
14818    }
14819
14820    #[doc(hidden)]
14821    impl crate::RequestBuilder for GetTargetSite {
14822        fn request_options(&mut self) -> &mut crate::RequestOptions {
14823            &mut self.0.options
14824        }
14825    }
14826
14827    /// The request builder for [SiteSearchEngineService::update_target_site][crate::client::SiteSearchEngineService::update_target_site] calls.
14828    ///
14829    /// # Example
14830    /// ```
14831    /// # use google_cloud_discoveryengine_v1::builder::site_search_engine_service::UpdateTargetSite;
14832    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
14833    /// use google_cloud_lro::Poller;
14834    ///
14835    /// let builder = prepare_request_builder();
14836    /// let response = builder.poller().until_done().await?;
14837    /// # Ok(()) }
14838    ///
14839    /// fn prepare_request_builder() -> UpdateTargetSite {
14840    ///   # panic!();
14841    ///   // ... details omitted ...
14842    /// }
14843    /// ```
14844    #[derive(Clone, Debug)]
14845    pub struct UpdateTargetSite(RequestBuilder<crate::model::UpdateTargetSiteRequest>);
14846
14847    impl UpdateTargetSite {
14848        pub(crate) fn new(
14849            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14850        ) -> Self {
14851            Self(RequestBuilder::new(stub))
14852        }
14853
14854        /// Sets the full request, replacing any prior values.
14855        pub fn with_request<V: Into<crate::model::UpdateTargetSiteRequest>>(
14856            mut self,
14857            v: V,
14858        ) -> Self {
14859            self.0.request = v.into();
14860            self
14861        }
14862
14863        /// Sets all the options, replacing any prior values.
14864        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
14865            self.0.options = v.into();
14866            self
14867        }
14868
14869        /// Sends the request.
14870        ///
14871        /// # Long running operations
14872        ///
14873        /// This starts, but does not poll, a longrunning operation. More information
14874        /// on [update_target_site][crate::client::SiteSearchEngineService::update_target_site].
14875        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
14876            (*self.0.stub)
14877                .update_target_site(self.0.request, self.0.options)
14878                .await
14879                .map(crate::Response::into_body)
14880        }
14881
14882        /// Creates a [Poller][google_cloud_lro::Poller] to work with `update_target_site`.
14883        pub fn poller(
14884            self,
14885        ) -> impl google_cloud_lro::Poller<
14886            crate::model::TargetSite,
14887            crate::model::UpdateTargetSiteMetadata,
14888        > {
14889            type Operation = google_cloud_lro::internal::Operation<
14890                crate::model::TargetSite,
14891                crate::model::UpdateTargetSiteMetadata,
14892            >;
14893            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
14894            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
14895            let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
14896            if let Some(ref mut details) = poller_options.tracing {
14897                details.method_name = "google_cloud_discoveryengine_v1::client::SiteSearchEngineService::update_target_site::until_done";
14898            }
14899
14900            let stub = self.0.stub.clone();
14901            let mut options = self.0.options.clone();
14902            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
14903            let query = move |name| {
14904                let stub = stub.clone();
14905                let options = options.clone();
14906                async {
14907                    let op = GetOperation::new(stub)
14908                        .set_name(name)
14909                        .with_options(options)
14910                        .send()
14911                        .await?;
14912                    Ok(Operation::new(op))
14913                }
14914            };
14915
14916            let start = move || async {
14917                let op = self.send().await?;
14918                Ok(Operation::new(op))
14919            };
14920
14921            use google_cloud_lro::internal::PollerExt;
14922            {
14923                google_cloud_lro::internal::new_poller(
14924                    polling_error_policy,
14925                    polling_backoff_policy,
14926                    start,
14927                    query,
14928                )
14929            }
14930            .with_options(poller_options)
14931        }
14932
14933        /// Sets the value of [target_site][crate::model::UpdateTargetSiteRequest::target_site].
14934        ///
14935        /// This is a **required** field for requests.
14936        pub fn set_target_site<T>(mut self, v: T) -> Self
14937        where
14938            T: std::convert::Into<crate::model::TargetSite>,
14939        {
14940            self.0.request.target_site = std::option::Option::Some(v.into());
14941            self
14942        }
14943
14944        /// Sets or clears the value of [target_site][crate::model::UpdateTargetSiteRequest::target_site].
14945        ///
14946        /// This is a **required** field for requests.
14947        pub fn set_or_clear_target_site<T>(mut self, v: std::option::Option<T>) -> Self
14948        where
14949            T: std::convert::Into<crate::model::TargetSite>,
14950        {
14951            self.0.request.target_site = v.map(|x| x.into());
14952            self
14953        }
14954    }
14955
14956    #[doc(hidden)]
14957    impl crate::RequestBuilder for UpdateTargetSite {
14958        fn request_options(&mut self) -> &mut crate::RequestOptions {
14959            &mut self.0.options
14960        }
14961    }
14962
14963    /// The request builder for [SiteSearchEngineService::delete_target_site][crate::client::SiteSearchEngineService::delete_target_site] calls.
14964    ///
14965    /// # Example
14966    /// ```
14967    /// # use google_cloud_discoveryengine_v1::builder::site_search_engine_service::DeleteTargetSite;
14968    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
14969    /// use google_cloud_lro::Poller;
14970    ///
14971    /// let builder = prepare_request_builder();
14972    /// let response = builder.poller().until_done().await?;
14973    /// # Ok(()) }
14974    ///
14975    /// fn prepare_request_builder() -> DeleteTargetSite {
14976    ///   # panic!();
14977    ///   // ... details omitted ...
14978    /// }
14979    /// ```
14980    #[derive(Clone, Debug)]
14981    pub struct DeleteTargetSite(RequestBuilder<crate::model::DeleteTargetSiteRequest>);
14982
14983    impl DeleteTargetSite {
14984        pub(crate) fn new(
14985            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14986        ) -> Self {
14987            Self(RequestBuilder::new(stub))
14988        }
14989
14990        /// Sets the full request, replacing any prior values.
14991        pub fn with_request<V: Into<crate::model::DeleteTargetSiteRequest>>(
14992            mut self,
14993            v: V,
14994        ) -> Self {
14995            self.0.request = v.into();
14996            self
14997        }
14998
14999        /// Sets all the options, replacing any prior values.
15000        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
15001            self.0.options = v.into();
15002            self
15003        }
15004
15005        /// Sends the request.
15006        ///
15007        /// # Long running operations
15008        ///
15009        /// This starts, but does not poll, a longrunning operation. More information
15010        /// on [delete_target_site][crate::client::SiteSearchEngineService::delete_target_site].
15011        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
15012            (*self.0.stub)
15013                .delete_target_site(self.0.request, self.0.options)
15014                .await
15015                .map(crate::Response::into_body)
15016        }
15017
15018        /// Creates a [Poller][google_cloud_lro::Poller] to work with `delete_target_site`.
15019        pub fn poller(
15020            self,
15021        ) -> impl google_cloud_lro::Poller<(), crate::model::DeleteTargetSiteMetadata> {
15022            type Operation = google_cloud_lro::internal::Operation<
15023                wkt::Empty,
15024                crate::model::DeleteTargetSiteMetadata,
15025            >;
15026            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
15027            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
15028            let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
15029            if let Some(ref mut details) = poller_options.tracing {
15030                details.method_name = "google_cloud_discoveryengine_v1::client::SiteSearchEngineService::delete_target_site::until_done";
15031            }
15032
15033            let stub = self.0.stub.clone();
15034            let mut options = self.0.options.clone();
15035            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
15036            let query = move |name| {
15037                let stub = stub.clone();
15038                let options = options.clone();
15039                async {
15040                    let op = GetOperation::new(stub)
15041                        .set_name(name)
15042                        .with_options(options)
15043                        .send()
15044                        .await?;
15045                    Ok(Operation::new(op))
15046                }
15047            };
15048
15049            let start = move || async {
15050                let op = self.send().await?;
15051                Ok(Operation::new(op))
15052            };
15053
15054            use google_cloud_lro::internal::PollerExt;
15055            {
15056                google_cloud_lro::internal::new_unit_response_poller(
15057                    polling_error_policy,
15058                    polling_backoff_policy,
15059                    start,
15060                    query,
15061                )
15062            }
15063            .with_options(poller_options)
15064        }
15065
15066        /// Sets the value of [name][crate::model::DeleteTargetSiteRequest::name].
15067        ///
15068        /// This is a **required** field for requests.
15069        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
15070            self.0.request.name = v.into();
15071            self
15072        }
15073    }
15074
15075    #[doc(hidden)]
15076    impl crate::RequestBuilder for DeleteTargetSite {
15077        fn request_options(&mut self) -> &mut crate::RequestOptions {
15078            &mut self.0.options
15079        }
15080    }
15081
15082    /// The request builder for [SiteSearchEngineService::list_target_sites][crate::client::SiteSearchEngineService::list_target_sites] calls.
15083    ///
15084    /// # Example
15085    /// ```
15086    /// # use google_cloud_discoveryengine_v1::builder::site_search_engine_service::ListTargetSites;
15087    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
15088    /// use google_cloud_gax::paginator::ItemPaginator;
15089    ///
15090    /// let builder = prepare_request_builder();
15091    /// let mut items = builder.by_item();
15092    /// while let Some(result) = items.next().await {
15093    ///   let item = result?;
15094    /// }
15095    /// # Ok(()) }
15096    ///
15097    /// fn prepare_request_builder() -> ListTargetSites {
15098    ///   # panic!();
15099    ///   // ... details omitted ...
15100    /// }
15101    /// ```
15102    #[derive(Clone, Debug)]
15103    pub struct ListTargetSites(RequestBuilder<crate::model::ListTargetSitesRequest>);
15104
15105    impl ListTargetSites {
15106        pub(crate) fn new(
15107            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
15108        ) -> Self {
15109            Self(RequestBuilder::new(stub))
15110        }
15111
15112        /// Sets the full request, replacing any prior values.
15113        pub fn with_request<V: Into<crate::model::ListTargetSitesRequest>>(mut self, v: V) -> Self {
15114            self.0.request = v.into();
15115            self
15116        }
15117
15118        /// Sets all the options, replacing any prior values.
15119        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
15120            self.0.options = v.into();
15121            self
15122        }
15123
15124        /// Sends the request.
15125        pub async fn send(self) -> Result<crate::model::ListTargetSitesResponse> {
15126            (*self.0.stub)
15127                .list_target_sites(self.0.request, self.0.options)
15128                .await
15129                .map(crate::Response::into_body)
15130        }
15131
15132        /// Streams each page in the collection.
15133        pub fn by_page(
15134            self,
15135        ) -> impl google_cloud_gax::paginator::Paginator<
15136            crate::model::ListTargetSitesResponse,
15137            crate::Error,
15138        > {
15139            use std::clone::Clone;
15140            let token = self.0.request.page_token.clone();
15141            let execute = move |token: String| {
15142                let mut builder = self.clone();
15143                builder.0.request = builder.0.request.set_page_token(token);
15144                builder.send()
15145            };
15146            google_cloud_gax::paginator::internal::new_paginator(token, execute)
15147        }
15148
15149        /// Streams each item in the collection.
15150        pub fn by_item(
15151            self,
15152        ) -> impl google_cloud_gax::paginator::ItemPaginator<
15153            crate::model::ListTargetSitesResponse,
15154            crate::Error,
15155        > {
15156            use google_cloud_gax::paginator::Paginator;
15157            self.by_page().items()
15158        }
15159
15160        /// Sets the value of [parent][crate::model::ListTargetSitesRequest::parent].
15161        ///
15162        /// This is a **required** field for requests.
15163        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
15164            self.0.request.parent = v.into();
15165            self
15166        }
15167
15168        /// Sets the value of [page_size][crate::model::ListTargetSitesRequest::page_size].
15169        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
15170            self.0.request.page_size = v.into();
15171            self
15172        }
15173
15174        /// Sets the value of [page_token][crate::model::ListTargetSitesRequest::page_token].
15175        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
15176            self.0.request.page_token = v.into();
15177            self
15178        }
15179    }
15180
15181    #[doc(hidden)]
15182    impl crate::RequestBuilder for ListTargetSites {
15183        fn request_options(&mut self) -> &mut crate::RequestOptions {
15184            &mut self.0.options
15185        }
15186    }
15187
15188    /// The request builder for [SiteSearchEngineService::create_sitemap][crate::client::SiteSearchEngineService::create_sitemap] calls.
15189    ///
15190    /// # Example
15191    /// ```
15192    /// # use google_cloud_discoveryengine_v1::builder::site_search_engine_service::CreateSitemap;
15193    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
15194    /// use google_cloud_lro::Poller;
15195    ///
15196    /// let builder = prepare_request_builder();
15197    /// let response = builder.poller().until_done().await?;
15198    /// # Ok(()) }
15199    ///
15200    /// fn prepare_request_builder() -> CreateSitemap {
15201    ///   # panic!();
15202    ///   // ... details omitted ...
15203    /// }
15204    /// ```
15205    #[derive(Clone, Debug)]
15206    pub struct CreateSitemap(RequestBuilder<crate::model::CreateSitemapRequest>);
15207
15208    impl CreateSitemap {
15209        pub(crate) fn new(
15210            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
15211        ) -> Self {
15212            Self(RequestBuilder::new(stub))
15213        }
15214
15215        /// Sets the full request, replacing any prior values.
15216        pub fn with_request<V: Into<crate::model::CreateSitemapRequest>>(mut self, v: V) -> Self {
15217            self.0.request = v.into();
15218            self
15219        }
15220
15221        /// Sets all the options, replacing any prior values.
15222        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
15223            self.0.options = v.into();
15224            self
15225        }
15226
15227        /// Sends the request.
15228        ///
15229        /// # Long running operations
15230        ///
15231        /// This starts, but does not poll, a longrunning operation. More information
15232        /// on [create_sitemap][crate::client::SiteSearchEngineService::create_sitemap].
15233        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
15234            (*self.0.stub)
15235                .create_sitemap(self.0.request, self.0.options)
15236                .await
15237                .map(crate::Response::into_body)
15238        }
15239
15240        /// Creates a [Poller][google_cloud_lro::Poller] to work with `create_sitemap`.
15241        pub fn poller(
15242            self,
15243        ) -> impl google_cloud_lro::Poller<crate::model::Sitemap, crate::model::CreateSitemapMetadata>
15244        {
15245            type Operation = google_cloud_lro::internal::Operation<
15246                crate::model::Sitemap,
15247                crate::model::CreateSitemapMetadata,
15248            >;
15249            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
15250            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
15251            let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
15252            if let Some(ref mut details) = poller_options.tracing {
15253                details.method_name = "google_cloud_discoveryengine_v1::client::SiteSearchEngineService::create_sitemap::until_done";
15254            }
15255
15256            let stub = self.0.stub.clone();
15257            let mut options = self.0.options.clone();
15258            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
15259            let query = move |name| {
15260                let stub = stub.clone();
15261                let options = options.clone();
15262                async {
15263                    let op = GetOperation::new(stub)
15264                        .set_name(name)
15265                        .with_options(options)
15266                        .send()
15267                        .await?;
15268                    Ok(Operation::new(op))
15269                }
15270            };
15271
15272            let start = move || async {
15273                let op = self.send().await?;
15274                Ok(Operation::new(op))
15275            };
15276
15277            use google_cloud_lro::internal::PollerExt;
15278            {
15279                google_cloud_lro::internal::new_poller(
15280                    polling_error_policy,
15281                    polling_backoff_policy,
15282                    start,
15283                    query,
15284                )
15285            }
15286            .with_options(poller_options)
15287        }
15288
15289        /// Sets the value of [parent][crate::model::CreateSitemapRequest::parent].
15290        ///
15291        /// This is a **required** field for requests.
15292        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
15293            self.0.request.parent = v.into();
15294            self
15295        }
15296
15297        /// Sets the value of [sitemap][crate::model::CreateSitemapRequest::sitemap].
15298        ///
15299        /// This is a **required** field for requests.
15300        pub fn set_sitemap<T>(mut self, v: T) -> Self
15301        where
15302            T: std::convert::Into<crate::model::Sitemap>,
15303        {
15304            self.0.request.sitemap = std::option::Option::Some(v.into());
15305            self
15306        }
15307
15308        /// Sets or clears the value of [sitemap][crate::model::CreateSitemapRequest::sitemap].
15309        ///
15310        /// This is a **required** field for requests.
15311        pub fn set_or_clear_sitemap<T>(mut self, v: std::option::Option<T>) -> Self
15312        where
15313            T: std::convert::Into<crate::model::Sitemap>,
15314        {
15315            self.0.request.sitemap = v.map(|x| x.into());
15316            self
15317        }
15318    }
15319
15320    #[doc(hidden)]
15321    impl crate::RequestBuilder for CreateSitemap {
15322        fn request_options(&mut self) -> &mut crate::RequestOptions {
15323            &mut self.0.options
15324        }
15325    }
15326
15327    /// The request builder for [SiteSearchEngineService::delete_sitemap][crate::client::SiteSearchEngineService::delete_sitemap] calls.
15328    ///
15329    /// # Example
15330    /// ```
15331    /// # use google_cloud_discoveryengine_v1::builder::site_search_engine_service::DeleteSitemap;
15332    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
15333    /// use google_cloud_lro::Poller;
15334    ///
15335    /// let builder = prepare_request_builder();
15336    /// let response = builder.poller().until_done().await?;
15337    /// # Ok(()) }
15338    ///
15339    /// fn prepare_request_builder() -> DeleteSitemap {
15340    ///   # panic!();
15341    ///   // ... details omitted ...
15342    /// }
15343    /// ```
15344    #[derive(Clone, Debug)]
15345    pub struct DeleteSitemap(RequestBuilder<crate::model::DeleteSitemapRequest>);
15346
15347    impl DeleteSitemap {
15348        pub(crate) fn new(
15349            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
15350        ) -> Self {
15351            Self(RequestBuilder::new(stub))
15352        }
15353
15354        /// Sets the full request, replacing any prior values.
15355        pub fn with_request<V: Into<crate::model::DeleteSitemapRequest>>(mut self, v: V) -> Self {
15356            self.0.request = v.into();
15357            self
15358        }
15359
15360        /// Sets all the options, replacing any prior values.
15361        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
15362            self.0.options = v.into();
15363            self
15364        }
15365
15366        /// Sends the request.
15367        ///
15368        /// # Long running operations
15369        ///
15370        /// This starts, but does not poll, a longrunning operation. More information
15371        /// on [delete_sitemap][crate::client::SiteSearchEngineService::delete_sitemap].
15372        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
15373            (*self.0.stub)
15374                .delete_sitemap(self.0.request, self.0.options)
15375                .await
15376                .map(crate::Response::into_body)
15377        }
15378
15379        /// Creates a [Poller][google_cloud_lro::Poller] to work with `delete_sitemap`.
15380        pub fn poller(
15381            self,
15382        ) -> impl google_cloud_lro::Poller<(), crate::model::DeleteSitemapMetadata> {
15383            type Operation = google_cloud_lro::internal::Operation<
15384                wkt::Empty,
15385                crate::model::DeleteSitemapMetadata,
15386            >;
15387            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
15388            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
15389            let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
15390            if let Some(ref mut details) = poller_options.tracing {
15391                details.method_name = "google_cloud_discoveryengine_v1::client::SiteSearchEngineService::delete_sitemap::until_done";
15392            }
15393
15394            let stub = self.0.stub.clone();
15395            let mut options = self.0.options.clone();
15396            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
15397            let query = move |name| {
15398                let stub = stub.clone();
15399                let options = options.clone();
15400                async {
15401                    let op = GetOperation::new(stub)
15402                        .set_name(name)
15403                        .with_options(options)
15404                        .send()
15405                        .await?;
15406                    Ok(Operation::new(op))
15407                }
15408            };
15409
15410            let start = move || async {
15411                let op = self.send().await?;
15412                Ok(Operation::new(op))
15413            };
15414
15415            use google_cloud_lro::internal::PollerExt;
15416            {
15417                google_cloud_lro::internal::new_unit_response_poller(
15418                    polling_error_policy,
15419                    polling_backoff_policy,
15420                    start,
15421                    query,
15422                )
15423            }
15424            .with_options(poller_options)
15425        }
15426
15427        /// Sets the value of [name][crate::model::DeleteSitemapRequest::name].
15428        ///
15429        /// This is a **required** field for requests.
15430        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
15431            self.0.request.name = v.into();
15432            self
15433        }
15434    }
15435
15436    #[doc(hidden)]
15437    impl crate::RequestBuilder for DeleteSitemap {
15438        fn request_options(&mut self) -> &mut crate::RequestOptions {
15439            &mut self.0.options
15440        }
15441    }
15442
15443    /// The request builder for [SiteSearchEngineService::fetch_sitemaps][crate::client::SiteSearchEngineService::fetch_sitemaps] calls.
15444    ///
15445    /// # Example
15446    /// ```
15447    /// # use google_cloud_discoveryengine_v1::builder::site_search_engine_service::FetchSitemaps;
15448    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
15449    ///
15450    /// let builder = prepare_request_builder();
15451    /// let response = builder.send().await?;
15452    /// # Ok(()) }
15453    ///
15454    /// fn prepare_request_builder() -> FetchSitemaps {
15455    ///   # panic!();
15456    ///   // ... details omitted ...
15457    /// }
15458    /// ```
15459    #[derive(Clone, Debug)]
15460    pub struct FetchSitemaps(RequestBuilder<crate::model::FetchSitemapsRequest>);
15461
15462    impl FetchSitemaps {
15463        pub(crate) fn new(
15464            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
15465        ) -> Self {
15466            Self(RequestBuilder::new(stub))
15467        }
15468
15469        /// Sets the full request, replacing any prior values.
15470        pub fn with_request<V: Into<crate::model::FetchSitemapsRequest>>(mut self, v: V) -> Self {
15471            self.0.request = v.into();
15472            self
15473        }
15474
15475        /// Sets all the options, replacing any prior values.
15476        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
15477            self.0.options = v.into();
15478            self
15479        }
15480
15481        /// Sends the request.
15482        pub async fn send(self) -> Result<crate::model::FetchSitemapsResponse> {
15483            (*self.0.stub)
15484                .fetch_sitemaps(self.0.request, self.0.options)
15485                .await
15486                .map(crate::Response::into_body)
15487        }
15488
15489        /// Sets the value of [parent][crate::model::FetchSitemapsRequest::parent].
15490        ///
15491        /// This is a **required** field for requests.
15492        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
15493            self.0.request.parent = v.into();
15494            self
15495        }
15496
15497        /// Sets the value of [matcher][crate::model::FetchSitemapsRequest::matcher].
15498        pub fn set_matcher<T>(mut self, v: T) -> Self
15499        where
15500            T: std::convert::Into<crate::model::fetch_sitemaps_request::Matcher>,
15501        {
15502            self.0.request.matcher = std::option::Option::Some(v.into());
15503            self
15504        }
15505
15506        /// Sets or clears the value of [matcher][crate::model::FetchSitemapsRequest::matcher].
15507        pub fn set_or_clear_matcher<T>(mut self, v: std::option::Option<T>) -> Self
15508        where
15509            T: std::convert::Into<crate::model::fetch_sitemaps_request::Matcher>,
15510        {
15511            self.0.request.matcher = v.map(|x| x.into());
15512            self
15513        }
15514    }
15515
15516    #[doc(hidden)]
15517    impl crate::RequestBuilder for FetchSitemaps {
15518        fn request_options(&mut self) -> &mut crate::RequestOptions {
15519            &mut self.0.options
15520        }
15521    }
15522
15523    /// The request builder for [SiteSearchEngineService::enable_advanced_site_search][crate::client::SiteSearchEngineService::enable_advanced_site_search] calls.
15524    ///
15525    /// # Example
15526    /// ```
15527    /// # use google_cloud_discoveryengine_v1::builder::site_search_engine_service::EnableAdvancedSiteSearch;
15528    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
15529    /// use google_cloud_lro::Poller;
15530    ///
15531    /// let builder = prepare_request_builder();
15532    /// let response = builder.poller().until_done().await?;
15533    /// # Ok(()) }
15534    ///
15535    /// fn prepare_request_builder() -> EnableAdvancedSiteSearch {
15536    ///   # panic!();
15537    ///   // ... details omitted ...
15538    /// }
15539    /// ```
15540    #[derive(Clone, Debug)]
15541    pub struct EnableAdvancedSiteSearch(
15542        RequestBuilder<crate::model::EnableAdvancedSiteSearchRequest>,
15543    );
15544
15545    impl EnableAdvancedSiteSearch {
15546        pub(crate) fn new(
15547            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
15548        ) -> Self {
15549            Self(RequestBuilder::new(stub))
15550        }
15551
15552        /// Sets the full request, replacing any prior values.
15553        pub fn with_request<V: Into<crate::model::EnableAdvancedSiteSearchRequest>>(
15554            mut self,
15555            v: V,
15556        ) -> Self {
15557            self.0.request = v.into();
15558            self
15559        }
15560
15561        /// Sets all the options, replacing any prior values.
15562        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
15563            self.0.options = v.into();
15564            self
15565        }
15566
15567        /// Sends the request.
15568        ///
15569        /// # Long running operations
15570        ///
15571        /// This starts, but does not poll, a longrunning operation. More information
15572        /// on [enable_advanced_site_search][crate::client::SiteSearchEngineService::enable_advanced_site_search].
15573        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
15574            (*self.0.stub)
15575                .enable_advanced_site_search(self.0.request, self.0.options)
15576                .await
15577                .map(crate::Response::into_body)
15578        }
15579
15580        /// Creates a [Poller][google_cloud_lro::Poller] to work with `enable_advanced_site_search`.
15581        pub fn poller(
15582            self,
15583        ) -> impl google_cloud_lro::Poller<
15584            crate::model::EnableAdvancedSiteSearchResponse,
15585            crate::model::EnableAdvancedSiteSearchMetadata,
15586        > {
15587            type Operation = google_cloud_lro::internal::Operation<
15588                crate::model::EnableAdvancedSiteSearchResponse,
15589                crate::model::EnableAdvancedSiteSearchMetadata,
15590            >;
15591            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
15592            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
15593            let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
15594            if let Some(ref mut details) = poller_options.tracing {
15595                details.method_name = "google_cloud_discoveryengine_v1::client::SiteSearchEngineService::enable_advanced_site_search::until_done";
15596            }
15597
15598            let stub = self.0.stub.clone();
15599            let mut options = self.0.options.clone();
15600            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
15601            let query = move |name| {
15602                let stub = stub.clone();
15603                let options = options.clone();
15604                async {
15605                    let op = GetOperation::new(stub)
15606                        .set_name(name)
15607                        .with_options(options)
15608                        .send()
15609                        .await?;
15610                    Ok(Operation::new(op))
15611                }
15612            };
15613
15614            let start = move || async {
15615                let op = self.send().await?;
15616                Ok(Operation::new(op))
15617            };
15618
15619            use google_cloud_lro::internal::PollerExt;
15620            {
15621                google_cloud_lro::internal::new_poller(
15622                    polling_error_policy,
15623                    polling_backoff_policy,
15624                    start,
15625                    query,
15626                )
15627            }
15628            .with_options(poller_options)
15629        }
15630
15631        /// Sets the value of [site_search_engine][crate::model::EnableAdvancedSiteSearchRequest::site_search_engine].
15632        ///
15633        /// This is a **required** field for requests.
15634        pub fn set_site_search_engine<T: Into<std::string::String>>(mut self, v: T) -> Self {
15635            self.0.request.site_search_engine = v.into();
15636            self
15637        }
15638    }
15639
15640    #[doc(hidden)]
15641    impl crate::RequestBuilder for EnableAdvancedSiteSearch {
15642        fn request_options(&mut self) -> &mut crate::RequestOptions {
15643            &mut self.0.options
15644        }
15645    }
15646
15647    /// The request builder for [SiteSearchEngineService::disable_advanced_site_search][crate::client::SiteSearchEngineService::disable_advanced_site_search] calls.
15648    ///
15649    /// # Example
15650    /// ```
15651    /// # use google_cloud_discoveryengine_v1::builder::site_search_engine_service::DisableAdvancedSiteSearch;
15652    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
15653    /// use google_cloud_lro::Poller;
15654    ///
15655    /// let builder = prepare_request_builder();
15656    /// let response = builder.poller().until_done().await?;
15657    /// # Ok(()) }
15658    ///
15659    /// fn prepare_request_builder() -> DisableAdvancedSiteSearch {
15660    ///   # panic!();
15661    ///   // ... details omitted ...
15662    /// }
15663    /// ```
15664    #[derive(Clone, Debug)]
15665    pub struct DisableAdvancedSiteSearch(
15666        RequestBuilder<crate::model::DisableAdvancedSiteSearchRequest>,
15667    );
15668
15669    impl DisableAdvancedSiteSearch {
15670        pub(crate) fn new(
15671            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
15672        ) -> Self {
15673            Self(RequestBuilder::new(stub))
15674        }
15675
15676        /// Sets the full request, replacing any prior values.
15677        pub fn with_request<V: Into<crate::model::DisableAdvancedSiteSearchRequest>>(
15678            mut self,
15679            v: V,
15680        ) -> Self {
15681            self.0.request = v.into();
15682            self
15683        }
15684
15685        /// Sets all the options, replacing any prior values.
15686        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
15687            self.0.options = v.into();
15688            self
15689        }
15690
15691        /// Sends the request.
15692        ///
15693        /// # Long running operations
15694        ///
15695        /// This starts, but does not poll, a longrunning operation. More information
15696        /// on [disable_advanced_site_search][crate::client::SiteSearchEngineService::disable_advanced_site_search].
15697        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
15698            (*self.0.stub)
15699                .disable_advanced_site_search(self.0.request, self.0.options)
15700                .await
15701                .map(crate::Response::into_body)
15702        }
15703
15704        /// Creates a [Poller][google_cloud_lro::Poller] to work with `disable_advanced_site_search`.
15705        pub fn poller(
15706            self,
15707        ) -> impl google_cloud_lro::Poller<
15708            crate::model::DisableAdvancedSiteSearchResponse,
15709            crate::model::DisableAdvancedSiteSearchMetadata,
15710        > {
15711            type Operation = google_cloud_lro::internal::Operation<
15712                crate::model::DisableAdvancedSiteSearchResponse,
15713                crate::model::DisableAdvancedSiteSearchMetadata,
15714            >;
15715            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
15716            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
15717            let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
15718            if let Some(ref mut details) = poller_options.tracing {
15719                details.method_name = "google_cloud_discoveryengine_v1::client::SiteSearchEngineService::disable_advanced_site_search::until_done";
15720            }
15721
15722            let stub = self.0.stub.clone();
15723            let mut options = self.0.options.clone();
15724            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
15725            let query = move |name| {
15726                let stub = stub.clone();
15727                let options = options.clone();
15728                async {
15729                    let op = GetOperation::new(stub)
15730                        .set_name(name)
15731                        .with_options(options)
15732                        .send()
15733                        .await?;
15734                    Ok(Operation::new(op))
15735                }
15736            };
15737
15738            let start = move || async {
15739                let op = self.send().await?;
15740                Ok(Operation::new(op))
15741            };
15742
15743            use google_cloud_lro::internal::PollerExt;
15744            {
15745                google_cloud_lro::internal::new_poller(
15746                    polling_error_policy,
15747                    polling_backoff_policy,
15748                    start,
15749                    query,
15750                )
15751            }
15752            .with_options(poller_options)
15753        }
15754
15755        /// Sets the value of [site_search_engine][crate::model::DisableAdvancedSiteSearchRequest::site_search_engine].
15756        ///
15757        /// This is a **required** field for requests.
15758        pub fn set_site_search_engine<T: Into<std::string::String>>(mut self, v: T) -> Self {
15759            self.0.request.site_search_engine = v.into();
15760            self
15761        }
15762    }
15763
15764    #[doc(hidden)]
15765    impl crate::RequestBuilder for DisableAdvancedSiteSearch {
15766        fn request_options(&mut self) -> &mut crate::RequestOptions {
15767            &mut self.0.options
15768        }
15769    }
15770
15771    /// The request builder for [SiteSearchEngineService::recrawl_uris][crate::client::SiteSearchEngineService::recrawl_uris] calls.
15772    ///
15773    /// # Example
15774    /// ```
15775    /// # use google_cloud_discoveryengine_v1::builder::site_search_engine_service::RecrawlUris;
15776    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
15777    /// use google_cloud_lro::Poller;
15778    ///
15779    /// let builder = prepare_request_builder();
15780    /// let response = builder.poller().until_done().await?;
15781    /// # Ok(()) }
15782    ///
15783    /// fn prepare_request_builder() -> RecrawlUris {
15784    ///   # panic!();
15785    ///   // ... details omitted ...
15786    /// }
15787    /// ```
15788    #[derive(Clone, Debug)]
15789    pub struct RecrawlUris(RequestBuilder<crate::model::RecrawlUrisRequest>);
15790
15791    impl RecrawlUris {
15792        pub(crate) fn new(
15793            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
15794        ) -> Self {
15795            Self(RequestBuilder::new(stub))
15796        }
15797
15798        /// Sets the full request, replacing any prior values.
15799        pub fn with_request<V: Into<crate::model::RecrawlUrisRequest>>(mut self, v: V) -> Self {
15800            self.0.request = v.into();
15801            self
15802        }
15803
15804        /// Sets all the options, replacing any prior values.
15805        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
15806            self.0.options = v.into();
15807            self
15808        }
15809
15810        /// Sends the request.
15811        ///
15812        /// # Long running operations
15813        ///
15814        /// This starts, but does not poll, a longrunning operation. More information
15815        /// on [recrawl_uris][crate::client::SiteSearchEngineService::recrawl_uris].
15816        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
15817            (*self.0.stub)
15818                .recrawl_uris(self.0.request, self.0.options)
15819                .await
15820                .map(crate::Response::into_body)
15821        }
15822
15823        /// Creates a [Poller][google_cloud_lro::Poller] to work with `recrawl_uris`.
15824        pub fn poller(
15825            self,
15826        ) -> impl google_cloud_lro::Poller<
15827            crate::model::RecrawlUrisResponse,
15828            crate::model::RecrawlUrisMetadata,
15829        > {
15830            type Operation = google_cloud_lro::internal::Operation<
15831                crate::model::RecrawlUrisResponse,
15832                crate::model::RecrawlUrisMetadata,
15833            >;
15834            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
15835            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
15836            let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
15837            if let Some(ref mut details) = poller_options.tracing {
15838                details.method_name = "google_cloud_discoveryengine_v1::client::SiteSearchEngineService::recrawl_uris::until_done";
15839            }
15840
15841            let stub = self.0.stub.clone();
15842            let mut options = self.0.options.clone();
15843            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
15844            let query = move |name| {
15845                let stub = stub.clone();
15846                let options = options.clone();
15847                async {
15848                    let op = GetOperation::new(stub)
15849                        .set_name(name)
15850                        .with_options(options)
15851                        .send()
15852                        .await?;
15853                    Ok(Operation::new(op))
15854                }
15855            };
15856
15857            let start = move || async {
15858                let op = self.send().await?;
15859                Ok(Operation::new(op))
15860            };
15861
15862            use google_cloud_lro::internal::PollerExt;
15863            {
15864                google_cloud_lro::internal::new_poller(
15865                    polling_error_policy,
15866                    polling_backoff_policy,
15867                    start,
15868                    query,
15869                )
15870            }
15871            .with_options(poller_options)
15872        }
15873
15874        /// Sets the value of [site_search_engine][crate::model::RecrawlUrisRequest::site_search_engine].
15875        ///
15876        /// This is a **required** field for requests.
15877        pub fn set_site_search_engine<T: Into<std::string::String>>(mut self, v: T) -> Self {
15878            self.0.request.site_search_engine = v.into();
15879            self
15880        }
15881
15882        /// Sets the value of [uris][crate::model::RecrawlUrisRequest::uris].
15883        ///
15884        /// This is a **required** field for requests.
15885        pub fn set_uris<T, V>(mut self, v: T) -> Self
15886        where
15887            T: std::iter::IntoIterator<Item = V>,
15888            V: std::convert::Into<std::string::String>,
15889        {
15890            use std::iter::Iterator;
15891            self.0.request.uris = v.into_iter().map(|i| i.into()).collect();
15892            self
15893        }
15894
15895        /// Sets the value of [site_credential][crate::model::RecrawlUrisRequest::site_credential].
15896        pub fn set_site_credential<T: Into<std::string::String>>(mut self, v: T) -> Self {
15897            self.0.request.site_credential = v.into();
15898            self
15899        }
15900    }
15901
15902    #[doc(hidden)]
15903    impl crate::RequestBuilder for RecrawlUris {
15904        fn request_options(&mut self) -> &mut crate::RequestOptions {
15905            &mut self.0.options
15906        }
15907    }
15908
15909    /// The request builder for [SiteSearchEngineService::batch_verify_target_sites][crate::client::SiteSearchEngineService::batch_verify_target_sites] calls.
15910    ///
15911    /// # Example
15912    /// ```
15913    /// # use google_cloud_discoveryengine_v1::builder::site_search_engine_service::BatchVerifyTargetSites;
15914    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
15915    /// use google_cloud_lro::Poller;
15916    ///
15917    /// let builder = prepare_request_builder();
15918    /// let response = builder.poller().until_done().await?;
15919    /// # Ok(()) }
15920    ///
15921    /// fn prepare_request_builder() -> BatchVerifyTargetSites {
15922    ///   # panic!();
15923    ///   // ... details omitted ...
15924    /// }
15925    /// ```
15926    #[derive(Clone, Debug)]
15927    pub struct BatchVerifyTargetSites(RequestBuilder<crate::model::BatchVerifyTargetSitesRequest>);
15928
15929    impl BatchVerifyTargetSites {
15930        pub(crate) fn new(
15931            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
15932        ) -> Self {
15933            Self(RequestBuilder::new(stub))
15934        }
15935
15936        /// Sets the full request, replacing any prior values.
15937        pub fn with_request<V: Into<crate::model::BatchVerifyTargetSitesRequest>>(
15938            mut self,
15939            v: V,
15940        ) -> Self {
15941            self.0.request = v.into();
15942            self
15943        }
15944
15945        /// Sets all the options, replacing any prior values.
15946        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
15947            self.0.options = v.into();
15948            self
15949        }
15950
15951        /// Sends the request.
15952        ///
15953        /// # Long running operations
15954        ///
15955        /// This starts, but does not poll, a longrunning operation. More information
15956        /// on [batch_verify_target_sites][crate::client::SiteSearchEngineService::batch_verify_target_sites].
15957        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
15958            (*self.0.stub)
15959                .batch_verify_target_sites(self.0.request, self.0.options)
15960                .await
15961                .map(crate::Response::into_body)
15962        }
15963
15964        /// Creates a [Poller][google_cloud_lro::Poller] to work with `batch_verify_target_sites`.
15965        pub fn poller(
15966            self,
15967        ) -> impl google_cloud_lro::Poller<
15968            crate::model::BatchVerifyTargetSitesResponse,
15969            crate::model::BatchVerifyTargetSitesMetadata,
15970        > {
15971            type Operation = google_cloud_lro::internal::Operation<
15972                crate::model::BatchVerifyTargetSitesResponse,
15973                crate::model::BatchVerifyTargetSitesMetadata,
15974            >;
15975            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
15976            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
15977            let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
15978            if let Some(ref mut details) = poller_options.tracing {
15979                details.method_name = "google_cloud_discoveryengine_v1::client::SiteSearchEngineService::batch_verify_target_sites::until_done";
15980            }
15981
15982            let stub = self.0.stub.clone();
15983            let mut options = self.0.options.clone();
15984            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
15985            let query = move |name| {
15986                let stub = stub.clone();
15987                let options = options.clone();
15988                async {
15989                    let op = GetOperation::new(stub)
15990                        .set_name(name)
15991                        .with_options(options)
15992                        .send()
15993                        .await?;
15994                    Ok(Operation::new(op))
15995                }
15996            };
15997
15998            let start = move || async {
15999                let op = self.send().await?;
16000                Ok(Operation::new(op))
16001            };
16002
16003            use google_cloud_lro::internal::PollerExt;
16004            {
16005                google_cloud_lro::internal::new_poller(
16006                    polling_error_policy,
16007                    polling_backoff_policy,
16008                    start,
16009                    query,
16010                )
16011            }
16012            .with_options(poller_options)
16013        }
16014
16015        /// Sets the value of [parent][crate::model::BatchVerifyTargetSitesRequest::parent].
16016        ///
16017        /// This is a **required** field for requests.
16018        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
16019            self.0.request.parent = v.into();
16020            self
16021        }
16022    }
16023
16024    #[doc(hidden)]
16025    impl crate::RequestBuilder for BatchVerifyTargetSites {
16026        fn request_options(&mut self) -> &mut crate::RequestOptions {
16027            &mut self.0.options
16028        }
16029    }
16030
16031    /// The request builder for [SiteSearchEngineService::fetch_domain_verification_status][crate::client::SiteSearchEngineService::fetch_domain_verification_status] calls.
16032    ///
16033    /// # Example
16034    /// ```
16035    /// # use google_cloud_discoveryengine_v1::builder::site_search_engine_service::FetchDomainVerificationStatus;
16036    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
16037    /// use google_cloud_gax::paginator::ItemPaginator;
16038    ///
16039    /// let builder = prepare_request_builder();
16040    /// let mut items = builder.by_item();
16041    /// while let Some(result) = items.next().await {
16042    ///   let item = result?;
16043    /// }
16044    /// # Ok(()) }
16045    ///
16046    /// fn prepare_request_builder() -> FetchDomainVerificationStatus {
16047    ///   # panic!();
16048    ///   // ... details omitted ...
16049    /// }
16050    /// ```
16051    #[derive(Clone, Debug)]
16052    pub struct FetchDomainVerificationStatus(
16053        RequestBuilder<crate::model::FetchDomainVerificationStatusRequest>,
16054    );
16055
16056    impl FetchDomainVerificationStatus {
16057        pub(crate) fn new(
16058            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
16059        ) -> Self {
16060            Self(RequestBuilder::new(stub))
16061        }
16062
16063        /// Sets the full request, replacing any prior values.
16064        pub fn with_request<V: Into<crate::model::FetchDomainVerificationStatusRequest>>(
16065            mut self,
16066            v: V,
16067        ) -> Self {
16068            self.0.request = v.into();
16069            self
16070        }
16071
16072        /// Sets all the options, replacing any prior values.
16073        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
16074            self.0.options = v.into();
16075            self
16076        }
16077
16078        /// Sends the request.
16079        pub async fn send(self) -> Result<crate::model::FetchDomainVerificationStatusResponse> {
16080            (*self.0.stub)
16081                .fetch_domain_verification_status(self.0.request, self.0.options)
16082                .await
16083                .map(crate::Response::into_body)
16084        }
16085
16086        /// Streams each page in the collection.
16087        pub fn by_page(
16088            self,
16089        ) -> impl google_cloud_gax::paginator::Paginator<
16090            crate::model::FetchDomainVerificationStatusResponse,
16091            crate::Error,
16092        > {
16093            use std::clone::Clone;
16094            let token = self.0.request.page_token.clone();
16095            let execute = move |token: String| {
16096                let mut builder = self.clone();
16097                builder.0.request = builder.0.request.set_page_token(token);
16098                builder.send()
16099            };
16100            google_cloud_gax::paginator::internal::new_paginator(token, execute)
16101        }
16102
16103        /// Streams each item in the collection.
16104        pub fn by_item(
16105            self,
16106        ) -> impl google_cloud_gax::paginator::ItemPaginator<
16107            crate::model::FetchDomainVerificationStatusResponse,
16108            crate::Error,
16109        > {
16110            use google_cloud_gax::paginator::Paginator;
16111            self.by_page().items()
16112        }
16113
16114        /// Sets the value of [site_search_engine][crate::model::FetchDomainVerificationStatusRequest::site_search_engine].
16115        ///
16116        /// This is a **required** field for requests.
16117        pub fn set_site_search_engine<T: Into<std::string::String>>(mut self, v: T) -> Self {
16118            self.0.request.site_search_engine = v.into();
16119            self
16120        }
16121
16122        /// Sets the value of [page_size][crate::model::FetchDomainVerificationStatusRequest::page_size].
16123        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
16124            self.0.request.page_size = v.into();
16125            self
16126        }
16127
16128        /// Sets the value of [page_token][crate::model::FetchDomainVerificationStatusRequest::page_token].
16129        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
16130            self.0.request.page_token = v.into();
16131            self
16132        }
16133    }
16134
16135    #[doc(hidden)]
16136    impl crate::RequestBuilder for FetchDomainVerificationStatus {
16137        fn request_options(&mut self) -> &mut crate::RequestOptions {
16138            &mut self.0.options
16139        }
16140    }
16141
16142    /// The request builder for [SiteSearchEngineService::list_operations][crate::client::SiteSearchEngineService::list_operations] calls.
16143    ///
16144    /// # Example
16145    /// ```
16146    /// # use google_cloud_discoveryengine_v1::builder::site_search_engine_service::ListOperations;
16147    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
16148    /// use google_cloud_gax::paginator::ItemPaginator;
16149    ///
16150    /// let builder = prepare_request_builder();
16151    /// let mut items = builder.by_item();
16152    /// while let Some(result) = items.next().await {
16153    ///   let item = result?;
16154    /// }
16155    /// # Ok(()) }
16156    ///
16157    /// fn prepare_request_builder() -> ListOperations {
16158    ///   # panic!();
16159    ///   // ... details omitted ...
16160    /// }
16161    /// ```
16162    #[derive(Clone, Debug)]
16163    pub struct ListOperations(
16164        RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
16165    );
16166
16167    impl ListOperations {
16168        pub(crate) fn new(
16169            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
16170        ) -> Self {
16171            Self(RequestBuilder::new(stub))
16172        }
16173
16174        /// Sets the full request, replacing any prior values.
16175        pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
16176            mut self,
16177            v: V,
16178        ) -> Self {
16179            self.0.request = v.into();
16180            self
16181        }
16182
16183        /// Sets all the options, replacing any prior values.
16184        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
16185            self.0.options = v.into();
16186            self
16187        }
16188
16189        /// Sends the request.
16190        pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
16191            (*self.0.stub)
16192                .list_operations(self.0.request, self.0.options)
16193                .await
16194                .map(crate::Response::into_body)
16195        }
16196
16197        /// Streams each page in the collection.
16198        pub fn by_page(
16199            self,
16200        ) -> impl google_cloud_gax::paginator::Paginator<
16201            google_cloud_longrunning::model::ListOperationsResponse,
16202            crate::Error,
16203        > {
16204            use std::clone::Clone;
16205            let token = self.0.request.page_token.clone();
16206            let execute = move |token: String| {
16207                let mut builder = self.clone();
16208                builder.0.request = builder.0.request.set_page_token(token);
16209                builder.send()
16210            };
16211            google_cloud_gax::paginator::internal::new_paginator(token, execute)
16212        }
16213
16214        /// Streams each item in the collection.
16215        pub fn by_item(
16216            self,
16217        ) -> impl google_cloud_gax::paginator::ItemPaginator<
16218            google_cloud_longrunning::model::ListOperationsResponse,
16219            crate::Error,
16220        > {
16221            use google_cloud_gax::paginator::Paginator;
16222            self.by_page().items()
16223        }
16224
16225        /// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
16226        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
16227            self.0.request.name = v.into();
16228            self
16229        }
16230
16231        /// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::filter].
16232        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
16233            self.0.request.filter = v.into();
16234            self
16235        }
16236
16237        /// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
16238        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
16239            self.0.request.page_size = v.into();
16240            self
16241        }
16242
16243        /// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
16244        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
16245            self.0.request.page_token = v.into();
16246            self
16247        }
16248
16249        /// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
16250        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
16251            self.0.request.return_partial_success = v.into();
16252            self
16253        }
16254    }
16255
16256    #[doc(hidden)]
16257    impl crate::RequestBuilder for ListOperations {
16258        fn request_options(&mut self) -> &mut crate::RequestOptions {
16259            &mut self.0.options
16260        }
16261    }
16262
16263    /// The request builder for [SiteSearchEngineService::get_operation][crate::client::SiteSearchEngineService::get_operation] calls.
16264    ///
16265    /// # Example
16266    /// ```
16267    /// # use google_cloud_discoveryengine_v1::builder::site_search_engine_service::GetOperation;
16268    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
16269    ///
16270    /// let builder = prepare_request_builder();
16271    /// let response = builder.send().await?;
16272    /// # Ok(()) }
16273    ///
16274    /// fn prepare_request_builder() -> GetOperation {
16275    ///   # panic!();
16276    ///   // ... details omitted ...
16277    /// }
16278    /// ```
16279    #[derive(Clone, Debug)]
16280    pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
16281
16282    impl GetOperation {
16283        pub(crate) fn new(
16284            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
16285        ) -> Self {
16286            Self(RequestBuilder::new(stub))
16287        }
16288
16289        /// Sets the full request, replacing any prior values.
16290        pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
16291            mut self,
16292            v: V,
16293        ) -> Self {
16294            self.0.request = v.into();
16295            self
16296        }
16297
16298        /// Sets all the options, replacing any prior values.
16299        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
16300            self.0.options = v.into();
16301            self
16302        }
16303
16304        /// Sends the request.
16305        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
16306            (*self.0.stub)
16307                .get_operation(self.0.request, self.0.options)
16308                .await
16309                .map(crate::Response::into_body)
16310        }
16311
16312        /// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
16313        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
16314            self.0.request.name = v.into();
16315            self
16316        }
16317    }
16318
16319    #[doc(hidden)]
16320    impl crate::RequestBuilder for GetOperation {
16321        fn request_options(&mut self) -> &mut crate::RequestOptions {
16322            &mut self.0.options
16323        }
16324    }
16325
16326    /// The request builder for [SiteSearchEngineService::cancel_operation][crate::client::SiteSearchEngineService::cancel_operation] calls.
16327    ///
16328    /// # Example
16329    /// ```
16330    /// # use google_cloud_discoveryengine_v1::builder::site_search_engine_service::CancelOperation;
16331    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
16332    ///
16333    /// let builder = prepare_request_builder();
16334    /// let response = builder.send().await?;
16335    /// # Ok(()) }
16336    ///
16337    /// fn prepare_request_builder() -> CancelOperation {
16338    ///   # panic!();
16339    ///   // ... details omitted ...
16340    /// }
16341    /// ```
16342    #[derive(Clone, Debug)]
16343    pub struct CancelOperation(
16344        RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
16345    );
16346
16347    impl CancelOperation {
16348        pub(crate) fn new(
16349            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
16350        ) -> Self {
16351            Self(RequestBuilder::new(stub))
16352        }
16353
16354        /// Sets the full request, replacing any prior values.
16355        pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
16356            mut self,
16357            v: V,
16358        ) -> Self {
16359            self.0.request = v.into();
16360            self
16361        }
16362
16363        /// Sets all the options, replacing any prior values.
16364        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
16365            self.0.options = v.into();
16366            self
16367        }
16368
16369        /// Sends the request.
16370        pub async fn send(self) -> Result<()> {
16371            (*self.0.stub)
16372                .cancel_operation(self.0.request, self.0.options)
16373                .await
16374                .map(crate::Response::into_body)
16375        }
16376
16377        /// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::name].
16378        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
16379            self.0.request.name = v.into();
16380            self
16381        }
16382    }
16383
16384    #[doc(hidden)]
16385    impl crate::RequestBuilder for CancelOperation {
16386        fn request_options(&mut self) -> &mut crate::RequestOptions {
16387            &mut self.0.options
16388        }
16389    }
16390}
16391
16392/// Request and client builders for [UserEventService][crate::client::UserEventService].
16393#[cfg(feature = "user-event-service")]
16394#[cfg_attr(docsrs, doc(cfg(feature = "user-event-service")))]
16395pub mod user_event_service {
16396    use crate::Result;
16397
16398    /// A builder for [UserEventService][crate::client::UserEventService].
16399    ///
16400    /// ```
16401    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
16402    /// # use google_cloud_discoveryengine_v1::*;
16403    /// # use builder::user_event_service::ClientBuilder;
16404    /// # use client::UserEventService;
16405    /// let builder : ClientBuilder = UserEventService::builder();
16406    /// let client = builder
16407    ///     .with_endpoint("https://discoveryengine.googleapis.com")
16408    ///     .build().await?;
16409    /// # Ok(()) }
16410    /// ```
16411    pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
16412
16413    pub(crate) mod client {
16414        use super::super::super::client::UserEventService;
16415        pub struct Factory;
16416        impl crate::ClientFactory for Factory {
16417            type Client = UserEventService;
16418            type Credentials = gaxi::options::Credentials;
16419            async fn build(
16420                self,
16421                config: gaxi::options::ClientConfig,
16422            ) -> crate::ClientBuilderResult<Self::Client> {
16423                Self::Client::new(config).await
16424            }
16425        }
16426    }
16427
16428    /// Common implementation for [crate::client::UserEventService] request builders.
16429    #[derive(Clone, Debug)]
16430    pub(crate) struct RequestBuilder<R: std::default::Default> {
16431        stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
16432        request: R,
16433        options: crate::RequestOptions,
16434    }
16435
16436    impl<R> RequestBuilder<R>
16437    where
16438        R: std::default::Default,
16439    {
16440        pub(crate) fn new(
16441            stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
16442        ) -> Self {
16443            Self {
16444                stub,
16445                request: R::default(),
16446                options: crate::RequestOptions::default(),
16447            }
16448        }
16449    }
16450
16451    /// The request builder for [UserEventService::write_user_event][crate::client::UserEventService::write_user_event] calls.
16452    ///
16453    /// # Example
16454    /// ```
16455    /// # use google_cloud_discoveryengine_v1::builder::user_event_service::WriteUserEvent;
16456    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
16457    ///
16458    /// let builder = prepare_request_builder();
16459    /// let response = builder.send().await?;
16460    /// # Ok(()) }
16461    ///
16462    /// fn prepare_request_builder() -> WriteUserEvent {
16463    ///   # panic!();
16464    ///   // ... details omitted ...
16465    /// }
16466    /// ```
16467    #[derive(Clone, Debug)]
16468    pub struct WriteUserEvent(RequestBuilder<crate::model::WriteUserEventRequest>);
16469
16470    impl WriteUserEvent {
16471        pub(crate) fn new(
16472            stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
16473        ) -> Self {
16474            Self(RequestBuilder::new(stub))
16475        }
16476
16477        /// Sets the full request, replacing any prior values.
16478        pub fn with_request<V: Into<crate::model::WriteUserEventRequest>>(mut self, v: V) -> Self {
16479            self.0.request = v.into();
16480            self
16481        }
16482
16483        /// Sets all the options, replacing any prior values.
16484        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
16485            self.0.options = v.into();
16486            self
16487        }
16488
16489        /// Sends the request.
16490        pub async fn send(self) -> Result<crate::model::UserEvent> {
16491            (*self.0.stub)
16492                .write_user_event(self.0.request, self.0.options)
16493                .await
16494                .map(crate::Response::into_body)
16495        }
16496
16497        /// Sets the value of [parent][crate::model::WriteUserEventRequest::parent].
16498        ///
16499        /// This is a **required** field for requests.
16500        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
16501            self.0.request.parent = v.into();
16502            self
16503        }
16504
16505        /// Sets the value of [user_event][crate::model::WriteUserEventRequest::user_event].
16506        ///
16507        /// This is a **required** field for requests.
16508        pub fn set_user_event<T>(mut self, v: T) -> Self
16509        where
16510            T: std::convert::Into<crate::model::UserEvent>,
16511        {
16512            self.0.request.user_event = std::option::Option::Some(v.into());
16513            self
16514        }
16515
16516        /// Sets or clears the value of [user_event][crate::model::WriteUserEventRequest::user_event].
16517        ///
16518        /// This is a **required** field for requests.
16519        pub fn set_or_clear_user_event<T>(mut self, v: std::option::Option<T>) -> Self
16520        where
16521            T: std::convert::Into<crate::model::UserEvent>,
16522        {
16523            self.0.request.user_event = v.map(|x| x.into());
16524            self
16525        }
16526
16527        /// Sets the value of [write_async][crate::model::WriteUserEventRequest::write_async].
16528        pub fn set_write_async<T: Into<bool>>(mut self, v: T) -> Self {
16529            self.0.request.write_async = v.into();
16530            self
16531        }
16532    }
16533
16534    #[doc(hidden)]
16535    impl crate::RequestBuilder for WriteUserEvent {
16536        fn request_options(&mut self) -> &mut crate::RequestOptions {
16537            &mut self.0.options
16538        }
16539    }
16540
16541    /// The request builder for [UserEventService::collect_user_event][crate::client::UserEventService::collect_user_event] calls.
16542    ///
16543    /// # Example
16544    /// ```
16545    /// # use google_cloud_discoveryengine_v1::builder::user_event_service::CollectUserEvent;
16546    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
16547    ///
16548    /// let builder = prepare_request_builder();
16549    /// let response = builder.send().await?;
16550    /// # Ok(()) }
16551    ///
16552    /// fn prepare_request_builder() -> CollectUserEvent {
16553    ///   # panic!();
16554    ///   // ... details omitted ...
16555    /// }
16556    /// ```
16557    #[derive(Clone, Debug)]
16558    pub struct CollectUserEvent(RequestBuilder<crate::model::CollectUserEventRequest>);
16559
16560    impl CollectUserEvent {
16561        pub(crate) fn new(
16562            stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
16563        ) -> Self {
16564            Self(RequestBuilder::new(stub))
16565        }
16566
16567        /// Sets the full request, replacing any prior values.
16568        pub fn with_request<V: Into<crate::model::CollectUserEventRequest>>(
16569            mut self,
16570            v: V,
16571        ) -> Self {
16572            self.0.request = v.into();
16573            self
16574        }
16575
16576        /// Sets all the options, replacing any prior values.
16577        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
16578            self.0.options = v.into();
16579            self
16580        }
16581
16582        /// Sends the request.
16583        pub async fn send(self) -> Result<google_cloud_api::model::HttpBody> {
16584            (*self.0.stub)
16585                .collect_user_event(self.0.request, self.0.options)
16586                .await
16587                .map(crate::Response::into_body)
16588        }
16589
16590        /// Sets the value of [parent][crate::model::CollectUserEventRequest::parent].
16591        ///
16592        /// This is a **required** field for requests.
16593        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
16594            self.0.request.parent = v.into();
16595            self
16596        }
16597
16598        /// Sets the value of [user_event][crate::model::CollectUserEventRequest::user_event].
16599        ///
16600        /// This is a **required** field for requests.
16601        pub fn set_user_event<T: Into<std::string::String>>(mut self, v: T) -> Self {
16602            self.0.request.user_event = v.into();
16603            self
16604        }
16605
16606        /// Sets the value of [uri][crate::model::CollectUserEventRequest::uri].
16607        pub fn set_uri<T>(mut self, v: T) -> Self
16608        where
16609            T: std::convert::Into<std::string::String>,
16610        {
16611            self.0.request.uri = std::option::Option::Some(v.into());
16612            self
16613        }
16614
16615        /// Sets or clears the value of [uri][crate::model::CollectUserEventRequest::uri].
16616        pub fn set_or_clear_uri<T>(mut self, v: std::option::Option<T>) -> Self
16617        where
16618            T: std::convert::Into<std::string::String>,
16619        {
16620            self.0.request.uri = v.map(|x| x.into());
16621            self
16622        }
16623
16624        /// Sets the value of [ets][crate::model::CollectUserEventRequest::ets].
16625        pub fn set_ets<T>(mut self, v: T) -> Self
16626        where
16627            T: std::convert::Into<i64>,
16628        {
16629            self.0.request.ets = std::option::Option::Some(v.into());
16630            self
16631        }
16632
16633        /// Sets or clears the value of [ets][crate::model::CollectUserEventRequest::ets].
16634        pub fn set_or_clear_ets<T>(mut self, v: std::option::Option<T>) -> Self
16635        where
16636            T: std::convert::Into<i64>,
16637        {
16638            self.0.request.ets = v.map(|x| x.into());
16639            self
16640        }
16641    }
16642
16643    #[doc(hidden)]
16644    impl crate::RequestBuilder for CollectUserEvent {
16645        fn request_options(&mut self) -> &mut crate::RequestOptions {
16646            &mut self.0.options
16647        }
16648    }
16649
16650    /// The request builder for [UserEventService::purge_user_events][crate::client::UserEventService::purge_user_events] calls.
16651    ///
16652    /// # Example
16653    /// ```
16654    /// # use google_cloud_discoveryengine_v1::builder::user_event_service::PurgeUserEvents;
16655    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
16656    /// use google_cloud_lro::Poller;
16657    ///
16658    /// let builder = prepare_request_builder();
16659    /// let response = builder.poller().until_done().await?;
16660    /// # Ok(()) }
16661    ///
16662    /// fn prepare_request_builder() -> PurgeUserEvents {
16663    ///   # panic!();
16664    ///   // ... details omitted ...
16665    /// }
16666    /// ```
16667    #[derive(Clone, Debug)]
16668    pub struct PurgeUserEvents(RequestBuilder<crate::model::PurgeUserEventsRequest>);
16669
16670    impl PurgeUserEvents {
16671        pub(crate) fn new(
16672            stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
16673        ) -> Self {
16674            Self(RequestBuilder::new(stub))
16675        }
16676
16677        /// Sets the full request, replacing any prior values.
16678        pub fn with_request<V: Into<crate::model::PurgeUserEventsRequest>>(mut self, v: V) -> Self {
16679            self.0.request = v.into();
16680            self
16681        }
16682
16683        /// Sets all the options, replacing any prior values.
16684        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
16685            self.0.options = v.into();
16686            self
16687        }
16688
16689        /// Sends the request.
16690        ///
16691        /// # Long running operations
16692        ///
16693        /// This starts, but does not poll, a longrunning operation. More information
16694        /// on [purge_user_events][crate::client::UserEventService::purge_user_events].
16695        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
16696            (*self.0.stub)
16697                .purge_user_events(self.0.request, self.0.options)
16698                .await
16699                .map(crate::Response::into_body)
16700        }
16701
16702        /// Creates a [Poller][google_cloud_lro::Poller] to work with `purge_user_events`.
16703        pub fn poller(
16704            self,
16705        ) -> impl google_cloud_lro::Poller<
16706            crate::model::PurgeUserEventsResponse,
16707            crate::model::PurgeUserEventsMetadata,
16708        > {
16709            type Operation = google_cloud_lro::internal::Operation<
16710                crate::model::PurgeUserEventsResponse,
16711                crate::model::PurgeUserEventsMetadata,
16712            >;
16713            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
16714            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
16715            let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
16716            if let Some(ref mut details) = poller_options.tracing {
16717                details.method_name = "google_cloud_discoveryengine_v1::client::UserEventService::purge_user_events::until_done";
16718            }
16719
16720            let stub = self.0.stub.clone();
16721            let mut options = self.0.options.clone();
16722            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
16723            let query = move |name| {
16724                let stub = stub.clone();
16725                let options = options.clone();
16726                async {
16727                    let op = GetOperation::new(stub)
16728                        .set_name(name)
16729                        .with_options(options)
16730                        .send()
16731                        .await?;
16732                    Ok(Operation::new(op))
16733                }
16734            };
16735
16736            let start = move || async {
16737                let op = self.send().await?;
16738                Ok(Operation::new(op))
16739            };
16740
16741            use google_cloud_lro::internal::PollerExt;
16742            {
16743                google_cloud_lro::internal::new_poller(
16744                    polling_error_policy,
16745                    polling_backoff_policy,
16746                    start,
16747                    query,
16748                )
16749            }
16750            .with_options(poller_options)
16751        }
16752
16753        /// Sets the value of [parent][crate::model::PurgeUserEventsRequest::parent].
16754        ///
16755        /// This is a **required** field for requests.
16756        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
16757            self.0.request.parent = v.into();
16758            self
16759        }
16760
16761        /// Sets the value of [filter][crate::model::PurgeUserEventsRequest::filter].
16762        ///
16763        /// This is a **required** field for requests.
16764        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
16765            self.0.request.filter = v.into();
16766            self
16767        }
16768
16769        /// Sets the value of [force][crate::model::PurgeUserEventsRequest::force].
16770        pub fn set_force<T: Into<bool>>(mut self, v: T) -> Self {
16771            self.0.request.force = v.into();
16772            self
16773        }
16774    }
16775
16776    #[doc(hidden)]
16777    impl crate::RequestBuilder for PurgeUserEvents {
16778        fn request_options(&mut self) -> &mut crate::RequestOptions {
16779            &mut self.0.options
16780        }
16781    }
16782
16783    /// The request builder for [UserEventService::import_user_events][crate::client::UserEventService::import_user_events] calls.
16784    ///
16785    /// # Example
16786    /// ```
16787    /// # use google_cloud_discoveryengine_v1::builder::user_event_service::ImportUserEvents;
16788    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
16789    /// use google_cloud_lro::Poller;
16790    ///
16791    /// let builder = prepare_request_builder();
16792    /// let response = builder.poller().until_done().await?;
16793    /// # Ok(()) }
16794    ///
16795    /// fn prepare_request_builder() -> ImportUserEvents {
16796    ///   # panic!();
16797    ///   // ... details omitted ...
16798    /// }
16799    /// ```
16800    #[derive(Clone, Debug)]
16801    pub struct ImportUserEvents(RequestBuilder<crate::model::ImportUserEventsRequest>);
16802
16803    impl ImportUserEvents {
16804        pub(crate) fn new(
16805            stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
16806        ) -> Self {
16807            Self(RequestBuilder::new(stub))
16808        }
16809
16810        /// Sets the full request, replacing any prior values.
16811        pub fn with_request<V: Into<crate::model::ImportUserEventsRequest>>(
16812            mut self,
16813            v: V,
16814        ) -> Self {
16815            self.0.request = v.into();
16816            self
16817        }
16818
16819        /// Sets all the options, replacing any prior values.
16820        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
16821            self.0.options = v.into();
16822            self
16823        }
16824
16825        /// Sends the request.
16826        ///
16827        /// # Long running operations
16828        ///
16829        /// This starts, but does not poll, a longrunning operation. More information
16830        /// on [import_user_events][crate::client::UserEventService::import_user_events].
16831        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
16832            (*self.0.stub)
16833                .import_user_events(self.0.request, self.0.options)
16834                .await
16835                .map(crate::Response::into_body)
16836        }
16837
16838        /// Creates a [Poller][google_cloud_lro::Poller] to work with `import_user_events`.
16839        pub fn poller(
16840            self,
16841        ) -> impl google_cloud_lro::Poller<
16842            crate::model::ImportUserEventsResponse,
16843            crate::model::ImportUserEventsMetadata,
16844        > {
16845            type Operation = google_cloud_lro::internal::Operation<
16846                crate::model::ImportUserEventsResponse,
16847                crate::model::ImportUserEventsMetadata,
16848            >;
16849            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
16850            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
16851            let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
16852            if let Some(ref mut details) = poller_options.tracing {
16853                details.method_name = "google_cloud_discoveryengine_v1::client::UserEventService::import_user_events::until_done";
16854            }
16855
16856            let stub = self.0.stub.clone();
16857            let mut options = self.0.options.clone();
16858            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
16859            let query = move |name| {
16860                let stub = stub.clone();
16861                let options = options.clone();
16862                async {
16863                    let op = GetOperation::new(stub)
16864                        .set_name(name)
16865                        .with_options(options)
16866                        .send()
16867                        .await?;
16868                    Ok(Operation::new(op))
16869                }
16870            };
16871
16872            let start = move || async {
16873                let op = self.send().await?;
16874                Ok(Operation::new(op))
16875            };
16876
16877            use google_cloud_lro::internal::PollerExt;
16878            {
16879                google_cloud_lro::internal::new_poller(
16880                    polling_error_policy,
16881                    polling_backoff_policy,
16882                    start,
16883                    query,
16884                )
16885            }
16886            .with_options(poller_options)
16887        }
16888
16889        /// Sets the value of [parent][crate::model::ImportUserEventsRequest::parent].
16890        ///
16891        /// This is a **required** field for requests.
16892        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
16893            self.0.request.parent = v.into();
16894            self
16895        }
16896
16897        /// Sets the value of [error_config][crate::model::ImportUserEventsRequest::error_config].
16898        pub fn set_error_config<T>(mut self, v: T) -> Self
16899        where
16900            T: std::convert::Into<crate::model::ImportErrorConfig>,
16901        {
16902            self.0.request.error_config = std::option::Option::Some(v.into());
16903            self
16904        }
16905
16906        /// Sets or clears the value of [error_config][crate::model::ImportUserEventsRequest::error_config].
16907        pub fn set_or_clear_error_config<T>(mut self, v: std::option::Option<T>) -> Self
16908        where
16909            T: std::convert::Into<crate::model::ImportErrorConfig>,
16910        {
16911            self.0.request.error_config = v.map(|x| x.into());
16912            self
16913        }
16914
16915        /// Sets the value of [source][crate::model::ImportUserEventsRequest::source].
16916        ///
16917        /// Note that all the setters affecting `source` are
16918        /// mutually exclusive.
16919        pub fn set_source<T: Into<Option<crate::model::import_user_events_request::Source>>>(
16920            mut self,
16921            v: T,
16922        ) -> Self {
16923            self.0.request.source = v.into();
16924            self
16925        }
16926
16927        /// Sets the value of [source][crate::model::ImportUserEventsRequest::source]
16928        /// to hold a `InlineSource`.
16929        ///
16930        /// Note that all the setters affecting `source` are
16931        /// mutually exclusive.
16932        pub fn set_inline_source<
16933            T: std::convert::Into<
16934                    std::boxed::Box<crate::model::import_user_events_request::InlineSource>,
16935                >,
16936        >(
16937            mut self,
16938            v: T,
16939        ) -> Self {
16940            self.0.request = self.0.request.set_inline_source(v);
16941            self
16942        }
16943
16944        /// Sets the value of [source][crate::model::ImportUserEventsRequest::source]
16945        /// to hold a `GcsSource`.
16946        ///
16947        /// Note that all the setters affecting `source` are
16948        /// mutually exclusive.
16949        pub fn set_gcs_source<T: std::convert::Into<std::boxed::Box<crate::model::GcsSource>>>(
16950            mut self,
16951            v: T,
16952        ) -> Self {
16953            self.0.request = self.0.request.set_gcs_source(v);
16954            self
16955        }
16956
16957        /// Sets the value of [source][crate::model::ImportUserEventsRequest::source]
16958        /// to hold a `BigquerySource`.
16959        ///
16960        /// Note that all the setters affecting `source` are
16961        /// mutually exclusive.
16962        pub fn set_bigquery_source<
16963            T: std::convert::Into<std::boxed::Box<crate::model::BigQuerySource>>,
16964        >(
16965            mut self,
16966            v: T,
16967        ) -> Self {
16968            self.0.request = self.0.request.set_bigquery_source(v);
16969            self
16970        }
16971    }
16972
16973    #[doc(hidden)]
16974    impl crate::RequestBuilder for ImportUserEvents {
16975        fn request_options(&mut self) -> &mut crate::RequestOptions {
16976            &mut self.0.options
16977        }
16978    }
16979
16980    /// The request builder for [UserEventService::list_operations][crate::client::UserEventService::list_operations] calls.
16981    ///
16982    /// # Example
16983    /// ```
16984    /// # use google_cloud_discoveryengine_v1::builder::user_event_service::ListOperations;
16985    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
16986    /// use google_cloud_gax::paginator::ItemPaginator;
16987    ///
16988    /// let builder = prepare_request_builder();
16989    /// let mut items = builder.by_item();
16990    /// while let Some(result) = items.next().await {
16991    ///   let item = result?;
16992    /// }
16993    /// # Ok(()) }
16994    ///
16995    /// fn prepare_request_builder() -> ListOperations {
16996    ///   # panic!();
16997    ///   // ... details omitted ...
16998    /// }
16999    /// ```
17000    #[derive(Clone, Debug)]
17001    pub struct ListOperations(
17002        RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
17003    );
17004
17005    impl ListOperations {
17006        pub(crate) fn new(
17007            stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
17008        ) -> Self {
17009            Self(RequestBuilder::new(stub))
17010        }
17011
17012        /// Sets the full request, replacing any prior values.
17013        pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
17014            mut self,
17015            v: V,
17016        ) -> Self {
17017            self.0.request = v.into();
17018            self
17019        }
17020
17021        /// Sets all the options, replacing any prior values.
17022        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
17023            self.0.options = v.into();
17024            self
17025        }
17026
17027        /// Sends the request.
17028        pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
17029            (*self.0.stub)
17030                .list_operations(self.0.request, self.0.options)
17031                .await
17032                .map(crate::Response::into_body)
17033        }
17034
17035        /// Streams each page in the collection.
17036        pub fn by_page(
17037            self,
17038        ) -> impl google_cloud_gax::paginator::Paginator<
17039            google_cloud_longrunning::model::ListOperationsResponse,
17040            crate::Error,
17041        > {
17042            use std::clone::Clone;
17043            let token = self.0.request.page_token.clone();
17044            let execute = move |token: String| {
17045                let mut builder = self.clone();
17046                builder.0.request = builder.0.request.set_page_token(token);
17047                builder.send()
17048            };
17049            google_cloud_gax::paginator::internal::new_paginator(token, execute)
17050        }
17051
17052        /// Streams each item in the collection.
17053        pub fn by_item(
17054            self,
17055        ) -> impl google_cloud_gax::paginator::ItemPaginator<
17056            google_cloud_longrunning::model::ListOperationsResponse,
17057            crate::Error,
17058        > {
17059            use google_cloud_gax::paginator::Paginator;
17060            self.by_page().items()
17061        }
17062
17063        /// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
17064        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
17065            self.0.request.name = v.into();
17066            self
17067        }
17068
17069        /// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::filter].
17070        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
17071            self.0.request.filter = v.into();
17072            self
17073        }
17074
17075        /// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
17076        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
17077            self.0.request.page_size = v.into();
17078            self
17079        }
17080
17081        /// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
17082        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
17083            self.0.request.page_token = v.into();
17084            self
17085        }
17086
17087        /// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
17088        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
17089            self.0.request.return_partial_success = v.into();
17090            self
17091        }
17092    }
17093
17094    #[doc(hidden)]
17095    impl crate::RequestBuilder for ListOperations {
17096        fn request_options(&mut self) -> &mut crate::RequestOptions {
17097            &mut self.0.options
17098        }
17099    }
17100
17101    /// The request builder for [UserEventService::get_operation][crate::client::UserEventService::get_operation] calls.
17102    ///
17103    /// # Example
17104    /// ```
17105    /// # use google_cloud_discoveryengine_v1::builder::user_event_service::GetOperation;
17106    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
17107    ///
17108    /// let builder = prepare_request_builder();
17109    /// let response = builder.send().await?;
17110    /// # Ok(()) }
17111    ///
17112    /// fn prepare_request_builder() -> GetOperation {
17113    ///   # panic!();
17114    ///   // ... details omitted ...
17115    /// }
17116    /// ```
17117    #[derive(Clone, Debug)]
17118    pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
17119
17120    impl GetOperation {
17121        pub(crate) fn new(
17122            stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
17123        ) -> Self {
17124            Self(RequestBuilder::new(stub))
17125        }
17126
17127        /// Sets the full request, replacing any prior values.
17128        pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
17129            mut self,
17130            v: V,
17131        ) -> Self {
17132            self.0.request = v.into();
17133            self
17134        }
17135
17136        /// Sets all the options, replacing any prior values.
17137        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
17138            self.0.options = v.into();
17139            self
17140        }
17141
17142        /// Sends the request.
17143        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
17144            (*self.0.stub)
17145                .get_operation(self.0.request, self.0.options)
17146                .await
17147                .map(crate::Response::into_body)
17148        }
17149
17150        /// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
17151        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
17152            self.0.request.name = v.into();
17153            self
17154        }
17155    }
17156
17157    #[doc(hidden)]
17158    impl crate::RequestBuilder for GetOperation {
17159        fn request_options(&mut self) -> &mut crate::RequestOptions {
17160            &mut self.0.options
17161        }
17162    }
17163
17164    /// The request builder for [UserEventService::cancel_operation][crate::client::UserEventService::cancel_operation] calls.
17165    ///
17166    /// # Example
17167    /// ```
17168    /// # use google_cloud_discoveryengine_v1::builder::user_event_service::CancelOperation;
17169    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
17170    ///
17171    /// let builder = prepare_request_builder();
17172    /// let response = builder.send().await?;
17173    /// # Ok(()) }
17174    ///
17175    /// fn prepare_request_builder() -> CancelOperation {
17176    ///   # panic!();
17177    ///   // ... details omitted ...
17178    /// }
17179    /// ```
17180    #[derive(Clone, Debug)]
17181    pub struct CancelOperation(
17182        RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
17183    );
17184
17185    impl CancelOperation {
17186        pub(crate) fn new(
17187            stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
17188        ) -> Self {
17189            Self(RequestBuilder::new(stub))
17190        }
17191
17192        /// Sets the full request, replacing any prior values.
17193        pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
17194            mut self,
17195            v: V,
17196        ) -> Self {
17197            self.0.request = v.into();
17198            self
17199        }
17200
17201        /// Sets all the options, replacing any prior values.
17202        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
17203            self.0.options = v.into();
17204            self
17205        }
17206
17207        /// Sends the request.
17208        pub async fn send(self) -> Result<()> {
17209            (*self.0.stub)
17210                .cancel_operation(self.0.request, self.0.options)
17211                .await
17212                .map(crate::Response::into_body)
17213        }
17214
17215        /// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::name].
17216        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
17217            self.0.request.name = v.into();
17218            self
17219        }
17220    }
17221
17222    #[doc(hidden)]
17223    impl crate::RequestBuilder for CancelOperation {
17224        fn request_options(&mut self) -> &mut crate::RequestOptions {
17225            &mut self.0.options
17226        }
17227    }
17228}
17229
17230/// Request and client builders for [UserLicenseService][crate::client::UserLicenseService].
17231#[cfg(feature = "user-license-service")]
17232#[cfg_attr(docsrs, doc(cfg(feature = "user-license-service")))]
17233pub mod user_license_service {
17234    use crate::Result;
17235
17236    /// A builder for [UserLicenseService][crate::client::UserLicenseService].
17237    ///
17238    /// ```
17239    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
17240    /// # use google_cloud_discoveryengine_v1::*;
17241    /// # use builder::user_license_service::ClientBuilder;
17242    /// # use client::UserLicenseService;
17243    /// let builder : ClientBuilder = UserLicenseService::builder();
17244    /// let client = builder
17245    ///     .with_endpoint("https://discoveryengine.googleapis.com")
17246    ///     .build().await?;
17247    /// # Ok(()) }
17248    /// ```
17249    pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
17250
17251    pub(crate) mod client {
17252        use super::super::super::client::UserLicenseService;
17253        pub struct Factory;
17254        impl crate::ClientFactory for Factory {
17255            type Client = UserLicenseService;
17256            type Credentials = gaxi::options::Credentials;
17257            async fn build(
17258                self,
17259                config: gaxi::options::ClientConfig,
17260            ) -> crate::ClientBuilderResult<Self::Client> {
17261                Self::Client::new(config).await
17262            }
17263        }
17264    }
17265
17266    /// Common implementation for [crate::client::UserLicenseService] request builders.
17267    #[derive(Clone, Debug)]
17268    pub(crate) struct RequestBuilder<R: std::default::Default> {
17269        stub: std::sync::Arc<dyn super::super::stub::dynamic::UserLicenseService>,
17270        request: R,
17271        options: crate::RequestOptions,
17272    }
17273
17274    impl<R> RequestBuilder<R>
17275    where
17276        R: std::default::Default,
17277    {
17278        pub(crate) fn new(
17279            stub: std::sync::Arc<dyn super::super::stub::dynamic::UserLicenseService>,
17280        ) -> Self {
17281            Self {
17282                stub,
17283                request: R::default(),
17284                options: crate::RequestOptions::default(),
17285            }
17286        }
17287    }
17288
17289    /// The request builder for [UserLicenseService::list_user_licenses][crate::client::UserLicenseService::list_user_licenses] calls.
17290    ///
17291    /// # Example
17292    /// ```
17293    /// # use google_cloud_discoveryengine_v1::builder::user_license_service::ListUserLicenses;
17294    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
17295    /// use google_cloud_gax::paginator::ItemPaginator;
17296    ///
17297    /// let builder = prepare_request_builder();
17298    /// let mut items = builder.by_item();
17299    /// while let Some(result) = items.next().await {
17300    ///   let item = result?;
17301    /// }
17302    /// # Ok(()) }
17303    ///
17304    /// fn prepare_request_builder() -> ListUserLicenses {
17305    ///   # panic!();
17306    ///   // ... details omitted ...
17307    /// }
17308    /// ```
17309    #[derive(Clone, Debug)]
17310    pub struct ListUserLicenses(RequestBuilder<crate::model::ListUserLicensesRequest>);
17311
17312    impl ListUserLicenses {
17313        pub(crate) fn new(
17314            stub: std::sync::Arc<dyn super::super::stub::dynamic::UserLicenseService>,
17315        ) -> Self {
17316            Self(RequestBuilder::new(stub))
17317        }
17318
17319        /// Sets the full request, replacing any prior values.
17320        pub fn with_request<V: Into<crate::model::ListUserLicensesRequest>>(
17321            mut self,
17322            v: V,
17323        ) -> Self {
17324            self.0.request = v.into();
17325            self
17326        }
17327
17328        /// Sets all the options, replacing any prior values.
17329        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
17330            self.0.options = v.into();
17331            self
17332        }
17333
17334        /// Sends the request.
17335        pub async fn send(self) -> Result<crate::model::ListUserLicensesResponse> {
17336            (*self.0.stub)
17337                .list_user_licenses(self.0.request, self.0.options)
17338                .await
17339                .map(crate::Response::into_body)
17340        }
17341
17342        /// Streams each page in the collection.
17343        pub fn by_page(
17344            self,
17345        ) -> impl google_cloud_gax::paginator::Paginator<
17346            crate::model::ListUserLicensesResponse,
17347            crate::Error,
17348        > {
17349            use std::clone::Clone;
17350            let token = self.0.request.page_token.clone();
17351            let execute = move |token: String| {
17352                let mut builder = self.clone();
17353                builder.0.request = builder.0.request.set_page_token(token);
17354                builder.send()
17355            };
17356            google_cloud_gax::paginator::internal::new_paginator(token, execute)
17357        }
17358
17359        /// Streams each item in the collection.
17360        pub fn by_item(
17361            self,
17362        ) -> impl google_cloud_gax::paginator::ItemPaginator<
17363            crate::model::ListUserLicensesResponse,
17364            crate::Error,
17365        > {
17366            use google_cloud_gax::paginator::Paginator;
17367            self.by_page().items()
17368        }
17369
17370        /// Sets the value of [parent][crate::model::ListUserLicensesRequest::parent].
17371        ///
17372        /// This is a **required** field for requests.
17373        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
17374            self.0.request.parent = v.into();
17375            self
17376        }
17377
17378        /// Sets the value of [page_size][crate::model::ListUserLicensesRequest::page_size].
17379        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
17380            self.0.request.page_size = v.into();
17381            self
17382        }
17383
17384        /// Sets the value of [page_token][crate::model::ListUserLicensesRequest::page_token].
17385        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
17386            self.0.request.page_token = v.into();
17387            self
17388        }
17389
17390        /// Sets the value of [filter][crate::model::ListUserLicensesRequest::filter].
17391        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
17392            self.0.request.filter = v.into();
17393            self
17394        }
17395    }
17396
17397    #[doc(hidden)]
17398    impl crate::RequestBuilder for ListUserLicenses {
17399        fn request_options(&mut self) -> &mut crate::RequestOptions {
17400            &mut self.0.options
17401        }
17402    }
17403
17404    /// The request builder for [UserLicenseService::batch_update_user_licenses][crate::client::UserLicenseService::batch_update_user_licenses] calls.
17405    ///
17406    /// # Example
17407    /// ```
17408    /// # use google_cloud_discoveryengine_v1::builder::user_license_service::BatchUpdateUserLicenses;
17409    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
17410    /// use google_cloud_lro::Poller;
17411    ///
17412    /// let builder = prepare_request_builder();
17413    /// let response = builder.poller().until_done().await?;
17414    /// # Ok(()) }
17415    ///
17416    /// fn prepare_request_builder() -> BatchUpdateUserLicenses {
17417    ///   # panic!();
17418    ///   // ... details omitted ...
17419    /// }
17420    /// ```
17421    #[derive(Clone, Debug)]
17422    pub struct BatchUpdateUserLicenses(
17423        RequestBuilder<crate::model::BatchUpdateUserLicensesRequest>,
17424    );
17425
17426    impl BatchUpdateUserLicenses {
17427        pub(crate) fn new(
17428            stub: std::sync::Arc<dyn super::super::stub::dynamic::UserLicenseService>,
17429        ) -> Self {
17430            Self(RequestBuilder::new(stub))
17431        }
17432
17433        /// Sets the full request, replacing any prior values.
17434        pub fn with_request<V: Into<crate::model::BatchUpdateUserLicensesRequest>>(
17435            mut self,
17436            v: V,
17437        ) -> Self {
17438            self.0.request = v.into();
17439            self
17440        }
17441
17442        /// Sets all the options, replacing any prior values.
17443        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
17444            self.0.options = v.into();
17445            self
17446        }
17447
17448        /// Sends the request.
17449        ///
17450        /// # Long running operations
17451        ///
17452        /// This starts, but does not poll, a longrunning operation. More information
17453        /// on [batch_update_user_licenses][crate::client::UserLicenseService::batch_update_user_licenses].
17454        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
17455            (*self.0.stub)
17456                .batch_update_user_licenses(self.0.request, self.0.options)
17457                .await
17458                .map(crate::Response::into_body)
17459        }
17460
17461        /// Creates a [Poller][google_cloud_lro::Poller] to work with `batch_update_user_licenses`.
17462        pub fn poller(
17463            self,
17464        ) -> impl google_cloud_lro::Poller<
17465            crate::model::BatchUpdateUserLicensesResponse,
17466            crate::model::BatchUpdateUserLicensesMetadata,
17467        > {
17468            type Operation = google_cloud_lro::internal::Operation<
17469                crate::model::BatchUpdateUserLicensesResponse,
17470                crate::model::BatchUpdateUserLicensesMetadata,
17471            >;
17472            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
17473            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
17474            let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
17475            if let Some(ref mut details) = poller_options.tracing {
17476                details.method_name = "google_cloud_discoveryengine_v1::client::UserLicenseService::batch_update_user_licenses::until_done";
17477            }
17478
17479            let stub = self.0.stub.clone();
17480            let mut options = self.0.options.clone();
17481            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
17482            let query = move |name| {
17483                let stub = stub.clone();
17484                let options = options.clone();
17485                async {
17486                    let op = GetOperation::new(stub)
17487                        .set_name(name)
17488                        .with_options(options)
17489                        .send()
17490                        .await?;
17491                    Ok(Operation::new(op))
17492                }
17493            };
17494
17495            let start = move || async {
17496                let op = self.send().await?;
17497                Ok(Operation::new(op))
17498            };
17499
17500            use google_cloud_lro::internal::PollerExt;
17501            {
17502                google_cloud_lro::internal::new_poller(
17503                    polling_error_policy,
17504                    polling_backoff_policy,
17505                    start,
17506                    query,
17507                )
17508            }
17509            .with_options(poller_options)
17510        }
17511
17512        /// Sets the value of [parent][crate::model::BatchUpdateUserLicensesRequest::parent].
17513        ///
17514        /// This is a **required** field for requests.
17515        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
17516            self.0.request.parent = v.into();
17517            self
17518        }
17519
17520        /// Sets the value of [delete_unassigned_user_licenses][crate::model::BatchUpdateUserLicensesRequest::delete_unassigned_user_licenses].
17521        pub fn set_delete_unassigned_user_licenses<T: Into<bool>>(mut self, v: T) -> Self {
17522            self.0.request.delete_unassigned_user_licenses = v.into();
17523            self
17524        }
17525
17526        /// Sets the value of [source][crate::model::BatchUpdateUserLicensesRequest::source].
17527        ///
17528        /// Note that all the setters affecting `source` are
17529        /// mutually exclusive.
17530        pub fn set_source<
17531            T: Into<Option<crate::model::batch_update_user_licenses_request::Source>>,
17532        >(
17533            mut self,
17534            v: T,
17535        ) -> Self {
17536            self.0.request.source = v.into();
17537            self
17538        }
17539
17540        /// Sets the value of [source][crate::model::BatchUpdateUserLicensesRequest::source]
17541        /// to hold a `InlineSource`.
17542        ///
17543        /// Note that all the setters affecting `source` are
17544        /// mutually exclusive.
17545        pub fn set_inline_source<
17546            T: std::convert::Into<
17547                    std::boxed::Box<crate::model::batch_update_user_licenses_request::InlineSource>,
17548                >,
17549        >(
17550            mut self,
17551            v: T,
17552        ) -> Self {
17553            self.0.request = self.0.request.set_inline_source(v);
17554            self
17555        }
17556    }
17557
17558    #[doc(hidden)]
17559    impl crate::RequestBuilder for BatchUpdateUserLicenses {
17560        fn request_options(&mut self) -> &mut crate::RequestOptions {
17561            &mut self.0.options
17562        }
17563    }
17564
17565    /// The request builder for [UserLicenseService::list_operations][crate::client::UserLicenseService::list_operations] calls.
17566    ///
17567    /// # Example
17568    /// ```
17569    /// # use google_cloud_discoveryengine_v1::builder::user_license_service::ListOperations;
17570    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
17571    /// use google_cloud_gax::paginator::ItemPaginator;
17572    ///
17573    /// let builder = prepare_request_builder();
17574    /// let mut items = builder.by_item();
17575    /// while let Some(result) = items.next().await {
17576    ///   let item = result?;
17577    /// }
17578    /// # Ok(()) }
17579    ///
17580    /// fn prepare_request_builder() -> ListOperations {
17581    ///   # panic!();
17582    ///   // ... details omitted ...
17583    /// }
17584    /// ```
17585    #[derive(Clone, Debug)]
17586    pub struct ListOperations(
17587        RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
17588    );
17589
17590    impl ListOperations {
17591        pub(crate) fn new(
17592            stub: std::sync::Arc<dyn super::super::stub::dynamic::UserLicenseService>,
17593        ) -> Self {
17594            Self(RequestBuilder::new(stub))
17595        }
17596
17597        /// Sets the full request, replacing any prior values.
17598        pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
17599            mut self,
17600            v: V,
17601        ) -> Self {
17602            self.0.request = v.into();
17603            self
17604        }
17605
17606        /// Sets all the options, replacing any prior values.
17607        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
17608            self.0.options = v.into();
17609            self
17610        }
17611
17612        /// Sends the request.
17613        pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
17614            (*self.0.stub)
17615                .list_operations(self.0.request, self.0.options)
17616                .await
17617                .map(crate::Response::into_body)
17618        }
17619
17620        /// Streams each page in the collection.
17621        pub fn by_page(
17622            self,
17623        ) -> impl google_cloud_gax::paginator::Paginator<
17624            google_cloud_longrunning::model::ListOperationsResponse,
17625            crate::Error,
17626        > {
17627            use std::clone::Clone;
17628            let token = self.0.request.page_token.clone();
17629            let execute = move |token: String| {
17630                let mut builder = self.clone();
17631                builder.0.request = builder.0.request.set_page_token(token);
17632                builder.send()
17633            };
17634            google_cloud_gax::paginator::internal::new_paginator(token, execute)
17635        }
17636
17637        /// Streams each item in the collection.
17638        pub fn by_item(
17639            self,
17640        ) -> impl google_cloud_gax::paginator::ItemPaginator<
17641            google_cloud_longrunning::model::ListOperationsResponse,
17642            crate::Error,
17643        > {
17644            use google_cloud_gax::paginator::Paginator;
17645            self.by_page().items()
17646        }
17647
17648        /// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
17649        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
17650            self.0.request.name = v.into();
17651            self
17652        }
17653
17654        /// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::filter].
17655        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
17656            self.0.request.filter = v.into();
17657            self
17658        }
17659
17660        /// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
17661        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
17662            self.0.request.page_size = v.into();
17663            self
17664        }
17665
17666        /// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
17667        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
17668            self.0.request.page_token = v.into();
17669            self
17670        }
17671
17672        /// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
17673        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
17674            self.0.request.return_partial_success = v.into();
17675            self
17676        }
17677    }
17678
17679    #[doc(hidden)]
17680    impl crate::RequestBuilder for ListOperations {
17681        fn request_options(&mut self) -> &mut crate::RequestOptions {
17682            &mut self.0.options
17683        }
17684    }
17685
17686    /// The request builder for [UserLicenseService::get_operation][crate::client::UserLicenseService::get_operation] calls.
17687    ///
17688    /// # Example
17689    /// ```
17690    /// # use google_cloud_discoveryengine_v1::builder::user_license_service::GetOperation;
17691    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
17692    ///
17693    /// let builder = prepare_request_builder();
17694    /// let response = builder.send().await?;
17695    /// # Ok(()) }
17696    ///
17697    /// fn prepare_request_builder() -> GetOperation {
17698    ///   # panic!();
17699    ///   // ... details omitted ...
17700    /// }
17701    /// ```
17702    #[derive(Clone, Debug)]
17703    pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
17704
17705    impl GetOperation {
17706        pub(crate) fn new(
17707            stub: std::sync::Arc<dyn super::super::stub::dynamic::UserLicenseService>,
17708        ) -> Self {
17709            Self(RequestBuilder::new(stub))
17710        }
17711
17712        /// Sets the full request, replacing any prior values.
17713        pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
17714            mut self,
17715            v: V,
17716        ) -> Self {
17717            self.0.request = v.into();
17718            self
17719        }
17720
17721        /// Sets all the options, replacing any prior values.
17722        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
17723            self.0.options = v.into();
17724            self
17725        }
17726
17727        /// Sends the request.
17728        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
17729            (*self.0.stub)
17730                .get_operation(self.0.request, self.0.options)
17731                .await
17732                .map(crate::Response::into_body)
17733        }
17734
17735        /// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
17736        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
17737            self.0.request.name = v.into();
17738            self
17739        }
17740    }
17741
17742    #[doc(hidden)]
17743    impl crate::RequestBuilder for GetOperation {
17744        fn request_options(&mut self) -> &mut crate::RequestOptions {
17745            &mut self.0.options
17746        }
17747    }
17748
17749    /// The request builder for [UserLicenseService::cancel_operation][crate::client::UserLicenseService::cancel_operation] calls.
17750    ///
17751    /// # Example
17752    /// ```
17753    /// # use google_cloud_discoveryengine_v1::builder::user_license_service::CancelOperation;
17754    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
17755    ///
17756    /// let builder = prepare_request_builder();
17757    /// let response = builder.send().await?;
17758    /// # Ok(()) }
17759    ///
17760    /// fn prepare_request_builder() -> CancelOperation {
17761    ///   # panic!();
17762    ///   // ... details omitted ...
17763    /// }
17764    /// ```
17765    #[derive(Clone, Debug)]
17766    pub struct CancelOperation(
17767        RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
17768    );
17769
17770    impl CancelOperation {
17771        pub(crate) fn new(
17772            stub: std::sync::Arc<dyn super::super::stub::dynamic::UserLicenseService>,
17773        ) -> Self {
17774            Self(RequestBuilder::new(stub))
17775        }
17776
17777        /// Sets the full request, replacing any prior values.
17778        pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
17779            mut self,
17780            v: V,
17781        ) -> Self {
17782            self.0.request = v.into();
17783            self
17784        }
17785
17786        /// Sets all the options, replacing any prior values.
17787        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
17788            self.0.options = v.into();
17789            self
17790        }
17791
17792        /// Sends the request.
17793        pub async fn send(self) -> Result<()> {
17794            (*self.0.stub)
17795                .cancel_operation(self.0.request, self.0.options)
17796                .await
17797                .map(crate::Response::into_body)
17798        }
17799
17800        /// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::name].
17801        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
17802            self.0.request.name = v.into();
17803            self
17804        }
17805    }
17806
17807    #[doc(hidden)]
17808    impl crate::RequestBuilder for CancelOperation {
17809        fn request_options(&mut self) -> &mut crate::RequestOptions {
17810            &mut self.0.options
17811        }
17812    }
17813}