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_score_spec][crate::model::SearchRequest::relevance_score_spec].
11887        pub fn set_relevance_score_spec<T>(mut self, v: T) -> Self
11888        where
11889            T: std::convert::Into<crate::model::search_request::RelevanceScoreSpec>,
11890        {
11891            self.0.request.relevance_score_spec = std::option::Option::Some(v.into());
11892            self
11893        }
11894
11895        /// Sets or clears the value of [relevance_score_spec][crate::model::SearchRequest::relevance_score_spec].
11896        pub fn set_or_clear_relevance_score_spec<T>(mut self, v: std::option::Option<T>) -> Self
11897        where
11898            T: std::convert::Into<crate::model::search_request::RelevanceScoreSpec>,
11899        {
11900            self.0.request.relevance_score_spec = v.map(|x| x.into());
11901            self
11902        }
11903    }
11904
11905    #[doc(hidden)]
11906    impl crate::RequestBuilder for Search {
11907        fn request_options(&mut self) -> &mut crate::RequestOptions {
11908            &mut self.0.options
11909        }
11910    }
11911
11912    /// The request builder for [SearchService::search_lite][crate::client::SearchService::search_lite] calls.
11913    ///
11914    /// # Example
11915    /// ```
11916    /// # use google_cloud_discoveryengine_v1::builder::search_service::SearchLite;
11917    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
11918    /// use google_cloud_gax::paginator::ItemPaginator;
11919    ///
11920    /// let builder = prepare_request_builder();
11921    /// let mut items = builder.by_item();
11922    /// while let Some(result) = items.next().await {
11923    ///   let item = result?;
11924    /// }
11925    /// # Ok(()) }
11926    ///
11927    /// fn prepare_request_builder() -> SearchLite {
11928    ///   # panic!();
11929    ///   // ... details omitted ...
11930    /// }
11931    /// ```
11932    #[derive(Clone, Debug)]
11933    pub struct SearchLite(RequestBuilder<crate::model::SearchRequest>);
11934
11935    impl SearchLite {
11936        pub(crate) fn new(
11937            stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchService>,
11938        ) -> Self {
11939            Self(RequestBuilder::new(stub))
11940        }
11941
11942        /// Sets the full request, replacing any prior values.
11943        pub fn with_request<V: Into<crate::model::SearchRequest>>(mut self, v: V) -> Self {
11944            self.0.request = v.into();
11945            self
11946        }
11947
11948        /// Sets all the options, replacing any prior values.
11949        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
11950            self.0.options = v.into();
11951            self
11952        }
11953
11954        /// Sends the request.
11955        pub async fn send(self) -> Result<crate::model::SearchResponse> {
11956            (*self.0.stub)
11957                .search_lite(self.0.request, self.0.options)
11958                .await
11959                .map(crate::Response::into_body)
11960        }
11961
11962        /// Streams each page in the collection.
11963        pub fn by_page(
11964            self,
11965        ) -> impl google_cloud_gax::paginator::Paginator<crate::model::SearchResponse, crate::Error>
11966        {
11967            use std::clone::Clone;
11968            let token = self.0.request.page_token.clone();
11969            let execute = move |token: String| {
11970                let mut builder = self.clone();
11971                builder.0.request = builder.0.request.set_page_token(token);
11972                builder.send()
11973            };
11974            google_cloud_gax::paginator::internal::new_paginator(token, execute)
11975        }
11976
11977        /// Streams each item in the collection.
11978        pub fn by_item(
11979            self,
11980        ) -> impl google_cloud_gax::paginator::ItemPaginator<crate::model::SearchResponse, crate::Error>
11981        {
11982            use google_cloud_gax::paginator::Paginator;
11983            self.by_page().items()
11984        }
11985
11986        /// Sets the value of [serving_config][crate::model::SearchRequest::serving_config].
11987        ///
11988        /// This is a **required** field for requests.
11989        pub fn set_serving_config<T: Into<std::string::String>>(mut self, v: T) -> Self {
11990            self.0.request.serving_config = v.into();
11991            self
11992        }
11993
11994        /// Sets the value of [branch][crate::model::SearchRequest::branch].
11995        pub fn set_branch<T: Into<std::string::String>>(mut self, v: T) -> Self {
11996            self.0.request.branch = v.into();
11997            self
11998        }
11999
12000        /// Sets the value of [query][crate::model::SearchRequest::query].
12001        pub fn set_query<T: Into<std::string::String>>(mut self, v: T) -> Self {
12002            self.0.request.query = v.into();
12003            self
12004        }
12005
12006        /// Sets the value of [page_categories][crate::model::SearchRequest::page_categories].
12007        pub fn set_page_categories<T, V>(mut self, v: T) -> Self
12008        where
12009            T: std::iter::IntoIterator<Item = V>,
12010            V: std::convert::Into<std::string::String>,
12011        {
12012            use std::iter::Iterator;
12013            self.0.request.page_categories = v.into_iter().map(|i| i.into()).collect();
12014            self
12015        }
12016
12017        /// Sets the value of [image_query][crate::model::SearchRequest::image_query].
12018        pub fn set_image_query<T>(mut self, v: T) -> Self
12019        where
12020            T: std::convert::Into<crate::model::search_request::ImageQuery>,
12021        {
12022            self.0.request.image_query = std::option::Option::Some(v.into());
12023            self
12024        }
12025
12026        /// Sets or clears the value of [image_query][crate::model::SearchRequest::image_query].
12027        pub fn set_or_clear_image_query<T>(mut self, v: std::option::Option<T>) -> Self
12028        where
12029            T: std::convert::Into<crate::model::search_request::ImageQuery>,
12030        {
12031            self.0.request.image_query = v.map(|x| x.into());
12032            self
12033        }
12034
12035        /// Sets the value of [page_size][crate::model::SearchRequest::page_size].
12036        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
12037            self.0.request.page_size = v.into();
12038            self
12039        }
12040
12041        /// Sets the value of [page_token][crate::model::SearchRequest::page_token].
12042        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
12043            self.0.request.page_token = v.into();
12044            self
12045        }
12046
12047        /// Sets the value of [offset][crate::model::SearchRequest::offset].
12048        pub fn set_offset<T: Into<i32>>(mut self, v: T) -> Self {
12049            self.0.request.offset = v.into();
12050            self
12051        }
12052
12053        /// Sets the value of [one_box_page_size][crate::model::SearchRequest::one_box_page_size].
12054        pub fn set_one_box_page_size<T: Into<i32>>(mut self, v: T) -> Self {
12055            self.0.request.one_box_page_size = v.into();
12056            self
12057        }
12058
12059        /// Sets the value of [data_store_specs][crate::model::SearchRequest::data_store_specs].
12060        pub fn set_data_store_specs<T, V>(mut self, v: T) -> Self
12061        where
12062            T: std::iter::IntoIterator<Item = V>,
12063            V: std::convert::Into<crate::model::search_request::DataStoreSpec>,
12064        {
12065            use std::iter::Iterator;
12066            self.0.request.data_store_specs = v.into_iter().map(|i| i.into()).collect();
12067            self
12068        }
12069
12070        /// Sets the value of [filter][crate::model::SearchRequest::filter].
12071        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
12072            self.0.request.filter = v.into();
12073            self
12074        }
12075
12076        /// Sets the value of [canonical_filter][crate::model::SearchRequest::canonical_filter].
12077        pub fn set_canonical_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
12078            self.0.request.canonical_filter = v.into();
12079            self
12080        }
12081
12082        /// Sets the value of [order_by][crate::model::SearchRequest::order_by].
12083        pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
12084            self.0.request.order_by = v.into();
12085            self
12086        }
12087
12088        /// Sets the value of [user_info][crate::model::SearchRequest::user_info].
12089        pub fn set_user_info<T>(mut self, v: T) -> Self
12090        where
12091            T: std::convert::Into<crate::model::UserInfo>,
12092        {
12093            self.0.request.user_info = std::option::Option::Some(v.into());
12094            self
12095        }
12096
12097        /// Sets or clears the value of [user_info][crate::model::SearchRequest::user_info].
12098        pub fn set_or_clear_user_info<T>(mut self, v: std::option::Option<T>) -> Self
12099        where
12100            T: std::convert::Into<crate::model::UserInfo>,
12101        {
12102            self.0.request.user_info = v.map(|x| x.into());
12103            self
12104        }
12105
12106        /// Sets the value of [language_code][crate::model::SearchRequest::language_code].
12107        pub fn set_language_code<T: Into<std::string::String>>(mut self, v: T) -> Self {
12108            self.0.request.language_code = v.into();
12109            self
12110        }
12111
12112        /// Sets the value of [facet_specs][crate::model::SearchRequest::facet_specs].
12113        pub fn set_facet_specs<T, V>(mut self, v: T) -> Self
12114        where
12115            T: std::iter::IntoIterator<Item = V>,
12116            V: std::convert::Into<crate::model::search_request::FacetSpec>,
12117        {
12118            use std::iter::Iterator;
12119            self.0.request.facet_specs = v.into_iter().map(|i| i.into()).collect();
12120            self
12121        }
12122
12123        /// Sets the value of [boost_spec][crate::model::SearchRequest::boost_spec].
12124        pub fn set_boost_spec<T>(mut self, v: T) -> Self
12125        where
12126            T: std::convert::Into<crate::model::search_request::BoostSpec>,
12127        {
12128            self.0.request.boost_spec = std::option::Option::Some(v.into());
12129            self
12130        }
12131
12132        /// Sets or clears the value of [boost_spec][crate::model::SearchRequest::boost_spec].
12133        pub fn set_or_clear_boost_spec<T>(mut self, v: std::option::Option<T>) -> Self
12134        where
12135            T: std::convert::Into<crate::model::search_request::BoostSpec>,
12136        {
12137            self.0.request.boost_spec = v.map(|x| x.into());
12138            self
12139        }
12140
12141        /// Sets the value of [params][crate::model::SearchRequest::params].
12142        pub fn set_params<T, K, V>(mut self, v: T) -> Self
12143        where
12144            T: std::iter::IntoIterator<Item = (K, V)>,
12145            K: std::convert::Into<std::string::String>,
12146            V: std::convert::Into<wkt::Value>,
12147        {
12148            self.0.request.params = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
12149            self
12150        }
12151
12152        /// Sets the value of [query_expansion_spec][crate::model::SearchRequest::query_expansion_spec].
12153        pub fn set_query_expansion_spec<T>(mut self, v: T) -> Self
12154        where
12155            T: std::convert::Into<crate::model::search_request::QueryExpansionSpec>,
12156        {
12157            self.0.request.query_expansion_spec = std::option::Option::Some(v.into());
12158            self
12159        }
12160
12161        /// Sets or clears the value of [query_expansion_spec][crate::model::SearchRequest::query_expansion_spec].
12162        pub fn set_or_clear_query_expansion_spec<T>(mut self, v: std::option::Option<T>) -> Self
12163        where
12164            T: std::convert::Into<crate::model::search_request::QueryExpansionSpec>,
12165        {
12166            self.0.request.query_expansion_spec = v.map(|x| x.into());
12167            self
12168        }
12169
12170        /// Sets the value of [spell_correction_spec][crate::model::SearchRequest::spell_correction_spec].
12171        pub fn set_spell_correction_spec<T>(mut self, v: T) -> Self
12172        where
12173            T: std::convert::Into<crate::model::search_request::SpellCorrectionSpec>,
12174        {
12175            self.0.request.spell_correction_spec = std::option::Option::Some(v.into());
12176            self
12177        }
12178
12179        /// Sets or clears the value of [spell_correction_spec][crate::model::SearchRequest::spell_correction_spec].
12180        pub fn set_or_clear_spell_correction_spec<T>(mut self, v: std::option::Option<T>) -> Self
12181        where
12182            T: std::convert::Into<crate::model::search_request::SpellCorrectionSpec>,
12183        {
12184            self.0.request.spell_correction_spec = v.map(|x| x.into());
12185            self
12186        }
12187
12188        /// Sets the value of [user_pseudo_id][crate::model::SearchRequest::user_pseudo_id].
12189        pub fn set_user_pseudo_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
12190            self.0.request.user_pseudo_id = v.into();
12191            self
12192        }
12193
12194        /// Sets the value of [content_search_spec][crate::model::SearchRequest::content_search_spec].
12195        pub fn set_content_search_spec<T>(mut self, v: T) -> Self
12196        where
12197            T: std::convert::Into<crate::model::search_request::ContentSearchSpec>,
12198        {
12199            self.0.request.content_search_spec = std::option::Option::Some(v.into());
12200            self
12201        }
12202
12203        /// Sets or clears the value of [content_search_spec][crate::model::SearchRequest::content_search_spec].
12204        pub fn set_or_clear_content_search_spec<T>(mut self, v: std::option::Option<T>) -> Self
12205        where
12206            T: std::convert::Into<crate::model::search_request::ContentSearchSpec>,
12207        {
12208            self.0.request.content_search_spec = v.map(|x| x.into());
12209            self
12210        }
12211
12212        /// Sets the value of [ranking_expression][crate::model::SearchRequest::ranking_expression].
12213        pub fn set_ranking_expression<T: Into<std::string::String>>(mut self, v: T) -> Self {
12214            self.0.request.ranking_expression = v.into();
12215            self
12216        }
12217
12218        /// Sets the value of [ranking_expression_backend][crate::model::SearchRequest::ranking_expression_backend].
12219        pub fn set_ranking_expression_backend<
12220            T: Into<crate::model::search_request::RankingExpressionBackend>,
12221        >(
12222            mut self,
12223            v: T,
12224        ) -> Self {
12225            self.0.request.ranking_expression_backend = v.into();
12226            self
12227        }
12228
12229        /// Sets the value of [safe_search][crate::model::SearchRequest::safe_search].
12230        pub fn set_safe_search<T: Into<bool>>(mut self, v: T) -> Self {
12231            self.0.request.safe_search = v.into();
12232            self
12233        }
12234
12235        /// Sets the value of [user_labels][crate::model::SearchRequest::user_labels].
12236        pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
12237        where
12238            T: std::iter::IntoIterator<Item = (K, V)>,
12239            K: std::convert::Into<std::string::String>,
12240            V: std::convert::Into<std::string::String>,
12241        {
12242            self.0.request.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
12243            self
12244        }
12245
12246        /// Sets the value of [natural_language_query_understanding_spec][crate::model::SearchRequest::natural_language_query_understanding_spec].
12247        pub fn set_natural_language_query_understanding_spec<T>(mut self, v: T) -> Self
12248        where
12249            T: std::convert::Into<
12250                    crate::model::search_request::NaturalLanguageQueryUnderstandingSpec,
12251                >,
12252        {
12253            self.0.request.natural_language_query_understanding_spec =
12254                std::option::Option::Some(v.into());
12255            self
12256        }
12257
12258        /// Sets or clears the value of [natural_language_query_understanding_spec][crate::model::SearchRequest::natural_language_query_understanding_spec].
12259        pub fn set_or_clear_natural_language_query_understanding_spec<T>(
12260            mut self,
12261            v: std::option::Option<T>,
12262        ) -> Self
12263        where
12264            T: std::convert::Into<
12265                    crate::model::search_request::NaturalLanguageQueryUnderstandingSpec,
12266                >,
12267        {
12268            self.0.request.natural_language_query_understanding_spec = v.map(|x| x.into());
12269            self
12270        }
12271
12272        /// Sets the value of [search_as_you_type_spec][crate::model::SearchRequest::search_as_you_type_spec].
12273        pub fn set_search_as_you_type_spec<T>(mut self, v: T) -> Self
12274        where
12275            T: std::convert::Into<crate::model::search_request::SearchAsYouTypeSpec>,
12276        {
12277            self.0.request.search_as_you_type_spec = std::option::Option::Some(v.into());
12278            self
12279        }
12280
12281        /// Sets or clears the value of [search_as_you_type_spec][crate::model::SearchRequest::search_as_you_type_spec].
12282        pub fn set_or_clear_search_as_you_type_spec<T>(mut self, v: std::option::Option<T>) -> Self
12283        where
12284            T: std::convert::Into<crate::model::search_request::SearchAsYouTypeSpec>,
12285        {
12286            self.0.request.search_as_you_type_spec = v.map(|x| x.into());
12287            self
12288        }
12289
12290        /// Sets the value of [display_spec][crate::model::SearchRequest::display_spec].
12291        pub fn set_display_spec<T>(mut self, v: T) -> Self
12292        where
12293            T: std::convert::Into<crate::model::search_request::DisplaySpec>,
12294        {
12295            self.0.request.display_spec = std::option::Option::Some(v.into());
12296            self
12297        }
12298
12299        /// Sets or clears the value of [display_spec][crate::model::SearchRequest::display_spec].
12300        pub fn set_or_clear_display_spec<T>(mut self, v: std::option::Option<T>) -> Self
12301        where
12302            T: std::convert::Into<crate::model::search_request::DisplaySpec>,
12303        {
12304            self.0.request.display_spec = v.map(|x| x.into());
12305            self
12306        }
12307
12308        /// Sets the value of [crowding_specs][crate::model::SearchRequest::crowding_specs].
12309        pub fn set_crowding_specs<T, V>(mut self, v: T) -> Self
12310        where
12311            T: std::iter::IntoIterator<Item = V>,
12312            V: std::convert::Into<crate::model::search_request::CrowdingSpec>,
12313        {
12314            use std::iter::Iterator;
12315            self.0.request.crowding_specs = v.into_iter().map(|i| i.into()).collect();
12316            self
12317        }
12318
12319        /// Sets the value of [session][crate::model::SearchRequest::session].
12320        pub fn set_session<T: Into<std::string::String>>(mut self, v: T) -> Self {
12321            self.0.request.session = v.into();
12322            self
12323        }
12324
12325        /// Sets the value of [session_spec][crate::model::SearchRequest::session_spec].
12326        pub fn set_session_spec<T>(mut self, v: T) -> Self
12327        where
12328            T: std::convert::Into<crate::model::search_request::SessionSpec>,
12329        {
12330            self.0.request.session_spec = std::option::Option::Some(v.into());
12331            self
12332        }
12333
12334        /// Sets or clears the value of [session_spec][crate::model::SearchRequest::session_spec].
12335        pub fn set_or_clear_session_spec<T>(mut self, v: std::option::Option<T>) -> Self
12336        where
12337            T: std::convert::Into<crate::model::search_request::SessionSpec>,
12338        {
12339            self.0.request.session_spec = v.map(|x| x.into());
12340            self
12341        }
12342
12343        /// Sets the value of [relevance_threshold][crate::model::SearchRequest::relevance_threshold].
12344        pub fn set_relevance_threshold<
12345            T: Into<crate::model::search_request::RelevanceThreshold>,
12346        >(
12347            mut self,
12348            v: T,
12349        ) -> Self {
12350            self.0.request.relevance_threshold = v.into();
12351            self
12352        }
12353
12354        /// Sets the value of [relevance_score_spec][crate::model::SearchRequest::relevance_score_spec].
12355        pub fn set_relevance_score_spec<T>(mut self, v: T) -> Self
12356        where
12357            T: std::convert::Into<crate::model::search_request::RelevanceScoreSpec>,
12358        {
12359            self.0.request.relevance_score_spec = std::option::Option::Some(v.into());
12360            self
12361        }
12362
12363        /// Sets or clears the value of [relevance_score_spec][crate::model::SearchRequest::relevance_score_spec].
12364        pub fn set_or_clear_relevance_score_spec<T>(mut self, v: std::option::Option<T>) -> Self
12365        where
12366            T: std::convert::Into<crate::model::search_request::RelevanceScoreSpec>,
12367        {
12368            self.0.request.relevance_score_spec = v.map(|x| x.into());
12369            self
12370        }
12371    }
12372
12373    #[doc(hidden)]
12374    impl crate::RequestBuilder for SearchLite {
12375        fn request_options(&mut self) -> &mut crate::RequestOptions {
12376            &mut self.0.options
12377        }
12378    }
12379
12380    /// The request builder for [SearchService::list_operations][crate::client::SearchService::list_operations] calls.
12381    ///
12382    /// # Example
12383    /// ```
12384    /// # use google_cloud_discoveryengine_v1::builder::search_service::ListOperations;
12385    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
12386    /// use google_cloud_gax::paginator::ItemPaginator;
12387    ///
12388    /// let builder = prepare_request_builder();
12389    /// let mut items = builder.by_item();
12390    /// while let Some(result) = items.next().await {
12391    ///   let item = result?;
12392    /// }
12393    /// # Ok(()) }
12394    ///
12395    /// fn prepare_request_builder() -> ListOperations {
12396    ///   # panic!();
12397    ///   // ... details omitted ...
12398    /// }
12399    /// ```
12400    #[derive(Clone, Debug)]
12401    pub struct ListOperations(
12402        RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
12403    );
12404
12405    impl ListOperations {
12406        pub(crate) fn new(
12407            stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchService>,
12408        ) -> Self {
12409            Self(RequestBuilder::new(stub))
12410        }
12411
12412        /// Sets the full request, replacing any prior values.
12413        pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
12414            mut self,
12415            v: V,
12416        ) -> Self {
12417            self.0.request = v.into();
12418            self
12419        }
12420
12421        /// Sets all the options, replacing any prior values.
12422        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
12423            self.0.options = v.into();
12424            self
12425        }
12426
12427        /// Sends the request.
12428        pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
12429            (*self.0.stub)
12430                .list_operations(self.0.request, self.0.options)
12431                .await
12432                .map(crate::Response::into_body)
12433        }
12434
12435        /// Streams each page in the collection.
12436        pub fn by_page(
12437            self,
12438        ) -> impl google_cloud_gax::paginator::Paginator<
12439            google_cloud_longrunning::model::ListOperationsResponse,
12440            crate::Error,
12441        > {
12442            use std::clone::Clone;
12443            let token = self.0.request.page_token.clone();
12444            let execute = move |token: String| {
12445                let mut builder = self.clone();
12446                builder.0.request = builder.0.request.set_page_token(token);
12447                builder.send()
12448            };
12449            google_cloud_gax::paginator::internal::new_paginator(token, execute)
12450        }
12451
12452        /// Streams each item in the collection.
12453        pub fn by_item(
12454            self,
12455        ) -> impl google_cloud_gax::paginator::ItemPaginator<
12456            google_cloud_longrunning::model::ListOperationsResponse,
12457            crate::Error,
12458        > {
12459            use google_cloud_gax::paginator::Paginator;
12460            self.by_page().items()
12461        }
12462
12463        /// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
12464        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
12465            self.0.request.name = v.into();
12466            self
12467        }
12468
12469        /// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::filter].
12470        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
12471            self.0.request.filter = v.into();
12472            self
12473        }
12474
12475        /// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
12476        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
12477            self.0.request.page_size = v.into();
12478            self
12479        }
12480
12481        /// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
12482        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
12483            self.0.request.page_token = v.into();
12484            self
12485        }
12486
12487        /// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
12488        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
12489            self.0.request.return_partial_success = v.into();
12490            self
12491        }
12492    }
12493
12494    #[doc(hidden)]
12495    impl crate::RequestBuilder for ListOperations {
12496        fn request_options(&mut self) -> &mut crate::RequestOptions {
12497            &mut self.0.options
12498        }
12499    }
12500
12501    /// The request builder for [SearchService::get_operation][crate::client::SearchService::get_operation] calls.
12502    ///
12503    /// # Example
12504    /// ```
12505    /// # use google_cloud_discoveryengine_v1::builder::search_service::GetOperation;
12506    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
12507    ///
12508    /// let builder = prepare_request_builder();
12509    /// let response = builder.send().await?;
12510    /// # Ok(()) }
12511    ///
12512    /// fn prepare_request_builder() -> GetOperation {
12513    ///   # panic!();
12514    ///   // ... details omitted ...
12515    /// }
12516    /// ```
12517    #[derive(Clone, Debug)]
12518    pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
12519
12520    impl GetOperation {
12521        pub(crate) fn new(
12522            stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchService>,
12523        ) -> Self {
12524            Self(RequestBuilder::new(stub))
12525        }
12526
12527        /// Sets the full request, replacing any prior values.
12528        pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
12529            mut self,
12530            v: V,
12531        ) -> Self {
12532            self.0.request = v.into();
12533            self
12534        }
12535
12536        /// Sets all the options, replacing any prior values.
12537        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
12538            self.0.options = v.into();
12539            self
12540        }
12541
12542        /// Sends the request.
12543        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
12544            (*self.0.stub)
12545                .get_operation(self.0.request, self.0.options)
12546                .await
12547                .map(crate::Response::into_body)
12548        }
12549
12550        /// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
12551        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
12552            self.0.request.name = v.into();
12553            self
12554        }
12555    }
12556
12557    #[doc(hidden)]
12558    impl crate::RequestBuilder for GetOperation {
12559        fn request_options(&mut self) -> &mut crate::RequestOptions {
12560            &mut self.0.options
12561        }
12562    }
12563
12564    /// The request builder for [SearchService::cancel_operation][crate::client::SearchService::cancel_operation] calls.
12565    ///
12566    /// # Example
12567    /// ```
12568    /// # use google_cloud_discoveryengine_v1::builder::search_service::CancelOperation;
12569    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
12570    ///
12571    /// let builder = prepare_request_builder();
12572    /// let response = builder.send().await?;
12573    /// # Ok(()) }
12574    ///
12575    /// fn prepare_request_builder() -> CancelOperation {
12576    ///   # panic!();
12577    ///   // ... details omitted ...
12578    /// }
12579    /// ```
12580    #[derive(Clone, Debug)]
12581    pub struct CancelOperation(
12582        RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
12583    );
12584
12585    impl CancelOperation {
12586        pub(crate) fn new(
12587            stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchService>,
12588        ) -> Self {
12589            Self(RequestBuilder::new(stub))
12590        }
12591
12592        /// Sets the full request, replacing any prior values.
12593        pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
12594            mut self,
12595            v: V,
12596        ) -> Self {
12597            self.0.request = v.into();
12598            self
12599        }
12600
12601        /// Sets all the options, replacing any prior values.
12602        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
12603            self.0.options = v.into();
12604            self
12605        }
12606
12607        /// Sends the request.
12608        pub async fn send(self) -> Result<()> {
12609            (*self.0.stub)
12610                .cancel_operation(self.0.request, self.0.options)
12611                .await
12612                .map(crate::Response::into_body)
12613        }
12614
12615        /// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::name].
12616        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
12617            self.0.request.name = v.into();
12618            self
12619        }
12620    }
12621
12622    #[doc(hidden)]
12623    impl crate::RequestBuilder for CancelOperation {
12624        fn request_options(&mut self) -> &mut crate::RequestOptions {
12625            &mut self.0.options
12626        }
12627    }
12628}
12629
12630/// Request and client builders for [SearchTuningService][crate::client::SearchTuningService].
12631#[cfg(feature = "search-tuning-service")]
12632#[cfg_attr(docsrs, doc(cfg(feature = "search-tuning-service")))]
12633pub mod search_tuning_service {
12634    use crate::Result;
12635
12636    /// A builder for [SearchTuningService][crate::client::SearchTuningService].
12637    ///
12638    /// ```
12639    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
12640    /// # use google_cloud_discoveryengine_v1::*;
12641    /// # use builder::search_tuning_service::ClientBuilder;
12642    /// # use client::SearchTuningService;
12643    /// let builder : ClientBuilder = SearchTuningService::builder();
12644    /// let client = builder
12645    ///     .with_endpoint("https://discoveryengine.googleapis.com")
12646    ///     .build().await?;
12647    /// # Ok(()) }
12648    /// ```
12649    pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
12650
12651    pub(crate) mod client {
12652        use super::super::super::client::SearchTuningService;
12653        pub struct Factory;
12654        impl crate::ClientFactory for Factory {
12655            type Client = SearchTuningService;
12656            type Credentials = gaxi::options::Credentials;
12657            async fn build(
12658                self,
12659                config: gaxi::options::ClientConfig,
12660            ) -> crate::ClientBuilderResult<Self::Client> {
12661                Self::Client::new(config).await
12662            }
12663        }
12664    }
12665
12666    /// Common implementation for [crate::client::SearchTuningService] request builders.
12667    #[derive(Clone, Debug)]
12668    pub(crate) struct RequestBuilder<R: std::default::Default> {
12669        stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchTuningService>,
12670        request: R,
12671        options: crate::RequestOptions,
12672    }
12673
12674    impl<R> RequestBuilder<R>
12675    where
12676        R: std::default::Default,
12677    {
12678        pub(crate) fn new(
12679            stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchTuningService>,
12680        ) -> Self {
12681            Self {
12682                stub,
12683                request: R::default(),
12684                options: crate::RequestOptions::default(),
12685            }
12686        }
12687    }
12688
12689    /// The request builder for [SearchTuningService::train_custom_model][crate::client::SearchTuningService::train_custom_model] calls.
12690    ///
12691    /// # Example
12692    /// ```
12693    /// # use google_cloud_discoveryengine_v1::builder::search_tuning_service::TrainCustomModel;
12694    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
12695    /// use google_cloud_lro::Poller;
12696    ///
12697    /// let builder = prepare_request_builder();
12698    /// let response = builder.poller().until_done().await?;
12699    /// # Ok(()) }
12700    ///
12701    /// fn prepare_request_builder() -> TrainCustomModel {
12702    ///   # panic!();
12703    ///   // ... details omitted ...
12704    /// }
12705    /// ```
12706    #[derive(Clone, Debug)]
12707    pub struct TrainCustomModel(RequestBuilder<crate::model::TrainCustomModelRequest>);
12708
12709    impl TrainCustomModel {
12710        pub(crate) fn new(
12711            stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchTuningService>,
12712        ) -> Self {
12713            Self(RequestBuilder::new(stub))
12714        }
12715
12716        /// Sets the full request, replacing any prior values.
12717        pub fn with_request<V: Into<crate::model::TrainCustomModelRequest>>(
12718            mut self,
12719            v: V,
12720        ) -> Self {
12721            self.0.request = v.into();
12722            self
12723        }
12724
12725        /// Sets all the options, replacing any prior values.
12726        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
12727            self.0.options = v.into();
12728            self
12729        }
12730
12731        /// Sends the request.
12732        ///
12733        /// # Long running operations
12734        ///
12735        /// This starts, but does not poll, a longrunning operation. More information
12736        /// on [train_custom_model][crate::client::SearchTuningService::train_custom_model].
12737        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
12738            (*self.0.stub)
12739                .train_custom_model(self.0.request, self.0.options)
12740                .await
12741                .map(crate::Response::into_body)
12742        }
12743
12744        /// Creates a [Poller][google_cloud_lro::Poller] to work with `train_custom_model`.
12745        pub fn poller(
12746            self,
12747        ) -> impl google_cloud_lro::Poller<
12748            crate::model::TrainCustomModelResponse,
12749            crate::model::TrainCustomModelMetadata,
12750        > {
12751            type Operation = google_cloud_lro::internal::Operation<
12752                crate::model::TrainCustomModelResponse,
12753                crate::model::TrainCustomModelMetadata,
12754            >;
12755            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
12756            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
12757            let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
12758            if let Some(ref mut details) = poller_options.tracing {
12759                details.method_name = "google_cloud_discoveryengine_v1::client::SearchTuningService::train_custom_model::until_done";
12760            }
12761
12762            let stub = self.0.stub.clone();
12763            let mut options = self.0.options.clone();
12764            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
12765            let query = move |name| {
12766                let stub = stub.clone();
12767                let options = options.clone();
12768                async {
12769                    let op = GetOperation::new(stub)
12770                        .set_name(name)
12771                        .with_options(options)
12772                        .send()
12773                        .await?;
12774                    Ok(Operation::new(op))
12775                }
12776            };
12777
12778            let start = move || async {
12779                let op = self.send().await?;
12780                Ok(Operation::new(op))
12781            };
12782
12783            use google_cloud_lro::internal::PollerExt;
12784            {
12785                google_cloud_lro::internal::new_poller(
12786                    polling_error_policy,
12787                    polling_backoff_policy,
12788                    start,
12789                    query,
12790                )
12791            }
12792            .with_options(poller_options)
12793        }
12794
12795        /// Sets the value of [data_store][crate::model::TrainCustomModelRequest::data_store].
12796        ///
12797        /// This is a **required** field for requests.
12798        pub fn set_data_store<T: Into<std::string::String>>(mut self, v: T) -> Self {
12799            self.0.request.data_store = v.into();
12800            self
12801        }
12802
12803        /// Sets the value of [model_type][crate::model::TrainCustomModelRequest::model_type].
12804        pub fn set_model_type<T: Into<std::string::String>>(mut self, v: T) -> Self {
12805            self.0.request.model_type = v.into();
12806            self
12807        }
12808
12809        /// Sets the value of [error_config][crate::model::TrainCustomModelRequest::error_config].
12810        pub fn set_error_config<T>(mut self, v: T) -> Self
12811        where
12812            T: std::convert::Into<crate::model::ImportErrorConfig>,
12813        {
12814            self.0.request.error_config = std::option::Option::Some(v.into());
12815            self
12816        }
12817
12818        /// Sets or clears the value of [error_config][crate::model::TrainCustomModelRequest::error_config].
12819        pub fn set_or_clear_error_config<T>(mut self, v: std::option::Option<T>) -> Self
12820        where
12821            T: std::convert::Into<crate::model::ImportErrorConfig>,
12822        {
12823            self.0.request.error_config = v.map(|x| x.into());
12824            self
12825        }
12826
12827        /// Sets the value of [model_id][crate::model::TrainCustomModelRequest::model_id].
12828        pub fn set_model_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
12829            self.0.request.model_id = v.into();
12830            self
12831        }
12832
12833        /// Sets the value of [training_input][crate::model::TrainCustomModelRequest::training_input].
12834        ///
12835        /// Note that all the setters affecting `training_input` are
12836        /// mutually exclusive.
12837        pub fn set_training_input<
12838            T: Into<Option<crate::model::train_custom_model_request::TrainingInput>>,
12839        >(
12840            mut self,
12841            v: T,
12842        ) -> Self {
12843            self.0.request.training_input = v.into();
12844            self
12845        }
12846
12847        /// Sets the value of [training_input][crate::model::TrainCustomModelRequest::training_input]
12848        /// to hold a `GcsTrainingInput`.
12849        ///
12850        /// Note that all the setters affecting `training_input` are
12851        /// mutually exclusive.
12852        pub fn set_gcs_training_input<
12853            T: std::convert::Into<
12854                    std::boxed::Box<crate::model::train_custom_model_request::GcsTrainingInput>,
12855                >,
12856        >(
12857            mut self,
12858            v: T,
12859        ) -> Self {
12860            self.0.request = self.0.request.set_gcs_training_input(v);
12861            self
12862        }
12863    }
12864
12865    #[doc(hidden)]
12866    impl crate::RequestBuilder for TrainCustomModel {
12867        fn request_options(&mut self) -> &mut crate::RequestOptions {
12868            &mut self.0.options
12869        }
12870    }
12871
12872    /// The request builder for [SearchTuningService::list_custom_models][crate::client::SearchTuningService::list_custom_models] calls.
12873    ///
12874    /// # Example
12875    /// ```
12876    /// # use google_cloud_discoveryengine_v1::builder::search_tuning_service::ListCustomModels;
12877    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
12878    ///
12879    /// let builder = prepare_request_builder();
12880    /// let response = builder.send().await?;
12881    /// # Ok(()) }
12882    ///
12883    /// fn prepare_request_builder() -> ListCustomModels {
12884    ///   # panic!();
12885    ///   // ... details omitted ...
12886    /// }
12887    /// ```
12888    #[derive(Clone, Debug)]
12889    pub struct ListCustomModels(RequestBuilder<crate::model::ListCustomModelsRequest>);
12890
12891    impl ListCustomModels {
12892        pub(crate) fn new(
12893            stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchTuningService>,
12894        ) -> Self {
12895            Self(RequestBuilder::new(stub))
12896        }
12897
12898        /// Sets the full request, replacing any prior values.
12899        pub fn with_request<V: Into<crate::model::ListCustomModelsRequest>>(
12900            mut self,
12901            v: V,
12902        ) -> Self {
12903            self.0.request = v.into();
12904            self
12905        }
12906
12907        /// Sets all the options, replacing any prior values.
12908        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
12909            self.0.options = v.into();
12910            self
12911        }
12912
12913        /// Sends the request.
12914        pub async fn send(self) -> Result<crate::model::ListCustomModelsResponse> {
12915            (*self.0.stub)
12916                .list_custom_models(self.0.request, self.0.options)
12917                .await
12918                .map(crate::Response::into_body)
12919        }
12920
12921        /// Sets the value of [data_store][crate::model::ListCustomModelsRequest::data_store].
12922        ///
12923        /// This is a **required** field for requests.
12924        pub fn set_data_store<T: Into<std::string::String>>(mut self, v: T) -> Self {
12925            self.0.request.data_store = v.into();
12926            self
12927        }
12928    }
12929
12930    #[doc(hidden)]
12931    impl crate::RequestBuilder for ListCustomModels {
12932        fn request_options(&mut self) -> &mut crate::RequestOptions {
12933            &mut self.0.options
12934        }
12935    }
12936
12937    /// The request builder for [SearchTuningService::list_operations][crate::client::SearchTuningService::list_operations] calls.
12938    ///
12939    /// # Example
12940    /// ```
12941    /// # use google_cloud_discoveryengine_v1::builder::search_tuning_service::ListOperations;
12942    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
12943    /// use google_cloud_gax::paginator::ItemPaginator;
12944    ///
12945    /// let builder = prepare_request_builder();
12946    /// let mut items = builder.by_item();
12947    /// while let Some(result) = items.next().await {
12948    ///   let item = result?;
12949    /// }
12950    /// # Ok(()) }
12951    ///
12952    /// fn prepare_request_builder() -> ListOperations {
12953    ///   # panic!();
12954    ///   // ... details omitted ...
12955    /// }
12956    /// ```
12957    #[derive(Clone, Debug)]
12958    pub struct ListOperations(
12959        RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
12960    );
12961
12962    impl ListOperations {
12963        pub(crate) fn new(
12964            stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchTuningService>,
12965        ) -> Self {
12966            Self(RequestBuilder::new(stub))
12967        }
12968
12969        /// Sets the full request, replacing any prior values.
12970        pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
12971            mut self,
12972            v: V,
12973        ) -> Self {
12974            self.0.request = v.into();
12975            self
12976        }
12977
12978        /// Sets all the options, replacing any prior values.
12979        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
12980            self.0.options = v.into();
12981            self
12982        }
12983
12984        /// Sends the request.
12985        pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
12986            (*self.0.stub)
12987                .list_operations(self.0.request, self.0.options)
12988                .await
12989                .map(crate::Response::into_body)
12990        }
12991
12992        /// Streams each page in the collection.
12993        pub fn by_page(
12994            self,
12995        ) -> impl google_cloud_gax::paginator::Paginator<
12996            google_cloud_longrunning::model::ListOperationsResponse,
12997            crate::Error,
12998        > {
12999            use std::clone::Clone;
13000            let token = self.0.request.page_token.clone();
13001            let execute = move |token: String| {
13002                let mut builder = self.clone();
13003                builder.0.request = builder.0.request.set_page_token(token);
13004                builder.send()
13005            };
13006            google_cloud_gax::paginator::internal::new_paginator(token, execute)
13007        }
13008
13009        /// Streams each item in the collection.
13010        pub fn by_item(
13011            self,
13012        ) -> impl google_cloud_gax::paginator::ItemPaginator<
13013            google_cloud_longrunning::model::ListOperationsResponse,
13014            crate::Error,
13015        > {
13016            use google_cloud_gax::paginator::Paginator;
13017            self.by_page().items()
13018        }
13019
13020        /// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
13021        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13022            self.0.request.name = v.into();
13023            self
13024        }
13025
13026        /// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::filter].
13027        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
13028            self.0.request.filter = v.into();
13029            self
13030        }
13031
13032        /// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
13033        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
13034            self.0.request.page_size = v.into();
13035            self
13036        }
13037
13038        /// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
13039        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
13040            self.0.request.page_token = v.into();
13041            self
13042        }
13043
13044        /// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
13045        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
13046            self.0.request.return_partial_success = v.into();
13047            self
13048        }
13049    }
13050
13051    #[doc(hidden)]
13052    impl crate::RequestBuilder for ListOperations {
13053        fn request_options(&mut self) -> &mut crate::RequestOptions {
13054            &mut self.0.options
13055        }
13056    }
13057
13058    /// The request builder for [SearchTuningService::get_operation][crate::client::SearchTuningService::get_operation] calls.
13059    ///
13060    /// # Example
13061    /// ```
13062    /// # use google_cloud_discoveryengine_v1::builder::search_tuning_service::GetOperation;
13063    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
13064    ///
13065    /// let builder = prepare_request_builder();
13066    /// let response = builder.send().await?;
13067    /// # Ok(()) }
13068    ///
13069    /// fn prepare_request_builder() -> GetOperation {
13070    ///   # panic!();
13071    ///   // ... details omitted ...
13072    /// }
13073    /// ```
13074    #[derive(Clone, Debug)]
13075    pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
13076
13077    impl GetOperation {
13078        pub(crate) fn new(
13079            stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchTuningService>,
13080        ) -> Self {
13081            Self(RequestBuilder::new(stub))
13082        }
13083
13084        /// Sets the full request, replacing any prior values.
13085        pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
13086            mut self,
13087            v: V,
13088        ) -> Self {
13089            self.0.request = v.into();
13090            self
13091        }
13092
13093        /// Sets all the options, replacing any prior values.
13094        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
13095            self.0.options = v.into();
13096            self
13097        }
13098
13099        /// Sends the request.
13100        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
13101            (*self.0.stub)
13102                .get_operation(self.0.request, self.0.options)
13103                .await
13104                .map(crate::Response::into_body)
13105        }
13106
13107        /// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
13108        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13109            self.0.request.name = v.into();
13110            self
13111        }
13112    }
13113
13114    #[doc(hidden)]
13115    impl crate::RequestBuilder for GetOperation {
13116        fn request_options(&mut self) -> &mut crate::RequestOptions {
13117            &mut self.0.options
13118        }
13119    }
13120
13121    /// The request builder for [SearchTuningService::cancel_operation][crate::client::SearchTuningService::cancel_operation] calls.
13122    ///
13123    /// # Example
13124    /// ```
13125    /// # use google_cloud_discoveryengine_v1::builder::search_tuning_service::CancelOperation;
13126    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
13127    ///
13128    /// let builder = prepare_request_builder();
13129    /// let response = builder.send().await?;
13130    /// # Ok(()) }
13131    ///
13132    /// fn prepare_request_builder() -> CancelOperation {
13133    ///   # panic!();
13134    ///   // ... details omitted ...
13135    /// }
13136    /// ```
13137    #[derive(Clone, Debug)]
13138    pub struct CancelOperation(
13139        RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
13140    );
13141
13142    impl CancelOperation {
13143        pub(crate) fn new(
13144            stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchTuningService>,
13145        ) -> Self {
13146            Self(RequestBuilder::new(stub))
13147        }
13148
13149        /// Sets the full request, replacing any prior values.
13150        pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
13151            mut self,
13152            v: V,
13153        ) -> Self {
13154            self.0.request = v.into();
13155            self
13156        }
13157
13158        /// Sets all the options, replacing any prior values.
13159        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
13160            self.0.options = v.into();
13161            self
13162        }
13163
13164        /// Sends the request.
13165        pub async fn send(self) -> Result<()> {
13166            (*self.0.stub)
13167                .cancel_operation(self.0.request, self.0.options)
13168                .await
13169                .map(crate::Response::into_body)
13170        }
13171
13172        /// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::name].
13173        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13174            self.0.request.name = v.into();
13175            self
13176        }
13177    }
13178
13179    #[doc(hidden)]
13180    impl crate::RequestBuilder for CancelOperation {
13181        fn request_options(&mut self) -> &mut crate::RequestOptions {
13182            &mut self.0.options
13183        }
13184    }
13185}
13186
13187/// Request and client builders for [ServingConfigService][crate::client::ServingConfigService].
13188#[cfg(feature = "serving-config-service")]
13189#[cfg_attr(docsrs, doc(cfg(feature = "serving-config-service")))]
13190pub mod serving_config_service {
13191    use crate::Result;
13192
13193    /// A builder for [ServingConfigService][crate::client::ServingConfigService].
13194    ///
13195    /// ```
13196    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
13197    /// # use google_cloud_discoveryengine_v1::*;
13198    /// # use builder::serving_config_service::ClientBuilder;
13199    /// # use client::ServingConfigService;
13200    /// let builder : ClientBuilder = ServingConfigService::builder();
13201    /// let client = builder
13202    ///     .with_endpoint("https://discoveryengine.googleapis.com")
13203    ///     .build().await?;
13204    /// # Ok(()) }
13205    /// ```
13206    pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
13207
13208    pub(crate) mod client {
13209        use super::super::super::client::ServingConfigService;
13210        pub struct Factory;
13211        impl crate::ClientFactory for Factory {
13212            type Client = ServingConfigService;
13213            type Credentials = gaxi::options::Credentials;
13214            async fn build(
13215                self,
13216                config: gaxi::options::ClientConfig,
13217            ) -> crate::ClientBuilderResult<Self::Client> {
13218                Self::Client::new(config).await
13219            }
13220        }
13221    }
13222
13223    /// Common implementation for [crate::client::ServingConfigService] request builders.
13224    #[derive(Clone, Debug)]
13225    pub(crate) struct RequestBuilder<R: std::default::Default> {
13226        stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
13227        request: R,
13228        options: crate::RequestOptions,
13229    }
13230
13231    impl<R> RequestBuilder<R>
13232    where
13233        R: std::default::Default,
13234    {
13235        pub(crate) fn new(
13236            stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
13237        ) -> Self {
13238            Self {
13239                stub,
13240                request: R::default(),
13241                options: crate::RequestOptions::default(),
13242            }
13243        }
13244    }
13245
13246    /// The request builder for [ServingConfigService::update_serving_config][crate::client::ServingConfigService::update_serving_config] calls.
13247    ///
13248    /// # Example
13249    /// ```
13250    /// # use google_cloud_discoveryengine_v1::builder::serving_config_service::UpdateServingConfig;
13251    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
13252    ///
13253    /// let builder = prepare_request_builder();
13254    /// let response = builder.send().await?;
13255    /// # Ok(()) }
13256    ///
13257    /// fn prepare_request_builder() -> UpdateServingConfig {
13258    ///   # panic!();
13259    ///   // ... details omitted ...
13260    /// }
13261    /// ```
13262    #[derive(Clone, Debug)]
13263    pub struct UpdateServingConfig(RequestBuilder<crate::model::UpdateServingConfigRequest>);
13264
13265    impl UpdateServingConfig {
13266        pub(crate) fn new(
13267            stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
13268        ) -> Self {
13269            Self(RequestBuilder::new(stub))
13270        }
13271
13272        /// Sets the full request, replacing any prior values.
13273        pub fn with_request<V: Into<crate::model::UpdateServingConfigRequest>>(
13274            mut self,
13275            v: V,
13276        ) -> Self {
13277            self.0.request = v.into();
13278            self
13279        }
13280
13281        /// Sets all the options, replacing any prior values.
13282        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
13283            self.0.options = v.into();
13284            self
13285        }
13286
13287        /// Sends the request.
13288        pub async fn send(self) -> Result<crate::model::ServingConfig> {
13289            (*self.0.stub)
13290                .update_serving_config(self.0.request, self.0.options)
13291                .await
13292                .map(crate::Response::into_body)
13293        }
13294
13295        /// Sets the value of [serving_config][crate::model::UpdateServingConfigRequest::serving_config].
13296        ///
13297        /// This is a **required** field for requests.
13298        pub fn set_serving_config<T>(mut self, v: T) -> Self
13299        where
13300            T: std::convert::Into<crate::model::ServingConfig>,
13301        {
13302            self.0.request.serving_config = std::option::Option::Some(v.into());
13303            self
13304        }
13305
13306        /// Sets or clears the value of [serving_config][crate::model::UpdateServingConfigRequest::serving_config].
13307        ///
13308        /// This is a **required** field for requests.
13309        pub fn set_or_clear_serving_config<T>(mut self, v: std::option::Option<T>) -> Self
13310        where
13311            T: std::convert::Into<crate::model::ServingConfig>,
13312        {
13313            self.0.request.serving_config = v.map(|x| x.into());
13314            self
13315        }
13316
13317        /// Sets the value of [update_mask][crate::model::UpdateServingConfigRequest::update_mask].
13318        pub fn set_update_mask<T>(mut self, v: T) -> Self
13319        where
13320            T: std::convert::Into<wkt::FieldMask>,
13321        {
13322            self.0.request.update_mask = std::option::Option::Some(v.into());
13323            self
13324        }
13325
13326        /// Sets or clears the value of [update_mask][crate::model::UpdateServingConfigRequest::update_mask].
13327        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
13328        where
13329            T: std::convert::Into<wkt::FieldMask>,
13330        {
13331            self.0.request.update_mask = v.map(|x| x.into());
13332            self
13333        }
13334    }
13335
13336    #[doc(hidden)]
13337    impl crate::RequestBuilder for UpdateServingConfig {
13338        fn request_options(&mut self) -> &mut crate::RequestOptions {
13339            &mut self.0.options
13340        }
13341    }
13342
13343    /// The request builder for [ServingConfigService::list_operations][crate::client::ServingConfigService::list_operations] calls.
13344    ///
13345    /// # Example
13346    /// ```
13347    /// # use google_cloud_discoveryengine_v1::builder::serving_config_service::ListOperations;
13348    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
13349    /// use google_cloud_gax::paginator::ItemPaginator;
13350    ///
13351    /// let builder = prepare_request_builder();
13352    /// let mut items = builder.by_item();
13353    /// while let Some(result) = items.next().await {
13354    ///   let item = result?;
13355    /// }
13356    /// # Ok(()) }
13357    ///
13358    /// fn prepare_request_builder() -> ListOperations {
13359    ///   # panic!();
13360    ///   // ... details omitted ...
13361    /// }
13362    /// ```
13363    #[derive(Clone, Debug)]
13364    pub struct ListOperations(
13365        RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
13366    );
13367
13368    impl ListOperations {
13369        pub(crate) fn new(
13370            stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
13371        ) -> Self {
13372            Self(RequestBuilder::new(stub))
13373        }
13374
13375        /// Sets the full request, replacing any prior values.
13376        pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
13377            mut self,
13378            v: V,
13379        ) -> Self {
13380            self.0.request = v.into();
13381            self
13382        }
13383
13384        /// Sets all the options, replacing any prior values.
13385        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
13386            self.0.options = v.into();
13387            self
13388        }
13389
13390        /// Sends the request.
13391        pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
13392            (*self.0.stub)
13393                .list_operations(self.0.request, self.0.options)
13394                .await
13395                .map(crate::Response::into_body)
13396        }
13397
13398        /// Streams each page in the collection.
13399        pub fn by_page(
13400            self,
13401        ) -> impl google_cloud_gax::paginator::Paginator<
13402            google_cloud_longrunning::model::ListOperationsResponse,
13403            crate::Error,
13404        > {
13405            use std::clone::Clone;
13406            let token = self.0.request.page_token.clone();
13407            let execute = move |token: String| {
13408                let mut builder = self.clone();
13409                builder.0.request = builder.0.request.set_page_token(token);
13410                builder.send()
13411            };
13412            google_cloud_gax::paginator::internal::new_paginator(token, execute)
13413        }
13414
13415        /// Streams each item in the collection.
13416        pub fn by_item(
13417            self,
13418        ) -> impl google_cloud_gax::paginator::ItemPaginator<
13419            google_cloud_longrunning::model::ListOperationsResponse,
13420            crate::Error,
13421        > {
13422            use google_cloud_gax::paginator::Paginator;
13423            self.by_page().items()
13424        }
13425
13426        /// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
13427        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13428            self.0.request.name = v.into();
13429            self
13430        }
13431
13432        /// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::filter].
13433        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
13434            self.0.request.filter = v.into();
13435            self
13436        }
13437
13438        /// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
13439        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
13440            self.0.request.page_size = v.into();
13441            self
13442        }
13443
13444        /// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
13445        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
13446            self.0.request.page_token = v.into();
13447            self
13448        }
13449
13450        /// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
13451        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
13452            self.0.request.return_partial_success = v.into();
13453            self
13454        }
13455    }
13456
13457    #[doc(hidden)]
13458    impl crate::RequestBuilder for ListOperations {
13459        fn request_options(&mut self) -> &mut crate::RequestOptions {
13460            &mut self.0.options
13461        }
13462    }
13463
13464    /// The request builder for [ServingConfigService::get_operation][crate::client::ServingConfigService::get_operation] calls.
13465    ///
13466    /// # Example
13467    /// ```
13468    /// # use google_cloud_discoveryengine_v1::builder::serving_config_service::GetOperation;
13469    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
13470    ///
13471    /// let builder = prepare_request_builder();
13472    /// let response = builder.send().await?;
13473    /// # Ok(()) }
13474    ///
13475    /// fn prepare_request_builder() -> GetOperation {
13476    ///   # panic!();
13477    ///   // ... details omitted ...
13478    /// }
13479    /// ```
13480    #[derive(Clone, Debug)]
13481    pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
13482
13483    impl GetOperation {
13484        pub(crate) fn new(
13485            stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
13486        ) -> Self {
13487            Self(RequestBuilder::new(stub))
13488        }
13489
13490        /// Sets the full request, replacing any prior values.
13491        pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
13492            mut self,
13493            v: V,
13494        ) -> Self {
13495            self.0.request = v.into();
13496            self
13497        }
13498
13499        /// Sets all the options, replacing any prior values.
13500        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
13501            self.0.options = v.into();
13502            self
13503        }
13504
13505        /// Sends the request.
13506        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
13507            (*self.0.stub)
13508                .get_operation(self.0.request, self.0.options)
13509                .await
13510                .map(crate::Response::into_body)
13511        }
13512
13513        /// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
13514        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13515            self.0.request.name = v.into();
13516            self
13517        }
13518    }
13519
13520    #[doc(hidden)]
13521    impl crate::RequestBuilder for GetOperation {
13522        fn request_options(&mut self) -> &mut crate::RequestOptions {
13523            &mut self.0.options
13524        }
13525    }
13526
13527    /// The request builder for [ServingConfigService::cancel_operation][crate::client::ServingConfigService::cancel_operation] calls.
13528    ///
13529    /// # Example
13530    /// ```
13531    /// # use google_cloud_discoveryengine_v1::builder::serving_config_service::CancelOperation;
13532    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
13533    ///
13534    /// let builder = prepare_request_builder();
13535    /// let response = builder.send().await?;
13536    /// # Ok(()) }
13537    ///
13538    /// fn prepare_request_builder() -> CancelOperation {
13539    ///   # panic!();
13540    ///   // ... details omitted ...
13541    /// }
13542    /// ```
13543    #[derive(Clone, Debug)]
13544    pub struct CancelOperation(
13545        RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
13546    );
13547
13548    impl CancelOperation {
13549        pub(crate) fn new(
13550            stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
13551        ) -> Self {
13552            Self(RequestBuilder::new(stub))
13553        }
13554
13555        /// Sets the full request, replacing any prior values.
13556        pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
13557            mut self,
13558            v: V,
13559        ) -> Self {
13560            self.0.request = v.into();
13561            self
13562        }
13563
13564        /// Sets all the options, replacing any prior values.
13565        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
13566            self.0.options = v.into();
13567            self
13568        }
13569
13570        /// Sends the request.
13571        pub async fn send(self) -> Result<()> {
13572            (*self.0.stub)
13573                .cancel_operation(self.0.request, self.0.options)
13574                .await
13575                .map(crate::Response::into_body)
13576        }
13577
13578        /// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::name].
13579        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13580            self.0.request.name = v.into();
13581            self
13582        }
13583    }
13584
13585    #[doc(hidden)]
13586    impl crate::RequestBuilder for CancelOperation {
13587        fn request_options(&mut self) -> &mut crate::RequestOptions {
13588            &mut self.0.options
13589        }
13590    }
13591}
13592
13593/// Request and client builders for [SessionService][crate::client::SessionService].
13594#[cfg(feature = "session-service")]
13595#[cfg_attr(docsrs, doc(cfg(feature = "session-service")))]
13596pub mod session_service {
13597    use crate::Result;
13598
13599    /// A builder for [SessionService][crate::client::SessionService].
13600    ///
13601    /// ```
13602    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
13603    /// # use google_cloud_discoveryengine_v1::*;
13604    /// # use builder::session_service::ClientBuilder;
13605    /// # use client::SessionService;
13606    /// let builder : ClientBuilder = SessionService::builder();
13607    /// let client = builder
13608    ///     .with_endpoint("https://discoveryengine.googleapis.com")
13609    ///     .build().await?;
13610    /// # Ok(()) }
13611    /// ```
13612    pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
13613
13614    pub(crate) mod client {
13615        use super::super::super::client::SessionService;
13616        pub struct Factory;
13617        impl crate::ClientFactory for Factory {
13618            type Client = SessionService;
13619            type Credentials = gaxi::options::Credentials;
13620            async fn build(
13621                self,
13622                config: gaxi::options::ClientConfig,
13623            ) -> crate::ClientBuilderResult<Self::Client> {
13624                Self::Client::new(config).await
13625            }
13626        }
13627    }
13628
13629    /// Common implementation for [crate::client::SessionService] request builders.
13630    #[derive(Clone, Debug)]
13631    pub(crate) struct RequestBuilder<R: std::default::Default> {
13632        stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
13633        request: R,
13634        options: crate::RequestOptions,
13635    }
13636
13637    impl<R> RequestBuilder<R>
13638    where
13639        R: std::default::Default,
13640    {
13641        pub(crate) fn new(
13642            stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
13643        ) -> Self {
13644            Self {
13645                stub,
13646                request: R::default(),
13647                options: crate::RequestOptions::default(),
13648            }
13649        }
13650    }
13651
13652    /// The request builder for [SessionService::create_session][crate::client::SessionService::create_session] calls.
13653    ///
13654    /// # Example
13655    /// ```
13656    /// # use google_cloud_discoveryengine_v1::builder::session_service::CreateSession;
13657    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
13658    ///
13659    /// let builder = prepare_request_builder();
13660    /// let response = builder.send().await?;
13661    /// # Ok(()) }
13662    ///
13663    /// fn prepare_request_builder() -> CreateSession {
13664    ///   # panic!();
13665    ///   // ... details omitted ...
13666    /// }
13667    /// ```
13668    #[derive(Clone, Debug)]
13669    pub struct CreateSession(RequestBuilder<crate::model::CreateSessionRequest>);
13670
13671    impl CreateSession {
13672        pub(crate) fn new(
13673            stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
13674        ) -> Self {
13675            Self(RequestBuilder::new(stub))
13676        }
13677
13678        /// Sets the full request, replacing any prior values.
13679        pub fn with_request<V: Into<crate::model::CreateSessionRequest>>(mut self, v: V) -> Self {
13680            self.0.request = v.into();
13681            self
13682        }
13683
13684        /// Sets all the options, replacing any prior values.
13685        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
13686            self.0.options = v.into();
13687            self
13688        }
13689
13690        /// Sends the request.
13691        pub async fn send(self) -> Result<crate::model::Session> {
13692            (*self.0.stub)
13693                .create_session(self.0.request, self.0.options)
13694                .await
13695                .map(crate::Response::into_body)
13696        }
13697
13698        /// Sets the value of [parent][crate::model::CreateSessionRequest::parent].
13699        ///
13700        /// This is a **required** field for requests.
13701        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
13702            self.0.request.parent = v.into();
13703            self
13704        }
13705
13706        /// Sets the value of [session][crate::model::CreateSessionRequest::session].
13707        ///
13708        /// This is a **required** field for requests.
13709        pub fn set_session<T>(mut self, v: T) -> Self
13710        where
13711            T: std::convert::Into<crate::model::Session>,
13712        {
13713            self.0.request.session = std::option::Option::Some(v.into());
13714            self
13715        }
13716
13717        /// Sets or clears the value of [session][crate::model::CreateSessionRequest::session].
13718        ///
13719        /// This is a **required** field for requests.
13720        pub fn set_or_clear_session<T>(mut self, v: std::option::Option<T>) -> Self
13721        where
13722            T: std::convert::Into<crate::model::Session>,
13723        {
13724            self.0.request.session = v.map(|x| x.into());
13725            self
13726        }
13727    }
13728
13729    #[doc(hidden)]
13730    impl crate::RequestBuilder for CreateSession {
13731        fn request_options(&mut self) -> &mut crate::RequestOptions {
13732            &mut self.0.options
13733        }
13734    }
13735
13736    /// The request builder for [SessionService::delete_session][crate::client::SessionService::delete_session] calls.
13737    ///
13738    /// # Example
13739    /// ```
13740    /// # use google_cloud_discoveryengine_v1::builder::session_service::DeleteSession;
13741    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
13742    ///
13743    /// let builder = prepare_request_builder();
13744    /// let response = builder.send().await?;
13745    /// # Ok(()) }
13746    ///
13747    /// fn prepare_request_builder() -> DeleteSession {
13748    ///   # panic!();
13749    ///   // ... details omitted ...
13750    /// }
13751    /// ```
13752    #[derive(Clone, Debug)]
13753    pub struct DeleteSession(RequestBuilder<crate::model::DeleteSessionRequest>);
13754
13755    impl DeleteSession {
13756        pub(crate) fn new(
13757            stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
13758        ) -> Self {
13759            Self(RequestBuilder::new(stub))
13760        }
13761
13762        /// Sets the full request, replacing any prior values.
13763        pub fn with_request<V: Into<crate::model::DeleteSessionRequest>>(mut self, v: V) -> Self {
13764            self.0.request = v.into();
13765            self
13766        }
13767
13768        /// Sets all the options, replacing any prior values.
13769        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
13770            self.0.options = v.into();
13771            self
13772        }
13773
13774        /// Sends the request.
13775        pub async fn send(self) -> Result<()> {
13776            (*self.0.stub)
13777                .delete_session(self.0.request, self.0.options)
13778                .await
13779                .map(crate::Response::into_body)
13780        }
13781
13782        /// Sets the value of [name][crate::model::DeleteSessionRequest::name].
13783        ///
13784        /// This is a **required** field for requests.
13785        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13786            self.0.request.name = v.into();
13787            self
13788        }
13789    }
13790
13791    #[doc(hidden)]
13792    impl crate::RequestBuilder for DeleteSession {
13793        fn request_options(&mut self) -> &mut crate::RequestOptions {
13794            &mut self.0.options
13795        }
13796    }
13797
13798    /// The request builder for [SessionService::update_session][crate::client::SessionService::update_session] calls.
13799    ///
13800    /// # Example
13801    /// ```
13802    /// # use google_cloud_discoveryengine_v1::builder::session_service::UpdateSession;
13803    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
13804    ///
13805    /// let builder = prepare_request_builder();
13806    /// let response = builder.send().await?;
13807    /// # Ok(()) }
13808    ///
13809    /// fn prepare_request_builder() -> UpdateSession {
13810    ///   # panic!();
13811    ///   // ... details omitted ...
13812    /// }
13813    /// ```
13814    #[derive(Clone, Debug)]
13815    pub struct UpdateSession(RequestBuilder<crate::model::UpdateSessionRequest>);
13816
13817    impl UpdateSession {
13818        pub(crate) fn new(
13819            stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
13820        ) -> Self {
13821            Self(RequestBuilder::new(stub))
13822        }
13823
13824        /// Sets the full request, replacing any prior values.
13825        pub fn with_request<V: Into<crate::model::UpdateSessionRequest>>(mut self, v: V) -> Self {
13826            self.0.request = v.into();
13827            self
13828        }
13829
13830        /// Sets all the options, replacing any prior values.
13831        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
13832            self.0.options = v.into();
13833            self
13834        }
13835
13836        /// Sends the request.
13837        pub async fn send(self) -> Result<crate::model::Session> {
13838            (*self.0.stub)
13839                .update_session(self.0.request, self.0.options)
13840                .await
13841                .map(crate::Response::into_body)
13842        }
13843
13844        /// Sets the value of [session][crate::model::UpdateSessionRequest::session].
13845        ///
13846        /// This is a **required** field for requests.
13847        pub fn set_session<T>(mut self, v: T) -> Self
13848        where
13849            T: std::convert::Into<crate::model::Session>,
13850        {
13851            self.0.request.session = std::option::Option::Some(v.into());
13852            self
13853        }
13854
13855        /// Sets or clears the value of [session][crate::model::UpdateSessionRequest::session].
13856        ///
13857        /// This is a **required** field for requests.
13858        pub fn set_or_clear_session<T>(mut self, v: std::option::Option<T>) -> Self
13859        where
13860            T: std::convert::Into<crate::model::Session>,
13861        {
13862            self.0.request.session = v.map(|x| x.into());
13863            self
13864        }
13865
13866        /// Sets the value of [update_mask][crate::model::UpdateSessionRequest::update_mask].
13867        pub fn set_update_mask<T>(mut self, v: T) -> Self
13868        where
13869            T: std::convert::Into<wkt::FieldMask>,
13870        {
13871            self.0.request.update_mask = std::option::Option::Some(v.into());
13872            self
13873        }
13874
13875        /// Sets or clears the value of [update_mask][crate::model::UpdateSessionRequest::update_mask].
13876        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
13877        where
13878            T: std::convert::Into<wkt::FieldMask>,
13879        {
13880            self.0.request.update_mask = v.map(|x| x.into());
13881            self
13882        }
13883    }
13884
13885    #[doc(hidden)]
13886    impl crate::RequestBuilder for UpdateSession {
13887        fn request_options(&mut self) -> &mut crate::RequestOptions {
13888            &mut self.0.options
13889        }
13890    }
13891
13892    /// The request builder for [SessionService::get_session][crate::client::SessionService::get_session] calls.
13893    ///
13894    /// # Example
13895    /// ```
13896    /// # use google_cloud_discoveryengine_v1::builder::session_service::GetSession;
13897    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
13898    ///
13899    /// let builder = prepare_request_builder();
13900    /// let response = builder.send().await?;
13901    /// # Ok(()) }
13902    ///
13903    /// fn prepare_request_builder() -> GetSession {
13904    ///   # panic!();
13905    ///   // ... details omitted ...
13906    /// }
13907    /// ```
13908    #[derive(Clone, Debug)]
13909    pub struct GetSession(RequestBuilder<crate::model::GetSessionRequest>);
13910
13911    impl GetSession {
13912        pub(crate) fn new(
13913            stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
13914        ) -> Self {
13915            Self(RequestBuilder::new(stub))
13916        }
13917
13918        /// Sets the full request, replacing any prior values.
13919        pub fn with_request<V: Into<crate::model::GetSessionRequest>>(mut self, v: V) -> Self {
13920            self.0.request = v.into();
13921            self
13922        }
13923
13924        /// Sets all the options, replacing any prior values.
13925        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
13926            self.0.options = v.into();
13927            self
13928        }
13929
13930        /// Sends the request.
13931        pub async fn send(self) -> Result<crate::model::Session> {
13932            (*self.0.stub)
13933                .get_session(self.0.request, self.0.options)
13934                .await
13935                .map(crate::Response::into_body)
13936        }
13937
13938        /// Sets the value of [name][crate::model::GetSessionRequest::name].
13939        ///
13940        /// This is a **required** field for requests.
13941        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13942            self.0.request.name = v.into();
13943            self
13944        }
13945
13946        /// Sets the value of [include_answer_details][crate::model::GetSessionRequest::include_answer_details].
13947        pub fn set_include_answer_details<T: Into<bool>>(mut self, v: T) -> Self {
13948            self.0.request.include_answer_details = v.into();
13949            self
13950        }
13951    }
13952
13953    #[doc(hidden)]
13954    impl crate::RequestBuilder for GetSession {
13955        fn request_options(&mut self) -> &mut crate::RequestOptions {
13956            &mut self.0.options
13957        }
13958    }
13959
13960    /// The request builder for [SessionService::list_sessions][crate::client::SessionService::list_sessions] calls.
13961    ///
13962    /// # Example
13963    /// ```
13964    /// # use google_cloud_discoveryengine_v1::builder::session_service::ListSessions;
13965    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
13966    /// use google_cloud_gax::paginator::ItemPaginator;
13967    ///
13968    /// let builder = prepare_request_builder();
13969    /// let mut items = builder.by_item();
13970    /// while let Some(result) = items.next().await {
13971    ///   let item = result?;
13972    /// }
13973    /// # Ok(()) }
13974    ///
13975    /// fn prepare_request_builder() -> ListSessions {
13976    ///   # panic!();
13977    ///   // ... details omitted ...
13978    /// }
13979    /// ```
13980    #[derive(Clone, Debug)]
13981    pub struct ListSessions(RequestBuilder<crate::model::ListSessionsRequest>);
13982
13983    impl ListSessions {
13984        pub(crate) fn new(
13985            stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
13986        ) -> Self {
13987            Self(RequestBuilder::new(stub))
13988        }
13989
13990        /// Sets the full request, replacing any prior values.
13991        pub fn with_request<V: Into<crate::model::ListSessionsRequest>>(mut self, v: V) -> Self {
13992            self.0.request = v.into();
13993            self
13994        }
13995
13996        /// Sets all the options, replacing any prior values.
13997        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
13998            self.0.options = v.into();
13999            self
14000        }
14001
14002        /// Sends the request.
14003        pub async fn send(self) -> Result<crate::model::ListSessionsResponse> {
14004            (*self.0.stub)
14005                .list_sessions(self.0.request, self.0.options)
14006                .await
14007                .map(crate::Response::into_body)
14008        }
14009
14010        /// Streams each page in the collection.
14011        pub fn by_page(
14012            self,
14013        ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListSessionsResponse, crate::Error>
14014        {
14015            use std::clone::Clone;
14016            let token = self.0.request.page_token.clone();
14017            let execute = move |token: String| {
14018                let mut builder = self.clone();
14019                builder.0.request = builder.0.request.set_page_token(token);
14020                builder.send()
14021            };
14022            google_cloud_gax::paginator::internal::new_paginator(token, execute)
14023        }
14024
14025        /// Streams each item in the collection.
14026        pub fn by_item(
14027            self,
14028        ) -> impl google_cloud_gax::paginator::ItemPaginator<
14029            crate::model::ListSessionsResponse,
14030            crate::Error,
14031        > {
14032            use google_cloud_gax::paginator::Paginator;
14033            self.by_page().items()
14034        }
14035
14036        /// Sets the value of [parent][crate::model::ListSessionsRequest::parent].
14037        ///
14038        /// This is a **required** field for requests.
14039        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
14040            self.0.request.parent = v.into();
14041            self
14042        }
14043
14044        /// Sets the value of [page_size][crate::model::ListSessionsRequest::page_size].
14045        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
14046            self.0.request.page_size = v.into();
14047            self
14048        }
14049
14050        /// Sets the value of [page_token][crate::model::ListSessionsRequest::page_token].
14051        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
14052            self.0.request.page_token = v.into();
14053            self
14054        }
14055
14056        /// Sets the value of [filter][crate::model::ListSessionsRequest::filter].
14057        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
14058            self.0.request.filter = v.into();
14059            self
14060        }
14061
14062        /// Sets the value of [order_by][crate::model::ListSessionsRequest::order_by].
14063        pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
14064            self.0.request.order_by = v.into();
14065            self
14066        }
14067    }
14068
14069    #[doc(hidden)]
14070    impl crate::RequestBuilder for ListSessions {
14071        fn request_options(&mut self) -> &mut crate::RequestOptions {
14072            &mut self.0.options
14073        }
14074    }
14075
14076    /// The request builder for [SessionService::list_operations][crate::client::SessionService::list_operations] calls.
14077    ///
14078    /// # Example
14079    /// ```
14080    /// # use google_cloud_discoveryengine_v1::builder::session_service::ListOperations;
14081    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
14082    /// use google_cloud_gax::paginator::ItemPaginator;
14083    ///
14084    /// let builder = prepare_request_builder();
14085    /// let mut items = builder.by_item();
14086    /// while let Some(result) = items.next().await {
14087    ///   let item = result?;
14088    /// }
14089    /// # Ok(()) }
14090    ///
14091    /// fn prepare_request_builder() -> ListOperations {
14092    ///   # panic!();
14093    ///   // ... details omitted ...
14094    /// }
14095    /// ```
14096    #[derive(Clone, Debug)]
14097    pub struct ListOperations(
14098        RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
14099    );
14100
14101    impl ListOperations {
14102        pub(crate) fn new(
14103            stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
14104        ) -> Self {
14105            Self(RequestBuilder::new(stub))
14106        }
14107
14108        /// Sets the full request, replacing any prior values.
14109        pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
14110            mut self,
14111            v: V,
14112        ) -> Self {
14113            self.0.request = v.into();
14114            self
14115        }
14116
14117        /// Sets all the options, replacing any prior values.
14118        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
14119            self.0.options = v.into();
14120            self
14121        }
14122
14123        /// Sends the request.
14124        pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
14125            (*self.0.stub)
14126                .list_operations(self.0.request, self.0.options)
14127                .await
14128                .map(crate::Response::into_body)
14129        }
14130
14131        /// Streams each page in the collection.
14132        pub fn by_page(
14133            self,
14134        ) -> impl google_cloud_gax::paginator::Paginator<
14135            google_cloud_longrunning::model::ListOperationsResponse,
14136            crate::Error,
14137        > {
14138            use std::clone::Clone;
14139            let token = self.0.request.page_token.clone();
14140            let execute = move |token: String| {
14141                let mut builder = self.clone();
14142                builder.0.request = builder.0.request.set_page_token(token);
14143                builder.send()
14144            };
14145            google_cloud_gax::paginator::internal::new_paginator(token, execute)
14146        }
14147
14148        /// Streams each item in the collection.
14149        pub fn by_item(
14150            self,
14151        ) -> impl google_cloud_gax::paginator::ItemPaginator<
14152            google_cloud_longrunning::model::ListOperationsResponse,
14153            crate::Error,
14154        > {
14155            use google_cloud_gax::paginator::Paginator;
14156            self.by_page().items()
14157        }
14158
14159        /// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
14160        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
14161            self.0.request.name = v.into();
14162            self
14163        }
14164
14165        /// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::filter].
14166        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
14167            self.0.request.filter = v.into();
14168            self
14169        }
14170
14171        /// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
14172        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
14173            self.0.request.page_size = v.into();
14174            self
14175        }
14176
14177        /// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
14178        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
14179            self.0.request.page_token = v.into();
14180            self
14181        }
14182
14183        /// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
14184        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
14185            self.0.request.return_partial_success = v.into();
14186            self
14187        }
14188    }
14189
14190    #[doc(hidden)]
14191    impl crate::RequestBuilder for ListOperations {
14192        fn request_options(&mut self) -> &mut crate::RequestOptions {
14193            &mut self.0.options
14194        }
14195    }
14196
14197    /// The request builder for [SessionService::get_operation][crate::client::SessionService::get_operation] calls.
14198    ///
14199    /// # Example
14200    /// ```
14201    /// # use google_cloud_discoveryengine_v1::builder::session_service::GetOperation;
14202    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
14203    ///
14204    /// let builder = prepare_request_builder();
14205    /// let response = builder.send().await?;
14206    /// # Ok(()) }
14207    ///
14208    /// fn prepare_request_builder() -> GetOperation {
14209    ///   # panic!();
14210    ///   // ... details omitted ...
14211    /// }
14212    /// ```
14213    #[derive(Clone, Debug)]
14214    pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
14215
14216    impl GetOperation {
14217        pub(crate) fn new(
14218            stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
14219        ) -> Self {
14220            Self(RequestBuilder::new(stub))
14221        }
14222
14223        /// Sets the full request, replacing any prior values.
14224        pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
14225            mut self,
14226            v: V,
14227        ) -> Self {
14228            self.0.request = v.into();
14229            self
14230        }
14231
14232        /// Sets all the options, replacing any prior values.
14233        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
14234            self.0.options = v.into();
14235            self
14236        }
14237
14238        /// Sends the request.
14239        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
14240            (*self.0.stub)
14241                .get_operation(self.0.request, self.0.options)
14242                .await
14243                .map(crate::Response::into_body)
14244        }
14245
14246        /// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
14247        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
14248            self.0.request.name = v.into();
14249            self
14250        }
14251    }
14252
14253    #[doc(hidden)]
14254    impl crate::RequestBuilder for GetOperation {
14255        fn request_options(&mut self) -> &mut crate::RequestOptions {
14256            &mut self.0.options
14257        }
14258    }
14259
14260    /// The request builder for [SessionService::cancel_operation][crate::client::SessionService::cancel_operation] calls.
14261    ///
14262    /// # Example
14263    /// ```
14264    /// # use google_cloud_discoveryengine_v1::builder::session_service::CancelOperation;
14265    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
14266    ///
14267    /// let builder = prepare_request_builder();
14268    /// let response = builder.send().await?;
14269    /// # Ok(()) }
14270    ///
14271    /// fn prepare_request_builder() -> CancelOperation {
14272    ///   # panic!();
14273    ///   // ... details omitted ...
14274    /// }
14275    /// ```
14276    #[derive(Clone, Debug)]
14277    pub struct CancelOperation(
14278        RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
14279    );
14280
14281    impl CancelOperation {
14282        pub(crate) fn new(
14283            stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
14284        ) -> Self {
14285            Self(RequestBuilder::new(stub))
14286        }
14287
14288        /// Sets the full request, replacing any prior values.
14289        pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
14290            mut self,
14291            v: V,
14292        ) -> Self {
14293            self.0.request = v.into();
14294            self
14295        }
14296
14297        /// Sets all the options, replacing any prior values.
14298        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
14299            self.0.options = v.into();
14300            self
14301        }
14302
14303        /// Sends the request.
14304        pub async fn send(self) -> Result<()> {
14305            (*self.0.stub)
14306                .cancel_operation(self.0.request, self.0.options)
14307                .await
14308                .map(crate::Response::into_body)
14309        }
14310
14311        /// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::name].
14312        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
14313            self.0.request.name = v.into();
14314            self
14315        }
14316    }
14317
14318    #[doc(hidden)]
14319    impl crate::RequestBuilder for CancelOperation {
14320        fn request_options(&mut self) -> &mut crate::RequestOptions {
14321            &mut self.0.options
14322        }
14323    }
14324}
14325
14326/// Request and client builders for [SiteSearchEngineService][crate::client::SiteSearchEngineService].
14327#[cfg(feature = "site-search-engine-service")]
14328#[cfg_attr(docsrs, doc(cfg(feature = "site-search-engine-service")))]
14329pub mod site_search_engine_service {
14330    use crate::Result;
14331
14332    /// A builder for [SiteSearchEngineService][crate::client::SiteSearchEngineService].
14333    ///
14334    /// ```
14335    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
14336    /// # use google_cloud_discoveryengine_v1::*;
14337    /// # use builder::site_search_engine_service::ClientBuilder;
14338    /// # use client::SiteSearchEngineService;
14339    /// let builder : ClientBuilder = SiteSearchEngineService::builder();
14340    /// let client = builder
14341    ///     .with_endpoint("https://discoveryengine.googleapis.com")
14342    ///     .build().await?;
14343    /// # Ok(()) }
14344    /// ```
14345    pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
14346
14347    pub(crate) mod client {
14348        use super::super::super::client::SiteSearchEngineService;
14349        pub struct Factory;
14350        impl crate::ClientFactory for Factory {
14351            type Client = SiteSearchEngineService;
14352            type Credentials = gaxi::options::Credentials;
14353            async fn build(
14354                self,
14355                config: gaxi::options::ClientConfig,
14356            ) -> crate::ClientBuilderResult<Self::Client> {
14357                Self::Client::new(config).await
14358            }
14359        }
14360    }
14361
14362    /// Common implementation for [crate::client::SiteSearchEngineService] request builders.
14363    #[derive(Clone, Debug)]
14364    pub(crate) struct RequestBuilder<R: std::default::Default> {
14365        stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14366        request: R,
14367        options: crate::RequestOptions,
14368    }
14369
14370    impl<R> RequestBuilder<R>
14371    where
14372        R: std::default::Default,
14373    {
14374        pub(crate) fn new(
14375            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14376        ) -> Self {
14377            Self {
14378                stub,
14379                request: R::default(),
14380                options: crate::RequestOptions::default(),
14381            }
14382        }
14383    }
14384
14385    /// The request builder for [SiteSearchEngineService::get_site_search_engine][crate::client::SiteSearchEngineService::get_site_search_engine] calls.
14386    ///
14387    /// # Example
14388    /// ```
14389    /// # use google_cloud_discoveryengine_v1::builder::site_search_engine_service::GetSiteSearchEngine;
14390    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
14391    ///
14392    /// let builder = prepare_request_builder();
14393    /// let response = builder.send().await?;
14394    /// # Ok(()) }
14395    ///
14396    /// fn prepare_request_builder() -> GetSiteSearchEngine {
14397    ///   # panic!();
14398    ///   // ... details omitted ...
14399    /// }
14400    /// ```
14401    #[derive(Clone, Debug)]
14402    pub struct GetSiteSearchEngine(RequestBuilder<crate::model::GetSiteSearchEngineRequest>);
14403
14404    impl GetSiteSearchEngine {
14405        pub(crate) fn new(
14406            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14407        ) -> Self {
14408            Self(RequestBuilder::new(stub))
14409        }
14410
14411        /// Sets the full request, replacing any prior values.
14412        pub fn with_request<V: Into<crate::model::GetSiteSearchEngineRequest>>(
14413            mut self,
14414            v: V,
14415        ) -> Self {
14416            self.0.request = v.into();
14417            self
14418        }
14419
14420        /// Sets all the options, replacing any prior values.
14421        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
14422            self.0.options = v.into();
14423            self
14424        }
14425
14426        /// Sends the request.
14427        pub async fn send(self) -> Result<crate::model::SiteSearchEngine> {
14428            (*self.0.stub)
14429                .get_site_search_engine(self.0.request, self.0.options)
14430                .await
14431                .map(crate::Response::into_body)
14432        }
14433
14434        /// Sets the value of [name][crate::model::GetSiteSearchEngineRequest::name].
14435        ///
14436        /// This is a **required** field for requests.
14437        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
14438            self.0.request.name = v.into();
14439            self
14440        }
14441    }
14442
14443    #[doc(hidden)]
14444    impl crate::RequestBuilder for GetSiteSearchEngine {
14445        fn request_options(&mut self) -> &mut crate::RequestOptions {
14446            &mut self.0.options
14447        }
14448    }
14449
14450    /// The request builder for [SiteSearchEngineService::create_target_site][crate::client::SiteSearchEngineService::create_target_site] calls.
14451    ///
14452    /// # Example
14453    /// ```
14454    /// # use google_cloud_discoveryengine_v1::builder::site_search_engine_service::CreateTargetSite;
14455    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
14456    /// use google_cloud_lro::Poller;
14457    ///
14458    /// let builder = prepare_request_builder();
14459    /// let response = builder.poller().until_done().await?;
14460    /// # Ok(()) }
14461    ///
14462    /// fn prepare_request_builder() -> CreateTargetSite {
14463    ///   # panic!();
14464    ///   // ... details omitted ...
14465    /// }
14466    /// ```
14467    #[derive(Clone, Debug)]
14468    pub struct CreateTargetSite(RequestBuilder<crate::model::CreateTargetSiteRequest>);
14469
14470    impl CreateTargetSite {
14471        pub(crate) fn new(
14472            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14473        ) -> Self {
14474            Self(RequestBuilder::new(stub))
14475        }
14476
14477        /// Sets the full request, replacing any prior values.
14478        pub fn with_request<V: Into<crate::model::CreateTargetSiteRequest>>(
14479            mut self,
14480            v: V,
14481        ) -> Self {
14482            self.0.request = v.into();
14483            self
14484        }
14485
14486        /// Sets all the options, replacing any prior values.
14487        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
14488            self.0.options = v.into();
14489            self
14490        }
14491
14492        /// Sends the request.
14493        ///
14494        /// # Long running operations
14495        ///
14496        /// This starts, but does not poll, a longrunning operation. More information
14497        /// on [create_target_site][crate::client::SiteSearchEngineService::create_target_site].
14498        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
14499            (*self.0.stub)
14500                .create_target_site(self.0.request, self.0.options)
14501                .await
14502                .map(crate::Response::into_body)
14503        }
14504
14505        /// Creates a [Poller][google_cloud_lro::Poller] to work with `create_target_site`.
14506        pub fn poller(
14507            self,
14508        ) -> impl google_cloud_lro::Poller<
14509            crate::model::TargetSite,
14510            crate::model::CreateTargetSiteMetadata,
14511        > {
14512            type Operation = google_cloud_lro::internal::Operation<
14513                crate::model::TargetSite,
14514                crate::model::CreateTargetSiteMetadata,
14515            >;
14516            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
14517            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
14518            let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
14519            if let Some(ref mut details) = poller_options.tracing {
14520                details.method_name = "google_cloud_discoveryengine_v1::client::SiteSearchEngineService::create_target_site::until_done";
14521            }
14522
14523            let stub = self.0.stub.clone();
14524            let mut options = self.0.options.clone();
14525            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
14526            let query = move |name| {
14527                let stub = stub.clone();
14528                let options = options.clone();
14529                async {
14530                    let op = GetOperation::new(stub)
14531                        .set_name(name)
14532                        .with_options(options)
14533                        .send()
14534                        .await?;
14535                    Ok(Operation::new(op))
14536                }
14537            };
14538
14539            let start = move || async {
14540                let op = self.send().await?;
14541                Ok(Operation::new(op))
14542            };
14543
14544            use google_cloud_lro::internal::PollerExt;
14545            {
14546                google_cloud_lro::internal::new_poller(
14547                    polling_error_policy,
14548                    polling_backoff_policy,
14549                    start,
14550                    query,
14551                )
14552            }
14553            .with_options(poller_options)
14554        }
14555
14556        /// Sets the value of [parent][crate::model::CreateTargetSiteRequest::parent].
14557        ///
14558        /// This is a **required** field for requests.
14559        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
14560            self.0.request.parent = v.into();
14561            self
14562        }
14563
14564        /// Sets the value of [target_site][crate::model::CreateTargetSiteRequest::target_site].
14565        ///
14566        /// This is a **required** field for requests.
14567        pub fn set_target_site<T>(mut self, v: T) -> Self
14568        where
14569            T: std::convert::Into<crate::model::TargetSite>,
14570        {
14571            self.0.request.target_site = std::option::Option::Some(v.into());
14572            self
14573        }
14574
14575        /// Sets or clears the value of [target_site][crate::model::CreateTargetSiteRequest::target_site].
14576        ///
14577        /// This is a **required** field for requests.
14578        pub fn set_or_clear_target_site<T>(mut self, v: std::option::Option<T>) -> Self
14579        where
14580            T: std::convert::Into<crate::model::TargetSite>,
14581        {
14582            self.0.request.target_site = v.map(|x| x.into());
14583            self
14584        }
14585    }
14586
14587    #[doc(hidden)]
14588    impl crate::RequestBuilder for CreateTargetSite {
14589        fn request_options(&mut self) -> &mut crate::RequestOptions {
14590            &mut self.0.options
14591        }
14592    }
14593
14594    /// The request builder for [SiteSearchEngineService::batch_create_target_sites][crate::client::SiteSearchEngineService::batch_create_target_sites] calls.
14595    ///
14596    /// # Example
14597    /// ```
14598    /// # use google_cloud_discoveryengine_v1::builder::site_search_engine_service::BatchCreateTargetSites;
14599    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
14600    /// use google_cloud_lro::Poller;
14601    ///
14602    /// let builder = prepare_request_builder();
14603    /// let response = builder.poller().until_done().await?;
14604    /// # Ok(()) }
14605    ///
14606    /// fn prepare_request_builder() -> BatchCreateTargetSites {
14607    ///   # panic!();
14608    ///   // ... details omitted ...
14609    /// }
14610    /// ```
14611    #[derive(Clone, Debug)]
14612    pub struct BatchCreateTargetSites(RequestBuilder<crate::model::BatchCreateTargetSitesRequest>);
14613
14614    impl BatchCreateTargetSites {
14615        pub(crate) fn new(
14616            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14617        ) -> Self {
14618            Self(RequestBuilder::new(stub))
14619        }
14620
14621        /// Sets the full request, replacing any prior values.
14622        pub fn with_request<V: Into<crate::model::BatchCreateTargetSitesRequest>>(
14623            mut self,
14624            v: V,
14625        ) -> Self {
14626            self.0.request = v.into();
14627            self
14628        }
14629
14630        /// Sets all the options, replacing any prior values.
14631        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
14632            self.0.options = v.into();
14633            self
14634        }
14635
14636        /// Sends the request.
14637        ///
14638        /// # Long running operations
14639        ///
14640        /// This starts, but does not poll, a longrunning operation. More information
14641        /// on [batch_create_target_sites][crate::client::SiteSearchEngineService::batch_create_target_sites].
14642        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
14643            (*self.0.stub)
14644                .batch_create_target_sites(self.0.request, self.0.options)
14645                .await
14646                .map(crate::Response::into_body)
14647        }
14648
14649        /// Creates a [Poller][google_cloud_lro::Poller] to work with `batch_create_target_sites`.
14650        pub fn poller(
14651            self,
14652        ) -> impl google_cloud_lro::Poller<
14653            crate::model::BatchCreateTargetSitesResponse,
14654            crate::model::BatchCreateTargetSiteMetadata,
14655        > {
14656            type Operation = google_cloud_lro::internal::Operation<
14657                crate::model::BatchCreateTargetSitesResponse,
14658                crate::model::BatchCreateTargetSiteMetadata,
14659            >;
14660            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
14661            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
14662            let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
14663            if let Some(ref mut details) = poller_options.tracing {
14664                details.method_name = "google_cloud_discoveryengine_v1::client::SiteSearchEngineService::batch_create_target_sites::until_done";
14665            }
14666
14667            let stub = self.0.stub.clone();
14668            let mut options = self.0.options.clone();
14669            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
14670            let query = move |name| {
14671                let stub = stub.clone();
14672                let options = options.clone();
14673                async {
14674                    let op = GetOperation::new(stub)
14675                        .set_name(name)
14676                        .with_options(options)
14677                        .send()
14678                        .await?;
14679                    Ok(Operation::new(op))
14680                }
14681            };
14682
14683            let start = move || async {
14684                let op = self.send().await?;
14685                Ok(Operation::new(op))
14686            };
14687
14688            use google_cloud_lro::internal::PollerExt;
14689            {
14690                google_cloud_lro::internal::new_poller(
14691                    polling_error_policy,
14692                    polling_backoff_policy,
14693                    start,
14694                    query,
14695                )
14696            }
14697            .with_options(poller_options)
14698        }
14699
14700        /// Sets the value of [parent][crate::model::BatchCreateTargetSitesRequest::parent].
14701        ///
14702        /// This is a **required** field for requests.
14703        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
14704            self.0.request.parent = v.into();
14705            self
14706        }
14707
14708        /// Sets the value of [requests][crate::model::BatchCreateTargetSitesRequest::requests].
14709        ///
14710        /// This is a **required** field for requests.
14711        pub fn set_requests<T, V>(mut self, v: T) -> Self
14712        where
14713            T: std::iter::IntoIterator<Item = V>,
14714            V: std::convert::Into<crate::model::CreateTargetSiteRequest>,
14715        {
14716            use std::iter::Iterator;
14717            self.0.request.requests = v.into_iter().map(|i| i.into()).collect();
14718            self
14719        }
14720    }
14721
14722    #[doc(hidden)]
14723    impl crate::RequestBuilder for BatchCreateTargetSites {
14724        fn request_options(&mut self) -> &mut crate::RequestOptions {
14725            &mut self.0.options
14726        }
14727    }
14728
14729    /// The request builder for [SiteSearchEngineService::get_target_site][crate::client::SiteSearchEngineService::get_target_site] calls.
14730    ///
14731    /// # Example
14732    /// ```
14733    /// # use google_cloud_discoveryengine_v1::builder::site_search_engine_service::GetTargetSite;
14734    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
14735    ///
14736    /// let builder = prepare_request_builder();
14737    /// let response = builder.send().await?;
14738    /// # Ok(()) }
14739    ///
14740    /// fn prepare_request_builder() -> GetTargetSite {
14741    ///   # panic!();
14742    ///   // ... details omitted ...
14743    /// }
14744    /// ```
14745    #[derive(Clone, Debug)]
14746    pub struct GetTargetSite(RequestBuilder<crate::model::GetTargetSiteRequest>);
14747
14748    impl GetTargetSite {
14749        pub(crate) fn new(
14750            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14751        ) -> Self {
14752            Self(RequestBuilder::new(stub))
14753        }
14754
14755        /// Sets the full request, replacing any prior values.
14756        pub fn with_request<V: Into<crate::model::GetTargetSiteRequest>>(mut self, v: V) -> Self {
14757            self.0.request = v.into();
14758            self
14759        }
14760
14761        /// Sets all the options, replacing any prior values.
14762        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
14763            self.0.options = v.into();
14764            self
14765        }
14766
14767        /// Sends the request.
14768        pub async fn send(self) -> Result<crate::model::TargetSite> {
14769            (*self.0.stub)
14770                .get_target_site(self.0.request, self.0.options)
14771                .await
14772                .map(crate::Response::into_body)
14773        }
14774
14775        /// Sets the value of [name][crate::model::GetTargetSiteRequest::name].
14776        ///
14777        /// This is a **required** field for requests.
14778        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
14779            self.0.request.name = v.into();
14780            self
14781        }
14782    }
14783
14784    #[doc(hidden)]
14785    impl crate::RequestBuilder for GetTargetSite {
14786        fn request_options(&mut self) -> &mut crate::RequestOptions {
14787            &mut self.0.options
14788        }
14789    }
14790
14791    /// The request builder for [SiteSearchEngineService::update_target_site][crate::client::SiteSearchEngineService::update_target_site] calls.
14792    ///
14793    /// # Example
14794    /// ```
14795    /// # use google_cloud_discoveryengine_v1::builder::site_search_engine_service::UpdateTargetSite;
14796    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
14797    /// use google_cloud_lro::Poller;
14798    ///
14799    /// let builder = prepare_request_builder();
14800    /// let response = builder.poller().until_done().await?;
14801    /// # Ok(()) }
14802    ///
14803    /// fn prepare_request_builder() -> UpdateTargetSite {
14804    ///   # panic!();
14805    ///   // ... details omitted ...
14806    /// }
14807    /// ```
14808    #[derive(Clone, Debug)]
14809    pub struct UpdateTargetSite(RequestBuilder<crate::model::UpdateTargetSiteRequest>);
14810
14811    impl UpdateTargetSite {
14812        pub(crate) fn new(
14813            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14814        ) -> Self {
14815            Self(RequestBuilder::new(stub))
14816        }
14817
14818        /// Sets the full request, replacing any prior values.
14819        pub fn with_request<V: Into<crate::model::UpdateTargetSiteRequest>>(
14820            mut self,
14821            v: V,
14822        ) -> Self {
14823            self.0.request = v.into();
14824            self
14825        }
14826
14827        /// Sets all the options, replacing any prior values.
14828        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
14829            self.0.options = v.into();
14830            self
14831        }
14832
14833        /// Sends the request.
14834        ///
14835        /// # Long running operations
14836        ///
14837        /// This starts, but does not poll, a longrunning operation. More information
14838        /// on [update_target_site][crate::client::SiteSearchEngineService::update_target_site].
14839        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
14840            (*self.0.stub)
14841                .update_target_site(self.0.request, self.0.options)
14842                .await
14843                .map(crate::Response::into_body)
14844        }
14845
14846        /// Creates a [Poller][google_cloud_lro::Poller] to work with `update_target_site`.
14847        pub fn poller(
14848            self,
14849        ) -> impl google_cloud_lro::Poller<
14850            crate::model::TargetSite,
14851            crate::model::UpdateTargetSiteMetadata,
14852        > {
14853            type Operation = google_cloud_lro::internal::Operation<
14854                crate::model::TargetSite,
14855                crate::model::UpdateTargetSiteMetadata,
14856            >;
14857            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
14858            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
14859            let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
14860            if let Some(ref mut details) = poller_options.tracing {
14861                details.method_name = "google_cloud_discoveryengine_v1::client::SiteSearchEngineService::update_target_site::until_done";
14862            }
14863
14864            let stub = self.0.stub.clone();
14865            let mut options = self.0.options.clone();
14866            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
14867            let query = move |name| {
14868                let stub = stub.clone();
14869                let options = options.clone();
14870                async {
14871                    let op = GetOperation::new(stub)
14872                        .set_name(name)
14873                        .with_options(options)
14874                        .send()
14875                        .await?;
14876                    Ok(Operation::new(op))
14877                }
14878            };
14879
14880            let start = move || async {
14881                let op = self.send().await?;
14882                Ok(Operation::new(op))
14883            };
14884
14885            use google_cloud_lro::internal::PollerExt;
14886            {
14887                google_cloud_lro::internal::new_poller(
14888                    polling_error_policy,
14889                    polling_backoff_policy,
14890                    start,
14891                    query,
14892                )
14893            }
14894            .with_options(poller_options)
14895        }
14896
14897        /// Sets the value of [target_site][crate::model::UpdateTargetSiteRequest::target_site].
14898        ///
14899        /// This is a **required** field for requests.
14900        pub fn set_target_site<T>(mut self, v: T) -> Self
14901        where
14902            T: std::convert::Into<crate::model::TargetSite>,
14903        {
14904            self.0.request.target_site = std::option::Option::Some(v.into());
14905            self
14906        }
14907
14908        /// Sets or clears the value of [target_site][crate::model::UpdateTargetSiteRequest::target_site].
14909        ///
14910        /// This is a **required** field for requests.
14911        pub fn set_or_clear_target_site<T>(mut self, v: std::option::Option<T>) -> Self
14912        where
14913            T: std::convert::Into<crate::model::TargetSite>,
14914        {
14915            self.0.request.target_site = v.map(|x| x.into());
14916            self
14917        }
14918    }
14919
14920    #[doc(hidden)]
14921    impl crate::RequestBuilder for UpdateTargetSite {
14922        fn request_options(&mut self) -> &mut crate::RequestOptions {
14923            &mut self.0.options
14924        }
14925    }
14926
14927    /// The request builder for [SiteSearchEngineService::delete_target_site][crate::client::SiteSearchEngineService::delete_target_site] calls.
14928    ///
14929    /// # Example
14930    /// ```
14931    /// # use google_cloud_discoveryengine_v1::builder::site_search_engine_service::DeleteTargetSite;
14932    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
14933    /// use google_cloud_lro::Poller;
14934    ///
14935    /// let builder = prepare_request_builder();
14936    /// let response = builder.poller().until_done().await?;
14937    /// # Ok(()) }
14938    ///
14939    /// fn prepare_request_builder() -> DeleteTargetSite {
14940    ///   # panic!();
14941    ///   // ... details omitted ...
14942    /// }
14943    /// ```
14944    #[derive(Clone, Debug)]
14945    pub struct DeleteTargetSite(RequestBuilder<crate::model::DeleteTargetSiteRequest>);
14946
14947    impl DeleteTargetSite {
14948        pub(crate) fn new(
14949            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14950        ) -> Self {
14951            Self(RequestBuilder::new(stub))
14952        }
14953
14954        /// Sets the full request, replacing any prior values.
14955        pub fn with_request<V: Into<crate::model::DeleteTargetSiteRequest>>(
14956            mut self,
14957            v: V,
14958        ) -> Self {
14959            self.0.request = v.into();
14960            self
14961        }
14962
14963        /// Sets all the options, replacing any prior values.
14964        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
14965            self.0.options = v.into();
14966            self
14967        }
14968
14969        /// Sends the request.
14970        ///
14971        /// # Long running operations
14972        ///
14973        /// This starts, but does not poll, a longrunning operation. More information
14974        /// on [delete_target_site][crate::client::SiteSearchEngineService::delete_target_site].
14975        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
14976            (*self.0.stub)
14977                .delete_target_site(self.0.request, self.0.options)
14978                .await
14979                .map(crate::Response::into_body)
14980        }
14981
14982        /// Creates a [Poller][google_cloud_lro::Poller] to work with `delete_target_site`.
14983        pub fn poller(
14984            self,
14985        ) -> impl google_cloud_lro::Poller<(), crate::model::DeleteTargetSiteMetadata> {
14986            type Operation = google_cloud_lro::internal::Operation<
14987                wkt::Empty,
14988                crate::model::DeleteTargetSiteMetadata,
14989            >;
14990            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
14991            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
14992            let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
14993            if let Some(ref mut details) = poller_options.tracing {
14994                details.method_name = "google_cloud_discoveryengine_v1::client::SiteSearchEngineService::delete_target_site::until_done";
14995            }
14996
14997            let stub = self.0.stub.clone();
14998            let mut options = self.0.options.clone();
14999            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
15000            let query = move |name| {
15001                let stub = stub.clone();
15002                let options = options.clone();
15003                async {
15004                    let op = GetOperation::new(stub)
15005                        .set_name(name)
15006                        .with_options(options)
15007                        .send()
15008                        .await?;
15009                    Ok(Operation::new(op))
15010                }
15011            };
15012
15013            let start = move || async {
15014                let op = self.send().await?;
15015                Ok(Operation::new(op))
15016            };
15017
15018            use google_cloud_lro::internal::PollerExt;
15019            {
15020                google_cloud_lro::internal::new_unit_response_poller(
15021                    polling_error_policy,
15022                    polling_backoff_policy,
15023                    start,
15024                    query,
15025                )
15026            }
15027            .with_options(poller_options)
15028        }
15029
15030        /// Sets the value of [name][crate::model::DeleteTargetSiteRequest::name].
15031        ///
15032        /// This is a **required** field for requests.
15033        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
15034            self.0.request.name = v.into();
15035            self
15036        }
15037    }
15038
15039    #[doc(hidden)]
15040    impl crate::RequestBuilder for DeleteTargetSite {
15041        fn request_options(&mut self) -> &mut crate::RequestOptions {
15042            &mut self.0.options
15043        }
15044    }
15045
15046    /// The request builder for [SiteSearchEngineService::list_target_sites][crate::client::SiteSearchEngineService::list_target_sites] calls.
15047    ///
15048    /// # Example
15049    /// ```
15050    /// # use google_cloud_discoveryengine_v1::builder::site_search_engine_service::ListTargetSites;
15051    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
15052    /// use google_cloud_gax::paginator::ItemPaginator;
15053    ///
15054    /// let builder = prepare_request_builder();
15055    /// let mut items = builder.by_item();
15056    /// while let Some(result) = items.next().await {
15057    ///   let item = result?;
15058    /// }
15059    /// # Ok(()) }
15060    ///
15061    /// fn prepare_request_builder() -> ListTargetSites {
15062    ///   # panic!();
15063    ///   // ... details omitted ...
15064    /// }
15065    /// ```
15066    #[derive(Clone, Debug)]
15067    pub struct ListTargetSites(RequestBuilder<crate::model::ListTargetSitesRequest>);
15068
15069    impl ListTargetSites {
15070        pub(crate) fn new(
15071            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
15072        ) -> Self {
15073            Self(RequestBuilder::new(stub))
15074        }
15075
15076        /// Sets the full request, replacing any prior values.
15077        pub fn with_request<V: Into<crate::model::ListTargetSitesRequest>>(mut self, v: V) -> Self {
15078            self.0.request = v.into();
15079            self
15080        }
15081
15082        /// Sets all the options, replacing any prior values.
15083        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
15084            self.0.options = v.into();
15085            self
15086        }
15087
15088        /// Sends the request.
15089        pub async fn send(self) -> Result<crate::model::ListTargetSitesResponse> {
15090            (*self.0.stub)
15091                .list_target_sites(self.0.request, self.0.options)
15092                .await
15093                .map(crate::Response::into_body)
15094        }
15095
15096        /// Streams each page in the collection.
15097        pub fn by_page(
15098            self,
15099        ) -> impl google_cloud_gax::paginator::Paginator<
15100            crate::model::ListTargetSitesResponse,
15101            crate::Error,
15102        > {
15103            use std::clone::Clone;
15104            let token = self.0.request.page_token.clone();
15105            let execute = move |token: String| {
15106                let mut builder = self.clone();
15107                builder.0.request = builder.0.request.set_page_token(token);
15108                builder.send()
15109            };
15110            google_cloud_gax::paginator::internal::new_paginator(token, execute)
15111        }
15112
15113        /// Streams each item in the collection.
15114        pub fn by_item(
15115            self,
15116        ) -> impl google_cloud_gax::paginator::ItemPaginator<
15117            crate::model::ListTargetSitesResponse,
15118            crate::Error,
15119        > {
15120            use google_cloud_gax::paginator::Paginator;
15121            self.by_page().items()
15122        }
15123
15124        /// Sets the value of [parent][crate::model::ListTargetSitesRequest::parent].
15125        ///
15126        /// This is a **required** field for requests.
15127        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
15128            self.0.request.parent = v.into();
15129            self
15130        }
15131
15132        /// Sets the value of [page_size][crate::model::ListTargetSitesRequest::page_size].
15133        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
15134            self.0.request.page_size = v.into();
15135            self
15136        }
15137
15138        /// Sets the value of [page_token][crate::model::ListTargetSitesRequest::page_token].
15139        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
15140            self.0.request.page_token = v.into();
15141            self
15142        }
15143    }
15144
15145    #[doc(hidden)]
15146    impl crate::RequestBuilder for ListTargetSites {
15147        fn request_options(&mut self) -> &mut crate::RequestOptions {
15148            &mut self.0.options
15149        }
15150    }
15151
15152    /// The request builder for [SiteSearchEngineService::create_sitemap][crate::client::SiteSearchEngineService::create_sitemap] calls.
15153    ///
15154    /// # Example
15155    /// ```
15156    /// # use google_cloud_discoveryengine_v1::builder::site_search_engine_service::CreateSitemap;
15157    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
15158    /// use google_cloud_lro::Poller;
15159    ///
15160    /// let builder = prepare_request_builder();
15161    /// let response = builder.poller().until_done().await?;
15162    /// # Ok(()) }
15163    ///
15164    /// fn prepare_request_builder() -> CreateSitemap {
15165    ///   # panic!();
15166    ///   // ... details omitted ...
15167    /// }
15168    /// ```
15169    #[derive(Clone, Debug)]
15170    pub struct CreateSitemap(RequestBuilder<crate::model::CreateSitemapRequest>);
15171
15172    impl CreateSitemap {
15173        pub(crate) fn new(
15174            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
15175        ) -> Self {
15176            Self(RequestBuilder::new(stub))
15177        }
15178
15179        /// Sets the full request, replacing any prior values.
15180        pub fn with_request<V: Into<crate::model::CreateSitemapRequest>>(mut self, v: V) -> Self {
15181            self.0.request = v.into();
15182            self
15183        }
15184
15185        /// Sets all the options, replacing any prior values.
15186        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
15187            self.0.options = v.into();
15188            self
15189        }
15190
15191        /// Sends the request.
15192        ///
15193        /// # Long running operations
15194        ///
15195        /// This starts, but does not poll, a longrunning operation. More information
15196        /// on [create_sitemap][crate::client::SiteSearchEngineService::create_sitemap].
15197        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
15198            (*self.0.stub)
15199                .create_sitemap(self.0.request, self.0.options)
15200                .await
15201                .map(crate::Response::into_body)
15202        }
15203
15204        /// Creates a [Poller][google_cloud_lro::Poller] to work with `create_sitemap`.
15205        pub fn poller(
15206            self,
15207        ) -> impl google_cloud_lro::Poller<crate::model::Sitemap, crate::model::CreateSitemapMetadata>
15208        {
15209            type Operation = google_cloud_lro::internal::Operation<
15210                crate::model::Sitemap,
15211                crate::model::CreateSitemapMetadata,
15212            >;
15213            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
15214            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
15215            let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
15216            if let Some(ref mut details) = poller_options.tracing {
15217                details.method_name = "google_cloud_discoveryengine_v1::client::SiteSearchEngineService::create_sitemap::until_done";
15218            }
15219
15220            let stub = self.0.stub.clone();
15221            let mut options = self.0.options.clone();
15222            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
15223            let query = move |name| {
15224                let stub = stub.clone();
15225                let options = options.clone();
15226                async {
15227                    let op = GetOperation::new(stub)
15228                        .set_name(name)
15229                        .with_options(options)
15230                        .send()
15231                        .await?;
15232                    Ok(Operation::new(op))
15233                }
15234            };
15235
15236            let start = move || async {
15237                let op = self.send().await?;
15238                Ok(Operation::new(op))
15239            };
15240
15241            use google_cloud_lro::internal::PollerExt;
15242            {
15243                google_cloud_lro::internal::new_poller(
15244                    polling_error_policy,
15245                    polling_backoff_policy,
15246                    start,
15247                    query,
15248                )
15249            }
15250            .with_options(poller_options)
15251        }
15252
15253        /// Sets the value of [parent][crate::model::CreateSitemapRequest::parent].
15254        ///
15255        /// This is a **required** field for requests.
15256        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
15257            self.0.request.parent = v.into();
15258            self
15259        }
15260
15261        /// Sets the value of [sitemap][crate::model::CreateSitemapRequest::sitemap].
15262        ///
15263        /// This is a **required** field for requests.
15264        pub fn set_sitemap<T>(mut self, v: T) -> Self
15265        where
15266            T: std::convert::Into<crate::model::Sitemap>,
15267        {
15268            self.0.request.sitemap = std::option::Option::Some(v.into());
15269            self
15270        }
15271
15272        /// Sets or clears the value of [sitemap][crate::model::CreateSitemapRequest::sitemap].
15273        ///
15274        /// This is a **required** field for requests.
15275        pub fn set_or_clear_sitemap<T>(mut self, v: std::option::Option<T>) -> Self
15276        where
15277            T: std::convert::Into<crate::model::Sitemap>,
15278        {
15279            self.0.request.sitemap = v.map(|x| x.into());
15280            self
15281        }
15282    }
15283
15284    #[doc(hidden)]
15285    impl crate::RequestBuilder for CreateSitemap {
15286        fn request_options(&mut self) -> &mut crate::RequestOptions {
15287            &mut self.0.options
15288        }
15289    }
15290
15291    /// The request builder for [SiteSearchEngineService::delete_sitemap][crate::client::SiteSearchEngineService::delete_sitemap] calls.
15292    ///
15293    /// # Example
15294    /// ```
15295    /// # use google_cloud_discoveryengine_v1::builder::site_search_engine_service::DeleteSitemap;
15296    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
15297    /// use google_cloud_lro::Poller;
15298    ///
15299    /// let builder = prepare_request_builder();
15300    /// let response = builder.poller().until_done().await?;
15301    /// # Ok(()) }
15302    ///
15303    /// fn prepare_request_builder() -> DeleteSitemap {
15304    ///   # panic!();
15305    ///   // ... details omitted ...
15306    /// }
15307    /// ```
15308    #[derive(Clone, Debug)]
15309    pub struct DeleteSitemap(RequestBuilder<crate::model::DeleteSitemapRequest>);
15310
15311    impl DeleteSitemap {
15312        pub(crate) fn new(
15313            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
15314        ) -> Self {
15315            Self(RequestBuilder::new(stub))
15316        }
15317
15318        /// Sets the full request, replacing any prior values.
15319        pub fn with_request<V: Into<crate::model::DeleteSitemapRequest>>(mut self, v: V) -> Self {
15320            self.0.request = v.into();
15321            self
15322        }
15323
15324        /// Sets all the options, replacing any prior values.
15325        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
15326            self.0.options = v.into();
15327            self
15328        }
15329
15330        /// Sends the request.
15331        ///
15332        /// # Long running operations
15333        ///
15334        /// This starts, but does not poll, a longrunning operation. More information
15335        /// on [delete_sitemap][crate::client::SiteSearchEngineService::delete_sitemap].
15336        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
15337            (*self.0.stub)
15338                .delete_sitemap(self.0.request, self.0.options)
15339                .await
15340                .map(crate::Response::into_body)
15341        }
15342
15343        /// Creates a [Poller][google_cloud_lro::Poller] to work with `delete_sitemap`.
15344        pub fn poller(
15345            self,
15346        ) -> impl google_cloud_lro::Poller<(), crate::model::DeleteSitemapMetadata> {
15347            type Operation = google_cloud_lro::internal::Operation<
15348                wkt::Empty,
15349                crate::model::DeleteSitemapMetadata,
15350            >;
15351            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
15352            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
15353            let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
15354            if let Some(ref mut details) = poller_options.tracing {
15355                details.method_name = "google_cloud_discoveryengine_v1::client::SiteSearchEngineService::delete_sitemap::until_done";
15356            }
15357
15358            let stub = self.0.stub.clone();
15359            let mut options = self.0.options.clone();
15360            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
15361            let query = move |name| {
15362                let stub = stub.clone();
15363                let options = options.clone();
15364                async {
15365                    let op = GetOperation::new(stub)
15366                        .set_name(name)
15367                        .with_options(options)
15368                        .send()
15369                        .await?;
15370                    Ok(Operation::new(op))
15371                }
15372            };
15373
15374            let start = move || async {
15375                let op = self.send().await?;
15376                Ok(Operation::new(op))
15377            };
15378
15379            use google_cloud_lro::internal::PollerExt;
15380            {
15381                google_cloud_lro::internal::new_unit_response_poller(
15382                    polling_error_policy,
15383                    polling_backoff_policy,
15384                    start,
15385                    query,
15386                )
15387            }
15388            .with_options(poller_options)
15389        }
15390
15391        /// Sets the value of [name][crate::model::DeleteSitemapRequest::name].
15392        ///
15393        /// This is a **required** field for requests.
15394        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
15395            self.0.request.name = v.into();
15396            self
15397        }
15398    }
15399
15400    #[doc(hidden)]
15401    impl crate::RequestBuilder for DeleteSitemap {
15402        fn request_options(&mut self) -> &mut crate::RequestOptions {
15403            &mut self.0.options
15404        }
15405    }
15406
15407    /// The request builder for [SiteSearchEngineService::fetch_sitemaps][crate::client::SiteSearchEngineService::fetch_sitemaps] calls.
15408    ///
15409    /// # Example
15410    /// ```
15411    /// # use google_cloud_discoveryengine_v1::builder::site_search_engine_service::FetchSitemaps;
15412    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
15413    ///
15414    /// let builder = prepare_request_builder();
15415    /// let response = builder.send().await?;
15416    /// # Ok(()) }
15417    ///
15418    /// fn prepare_request_builder() -> FetchSitemaps {
15419    ///   # panic!();
15420    ///   // ... details omitted ...
15421    /// }
15422    /// ```
15423    #[derive(Clone, Debug)]
15424    pub struct FetchSitemaps(RequestBuilder<crate::model::FetchSitemapsRequest>);
15425
15426    impl FetchSitemaps {
15427        pub(crate) fn new(
15428            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
15429        ) -> Self {
15430            Self(RequestBuilder::new(stub))
15431        }
15432
15433        /// Sets the full request, replacing any prior values.
15434        pub fn with_request<V: Into<crate::model::FetchSitemapsRequest>>(mut self, v: V) -> Self {
15435            self.0.request = v.into();
15436            self
15437        }
15438
15439        /// Sets all the options, replacing any prior values.
15440        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
15441            self.0.options = v.into();
15442            self
15443        }
15444
15445        /// Sends the request.
15446        pub async fn send(self) -> Result<crate::model::FetchSitemapsResponse> {
15447            (*self.0.stub)
15448                .fetch_sitemaps(self.0.request, self.0.options)
15449                .await
15450                .map(crate::Response::into_body)
15451        }
15452
15453        /// Sets the value of [parent][crate::model::FetchSitemapsRequest::parent].
15454        ///
15455        /// This is a **required** field for requests.
15456        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
15457            self.0.request.parent = v.into();
15458            self
15459        }
15460
15461        /// Sets the value of [matcher][crate::model::FetchSitemapsRequest::matcher].
15462        pub fn set_matcher<T>(mut self, v: T) -> Self
15463        where
15464            T: std::convert::Into<crate::model::fetch_sitemaps_request::Matcher>,
15465        {
15466            self.0.request.matcher = std::option::Option::Some(v.into());
15467            self
15468        }
15469
15470        /// Sets or clears the value of [matcher][crate::model::FetchSitemapsRequest::matcher].
15471        pub fn set_or_clear_matcher<T>(mut self, v: std::option::Option<T>) -> Self
15472        where
15473            T: std::convert::Into<crate::model::fetch_sitemaps_request::Matcher>,
15474        {
15475            self.0.request.matcher = v.map(|x| x.into());
15476            self
15477        }
15478    }
15479
15480    #[doc(hidden)]
15481    impl crate::RequestBuilder for FetchSitemaps {
15482        fn request_options(&mut self) -> &mut crate::RequestOptions {
15483            &mut self.0.options
15484        }
15485    }
15486
15487    /// The request builder for [SiteSearchEngineService::enable_advanced_site_search][crate::client::SiteSearchEngineService::enable_advanced_site_search] calls.
15488    ///
15489    /// # Example
15490    /// ```
15491    /// # use google_cloud_discoveryengine_v1::builder::site_search_engine_service::EnableAdvancedSiteSearch;
15492    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
15493    /// use google_cloud_lro::Poller;
15494    ///
15495    /// let builder = prepare_request_builder();
15496    /// let response = builder.poller().until_done().await?;
15497    /// # Ok(()) }
15498    ///
15499    /// fn prepare_request_builder() -> EnableAdvancedSiteSearch {
15500    ///   # panic!();
15501    ///   // ... details omitted ...
15502    /// }
15503    /// ```
15504    #[derive(Clone, Debug)]
15505    pub struct EnableAdvancedSiteSearch(
15506        RequestBuilder<crate::model::EnableAdvancedSiteSearchRequest>,
15507    );
15508
15509    impl EnableAdvancedSiteSearch {
15510        pub(crate) fn new(
15511            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
15512        ) -> Self {
15513            Self(RequestBuilder::new(stub))
15514        }
15515
15516        /// Sets the full request, replacing any prior values.
15517        pub fn with_request<V: Into<crate::model::EnableAdvancedSiteSearchRequest>>(
15518            mut self,
15519            v: V,
15520        ) -> Self {
15521            self.0.request = v.into();
15522            self
15523        }
15524
15525        /// Sets all the options, replacing any prior values.
15526        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
15527            self.0.options = v.into();
15528            self
15529        }
15530
15531        /// Sends the request.
15532        ///
15533        /// # Long running operations
15534        ///
15535        /// This starts, but does not poll, a longrunning operation. More information
15536        /// on [enable_advanced_site_search][crate::client::SiteSearchEngineService::enable_advanced_site_search].
15537        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
15538            (*self.0.stub)
15539                .enable_advanced_site_search(self.0.request, self.0.options)
15540                .await
15541                .map(crate::Response::into_body)
15542        }
15543
15544        /// Creates a [Poller][google_cloud_lro::Poller] to work with `enable_advanced_site_search`.
15545        pub fn poller(
15546            self,
15547        ) -> impl google_cloud_lro::Poller<
15548            crate::model::EnableAdvancedSiteSearchResponse,
15549            crate::model::EnableAdvancedSiteSearchMetadata,
15550        > {
15551            type Operation = google_cloud_lro::internal::Operation<
15552                crate::model::EnableAdvancedSiteSearchResponse,
15553                crate::model::EnableAdvancedSiteSearchMetadata,
15554            >;
15555            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
15556            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
15557            let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
15558            if let Some(ref mut details) = poller_options.tracing {
15559                details.method_name = "google_cloud_discoveryengine_v1::client::SiteSearchEngineService::enable_advanced_site_search::until_done";
15560            }
15561
15562            let stub = self.0.stub.clone();
15563            let mut options = self.0.options.clone();
15564            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
15565            let query = move |name| {
15566                let stub = stub.clone();
15567                let options = options.clone();
15568                async {
15569                    let op = GetOperation::new(stub)
15570                        .set_name(name)
15571                        .with_options(options)
15572                        .send()
15573                        .await?;
15574                    Ok(Operation::new(op))
15575                }
15576            };
15577
15578            let start = move || async {
15579                let op = self.send().await?;
15580                Ok(Operation::new(op))
15581            };
15582
15583            use google_cloud_lro::internal::PollerExt;
15584            {
15585                google_cloud_lro::internal::new_poller(
15586                    polling_error_policy,
15587                    polling_backoff_policy,
15588                    start,
15589                    query,
15590                )
15591            }
15592            .with_options(poller_options)
15593        }
15594
15595        /// Sets the value of [site_search_engine][crate::model::EnableAdvancedSiteSearchRequest::site_search_engine].
15596        ///
15597        /// This is a **required** field for requests.
15598        pub fn set_site_search_engine<T: Into<std::string::String>>(mut self, v: T) -> Self {
15599            self.0.request.site_search_engine = v.into();
15600            self
15601        }
15602    }
15603
15604    #[doc(hidden)]
15605    impl crate::RequestBuilder for EnableAdvancedSiteSearch {
15606        fn request_options(&mut self) -> &mut crate::RequestOptions {
15607            &mut self.0.options
15608        }
15609    }
15610
15611    /// The request builder for [SiteSearchEngineService::disable_advanced_site_search][crate::client::SiteSearchEngineService::disable_advanced_site_search] calls.
15612    ///
15613    /// # Example
15614    /// ```
15615    /// # use google_cloud_discoveryengine_v1::builder::site_search_engine_service::DisableAdvancedSiteSearch;
15616    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
15617    /// use google_cloud_lro::Poller;
15618    ///
15619    /// let builder = prepare_request_builder();
15620    /// let response = builder.poller().until_done().await?;
15621    /// # Ok(()) }
15622    ///
15623    /// fn prepare_request_builder() -> DisableAdvancedSiteSearch {
15624    ///   # panic!();
15625    ///   // ... details omitted ...
15626    /// }
15627    /// ```
15628    #[derive(Clone, Debug)]
15629    pub struct DisableAdvancedSiteSearch(
15630        RequestBuilder<crate::model::DisableAdvancedSiteSearchRequest>,
15631    );
15632
15633    impl DisableAdvancedSiteSearch {
15634        pub(crate) fn new(
15635            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
15636        ) -> Self {
15637            Self(RequestBuilder::new(stub))
15638        }
15639
15640        /// Sets the full request, replacing any prior values.
15641        pub fn with_request<V: Into<crate::model::DisableAdvancedSiteSearchRequest>>(
15642            mut self,
15643            v: V,
15644        ) -> Self {
15645            self.0.request = v.into();
15646            self
15647        }
15648
15649        /// Sets all the options, replacing any prior values.
15650        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
15651            self.0.options = v.into();
15652            self
15653        }
15654
15655        /// Sends the request.
15656        ///
15657        /// # Long running operations
15658        ///
15659        /// This starts, but does not poll, a longrunning operation. More information
15660        /// on [disable_advanced_site_search][crate::client::SiteSearchEngineService::disable_advanced_site_search].
15661        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
15662            (*self.0.stub)
15663                .disable_advanced_site_search(self.0.request, self.0.options)
15664                .await
15665                .map(crate::Response::into_body)
15666        }
15667
15668        /// Creates a [Poller][google_cloud_lro::Poller] to work with `disable_advanced_site_search`.
15669        pub fn poller(
15670            self,
15671        ) -> impl google_cloud_lro::Poller<
15672            crate::model::DisableAdvancedSiteSearchResponse,
15673            crate::model::DisableAdvancedSiteSearchMetadata,
15674        > {
15675            type Operation = google_cloud_lro::internal::Operation<
15676                crate::model::DisableAdvancedSiteSearchResponse,
15677                crate::model::DisableAdvancedSiteSearchMetadata,
15678            >;
15679            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
15680            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
15681            let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
15682            if let Some(ref mut details) = poller_options.tracing {
15683                details.method_name = "google_cloud_discoveryengine_v1::client::SiteSearchEngineService::disable_advanced_site_search::until_done";
15684            }
15685
15686            let stub = self.0.stub.clone();
15687            let mut options = self.0.options.clone();
15688            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
15689            let query = move |name| {
15690                let stub = stub.clone();
15691                let options = options.clone();
15692                async {
15693                    let op = GetOperation::new(stub)
15694                        .set_name(name)
15695                        .with_options(options)
15696                        .send()
15697                        .await?;
15698                    Ok(Operation::new(op))
15699                }
15700            };
15701
15702            let start = move || async {
15703                let op = self.send().await?;
15704                Ok(Operation::new(op))
15705            };
15706
15707            use google_cloud_lro::internal::PollerExt;
15708            {
15709                google_cloud_lro::internal::new_poller(
15710                    polling_error_policy,
15711                    polling_backoff_policy,
15712                    start,
15713                    query,
15714                )
15715            }
15716            .with_options(poller_options)
15717        }
15718
15719        /// Sets the value of [site_search_engine][crate::model::DisableAdvancedSiteSearchRequest::site_search_engine].
15720        ///
15721        /// This is a **required** field for requests.
15722        pub fn set_site_search_engine<T: Into<std::string::String>>(mut self, v: T) -> Self {
15723            self.0.request.site_search_engine = v.into();
15724            self
15725        }
15726    }
15727
15728    #[doc(hidden)]
15729    impl crate::RequestBuilder for DisableAdvancedSiteSearch {
15730        fn request_options(&mut self) -> &mut crate::RequestOptions {
15731            &mut self.0.options
15732        }
15733    }
15734
15735    /// The request builder for [SiteSearchEngineService::recrawl_uris][crate::client::SiteSearchEngineService::recrawl_uris] calls.
15736    ///
15737    /// # Example
15738    /// ```
15739    /// # use google_cloud_discoveryengine_v1::builder::site_search_engine_service::RecrawlUris;
15740    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
15741    /// use google_cloud_lro::Poller;
15742    ///
15743    /// let builder = prepare_request_builder();
15744    /// let response = builder.poller().until_done().await?;
15745    /// # Ok(()) }
15746    ///
15747    /// fn prepare_request_builder() -> RecrawlUris {
15748    ///   # panic!();
15749    ///   // ... details omitted ...
15750    /// }
15751    /// ```
15752    #[derive(Clone, Debug)]
15753    pub struct RecrawlUris(RequestBuilder<crate::model::RecrawlUrisRequest>);
15754
15755    impl RecrawlUris {
15756        pub(crate) fn new(
15757            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
15758        ) -> Self {
15759            Self(RequestBuilder::new(stub))
15760        }
15761
15762        /// Sets the full request, replacing any prior values.
15763        pub fn with_request<V: Into<crate::model::RecrawlUrisRequest>>(mut self, v: V) -> Self {
15764            self.0.request = v.into();
15765            self
15766        }
15767
15768        /// Sets all the options, replacing any prior values.
15769        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
15770            self.0.options = v.into();
15771            self
15772        }
15773
15774        /// Sends the request.
15775        ///
15776        /// # Long running operations
15777        ///
15778        /// This starts, but does not poll, a longrunning operation. More information
15779        /// on [recrawl_uris][crate::client::SiteSearchEngineService::recrawl_uris].
15780        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
15781            (*self.0.stub)
15782                .recrawl_uris(self.0.request, self.0.options)
15783                .await
15784                .map(crate::Response::into_body)
15785        }
15786
15787        /// Creates a [Poller][google_cloud_lro::Poller] to work with `recrawl_uris`.
15788        pub fn poller(
15789            self,
15790        ) -> impl google_cloud_lro::Poller<
15791            crate::model::RecrawlUrisResponse,
15792            crate::model::RecrawlUrisMetadata,
15793        > {
15794            type Operation = google_cloud_lro::internal::Operation<
15795                crate::model::RecrawlUrisResponse,
15796                crate::model::RecrawlUrisMetadata,
15797            >;
15798            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
15799            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
15800            let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
15801            if let Some(ref mut details) = poller_options.tracing {
15802                details.method_name = "google_cloud_discoveryengine_v1::client::SiteSearchEngineService::recrawl_uris::until_done";
15803            }
15804
15805            let stub = self.0.stub.clone();
15806            let mut options = self.0.options.clone();
15807            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
15808            let query = move |name| {
15809                let stub = stub.clone();
15810                let options = options.clone();
15811                async {
15812                    let op = GetOperation::new(stub)
15813                        .set_name(name)
15814                        .with_options(options)
15815                        .send()
15816                        .await?;
15817                    Ok(Operation::new(op))
15818                }
15819            };
15820
15821            let start = move || async {
15822                let op = self.send().await?;
15823                Ok(Operation::new(op))
15824            };
15825
15826            use google_cloud_lro::internal::PollerExt;
15827            {
15828                google_cloud_lro::internal::new_poller(
15829                    polling_error_policy,
15830                    polling_backoff_policy,
15831                    start,
15832                    query,
15833                )
15834            }
15835            .with_options(poller_options)
15836        }
15837
15838        /// Sets the value of [site_search_engine][crate::model::RecrawlUrisRequest::site_search_engine].
15839        ///
15840        /// This is a **required** field for requests.
15841        pub fn set_site_search_engine<T: Into<std::string::String>>(mut self, v: T) -> Self {
15842            self.0.request.site_search_engine = v.into();
15843            self
15844        }
15845
15846        /// Sets the value of [uris][crate::model::RecrawlUrisRequest::uris].
15847        ///
15848        /// This is a **required** field for requests.
15849        pub fn set_uris<T, V>(mut self, v: T) -> Self
15850        where
15851            T: std::iter::IntoIterator<Item = V>,
15852            V: std::convert::Into<std::string::String>,
15853        {
15854            use std::iter::Iterator;
15855            self.0.request.uris = v.into_iter().map(|i| i.into()).collect();
15856            self
15857        }
15858
15859        /// Sets the value of [site_credential][crate::model::RecrawlUrisRequest::site_credential].
15860        pub fn set_site_credential<T: Into<std::string::String>>(mut self, v: T) -> Self {
15861            self.0.request.site_credential = v.into();
15862            self
15863        }
15864    }
15865
15866    #[doc(hidden)]
15867    impl crate::RequestBuilder for RecrawlUris {
15868        fn request_options(&mut self) -> &mut crate::RequestOptions {
15869            &mut self.0.options
15870        }
15871    }
15872
15873    /// The request builder for [SiteSearchEngineService::batch_verify_target_sites][crate::client::SiteSearchEngineService::batch_verify_target_sites] calls.
15874    ///
15875    /// # Example
15876    /// ```
15877    /// # use google_cloud_discoveryengine_v1::builder::site_search_engine_service::BatchVerifyTargetSites;
15878    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
15879    /// use google_cloud_lro::Poller;
15880    ///
15881    /// let builder = prepare_request_builder();
15882    /// let response = builder.poller().until_done().await?;
15883    /// # Ok(()) }
15884    ///
15885    /// fn prepare_request_builder() -> BatchVerifyTargetSites {
15886    ///   # panic!();
15887    ///   // ... details omitted ...
15888    /// }
15889    /// ```
15890    #[derive(Clone, Debug)]
15891    pub struct BatchVerifyTargetSites(RequestBuilder<crate::model::BatchVerifyTargetSitesRequest>);
15892
15893    impl BatchVerifyTargetSites {
15894        pub(crate) fn new(
15895            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
15896        ) -> Self {
15897            Self(RequestBuilder::new(stub))
15898        }
15899
15900        /// Sets the full request, replacing any prior values.
15901        pub fn with_request<V: Into<crate::model::BatchVerifyTargetSitesRequest>>(
15902            mut self,
15903            v: V,
15904        ) -> Self {
15905            self.0.request = v.into();
15906            self
15907        }
15908
15909        /// Sets all the options, replacing any prior values.
15910        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
15911            self.0.options = v.into();
15912            self
15913        }
15914
15915        /// Sends the request.
15916        ///
15917        /// # Long running operations
15918        ///
15919        /// This starts, but does not poll, a longrunning operation. More information
15920        /// on [batch_verify_target_sites][crate::client::SiteSearchEngineService::batch_verify_target_sites].
15921        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
15922            (*self.0.stub)
15923                .batch_verify_target_sites(self.0.request, self.0.options)
15924                .await
15925                .map(crate::Response::into_body)
15926        }
15927
15928        /// Creates a [Poller][google_cloud_lro::Poller] to work with `batch_verify_target_sites`.
15929        pub fn poller(
15930            self,
15931        ) -> impl google_cloud_lro::Poller<
15932            crate::model::BatchVerifyTargetSitesResponse,
15933            crate::model::BatchVerifyTargetSitesMetadata,
15934        > {
15935            type Operation = google_cloud_lro::internal::Operation<
15936                crate::model::BatchVerifyTargetSitesResponse,
15937                crate::model::BatchVerifyTargetSitesMetadata,
15938            >;
15939            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
15940            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
15941            let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
15942            if let Some(ref mut details) = poller_options.tracing {
15943                details.method_name = "google_cloud_discoveryengine_v1::client::SiteSearchEngineService::batch_verify_target_sites::until_done";
15944            }
15945
15946            let stub = self.0.stub.clone();
15947            let mut options = self.0.options.clone();
15948            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
15949            let query = move |name| {
15950                let stub = stub.clone();
15951                let options = options.clone();
15952                async {
15953                    let op = GetOperation::new(stub)
15954                        .set_name(name)
15955                        .with_options(options)
15956                        .send()
15957                        .await?;
15958                    Ok(Operation::new(op))
15959                }
15960            };
15961
15962            let start = move || async {
15963                let op = self.send().await?;
15964                Ok(Operation::new(op))
15965            };
15966
15967            use google_cloud_lro::internal::PollerExt;
15968            {
15969                google_cloud_lro::internal::new_poller(
15970                    polling_error_policy,
15971                    polling_backoff_policy,
15972                    start,
15973                    query,
15974                )
15975            }
15976            .with_options(poller_options)
15977        }
15978
15979        /// Sets the value of [parent][crate::model::BatchVerifyTargetSitesRequest::parent].
15980        ///
15981        /// This is a **required** field for requests.
15982        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
15983            self.0.request.parent = v.into();
15984            self
15985        }
15986    }
15987
15988    #[doc(hidden)]
15989    impl crate::RequestBuilder for BatchVerifyTargetSites {
15990        fn request_options(&mut self) -> &mut crate::RequestOptions {
15991            &mut self.0.options
15992        }
15993    }
15994
15995    /// The request builder for [SiteSearchEngineService::fetch_domain_verification_status][crate::client::SiteSearchEngineService::fetch_domain_verification_status] calls.
15996    ///
15997    /// # Example
15998    /// ```
15999    /// # use google_cloud_discoveryengine_v1::builder::site_search_engine_service::FetchDomainVerificationStatus;
16000    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
16001    /// use google_cloud_gax::paginator::ItemPaginator;
16002    ///
16003    /// let builder = prepare_request_builder();
16004    /// let mut items = builder.by_item();
16005    /// while let Some(result) = items.next().await {
16006    ///   let item = result?;
16007    /// }
16008    /// # Ok(()) }
16009    ///
16010    /// fn prepare_request_builder() -> FetchDomainVerificationStatus {
16011    ///   # panic!();
16012    ///   // ... details omitted ...
16013    /// }
16014    /// ```
16015    #[derive(Clone, Debug)]
16016    pub struct FetchDomainVerificationStatus(
16017        RequestBuilder<crate::model::FetchDomainVerificationStatusRequest>,
16018    );
16019
16020    impl FetchDomainVerificationStatus {
16021        pub(crate) fn new(
16022            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
16023        ) -> Self {
16024            Self(RequestBuilder::new(stub))
16025        }
16026
16027        /// Sets the full request, replacing any prior values.
16028        pub fn with_request<V: Into<crate::model::FetchDomainVerificationStatusRequest>>(
16029            mut self,
16030            v: V,
16031        ) -> Self {
16032            self.0.request = v.into();
16033            self
16034        }
16035
16036        /// Sets all the options, replacing any prior values.
16037        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
16038            self.0.options = v.into();
16039            self
16040        }
16041
16042        /// Sends the request.
16043        pub async fn send(self) -> Result<crate::model::FetchDomainVerificationStatusResponse> {
16044            (*self.0.stub)
16045                .fetch_domain_verification_status(self.0.request, self.0.options)
16046                .await
16047                .map(crate::Response::into_body)
16048        }
16049
16050        /// Streams each page in the collection.
16051        pub fn by_page(
16052            self,
16053        ) -> impl google_cloud_gax::paginator::Paginator<
16054            crate::model::FetchDomainVerificationStatusResponse,
16055            crate::Error,
16056        > {
16057            use std::clone::Clone;
16058            let token = self.0.request.page_token.clone();
16059            let execute = move |token: String| {
16060                let mut builder = self.clone();
16061                builder.0.request = builder.0.request.set_page_token(token);
16062                builder.send()
16063            };
16064            google_cloud_gax::paginator::internal::new_paginator(token, execute)
16065        }
16066
16067        /// Streams each item in the collection.
16068        pub fn by_item(
16069            self,
16070        ) -> impl google_cloud_gax::paginator::ItemPaginator<
16071            crate::model::FetchDomainVerificationStatusResponse,
16072            crate::Error,
16073        > {
16074            use google_cloud_gax::paginator::Paginator;
16075            self.by_page().items()
16076        }
16077
16078        /// Sets the value of [site_search_engine][crate::model::FetchDomainVerificationStatusRequest::site_search_engine].
16079        ///
16080        /// This is a **required** field for requests.
16081        pub fn set_site_search_engine<T: Into<std::string::String>>(mut self, v: T) -> Self {
16082            self.0.request.site_search_engine = v.into();
16083            self
16084        }
16085
16086        /// Sets the value of [page_size][crate::model::FetchDomainVerificationStatusRequest::page_size].
16087        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
16088            self.0.request.page_size = v.into();
16089            self
16090        }
16091
16092        /// Sets the value of [page_token][crate::model::FetchDomainVerificationStatusRequest::page_token].
16093        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
16094            self.0.request.page_token = v.into();
16095            self
16096        }
16097    }
16098
16099    #[doc(hidden)]
16100    impl crate::RequestBuilder for FetchDomainVerificationStatus {
16101        fn request_options(&mut self) -> &mut crate::RequestOptions {
16102            &mut self.0.options
16103        }
16104    }
16105
16106    /// The request builder for [SiteSearchEngineService::list_operations][crate::client::SiteSearchEngineService::list_operations] calls.
16107    ///
16108    /// # Example
16109    /// ```
16110    /// # use google_cloud_discoveryengine_v1::builder::site_search_engine_service::ListOperations;
16111    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
16112    /// use google_cloud_gax::paginator::ItemPaginator;
16113    ///
16114    /// let builder = prepare_request_builder();
16115    /// let mut items = builder.by_item();
16116    /// while let Some(result) = items.next().await {
16117    ///   let item = result?;
16118    /// }
16119    /// # Ok(()) }
16120    ///
16121    /// fn prepare_request_builder() -> ListOperations {
16122    ///   # panic!();
16123    ///   // ... details omitted ...
16124    /// }
16125    /// ```
16126    #[derive(Clone, Debug)]
16127    pub struct ListOperations(
16128        RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
16129    );
16130
16131    impl ListOperations {
16132        pub(crate) fn new(
16133            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
16134        ) -> Self {
16135            Self(RequestBuilder::new(stub))
16136        }
16137
16138        /// Sets the full request, replacing any prior values.
16139        pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
16140            mut self,
16141            v: V,
16142        ) -> Self {
16143            self.0.request = v.into();
16144            self
16145        }
16146
16147        /// Sets all the options, replacing any prior values.
16148        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
16149            self.0.options = v.into();
16150            self
16151        }
16152
16153        /// Sends the request.
16154        pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
16155            (*self.0.stub)
16156                .list_operations(self.0.request, self.0.options)
16157                .await
16158                .map(crate::Response::into_body)
16159        }
16160
16161        /// Streams each page in the collection.
16162        pub fn by_page(
16163            self,
16164        ) -> impl google_cloud_gax::paginator::Paginator<
16165            google_cloud_longrunning::model::ListOperationsResponse,
16166            crate::Error,
16167        > {
16168            use std::clone::Clone;
16169            let token = self.0.request.page_token.clone();
16170            let execute = move |token: String| {
16171                let mut builder = self.clone();
16172                builder.0.request = builder.0.request.set_page_token(token);
16173                builder.send()
16174            };
16175            google_cloud_gax::paginator::internal::new_paginator(token, execute)
16176        }
16177
16178        /// Streams each item in the collection.
16179        pub fn by_item(
16180            self,
16181        ) -> impl google_cloud_gax::paginator::ItemPaginator<
16182            google_cloud_longrunning::model::ListOperationsResponse,
16183            crate::Error,
16184        > {
16185            use google_cloud_gax::paginator::Paginator;
16186            self.by_page().items()
16187        }
16188
16189        /// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
16190        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
16191            self.0.request.name = v.into();
16192            self
16193        }
16194
16195        /// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::filter].
16196        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
16197            self.0.request.filter = v.into();
16198            self
16199        }
16200
16201        /// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
16202        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
16203            self.0.request.page_size = v.into();
16204            self
16205        }
16206
16207        /// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
16208        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
16209            self.0.request.page_token = v.into();
16210            self
16211        }
16212
16213        /// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
16214        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
16215            self.0.request.return_partial_success = v.into();
16216            self
16217        }
16218    }
16219
16220    #[doc(hidden)]
16221    impl crate::RequestBuilder for ListOperations {
16222        fn request_options(&mut self) -> &mut crate::RequestOptions {
16223            &mut self.0.options
16224        }
16225    }
16226
16227    /// The request builder for [SiteSearchEngineService::get_operation][crate::client::SiteSearchEngineService::get_operation] calls.
16228    ///
16229    /// # Example
16230    /// ```
16231    /// # use google_cloud_discoveryengine_v1::builder::site_search_engine_service::GetOperation;
16232    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
16233    ///
16234    /// let builder = prepare_request_builder();
16235    /// let response = builder.send().await?;
16236    /// # Ok(()) }
16237    ///
16238    /// fn prepare_request_builder() -> GetOperation {
16239    ///   # panic!();
16240    ///   // ... details omitted ...
16241    /// }
16242    /// ```
16243    #[derive(Clone, Debug)]
16244    pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
16245
16246    impl GetOperation {
16247        pub(crate) fn new(
16248            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
16249        ) -> Self {
16250            Self(RequestBuilder::new(stub))
16251        }
16252
16253        /// Sets the full request, replacing any prior values.
16254        pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
16255            mut self,
16256            v: V,
16257        ) -> Self {
16258            self.0.request = v.into();
16259            self
16260        }
16261
16262        /// Sets all the options, replacing any prior values.
16263        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
16264            self.0.options = v.into();
16265            self
16266        }
16267
16268        /// Sends the request.
16269        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
16270            (*self.0.stub)
16271                .get_operation(self.0.request, self.0.options)
16272                .await
16273                .map(crate::Response::into_body)
16274        }
16275
16276        /// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
16277        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
16278            self.0.request.name = v.into();
16279            self
16280        }
16281    }
16282
16283    #[doc(hidden)]
16284    impl crate::RequestBuilder for GetOperation {
16285        fn request_options(&mut self) -> &mut crate::RequestOptions {
16286            &mut self.0.options
16287        }
16288    }
16289
16290    /// The request builder for [SiteSearchEngineService::cancel_operation][crate::client::SiteSearchEngineService::cancel_operation] calls.
16291    ///
16292    /// # Example
16293    /// ```
16294    /// # use google_cloud_discoveryengine_v1::builder::site_search_engine_service::CancelOperation;
16295    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
16296    ///
16297    /// let builder = prepare_request_builder();
16298    /// let response = builder.send().await?;
16299    /// # Ok(()) }
16300    ///
16301    /// fn prepare_request_builder() -> CancelOperation {
16302    ///   # panic!();
16303    ///   // ... details omitted ...
16304    /// }
16305    /// ```
16306    #[derive(Clone, Debug)]
16307    pub struct CancelOperation(
16308        RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
16309    );
16310
16311    impl CancelOperation {
16312        pub(crate) fn new(
16313            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
16314        ) -> Self {
16315            Self(RequestBuilder::new(stub))
16316        }
16317
16318        /// Sets the full request, replacing any prior values.
16319        pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
16320            mut self,
16321            v: V,
16322        ) -> Self {
16323            self.0.request = v.into();
16324            self
16325        }
16326
16327        /// Sets all the options, replacing any prior values.
16328        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
16329            self.0.options = v.into();
16330            self
16331        }
16332
16333        /// Sends the request.
16334        pub async fn send(self) -> Result<()> {
16335            (*self.0.stub)
16336                .cancel_operation(self.0.request, self.0.options)
16337                .await
16338                .map(crate::Response::into_body)
16339        }
16340
16341        /// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::name].
16342        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
16343            self.0.request.name = v.into();
16344            self
16345        }
16346    }
16347
16348    #[doc(hidden)]
16349    impl crate::RequestBuilder for CancelOperation {
16350        fn request_options(&mut self) -> &mut crate::RequestOptions {
16351            &mut self.0.options
16352        }
16353    }
16354}
16355
16356/// Request and client builders for [UserEventService][crate::client::UserEventService].
16357#[cfg(feature = "user-event-service")]
16358#[cfg_attr(docsrs, doc(cfg(feature = "user-event-service")))]
16359pub mod user_event_service {
16360    use crate::Result;
16361
16362    /// A builder for [UserEventService][crate::client::UserEventService].
16363    ///
16364    /// ```
16365    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
16366    /// # use google_cloud_discoveryengine_v1::*;
16367    /// # use builder::user_event_service::ClientBuilder;
16368    /// # use client::UserEventService;
16369    /// let builder : ClientBuilder = UserEventService::builder();
16370    /// let client = builder
16371    ///     .with_endpoint("https://discoveryengine.googleapis.com")
16372    ///     .build().await?;
16373    /// # Ok(()) }
16374    /// ```
16375    pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
16376
16377    pub(crate) mod client {
16378        use super::super::super::client::UserEventService;
16379        pub struct Factory;
16380        impl crate::ClientFactory for Factory {
16381            type Client = UserEventService;
16382            type Credentials = gaxi::options::Credentials;
16383            async fn build(
16384                self,
16385                config: gaxi::options::ClientConfig,
16386            ) -> crate::ClientBuilderResult<Self::Client> {
16387                Self::Client::new(config).await
16388            }
16389        }
16390    }
16391
16392    /// Common implementation for [crate::client::UserEventService] request builders.
16393    #[derive(Clone, Debug)]
16394    pub(crate) struct RequestBuilder<R: std::default::Default> {
16395        stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
16396        request: R,
16397        options: crate::RequestOptions,
16398    }
16399
16400    impl<R> RequestBuilder<R>
16401    where
16402        R: std::default::Default,
16403    {
16404        pub(crate) fn new(
16405            stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
16406        ) -> Self {
16407            Self {
16408                stub,
16409                request: R::default(),
16410                options: crate::RequestOptions::default(),
16411            }
16412        }
16413    }
16414
16415    /// The request builder for [UserEventService::write_user_event][crate::client::UserEventService::write_user_event] calls.
16416    ///
16417    /// # Example
16418    /// ```
16419    /// # use google_cloud_discoveryengine_v1::builder::user_event_service::WriteUserEvent;
16420    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
16421    ///
16422    /// let builder = prepare_request_builder();
16423    /// let response = builder.send().await?;
16424    /// # Ok(()) }
16425    ///
16426    /// fn prepare_request_builder() -> WriteUserEvent {
16427    ///   # panic!();
16428    ///   // ... details omitted ...
16429    /// }
16430    /// ```
16431    #[derive(Clone, Debug)]
16432    pub struct WriteUserEvent(RequestBuilder<crate::model::WriteUserEventRequest>);
16433
16434    impl WriteUserEvent {
16435        pub(crate) fn new(
16436            stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
16437        ) -> Self {
16438            Self(RequestBuilder::new(stub))
16439        }
16440
16441        /// Sets the full request, replacing any prior values.
16442        pub fn with_request<V: Into<crate::model::WriteUserEventRequest>>(mut self, v: V) -> Self {
16443            self.0.request = v.into();
16444            self
16445        }
16446
16447        /// Sets all the options, replacing any prior values.
16448        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
16449            self.0.options = v.into();
16450            self
16451        }
16452
16453        /// Sends the request.
16454        pub async fn send(self) -> Result<crate::model::UserEvent> {
16455            (*self.0.stub)
16456                .write_user_event(self.0.request, self.0.options)
16457                .await
16458                .map(crate::Response::into_body)
16459        }
16460
16461        /// Sets the value of [parent][crate::model::WriteUserEventRequest::parent].
16462        ///
16463        /// This is a **required** field for requests.
16464        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
16465            self.0.request.parent = v.into();
16466            self
16467        }
16468
16469        /// Sets the value of [user_event][crate::model::WriteUserEventRequest::user_event].
16470        ///
16471        /// This is a **required** field for requests.
16472        pub fn set_user_event<T>(mut self, v: T) -> Self
16473        where
16474            T: std::convert::Into<crate::model::UserEvent>,
16475        {
16476            self.0.request.user_event = std::option::Option::Some(v.into());
16477            self
16478        }
16479
16480        /// Sets or clears the value of [user_event][crate::model::WriteUserEventRequest::user_event].
16481        ///
16482        /// This is a **required** field for requests.
16483        pub fn set_or_clear_user_event<T>(mut self, v: std::option::Option<T>) -> Self
16484        where
16485            T: std::convert::Into<crate::model::UserEvent>,
16486        {
16487            self.0.request.user_event = v.map(|x| x.into());
16488            self
16489        }
16490
16491        /// Sets the value of [write_async][crate::model::WriteUserEventRequest::write_async].
16492        pub fn set_write_async<T: Into<bool>>(mut self, v: T) -> Self {
16493            self.0.request.write_async = v.into();
16494            self
16495        }
16496    }
16497
16498    #[doc(hidden)]
16499    impl crate::RequestBuilder for WriteUserEvent {
16500        fn request_options(&mut self) -> &mut crate::RequestOptions {
16501            &mut self.0.options
16502        }
16503    }
16504
16505    /// The request builder for [UserEventService::collect_user_event][crate::client::UserEventService::collect_user_event] calls.
16506    ///
16507    /// # Example
16508    /// ```
16509    /// # use google_cloud_discoveryengine_v1::builder::user_event_service::CollectUserEvent;
16510    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
16511    ///
16512    /// let builder = prepare_request_builder();
16513    /// let response = builder.send().await?;
16514    /// # Ok(()) }
16515    ///
16516    /// fn prepare_request_builder() -> CollectUserEvent {
16517    ///   # panic!();
16518    ///   // ... details omitted ...
16519    /// }
16520    /// ```
16521    #[derive(Clone, Debug)]
16522    pub struct CollectUserEvent(RequestBuilder<crate::model::CollectUserEventRequest>);
16523
16524    impl CollectUserEvent {
16525        pub(crate) fn new(
16526            stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
16527        ) -> Self {
16528            Self(RequestBuilder::new(stub))
16529        }
16530
16531        /// Sets the full request, replacing any prior values.
16532        pub fn with_request<V: Into<crate::model::CollectUserEventRequest>>(
16533            mut self,
16534            v: V,
16535        ) -> Self {
16536            self.0.request = v.into();
16537            self
16538        }
16539
16540        /// Sets all the options, replacing any prior values.
16541        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
16542            self.0.options = v.into();
16543            self
16544        }
16545
16546        /// Sends the request.
16547        pub async fn send(self) -> Result<google_cloud_api::model::HttpBody> {
16548            (*self.0.stub)
16549                .collect_user_event(self.0.request, self.0.options)
16550                .await
16551                .map(crate::Response::into_body)
16552        }
16553
16554        /// Sets the value of [parent][crate::model::CollectUserEventRequest::parent].
16555        ///
16556        /// This is a **required** field for requests.
16557        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
16558            self.0.request.parent = v.into();
16559            self
16560        }
16561
16562        /// Sets the value of [user_event][crate::model::CollectUserEventRequest::user_event].
16563        ///
16564        /// This is a **required** field for requests.
16565        pub fn set_user_event<T: Into<std::string::String>>(mut self, v: T) -> Self {
16566            self.0.request.user_event = v.into();
16567            self
16568        }
16569
16570        /// Sets the value of [uri][crate::model::CollectUserEventRequest::uri].
16571        pub fn set_uri<T>(mut self, v: T) -> Self
16572        where
16573            T: std::convert::Into<std::string::String>,
16574        {
16575            self.0.request.uri = std::option::Option::Some(v.into());
16576            self
16577        }
16578
16579        /// Sets or clears the value of [uri][crate::model::CollectUserEventRequest::uri].
16580        pub fn set_or_clear_uri<T>(mut self, v: std::option::Option<T>) -> Self
16581        where
16582            T: std::convert::Into<std::string::String>,
16583        {
16584            self.0.request.uri = v.map(|x| x.into());
16585            self
16586        }
16587
16588        /// Sets the value of [ets][crate::model::CollectUserEventRequest::ets].
16589        pub fn set_ets<T>(mut self, v: T) -> Self
16590        where
16591            T: std::convert::Into<i64>,
16592        {
16593            self.0.request.ets = std::option::Option::Some(v.into());
16594            self
16595        }
16596
16597        /// Sets or clears the value of [ets][crate::model::CollectUserEventRequest::ets].
16598        pub fn set_or_clear_ets<T>(mut self, v: std::option::Option<T>) -> Self
16599        where
16600            T: std::convert::Into<i64>,
16601        {
16602            self.0.request.ets = v.map(|x| x.into());
16603            self
16604        }
16605    }
16606
16607    #[doc(hidden)]
16608    impl crate::RequestBuilder for CollectUserEvent {
16609        fn request_options(&mut self) -> &mut crate::RequestOptions {
16610            &mut self.0.options
16611        }
16612    }
16613
16614    /// The request builder for [UserEventService::purge_user_events][crate::client::UserEventService::purge_user_events] calls.
16615    ///
16616    /// # Example
16617    /// ```
16618    /// # use google_cloud_discoveryengine_v1::builder::user_event_service::PurgeUserEvents;
16619    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
16620    /// use google_cloud_lro::Poller;
16621    ///
16622    /// let builder = prepare_request_builder();
16623    /// let response = builder.poller().until_done().await?;
16624    /// # Ok(()) }
16625    ///
16626    /// fn prepare_request_builder() -> PurgeUserEvents {
16627    ///   # panic!();
16628    ///   // ... details omitted ...
16629    /// }
16630    /// ```
16631    #[derive(Clone, Debug)]
16632    pub struct PurgeUserEvents(RequestBuilder<crate::model::PurgeUserEventsRequest>);
16633
16634    impl PurgeUserEvents {
16635        pub(crate) fn new(
16636            stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
16637        ) -> Self {
16638            Self(RequestBuilder::new(stub))
16639        }
16640
16641        /// Sets the full request, replacing any prior values.
16642        pub fn with_request<V: Into<crate::model::PurgeUserEventsRequest>>(mut self, v: V) -> Self {
16643            self.0.request = v.into();
16644            self
16645        }
16646
16647        /// Sets all the options, replacing any prior values.
16648        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
16649            self.0.options = v.into();
16650            self
16651        }
16652
16653        /// Sends the request.
16654        ///
16655        /// # Long running operations
16656        ///
16657        /// This starts, but does not poll, a longrunning operation. More information
16658        /// on [purge_user_events][crate::client::UserEventService::purge_user_events].
16659        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
16660            (*self.0.stub)
16661                .purge_user_events(self.0.request, self.0.options)
16662                .await
16663                .map(crate::Response::into_body)
16664        }
16665
16666        /// Creates a [Poller][google_cloud_lro::Poller] to work with `purge_user_events`.
16667        pub fn poller(
16668            self,
16669        ) -> impl google_cloud_lro::Poller<
16670            crate::model::PurgeUserEventsResponse,
16671            crate::model::PurgeUserEventsMetadata,
16672        > {
16673            type Operation = google_cloud_lro::internal::Operation<
16674                crate::model::PurgeUserEventsResponse,
16675                crate::model::PurgeUserEventsMetadata,
16676            >;
16677            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
16678            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
16679            let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
16680            if let Some(ref mut details) = poller_options.tracing {
16681                details.method_name = "google_cloud_discoveryengine_v1::client::UserEventService::purge_user_events::until_done";
16682            }
16683
16684            let stub = self.0.stub.clone();
16685            let mut options = self.0.options.clone();
16686            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
16687            let query = move |name| {
16688                let stub = stub.clone();
16689                let options = options.clone();
16690                async {
16691                    let op = GetOperation::new(stub)
16692                        .set_name(name)
16693                        .with_options(options)
16694                        .send()
16695                        .await?;
16696                    Ok(Operation::new(op))
16697                }
16698            };
16699
16700            let start = move || async {
16701                let op = self.send().await?;
16702                Ok(Operation::new(op))
16703            };
16704
16705            use google_cloud_lro::internal::PollerExt;
16706            {
16707                google_cloud_lro::internal::new_poller(
16708                    polling_error_policy,
16709                    polling_backoff_policy,
16710                    start,
16711                    query,
16712                )
16713            }
16714            .with_options(poller_options)
16715        }
16716
16717        /// Sets the value of [parent][crate::model::PurgeUserEventsRequest::parent].
16718        ///
16719        /// This is a **required** field for requests.
16720        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
16721            self.0.request.parent = v.into();
16722            self
16723        }
16724
16725        /// Sets the value of [filter][crate::model::PurgeUserEventsRequest::filter].
16726        ///
16727        /// This is a **required** field for requests.
16728        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
16729            self.0.request.filter = v.into();
16730            self
16731        }
16732
16733        /// Sets the value of [force][crate::model::PurgeUserEventsRequest::force].
16734        pub fn set_force<T: Into<bool>>(mut self, v: T) -> Self {
16735            self.0.request.force = v.into();
16736            self
16737        }
16738    }
16739
16740    #[doc(hidden)]
16741    impl crate::RequestBuilder for PurgeUserEvents {
16742        fn request_options(&mut self) -> &mut crate::RequestOptions {
16743            &mut self.0.options
16744        }
16745    }
16746
16747    /// The request builder for [UserEventService::import_user_events][crate::client::UserEventService::import_user_events] calls.
16748    ///
16749    /// # Example
16750    /// ```
16751    /// # use google_cloud_discoveryengine_v1::builder::user_event_service::ImportUserEvents;
16752    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
16753    /// use google_cloud_lro::Poller;
16754    ///
16755    /// let builder = prepare_request_builder();
16756    /// let response = builder.poller().until_done().await?;
16757    /// # Ok(()) }
16758    ///
16759    /// fn prepare_request_builder() -> ImportUserEvents {
16760    ///   # panic!();
16761    ///   // ... details omitted ...
16762    /// }
16763    /// ```
16764    #[derive(Clone, Debug)]
16765    pub struct ImportUserEvents(RequestBuilder<crate::model::ImportUserEventsRequest>);
16766
16767    impl ImportUserEvents {
16768        pub(crate) fn new(
16769            stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
16770        ) -> Self {
16771            Self(RequestBuilder::new(stub))
16772        }
16773
16774        /// Sets the full request, replacing any prior values.
16775        pub fn with_request<V: Into<crate::model::ImportUserEventsRequest>>(
16776            mut self,
16777            v: V,
16778        ) -> Self {
16779            self.0.request = v.into();
16780            self
16781        }
16782
16783        /// Sets all the options, replacing any prior values.
16784        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
16785            self.0.options = v.into();
16786            self
16787        }
16788
16789        /// Sends the request.
16790        ///
16791        /// # Long running operations
16792        ///
16793        /// This starts, but does not poll, a longrunning operation. More information
16794        /// on [import_user_events][crate::client::UserEventService::import_user_events].
16795        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
16796            (*self.0.stub)
16797                .import_user_events(self.0.request, self.0.options)
16798                .await
16799                .map(crate::Response::into_body)
16800        }
16801
16802        /// Creates a [Poller][google_cloud_lro::Poller] to work with `import_user_events`.
16803        pub fn poller(
16804            self,
16805        ) -> impl google_cloud_lro::Poller<
16806            crate::model::ImportUserEventsResponse,
16807            crate::model::ImportUserEventsMetadata,
16808        > {
16809            type Operation = google_cloud_lro::internal::Operation<
16810                crate::model::ImportUserEventsResponse,
16811                crate::model::ImportUserEventsMetadata,
16812            >;
16813            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
16814            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
16815            let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
16816            if let Some(ref mut details) = poller_options.tracing {
16817                details.method_name = "google_cloud_discoveryengine_v1::client::UserEventService::import_user_events::until_done";
16818            }
16819
16820            let stub = self.0.stub.clone();
16821            let mut options = self.0.options.clone();
16822            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
16823            let query = move |name| {
16824                let stub = stub.clone();
16825                let options = options.clone();
16826                async {
16827                    let op = GetOperation::new(stub)
16828                        .set_name(name)
16829                        .with_options(options)
16830                        .send()
16831                        .await?;
16832                    Ok(Operation::new(op))
16833                }
16834            };
16835
16836            let start = move || async {
16837                let op = self.send().await?;
16838                Ok(Operation::new(op))
16839            };
16840
16841            use google_cloud_lro::internal::PollerExt;
16842            {
16843                google_cloud_lro::internal::new_poller(
16844                    polling_error_policy,
16845                    polling_backoff_policy,
16846                    start,
16847                    query,
16848                )
16849            }
16850            .with_options(poller_options)
16851        }
16852
16853        /// Sets the value of [parent][crate::model::ImportUserEventsRequest::parent].
16854        ///
16855        /// This is a **required** field for requests.
16856        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
16857            self.0.request.parent = v.into();
16858            self
16859        }
16860
16861        /// Sets the value of [error_config][crate::model::ImportUserEventsRequest::error_config].
16862        pub fn set_error_config<T>(mut self, v: T) -> Self
16863        where
16864            T: std::convert::Into<crate::model::ImportErrorConfig>,
16865        {
16866            self.0.request.error_config = std::option::Option::Some(v.into());
16867            self
16868        }
16869
16870        /// Sets or clears the value of [error_config][crate::model::ImportUserEventsRequest::error_config].
16871        pub fn set_or_clear_error_config<T>(mut self, v: std::option::Option<T>) -> Self
16872        where
16873            T: std::convert::Into<crate::model::ImportErrorConfig>,
16874        {
16875            self.0.request.error_config = v.map(|x| x.into());
16876            self
16877        }
16878
16879        /// Sets the value of [source][crate::model::ImportUserEventsRequest::source].
16880        ///
16881        /// Note that all the setters affecting `source` are
16882        /// mutually exclusive.
16883        pub fn set_source<T: Into<Option<crate::model::import_user_events_request::Source>>>(
16884            mut self,
16885            v: T,
16886        ) -> Self {
16887            self.0.request.source = v.into();
16888            self
16889        }
16890
16891        /// Sets the value of [source][crate::model::ImportUserEventsRequest::source]
16892        /// to hold a `InlineSource`.
16893        ///
16894        /// Note that all the setters affecting `source` are
16895        /// mutually exclusive.
16896        pub fn set_inline_source<
16897            T: std::convert::Into<
16898                    std::boxed::Box<crate::model::import_user_events_request::InlineSource>,
16899                >,
16900        >(
16901            mut self,
16902            v: T,
16903        ) -> Self {
16904            self.0.request = self.0.request.set_inline_source(v);
16905            self
16906        }
16907
16908        /// Sets the value of [source][crate::model::ImportUserEventsRequest::source]
16909        /// to hold a `GcsSource`.
16910        ///
16911        /// Note that all the setters affecting `source` are
16912        /// mutually exclusive.
16913        pub fn set_gcs_source<T: std::convert::Into<std::boxed::Box<crate::model::GcsSource>>>(
16914            mut self,
16915            v: T,
16916        ) -> Self {
16917            self.0.request = self.0.request.set_gcs_source(v);
16918            self
16919        }
16920
16921        /// Sets the value of [source][crate::model::ImportUserEventsRequest::source]
16922        /// to hold a `BigquerySource`.
16923        ///
16924        /// Note that all the setters affecting `source` are
16925        /// mutually exclusive.
16926        pub fn set_bigquery_source<
16927            T: std::convert::Into<std::boxed::Box<crate::model::BigQuerySource>>,
16928        >(
16929            mut self,
16930            v: T,
16931        ) -> Self {
16932            self.0.request = self.0.request.set_bigquery_source(v);
16933            self
16934        }
16935    }
16936
16937    #[doc(hidden)]
16938    impl crate::RequestBuilder for ImportUserEvents {
16939        fn request_options(&mut self) -> &mut crate::RequestOptions {
16940            &mut self.0.options
16941        }
16942    }
16943
16944    /// The request builder for [UserEventService::list_operations][crate::client::UserEventService::list_operations] calls.
16945    ///
16946    /// # Example
16947    /// ```
16948    /// # use google_cloud_discoveryengine_v1::builder::user_event_service::ListOperations;
16949    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
16950    /// use google_cloud_gax::paginator::ItemPaginator;
16951    ///
16952    /// let builder = prepare_request_builder();
16953    /// let mut items = builder.by_item();
16954    /// while let Some(result) = items.next().await {
16955    ///   let item = result?;
16956    /// }
16957    /// # Ok(()) }
16958    ///
16959    /// fn prepare_request_builder() -> ListOperations {
16960    ///   # panic!();
16961    ///   // ... details omitted ...
16962    /// }
16963    /// ```
16964    #[derive(Clone, Debug)]
16965    pub struct ListOperations(
16966        RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
16967    );
16968
16969    impl ListOperations {
16970        pub(crate) fn new(
16971            stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
16972        ) -> Self {
16973            Self(RequestBuilder::new(stub))
16974        }
16975
16976        /// Sets the full request, replacing any prior values.
16977        pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
16978            mut self,
16979            v: V,
16980        ) -> Self {
16981            self.0.request = v.into();
16982            self
16983        }
16984
16985        /// Sets all the options, replacing any prior values.
16986        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
16987            self.0.options = v.into();
16988            self
16989        }
16990
16991        /// Sends the request.
16992        pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
16993            (*self.0.stub)
16994                .list_operations(self.0.request, self.0.options)
16995                .await
16996                .map(crate::Response::into_body)
16997        }
16998
16999        /// Streams each page in the collection.
17000        pub fn by_page(
17001            self,
17002        ) -> impl google_cloud_gax::paginator::Paginator<
17003            google_cloud_longrunning::model::ListOperationsResponse,
17004            crate::Error,
17005        > {
17006            use std::clone::Clone;
17007            let token = self.0.request.page_token.clone();
17008            let execute = move |token: String| {
17009                let mut builder = self.clone();
17010                builder.0.request = builder.0.request.set_page_token(token);
17011                builder.send()
17012            };
17013            google_cloud_gax::paginator::internal::new_paginator(token, execute)
17014        }
17015
17016        /// Streams each item in the collection.
17017        pub fn by_item(
17018            self,
17019        ) -> impl google_cloud_gax::paginator::ItemPaginator<
17020            google_cloud_longrunning::model::ListOperationsResponse,
17021            crate::Error,
17022        > {
17023            use google_cloud_gax::paginator::Paginator;
17024            self.by_page().items()
17025        }
17026
17027        /// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
17028        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
17029            self.0.request.name = v.into();
17030            self
17031        }
17032
17033        /// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::filter].
17034        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
17035            self.0.request.filter = v.into();
17036            self
17037        }
17038
17039        /// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
17040        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
17041            self.0.request.page_size = v.into();
17042            self
17043        }
17044
17045        /// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
17046        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
17047            self.0.request.page_token = v.into();
17048            self
17049        }
17050
17051        /// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
17052        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
17053            self.0.request.return_partial_success = v.into();
17054            self
17055        }
17056    }
17057
17058    #[doc(hidden)]
17059    impl crate::RequestBuilder for ListOperations {
17060        fn request_options(&mut self) -> &mut crate::RequestOptions {
17061            &mut self.0.options
17062        }
17063    }
17064
17065    /// The request builder for [UserEventService::get_operation][crate::client::UserEventService::get_operation] calls.
17066    ///
17067    /// # Example
17068    /// ```
17069    /// # use google_cloud_discoveryengine_v1::builder::user_event_service::GetOperation;
17070    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
17071    ///
17072    /// let builder = prepare_request_builder();
17073    /// let response = builder.send().await?;
17074    /// # Ok(()) }
17075    ///
17076    /// fn prepare_request_builder() -> GetOperation {
17077    ///   # panic!();
17078    ///   // ... details omitted ...
17079    /// }
17080    /// ```
17081    #[derive(Clone, Debug)]
17082    pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
17083
17084    impl GetOperation {
17085        pub(crate) fn new(
17086            stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
17087        ) -> Self {
17088            Self(RequestBuilder::new(stub))
17089        }
17090
17091        /// Sets the full request, replacing any prior values.
17092        pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
17093            mut self,
17094            v: V,
17095        ) -> Self {
17096            self.0.request = v.into();
17097            self
17098        }
17099
17100        /// Sets all the options, replacing any prior values.
17101        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
17102            self.0.options = v.into();
17103            self
17104        }
17105
17106        /// Sends the request.
17107        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
17108            (*self.0.stub)
17109                .get_operation(self.0.request, self.0.options)
17110                .await
17111                .map(crate::Response::into_body)
17112        }
17113
17114        /// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
17115        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
17116            self.0.request.name = v.into();
17117            self
17118        }
17119    }
17120
17121    #[doc(hidden)]
17122    impl crate::RequestBuilder for GetOperation {
17123        fn request_options(&mut self) -> &mut crate::RequestOptions {
17124            &mut self.0.options
17125        }
17126    }
17127
17128    /// The request builder for [UserEventService::cancel_operation][crate::client::UserEventService::cancel_operation] calls.
17129    ///
17130    /// # Example
17131    /// ```
17132    /// # use google_cloud_discoveryengine_v1::builder::user_event_service::CancelOperation;
17133    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
17134    ///
17135    /// let builder = prepare_request_builder();
17136    /// let response = builder.send().await?;
17137    /// # Ok(()) }
17138    ///
17139    /// fn prepare_request_builder() -> CancelOperation {
17140    ///   # panic!();
17141    ///   // ... details omitted ...
17142    /// }
17143    /// ```
17144    #[derive(Clone, Debug)]
17145    pub struct CancelOperation(
17146        RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
17147    );
17148
17149    impl CancelOperation {
17150        pub(crate) fn new(
17151            stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
17152        ) -> Self {
17153            Self(RequestBuilder::new(stub))
17154        }
17155
17156        /// Sets the full request, replacing any prior values.
17157        pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
17158            mut self,
17159            v: V,
17160        ) -> Self {
17161            self.0.request = v.into();
17162            self
17163        }
17164
17165        /// Sets all the options, replacing any prior values.
17166        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
17167            self.0.options = v.into();
17168            self
17169        }
17170
17171        /// Sends the request.
17172        pub async fn send(self) -> Result<()> {
17173            (*self.0.stub)
17174                .cancel_operation(self.0.request, self.0.options)
17175                .await
17176                .map(crate::Response::into_body)
17177        }
17178
17179        /// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::name].
17180        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
17181            self.0.request.name = v.into();
17182            self
17183        }
17184    }
17185
17186    #[doc(hidden)]
17187    impl crate::RequestBuilder for CancelOperation {
17188        fn request_options(&mut self) -> &mut crate::RequestOptions {
17189            &mut self.0.options
17190        }
17191    }
17192}
17193
17194/// Request and client builders for [UserLicenseService][crate::client::UserLicenseService].
17195#[cfg(feature = "user-license-service")]
17196#[cfg_attr(docsrs, doc(cfg(feature = "user-license-service")))]
17197pub mod user_license_service {
17198    use crate::Result;
17199
17200    /// A builder for [UserLicenseService][crate::client::UserLicenseService].
17201    ///
17202    /// ```
17203    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
17204    /// # use google_cloud_discoveryengine_v1::*;
17205    /// # use builder::user_license_service::ClientBuilder;
17206    /// # use client::UserLicenseService;
17207    /// let builder : ClientBuilder = UserLicenseService::builder();
17208    /// let client = builder
17209    ///     .with_endpoint("https://discoveryengine.googleapis.com")
17210    ///     .build().await?;
17211    /// # Ok(()) }
17212    /// ```
17213    pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
17214
17215    pub(crate) mod client {
17216        use super::super::super::client::UserLicenseService;
17217        pub struct Factory;
17218        impl crate::ClientFactory for Factory {
17219            type Client = UserLicenseService;
17220            type Credentials = gaxi::options::Credentials;
17221            async fn build(
17222                self,
17223                config: gaxi::options::ClientConfig,
17224            ) -> crate::ClientBuilderResult<Self::Client> {
17225                Self::Client::new(config).await
17226            }
17227        }
17228    }
17229
17230    /// Common implementation for [crate::client::UserLicenseService] request builders.
17231    #[derive(Clone, Debug)]
17232    pub(crate) struct RequestBuilder<R: std::default::Default> {
17233        stub: std::sync::Arc<dyn super::super::stub::dynamic::UserLicenseService>,
17234        request: R,
17235        options: crate::RequestOptions,
17236    }
17237
17238    impl<R> RequestBuilder<R>
17239    where
17240        R: std::default::Default,
17241    {
17242        pub(crate) fn new(
17243            stub: std::sync::Arc<dyn super::super::stub::dynamic::UserLicenseService>,
17244        ) -> Self {
17245            Self {
17246                stub,
17247                request: R::default(),
17248                options: crate::RequestOptions::default(),
17249            }
17250        }
17251    }
17252
17253    /// The request builder for [UserLicenseService::list_user_licenses][crate::client::UserLicenseService::list_user_licenses] calls.
17254    ///
17255    /// # Example
17256    /// ```
17257    /// # use google_cloud_discoveryengine_v1::builder::user_license_service::ListUserLicenses;
17258    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
17259    /// use google_cloud_gax::paginator::ItemPaginator;
17260    ///
17261    /// let builder = prepare_request_builder();
17262    /// let mut items = builder.by_item();
17263    /// while let Some(result) = items.next().await {
17264    ///   let item = result?;
17265    /// }
17266    /// # Ok(()) }
17267    ///
17268    /// fn prepare_request_builder() -> ListUserLicenses {
17269    ///   # panic!();
17270    ///   // ... details omitted ...
17271    /// }
17272    /// ```
17273    #[derive(Clone, Debug)]
17274    pub struct ListUserLicenses(RequestBuilder<crate::model::ListUserLicensesRequest>);
17275
17276    impl ListUserLicenses {
17277        pub(crate) fn new(
17278            stub: std::sync::Arc<dyn super::super::stub::dynamic::UserLicenseService>,
17279        ) -> Self {
17280            Self(RequestBuilder::new(stub))
17281        }
17282
17283        /// Sets the full request, replacing any prior values.
17284        pub fn with_request<V: Into<crate::model::ListUserLicensesRequest>>(
17285            mut self,
17286            v: V,
17287        ) -> Self {
17288            self.0.request = v.into();
17289            self
17290        }
17291
17292        /// Sets all the options, replacing any prior values.
17293        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
17294            self.0.options = v.into();
17295            self
17296        }
17297
17298        /// Sends the request.
17299        pub async fn send(self) -> Result<crate::model::ListUserLicensesResponse> {
17300            (*self.0.stub)
17301                .list_user_licenses(self.0.request, self.0.options)
17302                .await
17303                .map(crate::Response::into_body)
17304        }
17305
17306        /// Streams each page in the collection.
17307        pub fn by_page(
17308            self,
17309        ) -> impl google_cloud_gax::paginator::Paginator<
17310            crate::model::ListUserLicensesResponse,
17311            crate::Error,
17312        > {
17313            use std::clone::Clone;
17314            let token = self.0.request.page_token.clone();
17315            let execute = move |token: String| {
17316                let mut builder = self.clone();
17317                builder.0.request = builder.0.request.set_page_token(token);
17318                builder.send()
17319            };
17320            google_cloud_gax::paginator::internal::new_paginator(token, execute)
17321        }
17322
17323        /// Streams each item in the collection.
17324        pub fn by_item(
17325            self,
17326        ) -> impl google_cloud_gax::paginator::ItemPaginator<
17327            crate::model::ListUserLicensesResponse,
17328            crate::Error,
17329        > {
17330            use google_cloud_gax::paginator::Paginator;
17331            self.by_page().items()
17332        }
17333
17334        /// Sets the value of [parent][crate::model::ListUserLicensesRequest::parent].
17335        ///
17336        /// This is a **required** field for requests.
17337        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
17338            self.0.request.parent = v.into();
17339            self
17340        }
17341
17342        /// Sets the value of [page_size][crate::model::ListUserLicensesRequest::page_size].
17343        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
17344            self.0.request.page_size = v.into();
17345            self
17346        }
17347
17348        /// Sets the value of [page_token][crate::model::ListUserLicensesRequest::page_token].
17349        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
17350            self.0.request.page_token = v.into();
17351            self
17352        }
17353
17354        /// Sets the value of [filter][crate::model::ListUserLicensesRequest::filter].
17355        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
17356            self.0.request.filter = v.into();
17357            self
17358        }
17359    }
17360
17361    #[doc(hidden)]
17362    impl crate::RequestBuilder for ListUserLicenses {
17363        fn request_options(&mut self) -> &mut crate::RequestOptions {
17364            &mut self.0.options
17365        }
17366    }
17367
17368    /// The request builder for [UserLicenseService::batch_update_user_licenses][crate::client::UserLicenseService::batch_update_user_licenses] calls.
17369    ///
17370    /// # Example
17371    /// ```
17372    /// # use google_cloud_discoveryengine_v1::builder::user_license_service::BatchUpdateUserLicenses;
17373    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
17374    /// use google_cloud_lro::Poller;
17375    ///
17376    /// let builder = prepare_request_builder();
17377    /// let response = builder.poller().until_done().await?;
17378    /// # Ok(()) }
17379    ///
17380    /// fn prepare_request_builder() -> BatchUpdateUserLicenses {
17381    ///   # panic!();
17382    ///   // ... details omitted ...
17383    /// }
17384    /// ```
17385    #[derive(Clone, Debug)]
17386    pub struct BatchUpdateUserLicenses(
17387        RequestBuilder<crate::model::BatchUpdateUserLicensesRequest>,
17388    );
17389
17390    impl BatchUpdateUserLicenses {
17391        pub(crate) fn new(
17392            stub: std::sync::Arc<dyn super::super::stub::dynamic::UserLicenseService>,
17393        ) -> Self {
17394            Self(RequestBuilder::new(stub))
17395        }
17396
17397        /// Sets the full request, replacing any prior values.
17398        pub fn with_request<V: Into<crate::model::BatchUpdateUserLicensesRequest>>(
17399            mut self,
17400            v: V,
17401        ) -> Self {
17402            self.0.request = v.into();
17403            self
17404        }
17405
17406        /// Sets all the options, replacing any prior values.
17407        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
17408            self.0.options = v.into();
17409            self
17410        }
17411
17412        /// Sends the request.
17413        ///
17414        /// # Long running operations
17415        ///
17416        /// This starts, but does not poll, a longrunning operation. More information
17417        /// on [batch_update_user_licenses][crate::client::UserLicenseService::batch_update_user_licenses].
17418        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
17419            (*self.0.stub)
17420                .batch_update_user_licenses(self.0.request, self.0.options)
17421                .await
17422                .map(crate::Response::into_body)
17423        }
17424
17425        /// Creates a [Poller][google_cloud_lro::Poller] to work with `batch_update_user_licenses`.
17426        pub fn poller(
17427            self,
17428        ) -> impl google_cloud_lro::Poller<
17429            crate::model::BatchUpdateUserLicensesResponse,
17430            crate::model::BatchUpdateUserLicensesMetadata,
17431        > {
17432            type Operation = google_cloud_lro::internal::Operation<
17433                crate::model::BatchUpdateUserLicensesResponse,
17434                crate::model::BatchUpdateUserLicensesMetadata,
17435            >;
17436            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
17437            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
17438            let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
17439            if let Some(ref mut details) = poller_options.tracing {
17440                details.method_name = "google_cloud_discoveryengine_v1::client::UserLicenseService::batch_update_user_licenses::until_done";
17441            }
17442
17443            let stub = self.0.stub.clone();
17444            let mut options = self.0.options.clone();
17445            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
17446            let query = move |name| {
17447                let stub = stub.clone();
17448                let options = options.clone();
17449                async {
17450                    let op = GetOperation::new(stub)
17451                        .set_name(name)
17452                        .with_options(options)
17453                        .send()
17454                        .await?;
17455                    Ok(Operation::new(op))
17456                }
17457            };
17458
17459            let start = move || async {
17460                let op = self.send().await?;
17461                Ok(Operation::new(op))
17462            };
17463
17464            use google_cloud_lro::internal::PollerExt;
17465            {
17466                google_cloud_lro::internal::new_poller(
17467                    polling_error_policy,
17468                    polling_backoff_policy,
17469                    start,
17470                    query,
17471                )
17472            }
17473            .with_options(poller_options)
17474        }
17475
17476        /// Sets the value of [parent][crate::model::BatchUpdateUserLicensesRequest::parent].
17477        ///
17478        /// This is a **required** field for requests.
17479        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
17480            self.0.request.parent = v.into();
17481            self
17482        }
17483
17484        /// Sets the value of [delete_unassigned_user_licenses][crate::model::BatchUpdateUserLicensesRequest::delete_unassigned_user_licenses].
17485        pub fn set_delete_unassigned_user_licenses<T: Into<bool>>(mut self, v: T) -> Self {
17486            self.0.request.delete_unassigned_user_licenses = v.into();
17487            self
17488        }
17489
17490        /// Sets the value of [source][crate::model::BatchUpdateUserLicensesRequest::source].
17491        ///
17492        /// Note that all the setters affecting `source` are
17493        /// mutually exclusive.
17494        pub fn set_source<
17495            T: Into<Option<crate::model::batch_update_user_licenses_request::Source>>,
17496        >(
17497            mut self,
17498            v: T,
17499        ) -> Self {
17500            self.0.request.source = v.into();
17501            self
17502        }
17503
17504        /// Sets the value of [source][crate::model::BatchUpdateUserLicensesRequest::source]
17505        /// to hold a `InlineSource`.
17506        ///
17507        /// Note that all the setters affecting `source` are
17508        /// mutually exclusive.
17509        pub fn set_inline_source<
17510            T: std::convert::Into<
17511                    std::boxed::Box<crate::model::batch_update_user_licenses_request::InlineSource>,
17512                >,
17513        >(
17514            mut self,
17515            v: T,
17516        ) -> Self {
17517            self.0.request = self.0.request.set_inline_source(v);
17518            self
17519        }
17520    }
17521
17522    #[doc(hidden)]
17523    impl crate::RequestBuilder for BatchUpdateUserLicenses {
17524        fn request_options(&mut self) -> &mut crate::RequestOptions {
17525            &mut self.0.options
17526        }
17527    }
17528
17529    /// The request builder for [UserLicenseService::list_operations][crate::client::UserLicenseService::list_operations] calls.
17530    ///
17531    /// # Example
17532    /// ```
17533    /// # use google_cloud_discoveryengine_v1::builder::user_license_service::ListOperations;
17534    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
17535    /// use google_cloud_gax::paginator::ItemPaginator;
17536    ///
17537    /// let builder = prepare_request_builder();
17538    /// let mut items = builder.by_item();
17539    /// while let Some(result) = items.next().await {
17540    ///   let item = result?;
17541    /// }
17542    /// # Ok(()) }
17543    ///
17544    /// fn prepare_request_builder() -> ListOperations {
17545    ///   # panic!();
17546    ///   // ... details omitted ...
17547    /// }
17548    /// ```
17549    #[derive(Clone, Debug)]
17550    pub struct ListOperations(
17551        RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
17552    );
17553
17554    impl ListOperations {
17555        pub(crate) fn new(
17556            stub: std::sync::Arc<dyn super::super::stub::dynamic::UserLicenseService>,
17557        ) -> Self {
17558            Self(RequestBuilder::new(stub))
17559        }
17560
17561        /// Sets the full request, replacing any prior values.
17562        pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
17563            mut self,
17564            v: V,
17565        ) -> Self {
17566            self.0.request = v.into();
17567            self
17568        }
17569
17570        /// Sets all the options, replacing any prior values.
17571        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
17572            self.0.options = v.into();
17573            self
17574        }
17575
17576        /// Sends the request.
17577        pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
17578            (*self.0.stub)
17579                .list_operations(self.0.request, self.0.options)
17580                .await
17581                .map(crate::Response::into_body)
17582        }
17583
17584        /// Streams each page in the collection.
17585        pub fn by_page(
17586            self,
17587        ) -> impl google_cloud_gax::paginator::Paginator<
17588            google_cloud_longrunning::model::ListOperationsResponse,
17589            crate::Error,
17590        > {
17591            use std::clone::Clone;
17592            let token = self.0.request.page_token.clone();
17593            let execute = move |token: String| {
17594                let mut builder = self.clone();
17595                builder.0.request = builder.0.request.set_page_token(token);
17596                builder.send()
17597            };
17598            google_cloud_gax::paginator::internal::new_paginator(token, execute)
17599        }
17600
17601        /// Streams each item in the collection.
17602        pub fn by_item(
17603            self,
17604        ) -> impl google_cloud_gax::paginator::ItemPaginator<
17605            google_cloud_longrunning::model::ListOperationsResponse,
17606            crate::Error,
17607        > {
17608            use google_cloud_gax::paginator::Paginator;
17609            self.by_page().items()
17610        }
17611
17612        /// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
17613        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
17614            self.0.request.name = v.into();
17615            self
17616        }
17617
17618        /// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::filter].
17619        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
17620            self.0.request.filter = v.into();
17621            self
17622        }
17623
17624        /// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
17625        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
17626            self.0.request.page_size = v.into();
17627            self
17628        }
17629
17630        /// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
17631        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
17632            self.0.request.page_token = v.into();
17633            self
17634        }
17635
17636        /// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
17637        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
17638            self.0.request.return_partial_success = v.into();
17639            self
17640        }
17641    }
17642
17643    #[doc(hidden)]
17644    impl crate::RequestBuilder for ListOperations {
17645        fn request_options(&mut self) -> &mut crate::RequestOptions {
17646            &mut self.0.options
17647        }
17648    }
17649
17650    /// The request builder for [UserLicenseService::get_operation][crate::client::UserLicenseService::get_operation] calls.
17651    ///
17652    /// # Example
17653    /// ```
17654    /// # use google_cloud_discoveryengine_v1::builder::user_license_service::GetOperation;
17655    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
17656    ///
17657    /// let builder = prepare_request_builder();
17658    /// let response = builder.send().await?;
17659    /// # Ok(()) }
17660    ///
17661    /// fn prepare_request_builder() -> GetOperation {
17662    ///   # panic!();
17663    ///   // ... details omitted ...
17664    /// }
17665    /// ```
17666    #[derive(Clone, Debug)]
17667    pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
17668
17669    impl GetOperation {
17670        pub(crate) fn new(
17671            stub: std::sync::Arc<dyn super::super::stub::dynamic::UserLicenseService>,
17672        ) -> Self {
17673            Self(RequestBuilder::new(stub))
17674        }
17675
17676        /// Sets the full request, replacing any prior values.
17677        pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
17678            mut self,
17679            v: V,
17680        ) -> Self {
17681            self.0.request = v.into();
17682            self
17683        }
17684
17685        /// Sets all the options, replacing any prior values.
17686        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
17687            self.0.options = v.into();
17688            self
17689        }
17690
17691        /// Sends the request.
17692        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
17693            (*self.0.stub)
17694                .get_operation(self.0.request, self.0.options)
17695                .await
17696                .map(crate::Response::into_body)
17697        }
17698
17699        /// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
17700        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
17701            self.0.request.name = v.into();
17702            self
17703        }
17704    }
17705
17706    #[doc(hidden)]
17707    impl crate::RequestBuilder for GetOperation {
17708        fn request_options(&mut self) -> &mut crate::RequestOptions {
17709            &mut self.0.options
17710        }
17711    }
17712
17713    /// The request builder for [UserLicenseService::cancel_operation][crate::client::UserLicenseService::cancel_operation] calls.
17714    ///
17715    /// # Example
17716    /// ```
17717    /// # use google_cloud_discoveryengine_v1::builder::user_license_service::CancelOperation;
17718    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
17719    ///
17720    /// let builder = prepare_request_builder();
17721    /// let response = builder.send().await?;
17722    /// # Ok(()) }
17723    ///
17724    /// fn prepare_request_builder() -> CancelOperation {
17725    ///   # panic!();
17726    ///   // ... details omitted ...
17727    /// }
17728    /// ```
17729    #[derive(Clone, Debug)]
17730    pub struct CancelOperation(
17731        RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
17732    );
17733
17734    impl CancelOperation {
17735        pub(crate) fn new(
17736            stub: std::sync::Arc<dyn super::super::stub::dynamic::UserLicenseService>,
17737        ) -> Self {
17738            Self(RequestBuilder::new(stub))
17739        }
17740
17741        /// Sets the full request, replacing any prior values.
17742        pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
17743            mut self,
17744            v: V,
17745        ) -> Self {
17746            self.0.request = v.into();
17747            self
17748        }
17749
17750        /// Sets all the options, replacing any prior values.
17751        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
17752            self.0.options = v.into();
17753            self
17754        }
17755
17756        /// Sends the request.
17757        pub async fn send(self) -> Result<()> {
17758            (*self.0.stub)
17759                .cancel_operation(self.0.request, self.0.options)
17760                .await
17761                .map(crate::Response::into_body)
17762        }
17763
17764        /// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::name].
17765        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
17766            self.0.request.name = v.into();
17767            self
17768        }
17769    }
17770
17771    #[doc(hidden)]
17772    impl crate::RequestBuilder for CancelOperation {
17773        fn request_options(&mut self) -> &mut crate::RequestOptions {
17774            &mut self.0.options
17775        }
17776    }
17777}