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
454            let stub = self.0.stub.clone();
455            let mut options = self.0.options.clone();
456            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
457            let query = move |name| {
458                let stub = stub.clone();
459                let options = options.clone();
460                async {
461                    let op = GetOperation::new(stub)
462                        .set_name(name)
463                        .with_options(options)
464                        .send()
465                        .await?;
466                    Ok(Operation::new(op))
467                }
468            };
469
470            let start = move || async {
471                let op = self.send().await?;
472                Ok(Operation::new(op))
473            };
474
475            google_cloud_lro::internal::new_poller(
476                polling_error_policy,
477                polling_backoff_policy,
478                start,
479                query,
480            )
481        }
482
483        /// Sets the value of [config][crate::model::UpdateCmekConfigRequest::config].
484        ///
485        /// This is a **required** field for requests.
486        pub fn set_config<T>(mut self, v: T) -> Self
487        where
488            T: std::convert::Into<crate::model::CmekConfig>,
489        {
490            self.0.request.config = std::option::Option::Some(v.into());
491            self
492        }
493
494        /// Sets or clears the value of [config][crate::model::UpdateCmekConfigRequest::config].
495        ///
496        /// This is a **required** field for requests.
497        pub fn set_or_clear_config<T>(mut self, v: std::option::Option<T>) -> Self
498        where
499            T: std::convert::Into<crate::model::CmekConfig>,
500        {
501            self.0.request.config = v.map(|x| x.into());
502            self
503        }
504
505        /// Sets the value of [set_default][crate::model::UpdateCmekConfigRequest::set_default].
506        pub fn set_set_default<T: Into<bool>>(mut self, v: T) -> Self {
507            self.0.request.set_default = v.into();
508            self
509        }
510    }
511
512    #[doc(hidden)]
513    impl crate::RequestBuilder for UpdateCmekConfig {
514        fn request_options(&mut self) -> &mut crate::RequestOptions {
515            &mut self.0.options
516        }
517    }
518
519    /// The request builder for [CmekConfigService::get_cmek_config][crate::client::CmekConfigService::get_cmek_config] calls.
520    ///
521    /// # Example
522    /// ```
523    /// # use google_cloud_discoveryengine_v1::builder::cmek_config_service::GetCmekConfig;
524    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
525    ///
526    /// let builder = prepare_request_builder();
527    /// let response = builder.send().await?;
528    /// # Ok(()) }
529    ///
530    /// fn prepare_request_builder() -> GetCmekConfig {
531    ///   # panic!();
532    ///   // ... details omitted ...
533    /// }
534    /// ```
535    #[derive(Clone, Debug)]
536    pub struct GetCmekConfig(RequestBuilder<crate::model::GetCmekConfigRequest>);
537
538    impl GetCmekConfig {
539        pub(crate) fn new(
540            stub: std::sync::Arc<dyn super::super::stub::dynamic::CmekConfigService>,
541        ) -> Self {
542            Self(RequestBuilder::new(stub))
543        }
544
545        /// Sets the full request, replacing any prior values.
546        pub fn with_request<V: Into<crate::model::GetCmekConfigRequest>>(mut self, v: V) -> Self {
547            self.0.request = v.into();
548            self
549        }
550
551        /// Sets all the options, replacing any prior values.
552        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
553            self.0.options = v.into();
554            self
555        }
556
557        /// Sends the request.
558        pub async fn send(self) -> Result<crate::model::CmekConfig> {
559            (*self.0.stub)
560                .get_cmek_config(self.0.request, self.0.options)
561                .await
562                .map(crate::Response::into_body)
563        }
564
565        /// Sets the value of [name][crate::model::GetCmekConfigRequest::name].
566        ///
567        /// This is a **required** field for requests.
568        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
569            self.0.request.name = v.into();
570            self
571        }
572    }
573
574    #[doc(hidden)]
575    impl crate::RequestBuilder for GetCmekConfig {
576        fn request_options(&mut self) -> &mut crate::RequestOptions {
577            &mut self.0.options
578        }
579    }
580
581    /// The request builder for [CmekConfigService::list_cmek_configs][crate::client::CmekConfigService::list_cmek_configs] calls.
582    ///
583    /// # Example
584    /// ```
585    /// # use google_cloud_discoveryengine_v1::builder::cmek_config_service::ListCmekConfigs;
586    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
587    ///
588    /// let builder = prepare_request_builder();
589    /// let response = builder.send().await?;
590    /// # Ok(()) }
591    ///
592    /// fn prepare_request_builder() -> ListCmekConfigs {
593    ///   # panic!();
594    ///   // ... details omitted ...
595    /// }
596    /// ```
597    #[derive(Clone, Debug)]
598    pub struct ListCmekConfigs(RequestBuilder<crate::model::ListCmekConfigsRequest>);
599
600    impl ListCmekConfigs {
601        pub(crate) fn new(
602            stub: std::sync::Arc<dyn super::super::stub::dynamic::CmekConfigService>,
603        ) -> Self {
604            Self(RequestBuilder::new(stub))
605        }
606
607        /// Sets the full request, replacing any prior values.
608        pub fn with_request<V: Into<crate::model::ListCmekConfigsRequest>>(mut self, v: V) -> Self {
609            self.0.request = v.into();
610            self
611        }
612
613        /// Sets all the options, replacing any prior values.
614        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
615            self.0.options = v.into();
616            self
617        }
618
619        /// Sends the request.
620        pub async fn send(self) -> Result<crate::model::ListCmekConfigsResponse> {
621            (*self.0.stub)
622                .list_cmek_configs(self.0.request, self.0.options)
623                .await
624                .map(crate::Response::into_body)
625        }
626
627        /// Sets the value of [parent][crate::model::ListCmekConfigsRequest::parent].
628        ///
629        /// This is a **required** field for requests.
630        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
631            self.0.request.parent = v.into();
632            self
633        }
634    }
635
636    #[doc(hidden)]
637    impl crate::RequestBuilder for ListCmekConfigs {
638        fn request_options(&mut self) -> &mut crate::RequestOptions {
639            &mut self.0.options
640        }
641    }
642
643    /// The request builder for [CmekConfigService::delete_cmek_config][crate::client::CmekConfigService::delete_cmek_config] calls.
644    ///
645    /// # Example
646    /// ```
647    /// # use google_cloud_discoveryengine_v1::builder::cmek_config_service::DeleteCmekConfig;
648    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
649    /// use google_cloud_lro::Poller;
650    ///
651    /// let builder = prepare_request_builder();
652    /// let response = builder.poller().until_done().await?;
653    /// # Ok(()) }
654    ///
655    /// fn prepare_request_builder() -> DeleteCmekConfig {
656    ///   # panic!();
657    ///   // ... details omitted ...
658    /// }
659    /// ```
660    #[derive(Clone, Debug)]
661    pub struct DeleteCmekConfig(RequestBuilder<crate::model::DeleteCmekConfigRequest>);
662
663    impl DeleteCmekConfig {
664        pub(crate) fn new(
665            stub: std::sync::Arc<dyn super::super::stub::dynamic::CmekConfigService>,
666        ) -> Self {
667            Self(RequestBuilder::new(stub))
668        }
669
670        /// Sets the full request, replacing any prior values.
671        pub fn with_request<V: Into<crate::model::DeleteCmekConfigRequest>>(
672            mut self,
673            v: V,
674        ) -> Self {
675            self.0.request = v.into();
676            self
677        }
678
679        /// Sets all the options, replacing any prior values.
680        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
681            self.0.options = v.into();
682            self
683        }
684
685        /// Sends the request.
686        ///
687        /// # Long running operations
688        ///
689        /// This starts, but does not poll, a longrunning operation. More information
690        /// on [delete_cmek_config][crate::client::CmekConfigService::delete_cmek_config].
691        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
692            (*self.0.stub)
693                .delete_cmek_config(self.0.request, self.0.options)
694                .await
695                .map(crate::Response::into_body)
696        }
697
698        /// Creates a [Poller][google_cloud_lro::Poller] to work with `delete_cmek_config`.
699        pub fn poller(
700            self,
701        ) -> impl google_cloud_lro::Poller<(), crate::model::DeleteCmekConfigMetadata> {
702            type Operation = google_cloud_lro::internal::Operation<
703                wkt::Empty,
704                crate::model::DeleteCmekConfigMetadata,
705            >;
706            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
707            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
708
709            let stub = self.0.stub.clone();
710            let mut options = self.0.options.clone();
711            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
712            let query = move |name| {
713                let stub = stub.clone();
714                let options = options.clone();
715                async {
716                    let op = GetOperation::new(stub)
717                        .set_name(name)
718                        .with_options(options)
719                        .send()
720                        .await?;
721                    Ok(Operation::new(op))
722                }
723            };
724
725            let start = move || async {
726                let op = self.send().await?;
727                Ok(Operation::new(op))
728            };
729
730            google_cloud_lro::internal::new_unit_response_poller(
731                polling_error_policy,
732                polling_backoff_policy,
733                start,
734                query,
735            )
736        }
737
738        /// Sets the value of [name][crate::model::DeleteCmekConfigRequest::name].
739        ///
740        /// This is a **required** field for requests.
741        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
742            self.0.request.name = v.into();
743            self
744        }
745    }
746
747    #[doc(hidden)]
748    impl crate::RequestBuilder for DeleteCmekConfig {
749        fn request_options(&mut self) -> &mut crate::RequestOptions {
750            &mut self.0.options
751        }
752    }
753
754    /// The request builder for [CmekConfigService::list_operations][crate::client::CmekConfigService::list_operations] calls.
755    ///
756    /// # Example
757    /// ```
758    /// # use google_cloud_discoveryengine_v1::builder::cmek_config_service::ListOperations;
759    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
760    /// use google_cloud_gax::paginator::ItemPaginator;
761    ///
762    /// let builder = prepare_request_builder();
763    /// let mut items = builder.by_item();
764    /// while let Some(result) = items.next().await {
765    ///   let item = result?;
766    /// }
767    /// # Ok(()) }
768    ///
769    /// fn prepare_request_builder() -> ListOperations {
770    ///   # panic!();
771    ///   // ... details omitted ...
772    /// }
773    /// ```
774    #[derive(Clone, Debug)]
775    pub struct ListOperations(
776        RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
777    );
778
779    impl ListOperations {
780        pub(crate) fn new(
781            stub: std::sync::Arc<dyn super::super::stub::dynamic::CmekConfigService>,
782        ) -> Self {
783            Self(RequestBuilder::new(stub))
784        }
785
786        /// Sets the full request, replacing any prior values.
787        pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
788            mut self,
789            v: V,
790        ) -> Self {
791            self.0.request = v.into();
792            self
793        }
794
795        /// Sets all the options, replacing any prior values.
796        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
797            self.0.options = v.into();
798            self
799        }
800
801        /// Sends the request.
802        pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
803            (*self.0.stub)
804                .list_operations(self.0.request, self.0.options)
805                .await
806                .map(crate::Response::into_body)
807        }
808
809        /// Streams each page in the collection.
810        pub fn by_page(
811            self,
812        ) -> impl google_cloud_gax::paginator::Paginator<
813            google_cloud_longrunning::model::ListOperationsResponse,
814            crate::Error,
815        > {
816            use std::clone::Clone;
817            let token = self.0.request.page_token.clone();
818            let execute = move |token: String| {
819                let mut builder = self.clone();
820                builder.0.request = builder.0.request.set_page_token(token);
821                builder.send()
822            };
823            google_cloud_gax::paginator::internal::new_paginator(token, execute)
824        }
825
826        /// Streams each item in the collection.
827        pub fn by_item(
828            self,
829        ) -> impl google_cloud_gax::paginator::ItemPaginator<
830            google_cloud_longrunning::model::ListOperationsResponse,
831            crate::Error,
832        > {
833            use google_cloud_gax::paginator::Paginator;
834            self.by_page().items()
835        }
836
837        /// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
838        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
839            self.0.request.name = v.into();
840            self
841        }
842
843        /// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::filter].
844        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
845            self.0.request.filter = v.into();
846            self
847        }
848
849        /// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
850        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
851            self.0.request.page_size = v.into();
852            self
853        }
854
855        /// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
856        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
857            self.0.request.page_token = v.into();
858            self
859        }
860
861        /// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
862        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
863            self.0.request.return_partial_success = v.into();
864            self
865        }
866    }
867
868    #[doc(hidden)]
869    impl crate::RequestBuilder for ListOperations {
870        fn request_options(&mut self) -> &mut crate::RequestOptions {
871            &mut self.0.options
872        }
873    }
874
875    /// The request builder for [CmekConfigService::get_operation][crate::client::CmekConfigService::get_operation] calls.
876    ///
877    /// # Example
878    /// ```
879    /// # use google_cloud_discoveryengine_v1::builder::cmek_config_service::GetOperation;
880    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
881    ///
882    /// let builder = prepare_request_builder();
883    /// let response = builder.send().await?;
884    /// # Ok(()) }
885    ///
886    /// fn prepare_request_builder() -> GetOperation {
887    ///   # panic!();
888    ///   // ... details omitted ...
889    /// }
890    /// ```
891    #[derive(Clone, Debug)]
892    pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
893
894    impl GetOperation {
895        pub(crate) fn new(
896            stub: std::sync::Arc<dyn super::super::stub::dynamic::CmekConfigService>,
897        ) -> Self {
898            Self(RequestBuilder::new(stub))
899        }
900
901        /// Sets the full request, replacing any prior values.
902        pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
903            mut self,
904            v: V,
905        ) -> Self {
906            self.0.request = v.into();
907            self
908        }
909
910        /// Sets all the options, replacing any prior values.
911        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
912            self.0.options = v.into();
913            self
914        }
915
916        /// Sends the request.
917        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
918            (*self.0.stub)
919                .get_operation(self.0.request, self.0.options)
920                .await
921                .map(crate::Response::into_body)
922        }
923
924        /// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
925        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
926            self.0.request.name = v.into();
927            self
928        }
929    }
930
931    #[doc(hidden)]
932    impl crate::RequestBuilder for GetOperation {
933        fn request_options(&mut self) -> &mut crate::RequestOptions {
934            &mut self.0.options
935        }
936    }
937
938    /// The request builder for [CmekConfigService::cancel_operation][crate::client::CmekConfigService::cancel_operation] calls.
939    ///
940    /// # Example
941    /// ```
942    /// # use google_cloud_discoveryengine_v1::builder::cmek_config_service::CancelOperation;
943    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
944    ///
945    /// let builder = prepare_request_builder();
946    /// let response = builder.send().await?;
947    /// # Ok(()) }
948    ///
949    /// fn prepare_request_builder() -> CancelOperation {
950    ///   # panic!();
951    ///   // ... details omitted ...
952    /// }
953    /// ```
954    #[derive(Clone, Debug)]
955    pub struct CancelOperation(
956        RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
957    );
958
959    impl CancelOperation {
960        pub(crate) fn new(
961            stub: std::sync::Arc<dyn super::super::stub::dynamic::CmekConfigService>,
962        ) -> Self {
963            Self(RequestBuilder::new(stub))
964        }
965
966        /// Sets the full request, replacing any prior values.
967        pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
968            mut self,
969            v: V,
970        ) -> Self {
971            self.0.request = v.into();
972            self
973        }
974
975        /// Sets all the options, replacing any prior values.
976        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
977            self.0.options = v.into();
978            self
979        }
980
981        /// Sends the request.
982        pub async fn send(self) -> Result<()> {
983            (*self.0.stub)
984                .cancel_operation(self.0.request, self.0.options)
985                .await
986                .map(crate::Response::into_body)
987        }
988
989        /// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::name].
990        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
991            self.0.request.name = v.into();
992            self
993        }
994    }
995
996    #[doc(hidden)]
997    impl crate::RequestBuilder for CancelOperation {
998        fn request_options(&mut self) -> &mut crate::RequestOptions {
999            &mut self.0.options
1000        }
1001    }
1002}
1003
1004/// Request and client builders for [CompletionService][crate::client::CompletionService].
1005#[cfg(feature = "completion-service")]
1006#[cfg_attr(docsrs, doc(cfg(feature = "completion-service")))]
1007pub mod completion_service {
1008    use crate::Result;
1009
1010    /// A builder for [CompletionService][crate::client::CompletionService].
1011    ///
1012    /// ```
1013    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
1014    /// # use google_cloud_discoveryengine_v1::*;
1015    /// # use builder::completion_service::ClientBuilder;
1016    /// # use client::CompletionService;
1017    /// let builder : ClientBuilder = CompletionService::builder();
1018    /// let client = builder
1019    ///     .with_endpoint("https://discoveryengine.googleapis.com")
1020    ///     .build().await?;
1021    /// # Ok(()) }
1022    /// ```
1023    pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
1024
1025    pub(crate) mod client {
1026        use super::super::super::client::CompletionService;
1027        pub struct Factory;
1028        impl crate::ClientFactory for Factory {
1029            type Client = CompletionService;
1030            type Credentials = gaxi::options::Credentials;
1031            async fn build(
1032                self,
1033                config: gaxi::options::ClientConfig,
1034            ) -> crate::ClientBuilderResult<Self::Client> {
1035                Self::Client::new(config).await
1036            }
1037        }
1038    }
1039
1040    /// Common implementation for [crate::client::CompletionService] request builders.
1041    #[derive(Clone, Debug)]
1042    pub(crate) struct RequestBuilder<R: std::default::Default> {
1043        stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1044        request: R,
1045        options: crate::RequestOptions,
1046    }
1047
1048    impl<R> RequestBuilder<R>
1049    where
1050        R: std::default::Default,
1051    {
1052        pub(crate) fn new(
1053            stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1054        ) -> Self {
1055            Self {
1056                stub,
1057                request: R::default(),
1058                options: crate::RequestOptions::default(),
1059            }
1060        }
1061    }
1062
1063    /// The request builder for [CompletionService::complete_query][crate::client::CompletionService::complete_query] calls.
1064    ///
1065    /// # Example
1066    /// ```
1067    /// # use google_cloud_discoveryengine_v1::builder::completion_service::CompleteQuery;
1068    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
1069    ///
1070    /// let builder = prepare_request_builder();
1071    /// let response = builder.send().await?;
1072    /// # Ok(()) }
1073    ///
1074    /// fn prepare_request_builder() -> CompleteQuery {
1075    ///   # panic!();
1076    ///   // ... details omitted ...
1077    /// }
1078    /// ```
1079    #[derive(Clone, Debug)]
1080    pub struct CompleteQuery(RequestBuilder<crate::model::CompleteQueryRequest>);
1081
1082    impl CompleteQuery {
1083        pub(crate) fn new(
1084            stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1085        ) -> Self {
1086            Self(RequestBuilder::new(stub))
1087        }
1088
1089        /// Sets the full request, replacing any prior values.
1090        pub fn with_request<V: Into<crate::model::CompleteQueryRequest>>(mut self, v: V) -> Self {
1091            self.0.request = v.into();
1092            self
1093        }
1094
1095        /// Sets all the options, replacing any prior values.
1096        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1097            self.0.options = v.into();
1098            self
1099        }
1100
1101        /// Sends the request.
1102        pub async fn send(self) -> Result<crate::model::CompleteQueryResponse> {
1103            (*self.0.stub)
1104                .complete_query(self.0.request, self.0.options)
1105                .await
1106                .map(crate::Response::into_body)
1107        }
1108
1109        /// Sets the value of [data_store][crate::model::CompleteQueryRequest::data_store].
1110        ///
1111        /// This is a **required** field for requests.
1112        pub fn set_data_store<T: Into<std::string::String>>(mut self, v: T) -> Self {
1113            self.0.request.data_store = v.into();
1114            self
1115        }
1116
1117        /// Sets the value of [query][crate::model::CompleteQueryRequest::query].
1118        ///
1119        /// This is a **required** field for requests.
1120        pub fn set_query<T: Into<std::string::String>>(mut self, v: T) -> Self {
1121            self.0.request.query = v.into();
1122            self
1123        }
1124
1125        /// Sets the value of [query_model][crate::model::CompleteQueryRequest::query_model].
1126        pub fn set_query_model<T: Into<std::string::String>>(mut self, v: T) -> Self {
1127            self.0.request.query_model = v.into();
1128            self
1129        }
1130
1131        /// Sets the value of [user_pseudo_id][crate::model::CompleteQueryRequest::user_pseudo_id].
1132        pub fn set_user_pseudo_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1133            self.0.request.user_pseudo_id = v.into();
1134            self
1135        }
1136
1137        /// Sets the value of [include_tail_suggestions][crate::model::CompleteQueryRequest::include_tail_suggestions].
1138        pub fn set_include_tail_suggestions<T: Into<bool>>(mut self, v: T) -> Self {
1139            self.0.request.include_tail_suggestions = v.into();
1140            self
1141        }
1142    }
1143
1144    #[doc(hidden)]
1145    impl crate::RequestBuilder for CompleteQuery {
1146        fn request_options(&mut self) -> &mut crate::RequestOptions {
1147            &mut self.0.options
1148        }
1149    }
1150
1151    /// The request builder for [CompletionService::import_suggestion_deny_list_entries][crate::client::CompletionService::import_suggestion_deny_list_entries] calls.
1152    ///
1153    /// # Example
1154    /// ```
1155    /// # use google_cloud_discoveryengine_v1::builder::completion_service::ImportSuggestionDenyListEntries;
1156    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
1157    /// use google_cloud_lro::Poller;
1158    ///
1159    /// let builder = prepare_request_builder();
1160    /// let response = builder.poller().until_done().await?;
1161    /// # Ok(()) }
1162    ///
1163    /// fn prepare_request_builder() -> ImportSuggestionDenyListEntries {
1164    ///   # panic!();
1165    ///   // ... details omitted ...
1166    /// }
1167    /// ```
1168    #[derive(Clone, Debug)]
1169    pub struct ImportSuggestionDenyListEntries(
1170        RequestBuilder<crate::model::ImportSuggestionDenyListEntriesRequest>,
1171    );
1172
1173    impl ImportSuggestionDenyListEntries {
1174        pub(crate) fn new(
1175            stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1176        ) -> Self {
1177            Self(RequestBuilder::new(stub))
1178        }
1179
1180        /// Sets the full request, replacing any prior values.
1181        pub fn with_request<V: Into<crate::model::ImportSuggestionDenyListEntriesRequest>>(
1182            mut self,
1183            v: V,
1184        ) -> Self {
1185            self.0.request = v.into();
1186            self
1187        }
1188
1189        /// Sets all the options, replacing any prior values.
1190        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1191            self.0.options = v.into();
1192            self
1193        }
1194
1195        /// Sends the request.
1196        ///
1197        /// # Long running operations
1198        ///
1199        /// This starts, but does not poll, a longrunning operation. More information
1200        /// on [import_suggestion_deny_list_entries][crate::client::CompletionService::import_suggestion_deny_list_entries].
1201        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1202            (*self.0.stub)
1203                .import_suggestion_deny_list_entries(self.0.request, self.0.options)
1204                .await
1205                .map(crate::Response::into_body)
1206        }
1207
1208        /// Creates a [Poller][google_cloud_lro::Poller] to work with `import_suggestion_deny_list_entries`.
1209        pub fn poller(
1210            self,
1211        ) -> impl google_cloud_lro::Poller<
1212            crate::model::ImportSuggestionDenyListEntriesResponse,
1213            crate::model::ImportSuggestionDenyListEntriesMetadata,
1214        > {
1215            type Operation = google_cloud_lro::internal::Operation<
1216                crate::model::ImportSuggestionDenyListEntriesResponse,
1217                crate::model::ImportSuggestionDenyListEntriesMetadata,
1218            >;
1219            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1220            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1221
1222            let stub = self.0.stub.clone();
1223            let mut options = self.0.options.clone();
1224            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
1225            let query = move |name| {
1226                let stub = stub.clone();
1227                let options = options.clone();
1228                async {
1229                    let op = GetOperation::new(stub)
1230                        .set_name(name)
1231                        .with_options(options)
1232                        .send()
1233                        .await?;
1234                    Ok(Operation::new(op))
1235                }
1236            };
1237
1238            let start = move || async {
1239                let op = self.send().await?;
1240                Ok(Operation::new(op))
1241            };
1242
1243            google_cloud_lro::internal::new_poller(
1244                polling_error_policy,
1245                polling_backoff_policy,
1246                start,
1247                query,
1248            )
1249        }
1250
1251        /// Sets the value of [parent][crate::model::ImportSuggestionDenyListEntriesRequest::parent].
1252        ///
1253        /// This is a **required** field for requests.
1254        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1255            self.0.request.parent = v.into();
1256            self
1257        }
1258
1259        /// Sets the value of [source][crate::model::ImportSuggestionDenyListEntriesRequest::source].
1260        ///
1261        /// Note that all the setters affecting `source` are
1262        /// mutually exclusive.
1263        pub fn set_source<
1264            T: Into<Option<crate::model::import_suggestion_deny_list_entries_request::Source>>,
1265        >(
1266            mut self,
1267            v: T,
1268        ) -> Self {
1269            self.0.request.source = v.into();
1270            self
1271        }
1272
1273        /// Sets the value of [source][crate::model::ImportSuggestionDenyListEntriesRequest::source]
1274        /// to hold a `InlineSource`.
1275        ///
1276        /// Note that all the setters affecting `source` are
1277        /// mutually exclusive.
1278        pub fn set_inline_source<
1279            T: std::convert::Into<
1280                    std::boxed::Box<
1281                        crate::model::import_suggestion_deny_list_entries_request::InlineSource,
1282                    >,
1283                >,
1284        >(
1285            mut self,
1286            v: T,
1287        ) -> Self {
1288            self.0.request = self.0.request.set_inline_source(v);
1289            self
1290        }
1291
1292        /// Sets the value of [source][crate::model::ImportSuggestionDenyListEntriesRequest::source]
1293        /// to hold a `GcsSource`.
1294        ///
1295        /// Note that all the setters affecting `source` are
1296        /// mutually exclusive.
1297        pub fn set_gcs_source<T: std::convert::Into<std::boxed::Box<crate::model::GcsSource>>>(
1298            mut self,
1299            v: T,
1300        ) -> Self {
1301            self.0.request = self.0.request.set_gcs_source(v);
1302            self
1303        }
1304    }
1305
1306    #[doc(hidden)]
1307    impl crate::RequestBuilder for ImportSuggestionDenyListEntries {
1308        fn request_options(&mut self) -> &mut crate::RequestOptions {
1309            &mut self.0.options
1310        }
1311    }
1312
1313    /// The request builder for [CompletionService::purge_suggestion_deny_list_entries][crate::client::CompletionService::purge_suggestion_deny_list_entries] calls.
1314    ///
1315    /// # Example
1316    /// ```
1317    /// # use google_cloud_discoveryengine_v1::builder::completion_service::PurgeSuggestionDenyListEntries;
1318    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
1319    /// use google_cloud_lro::Poller;
1320    ///
1321    /// let builder = prepare_request_builder();
1322    /// let response = builder.poller().until_done().await?;
1323    /// # Ok(()) }
1324    ///
1325    /// fn prepare_request_builder() -> PurgeSuggestionDenyListEntries {
1326    ///   # panic!();
1327    ///   // ... details omitted ...
1328    /// }
1329    /// ```
1330    #[derive(Clone, Debug)]
1331    pub struct PurgeSuggestionDenyListEntries(
1332        RequestBuilder<crate::model::PurgeSuggestionDenyListEntriesRequest>,
1333    );
1334
1335    impl PurgeSuggestionDenyListEntries {
1336        pub(crate) fn new(
1337            stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1338        ) -> Self {
1339            Self(RequestBuilder::new(stub))
1340        }
1341
1342        /// Sets the full request, replacing any prior values.
1343        pub fn with_request<V: Into<crate::model::PurgeSuggestionDenyListEntriesRequest>>(
1344            mut self,
1345            v: V,
1346        ) -> Self {
1347            self.0.request = v.into();
1348            self
1349        }
1350
1351        /// Sets all the options, replacing any prior values.
1352        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1353            self.0.options = v.into();
1354            self
1355        }
1356
1357        /// Sends the request.
1358        ///
1359        /// # Long running operations
1360        ///
1361        /// This starts, but does not poll, a longrunning operation. More information
1362        /// on [purge_suggestion_deny_list_entries][crate::client::CompletionService::purge_suggestion_deny_list_entries].
1363        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1364            (*self.0.stub)
1365                .purge_suggestion_deny_list_entries(self.0.request, self.0.options)
1366                .await
1367                .map(crate::Response::into_body)
1368        }
1369
1370        /// Creates a [Poller][google_cloud_lro::Poller] to work with `purge_suggestion_deny_list_entries`.
1371        pub fn poller(
1372            self,
1373        ) -> impl google_cloud_lro::Poller<
1374            crate::model::PurgeSuggestionDenyListEntriesResponse,
1375            crate::model::PurgeSuggestionDenyListEntriesMetadata,
1376        > {
1377            type Operation = google_cloud_lro::internal::Operation<
1378                crate::model::PurgeSuggestionDenyListEntriesResponse,
1379                crate::model::PurgeSuggestionDenyListEntriesMetadata,
1380            >;
1381            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1382            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1383
1384            let stub = self.0.stub.clone();
1385            let mut options = self.0.options.clone();
1386            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
1387            let query = move |name| {
1388                let stub = stub.clone();
1389                let options = options.clone();
1390                async {
1391                    let op = GetOperation::new(stub)
1392                        .set_name(name)
1393                        .with_options(options)
1394                        .send()
1395                        .await?;
1396                    Ok(Operation::new(op))
1397                }
1398            };
1399
1400            let start = move || async {
1401                let op = self.send().await?;
1402                Ok(Operation::new(op))
1403            };
1404
1405            google_cloud_lro::internal::new_poller(
1406                polling_error_policy,
1407                polling_backoff_policy,
1408                start,
1409                query,
1410            )
1411        }
1412
1413        /// Sets the value of [parent][crate::model::PurgeSuggestionDenyListEntriesRequest::parent].
1414        ///
1415        /// This is a **required** field for requests.
1416        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1417            self.0.request.parent = v.into();
1418            self
1419        }
1420    }
1421
1422    #[doc(hidden)]
1423    impl crate::RequestBuilder for PurgeSuggestionDenyListEntries {
1424        fn request_options(&mut self) -> &mut crate::RequestOptions {
1425            &mut self.0.options
1426        }
1427    }
1428
1429    /// The request builder for [CompletionService::import_completion_suggestions][crate::client::CompletionService::import_completion_suggestions] calls.
1430    ///
1431    /// # Example
1432    /// ```
1433    /// # use google_cloud_discoveryengine_v1::builder::completion_service::ImportCompletionSuggestions;
1434    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
1435    /// use google_cloud_lro::Poller;
1436    ///
1437    /// let builder = prepare_request_builder();
1438    /// let response = builder.poller().until_done().await?;
1439    /// # Ok(()) }
1440    ///
1441    /// fn prepare_request_builder() -> ImportCompletionSuggestions {
1442    ///   # panic!();
1443    ///   // ... details omitted ...
1444    /// }
1445    /// ```
1446    #[derive(Clone, Debug)]
1447    pub struct ImportCompletionSuggestions(
1448        RequestBuilder<crate::model::ImportCompletionSuggestionsRequest>,
1449    );
1450
1451    impl ImportCompletionSuggestions {
1452        pub(crate) fn new(
1453            stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1454        ) -> Self {
1455            Self(RequestBuilder::new(stub))
1456        }
1457
1458        /// Sets the full request, replacing any prior values.
1459        pub fn with_request<V: Into<crate::model::ImportCompletionSuggestionsRequest>>(
1460            mut self,
1461            v: V,
1462        ) -> Self {
1463            self.0.request = v.into();
1464            self
1465        }
1466
1467        /// Sets all the options, replacing any prior values.
1468        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1469            self.0.options = v.into();
1470            self
1471        }
1472
1473        /// Sends the request.
1474        ///
1475        /// # Long running operations
1476        ///
1477        /// This starts, but does not poll, a longrunning operation. More information
1478        /// on [import_completion_suggestions][crate::client::CompletionService::import_completion_suggestions].
1479        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1480            (*self.0.stub)
1481                .import_completion_suggestions(self.0.request, self.0.options)
1482                .await
1483                .map(crate::Response::into_body)
1484        }
1485
1486        /// Creates a [Poller][google_cloud_lro::Poller] to work with `import_completion_suggestions`.
1487        pub fn poller(
1488            self,
1489        ) -> impl google_cloud_lro::Poller<
1490            crate::model::ImportCompletionSuggestionsResponse,
1491            crate::model::ImportCompletionSuggestionsMetadata,
1492        > {
1493            type Operation = google_cloud_lro::internal::Operation<
1494                crate::model::ImportCompletionSuggestionsResponse,
1495                crate::model::ImportCompletionSuggestionsMetadata,
1496            >;
1497            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1498            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1499
1500            let stub = self.0.stub.clone();
1501            let mut options = self.0.options.clone();
1502            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
1503            let query = move |name| {
1504                let stub = stub.clone();
1505                let options = options.clone();
1506                async {
1507                    let op = GetOperation::new(stub)
1508                        .set_name(name)
1509                        .with_options(options)
1510                        .send()
1511                        .await?;
1512                    Ok(Operation::new(op))
1513                }
1514            };
1515
1516            let start = move || async {
1517                let op = self.send().await?;
1518                Ok(Operation::new(op))
1519            };
1520
1521            google_cloud_lro::internal::new_poller(
1522                polling_error_policy,
1523                polling_backoff_policy,
1524                start,
1525                query,
1526            )
1527        }
1528
1529        /// Sets the value of [parent][crate::model::ImportCompletionSuggestionsRequest::parent].
1530        ///
1531        /// This is a **required** field for requests.
1532        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1533            self.0.request.parent = v.into();
1534            self
1535        }
1536
1537        /// Sets the value of [error_config][crate::model::ImportCompletionSuggestionsRequest::error_config].
1538        pub fn set_error_config<T>(mut self, v: T) -> Self
1539        where
1540            T: std::convert::Into<crate::model::ImportErrorConfig>,
1541        {
1542            self.0.request.error_config = std::option::Option::Some(v.into());
1543            self
1544        }
1545
1546        /// Sets or clears the value of [error_config][crate::model::ImportCompletionSuggestionsRequest::error_config].
1547        pub fn set_or_clear_error_config<T>(mut self, v: std::option::Option<T>) -> Self
1548        where
1549            T: std::convert::Into<crate::model::ImportErrorConfig>,
1550        {
1551            self.0.request.error_config = v.map(|x| x.into());
1552            self
1553        }
1554
1555        /// Sets the value of [source][crate::model::ImportCompletionSuggestionsRequest::source].
1556        ///
1557        /// Note that all the setters affecting `source` are
1558        /// mutually exclusive.
1559        pub fn set_source<
1560            T: Into<Option<crate::model::import_completion_suggestions_request::Source>>,
1561        >(
1562            mut self,
1563            v: T,
1564        ) -> Self {
1565            self.0.request.source = v.into();
1566            self
1567        }
1568
1569        /// Sets the value of [source][crate::model::ImportCompletionSuggestionsRequest::source]
1570        /// to hold a `InlineSource`.
1571        ///
1572        /// Note that all the setters affecting `source` are
1573        /// mutually exclusive.
1574        pub fn set_inline_source<
1575            T: std::convert::Into<
1576                    std::boxed::Box<
1577                        crate::model::import_completion_suggestions_request::InlineSource,
1578                    >,
1579                >,
1580        >(
1581            mut self,
1582            v: T,
1583        ) -> Self {
1584            self.0.request = self.0.request.set_inline_source(v);
1585            self
1586        }
1587
1588        /// Sets the value of [source][crate::model::ImportCompletionSuggestionsRequest::source]
1589        /// to hold a `GcsSource`.
1590        ///
1591        /// Note that all the setters affecting `source` are
1592        /// mutually exclusive.
1593        pub fn set_gcs_source<T: std::convert::Into<std::boxed::Box<crate::model::GcsSource>>>(
1594            mut self,
1595            v: T,
1596        ) -> Self {
1597            self.0.request = self.0.request.set_gcs_source(v);
1598            self
1599        }
1600
1601        /// Sets the value of [source][crate::model::ImportCompletionSuggestionsRequest::source]
1602        /// to hold a `BigquerySource`.
1603        ///
1604        /// Note that all the setters affecting `source` are
1605        /// mutually exclusive.
1606        pub fn set_bigquery_source<
1607            T: std::convert::Into<std::boxed::Box<crate::model::BigQuerySource>>,
1608        >(
1609            mut self,
1610            v: T,
1611        ) -> Self {
1612            self.0.request = self.0.request.set_bigquery_source(v);
1613            self
1614        }
1615    }
1616
1617    #[doc(hidden)]
1618    impl crate::RequestBuilder for ImportCompletionSuggestions {
1619        fn request_options(&mut self) -> &mut crate::RequestOptions {
1620            &mut self.0.options
1621        }
1622    }
1623
1624    /// The request builder for [CompletionService::purge_completion_suggestions][crate::client::CompletionService::purge_completion_suggestions] calls.
1625    ///
1626    /// # Example
1627    /// ```
1628    /// # use google_cloud_discoveryengine_v1::builder::completion_service::PurgeCompletionSuggestions;
1629    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
1630    /// use google_cloud_lro::Poller;
1631    ///
1632    /// let builder = prepare_request_builder();
1633    /// let response = builder.poller().until_done().await?;
1634    /// # Ok(()) }
1635    ///
1636    /// fn prepare_request_builder() -> PurgeCompletionSuggestions {
1637    ///   # panic!();
1638    ///   // ... details omitted ...
1639    /// }
1640    /// ```
1641    #[derive(Clone, Debug)]
1642    pub struct PurgeCompletionSuggestions(
1643        RequestBuilder<crate::model::PurgeCompletionSuggestionsRequest>,
1644    );
1645
1646    impl PurgeCompletionSuggestions {
1647        pub(crate) fn new(
1648            stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1649        ) -> Self {
1650            Self(RequestBuilder::new(stub))
1651        }
1652
1653        /// Sets the full request, replacing any prior values.
1654        pub fn with_request<V: Into<crate::model::PurgeCompletionSuggestionsRequest>>(
1655            mut self,
1656            v: V,
1657        ) -> Self {
1658            self.0.request = v.into();
1659            self
1660        }
1661
1662        /// Sets all the options, replacing any prior values.
1663        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1664            self.0.options = v.into();
1665            self
1666        }
1667
1668        /// Sends the request.
1669        ///
1670        /// # Long running operations
1671        ///
1672        /// This starts, but does not poll, a longrunning operation. More information
1673        /// on [purge_completion_suggestions][crate::client::CompletionService::purge_completion_suggestions].
1674        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1675            (*self.0.stub)
1676                .purge_completion_suggestions(self.0.request, self.0.options)
1677                .await
1678                .map(crate::Response::into_body)
1679        }
1680
1681        /// Creates a [Poller][google_cloud_lro::Poller] to work with `purge_completion_suggestions`.
1682        pub fn poller(
1683            self,
1684        ) -> impl google_cloud_lro::Poller<
1685            crate::model::PurgeCompletionSuggestionsResponse,
1686            crate::model::PurgeCompletionSuggestionsMetadata,
1687        > {
1688            type Operation = google_cloud_lro::internal::Operation<
1689                crate::model::PurgeCompletionSuggestionsResponse,
1690                crate::model::PurgeCompletionSuggestionsMetadata,
1691            >;
1692            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1693            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1694
1695            let stub = self.0.stub.clone();
1696            let mut options = self.0.options.clone();
1697            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
1698            let query = move |name| {
1699                let stub = stub.clone();
1700                let options = options.clone();
1701                async {
1702                    let op = GetOperation::new(stub)
1703                        .set_name(name)
1704                        .with_options(options)
1705                        .send()
1706                        .await?;
1707                    Ok(Operation::new(op))
1708                }
1709            };
1710
1711            let start = move || async {
1712                let op = self.send().await?;
1713                Ok(Operation::new(op))
1714            };
1715
1716            google_cloud_lro::internal::new_poller(
1717                polling_error_policy,
1718                polling_backoff_policy,
1719                start,
1720                query,
1721            )
1722        }
1723
1724        /// Sets the value of [parent][crate::model::PurgeCompletionSuggestionsRequest::parent].
1725        ///
1726        /// This is a **required** field for requests.
1727        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1728            self.0.request.parent = v.into();
1729            self
1730        }
1731    }
1732
1733    #[doc(hidden)]
1734    impl crate::RequestBuilder for PurgeCompletionSuggestions {
1735        fn request_options(&mut self) -> &mut crate::RequestOptions {
1736            &mut self.0.options
1737        }
1738    }
1739
1740    /// The request builder for [CompletionService::list_operations][crate::client::CompletionService::list_operations] calls.
1741    ///
1742    /// # Example
1743    /// ```
1744    /// # use google_cloud_discoveryengine_v1::builder::completion_service::ListOperations;
1745    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
1746    /// use google_cloud_gax::paginator::ItemPaginator;
1747    ///
1748    /// let builder = prepare_request_builder();
1749    /// let mut items = builder.by_item();
1750    /// while let Some(result) = items.next().await {
1751    ///   let item = result?;
1752    /// }
1753    /// # Ok(()) }
1754    ///
1755    /// fn prepare_request_builder() -> ListOperations {
1756    ///   # panic!();
1757    ///   // ... details omitted ...
1758    /// }
1759    /// ```
1760    #[derive(Clone, Debug)]
1761    pub struct ListOperations(
1762        RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
1763    );
1764
1765    impl ListOperations {
1766        pub(crate) fn new(
1767            stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1768        ) -> Self {
1769            Self(RequestBuilder::new(stub))
1770        }
1771
1772        /// Sets the full request, replacing any prior values.
1773        pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
1774            mut self,
1775            v: V,
1776        ) -> Self {
1777            self.0.request = v.into();
1778            self
1779        }
1780
1781        /// Sets all the options, replacing any prior values.
1782        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1783            self.0.options = v.into();
1784            self
1785        }
1786
1787        /// Sends the request.
1788        pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
1789            (*self.0.stub)
1790                .list_operations(self.0.request, self.0.options)
1791                .await
1792                .map(crate::Response::into_body)
1793        }
1794
1795        /// Streams each page in the collection.
1796        pub fn by_page(
1797            self,
1798        ) -> impl google_cloud_gax::paginator::Paginator<
1799            google_cloud_longrunning::model::ListOperationsResponse,
1800            crate::Error,
1801        > {
1802            use std::clone::Clone;
1803            let token = self.0.request.page_token.clone();
1804            let execute = move |token: String| {
1805                let mut builder = self.clone();
1806                builder.0.request = builder.0.request.set_page_token(token);
1807                builder.send()
1808            };
1809            google_cloud_gax::paginator::internal::new_paginator(token, execute)
1810        }
1811
1812        /// Streams each item in the collection.
1813        pub fn by_item(
1814            self,
1815        ) -> impl google_cloud_gax::paginator::ItemPaginator<
1816            google_cloud_longrunning::model::ListOperationsResponse,
1817            crate::Error,
1818        > {
1819            use google_cloud_gax::paginator::Paginator;
1820            self.by_page().items()
1821        }
1822
1823        /// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
1824        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1825            self.0.request.name = v.into();
1826            self
1827        }
1828
1829        /// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::filter].
1830        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1831            self.0.request.filter = v.into();
1832            self
1833        }
1834
1835        /// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
1836        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1837            self.0.request.page_size = v.into();
1838            self
1839        }
1840
1841        /// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
1842        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1843            self.0.request.page_token = v.into();
1844            self
1845        }
1846
1847        /// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
1848        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
1849            self.0.request.return_partial_success = v.into();
1850            self
1851        }
1852    }
1853
1854    #[doc(hidden)]
1855    impl crate::RequestBuilder for ListOperations {
1856        fn request_options(&mut self) -> &mut crate::RequestOptions {
1857            &mut self.0.options
1858        }
1859    }
1860
1861    /// The request builder for [CompletionService::get_operation][crate::client::CompletionService::get_operation] calls.
1862    ///
1863    /// # Example
1864    /// ```
1865    /// # use google_cloud_discoveryengine_v1::builder::completion_service::GetOperation;
1866    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
1867    ///
1868    /// let builder = prepare_request_builder();
1869    /// let response = builder.send().await?;
1870    /// # Ok(()) }
1871    ///
1872    /// fn prepare_request_builder() -> GetOperation {
1873    ///   # panic!();
1874    ///   // ... details omitted ...
1875    /// }
1876    /// ```
1877    #[derive(Clone, Debug)]
1878    pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
1879
1880    impl GetOperation {
1881        pub(crate) fn new(
1882            stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1883        ) -> Self {
1884            Self(RequestBuilder::new(stub))
1885        }
1886
1887        /// Sets the full request, replacing any prior values.
1888        pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
1889            mut self,
1890            v: V,
1891        ) -> Self {
1892            self.0.request = v.into();
1893            self
1894        }
1895
1896        /// Sets all the options, replacing any prior values.
1897        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1898            self.0.options = v.into();
1899            self
1900        }
1901
1902        /// Sends the request.
1903        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1904            (*self.0.stub)
1905                .get_operation(self.0.request, self.0.options)
1906                .await
1907                .map(crate::Response::into_body)
1908        }
1909
1910        /// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
1911        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1912            self.0.request.name = v.into();
1913            self
1914        }
1915    }
1916
1917    #[doc(hidden)]
1918    impl crate::RequestBuilder for GetOperation {
1919        fn request_options(&mut self) -> &mut crate::RequestOptions {
1920            &mut self.0.options
1921        }
1922    }
1923
1924    /// The request builder for [CompletionService::cancel_operation][crate::client::CompletionService::cancel_operation] calls.
1925    ///
1926    /// # Example
1927    /// ```
1928    /// # use google_cloud_discoveryengine_v1::builder::completion_service::CancelOperation;
1929    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
1930    ///
1931    /// let builder = prepare_request_builder();
1932    /// let response = builder.send().await?;
1933    /// # Ok(()) }
1934    ///
1935    /// fn prepare_request_builder() -> CancelOperation {
1936    ///   # panic!();
1937    ///   // ... details omitted ...
1938    /// }
1939    /// ```
1940    #[derive(Clone, Debug)]
1941    pub struct CancelOperation(
1942        RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
1943    );
1944
1945    impl CancelOperation {
1946        pub(crate) fn new(
1947            stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1948        ) -> Self {
1949            Self(RequestBuilder::new(stub))
1950        }
1951
1952        /// Sets the full request, replacing any prior values.
1953        pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
1954            mut self,
1955            v: V,
1956        ) -> Self {
1957            self.0.request = v.into();
1958            self
1959        }
1960
1961        /// Sets all the options, replacing any prior values.
1962        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1963            self.0.options = v.into();
1964            self
1965        }
1966
1967        /// Sends the request.
1968        pub async fn send(self) -> Result<()> {
1969            (*self.0.stub)
1970                .cancel_operation(self.0.request, self.0.options)
1971                .await
1972                .map(crate::Response::into_body)
1973        }
1974
1975        /// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::name].
1976        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1977            self.0.request.name = v.into();
1978            self
1979        }
1980    }
1981
1982    #[doc(hidden)]
1983    impl crate::RequestBuilder for CancelOperation {
1984        fn request_options(&mut self) -> &mut crate::RequestOptions {
1985            &mut self.0.options
1986        }
1987    }
1988}
1989
1990/// Request and client builders for [ControlService][crate::client::ControlService].
1991#[cfg(feature = "control-service")]
1992#[cfg_attr(docsrs, doc(cfg(feature = "control-service")))]
1993pub mod control_service {
1994    use crate::Result;
1995
1996    /// A builder for [ControlService][crate::client::ControlService].
1997    ///
1998    /// ```
1999    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
2000    /// # use google_cloud_discoveryengine_v1::*;
2001    /// # use builder::control_service::ClientBuilder;
2002    /// # use client::ControlService;
2003    /// let builder : ClientBuilder = ControlService::builder();
2004    /// let client = builder
2005    ///     .with_endpoint("https://discoveryengine.googleapis.com")
2006    ///     .build().await?;
2007    /// # Ok(()) }
2008    /// ```
2009    pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
2010
2011    pub(crate) mod client {
2012        use super::super::super::client::ControlService;
2013        pub struct Factory;
2014        impl crate::ClientFactory for Factory {
2015            type Client = ControlService;
2016            type Credentials = gaxi::options::Credentials;
2017            async fn build(
2018                self,
2019                config: gaxi::options::ClientConfig,
2020            ) -> crate::ClientBuilderResult<Self::Client> {
2021                Self::Client::new(config).await
2022            }
2023        }
2024    }
2025
2026    /// Common implementation for [crate::client::ControlService] request builders.
2027    #[derive(Clone, Debug)]
2028    pub(crate) struct RequestBuilder<R: std::default::Default> {
2029        stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2030        request: R,
2031        options: crate::RequestOptions,
2032    }
2033
2034    impl<R> RequestBuilder<R>
2035    where
2036        R: std::default::Default,
2037    {
2038        pub(crate) fn new(
2039            stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2040        ) -> Self {
2041            Self {
2042                stub,
2043                request: R::default(),
2044                options: crate::RequestOptions::default(),
2045            }
2046        }
2047    }
2048
2049    /// The request builder for [ControlService::create_control][crate::client::ControlService::create_control] calls.
2050    ///
2051    /// # Example
2052    /// ```
2053    /// # use google_cloud_discoveryengine_v1::builder::control_service::CreateControl;
2054    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
2055    ///
2056    /// let builder = prepare_request_builder();
2057    /// let response = builder.send().await?;
2058    /// # Ok(()) }
2059    ///
2060    /// fn prepare_request_builder() -> CreateControl {
2061    ///   # panic!();
2062    ///   // ... details omitted ...
2063    /// }
2064    /// ```
2065    #[derive(Clone, Debug)]
2066    pub struct CreateControl(RequestBuilder<crate::model::CreateControlRequest>);
2067
2068    impl CreateControl {
2069        pub(crate) fn new(
2070            stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2071        ) -> Self {
2072            Self(RequestBuilder::new(stub))
2073        }
2074
2075        /// Sets the full request, replacing any prior values.
2076        pub fn with_request<V: Into<crate::model::CreateControlRequest>>(mut self, v: V) -> Self {
2077            self.0.request = v.into();
2078            self
2079        }
2080
2081        /// Sets all the options, replacing any prior values.
2082        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2083            self.0.options = v.into();
2084            self
2085        }
2086
2087        /// Sends the request.
2088        pub async fn send(self) -> Result<crate::model::Control> {
2089            (*self.0.stub)
2090                .create_control(self.0.request, self.0.options)
2091                .await
2092                .map(crate::Response::into_body)
2093        }
2094
2095        /// Sets the value of [parent][crate::model::CreateControlRequest::parent].
2096        ///
2097        /// This is a **required** field for requests.
2098        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2099            self.0.request.parent = v.into();
2100            self
2101        }
2102
2103        /// Sets the value of [control][crate::model::CreateControlRequest::control].
2104        ///
2105        /// This is a **required** field for requests.
2106        pub fn set_control<T>(mut self, v: T) -> Self
2107        where
2108            T: std::convert::Into<crate::model::Control>,
2109        {
2110            self.0.request.control = std::option::Option::Some(v.into());
2111            self
2112        }
2113
2114        /// Sets or clears the value of [control][crate::model::CreateControlRequest::control].
2115        ///
2116        /// This is a **required** field for requests.
2117        pub fn set_or_clear_control<T>(mut self, v: std::option::Option<T>) -> Self
2118        where
2119            T: std::convert::Into<crate::model::Control>,
2120        {
2121            self.0.request.control = v.map(|x| x.into());
2122            self
2123        }
2124
2125        /// Sets the value of [control_id][crate::model::CreateControlRequest::control_id].
2126        ///
2127        /// This is a **required** field for requests.
2128        pub fn set_control_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2129            self.0.request.control_id = v.into();
2130            self
2131        }
2132    }
2133
2134    #[doc(hidden)]
2135    impl crate::RequestBuilder for CreateControl {
2136        fn request_options(&mut self) -> &mut crate::RequestOptions {
2137            &mut self.0.options
2138        }
2139    }
2140
2141    /// The request builder for [ControlService::delete_control][crate::client::ControlService::delete_control] calls.
2142    ///
2143    /// # Example
2144    /// ```
2145    /// # use google_cloud_discoveryengine_v1::builder::control_service::DeleteControl;
2146    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
2147    ///
2148    /// let builder = prepare_request_builder();
2149    /// let response = builder.send().await?;
2150    /// # Ok(()) }
2151    ///
2152    /// fn prepare_request_builder() -> DeleteControl {
2153    ///   # panic!();
2154    ///   // ... details omitted ...
2155    /// }
2156    /// ```
2157    #[derive(Clone, Debug)]
2158    pub struct DeleteControl(RequestBuilder<crate::model::DeleteControlRequest>);
2159
2160    impl DeleteControl {
2161        pub(crate) fn new(
2162            stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2163        ) -> Self {
2164            Self(RequestBuilder::new(stub))
2165        }
2166
2167        /// Sets the full request, replacing any prior values.
2168        pub fn with_request<V: Into<crate::model::DeleteControlRequest>>(mut self, v: V) -> Self {
2169            self.0.request = v.into();
2170            self
2171        }
2172
2173        /// Sets all the options, replacing any prior values.
2174        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2175            self.0.options = v.into();
2176            self
2177        }
2178
2179        /// Sends the request.
2180        pub async fn send(self) -> Result<()> {
2181            (*self.0.stub)
2182                .delete_control(self.0.request, self.0.options)
2183                .await
2184                .map(crate::Response::into_body)
2185        }
2186
2187        /// Sets the value of [name][crate::model::DeleteControlRequest::name].
2188        ///
2189        /// This is a **required** field for requests.
2190        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2191            self.0.request.name = v.into();
2192            self
2193        }
2194    }
2195
2196    #[doc(hidden)]
2197    impl crate::RequestBuilder for DeleteControl {
2198        fn request_options(&mut self) -> &mut crate::RequestOptions {
2199            &mut self.0.options
2200        }
2201    }
2202
2203    /// The request builder for [ControlService::update_control][crate::client::ControlService::update_control] calls.
2204    ///
2205    /// # Example
2206    /// ```
2207    /// # use google_cloud_discoveryengine_v1::builder::control_service::UpdateControl;
2208    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
2209    ///
2210    /// let builder = prepare_request_builder();
2211    /// let response = builder.send().await?;
2212    /// # Ok(()) }
2213    ///
2214    /// fn prepare_request_builder() -> UpdateControl {
2215    ///   # panic!();
2216    ///   // ... details omitted ...
2217    /// }
2218    /// ```
2219    #[derive(Clone, Debug)]
2220    pub struct UpdateControl(RequestBuilder<crate::model::UpdateControlRequest>);
2221
2222    impl UpdateControl {
2223        pub(crate) fn new(
2224            stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2225        ) -> Self {
2226            Self(RequestBuilder::new(stub))
2227        }
2228
2229        /// Sets the full request, replacing any prior values.
2230        pub fn with_request<V: Into<crate::model::UpdateControlRequest>>(mut self, v: V) -> Self {
2231            self.0.request = v.into();
2232            self
2233        }
2234
2235        /// Sets all the options, replacing any prior values.
2236        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2237            self.0.options = v.into();
2238            self
2239        }
2240
2241        /// Sends the request.
2242        pub async fn send(self) -> Result<crate::model::Control> {
2243            (*self.0.stub)
2244                .update_control(self.0.request, self.0.options)
2245                .await
2246                .map(crate::Response::into_body)
2247        }
2248
2249        /// Sets the value of [control][crate::model::UpdateControlRequest::control].
2250        ///
2251        /// This is a **required** field for requests.
2252        pub fn set_control<T>(mut self, v: T) -> Self
2253        where
2254            T: std::convert::Into<crate::model::Control>,
2255        {
2256            self.0.request.control = std::option::Option::Some(v.into());
2257            self
2258        }
2259
2260        /// Sets or clears the value of [control][crate::model::UpdateControlRequest::control].
2261        ///
2262        /// This is a **required** field for requests.
2263        pub fn set_or_clear_control<T>(mut self, v: std::option::Option<T>) -> Self
2264        where
2265            T: std::convert::Into<crate::model::Control>,
2266        {
2267            self.0.request.control = v.map(|x| x.into());
2268            self
2269        }
2270
2271        /// Sets the value of [update_mask][crate::model::UpdateControlRequest::update_mask].
2272        pub fn set_update_mask<T>(mut self, v: T) -> Self
2273        where
2274            T: std::convert::Into<wkt::FieldMask>,
2275        {
2276            self.0.request.update_mask = std::option::Option::Some(v.into());
2277            self
2278        }
2279
2280        /// Sets or clears the value of [update_mask][crate::model::UpdateControlRequest::update_mask].
2281        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
2282        where
2283            T: std::convert::Into<wkt::FieldMask>,
2284        {
2285            self.0.request.update_mask = v.map(|x| x.into());
2286            self
2287        }
2288    }
2289
2290    #[doc(hidden)]
2291    impl crate::RequestBuilder for UpdateControl {
2292        fn request_options(&mut self) -> &mut crate::RequestOptions {
2293            &mut self.0.options
2294        }
2295    }
2296
2297    /// The request builder for [ControlService::get_control][crate::client::ControlService::get_control] calls.
2298    ///
2299    /// # Example
2300    /// ```
2301    /// # use google_cloud_discoveryengine_v1::builder::control_service::GetControl;
2302    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
2303    ///
2304    /// let builder = prepare_request_builder();
2305    /// let response = builder.send().await?;
2306    /// # Ok(()) }
2307    ///
2308    /// fn prepare_request_builder() -> GetControl {
2309    ///   # panic!();
2310    ///   // ... details omitted ...
2311    /// }
2312    /// ```
2313    #[derive(Clone, Debug)]
2314    pub struct GetControl(RequestBuilder<crate::model::GetControlRequest>);
2315
2316    impl GetControl {
2317        pub(crate) fn new(
2318            stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2319        ) -> Self {
2320            Self(RequestBuilder::new(stub))
2321        }
2322
2323        /// Sets the full request, replacing any prior values.
2324        pub fn with_request<V: Into<crate::model::GetControlRequest>>(mut self, v: V) -> Self {
2325            self.0.request = v.into();
2326            self
2327        }
2328
2329        /// Sets all the options, replacing any prior values.
2330        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2331            self.0.options = v.into();
2332            self
2333        }
2334
2335        /// Sends the request.
2336        pub async fn send(self) -> Result<crate::model::Control> {
2337            (*self.0.stub)
2338                .get_control(self.0.request, self.0.options)
2339                .await
2340                .map(crate::Response::into_body)
2341        }
2342
2343        /// Sets the value of [name][crate::model::GetControlRequest::name].
2344        ///
2345        /// This is a **required** field for requests.
2346        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2347            self.0.request.name = v.into();
2348            self
2349        }
2350    }
2351
2352    #[doc(hidden)]
2353    impl crate::RequestBuilder for GetControl {
2354        fn request_options(&mut self) -> &mut crate::RequestOptions {
2355            &mut self.0.options
2356        }
2357    }
2358
2359    /// The request builder for [ControlService::list_controls][crate::client::ControlService::list_controls] calls.
2360    ///
2361    /// # Example
2362    /// ```
2363    /// # use google_cloud_discoveryengine_v1::builder::control_service::ListControls;
2364    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
2365    /// use google_cloud_gax::paginator::ItemPaginator;
2366    ///
2367    /// let builder = prepare_request_builder();
2368    /// let mut items = builder.by_item();
2369    /// while let Some(result) = items.next().await {
2370    ///   let item = result?;
2371    /// }
2372    /// # Ok(()) }
2373    ///
2374    /// fn prepare_request_builder() -> ListControls {
2375    ///   # panic!();
2376    ///   // ... details omitted ...
2377    /// }
2378    /// ```
2379    #[derive(Clone, Debug)]
2380    pub struct ListControls(RequestBuilder<crate::model::ListControlsRequest>);
2381
2382    impl ListControls {
2383        pub(crate) fn new(
2384            stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2385        ) -> Self {
2386            Self(RequestBuilder::new(stub))
2387        }
2388
2389        /// Sets the full request, replacing any prior values.
2390        pub fn with_request<V: Into<crate::model::ListControlsRequest>>(mut self, v: V) -> Self {
2391            self.0.request = v.into();
2392            self
2393        }
2394
2395        /// Sets all the options, replacing any prior values.
2396        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2397            self.0.options = v.into();
2398            self
2399        }
2400
2401        /// Sends the request.
2402        pub async fn send(self) -> Result<crate::model::ListControlsResponse> {
2403            (*self.0.stub)
2404                .list_controls(self.0.request, self.0.options)
2405                .await
2406                .map(crate::Response::into_body)
2407        }
2408
2409        /// Streams each page in the collection.
2410        pub fn by_page(
2411            self,
2412        ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListControlsResponse, crate::Error>
2413        {
2414            use std::clone::Clone;
2415            let token = self.0.request.page_token.clone();
2416            let execute = move |token: String| {
2417                let mut builder = self.clone();
2418                builder.0.request = builder.0.request.set_page_token(token);
2419                builder.send()
2420            };
2421            google_cloud_gax::paginator::internal::new_paginator(token, execute)
2422        }
2423
2424        /// Streams each item in the collection.
2425        pub fn by_item(
2426            self,
2427        ) -> impl google_cloud_gax::paginator::ItemPaginator<
2428            crate::model::ListControlsResponse,
2429            crate::Error,
2430        > {
2431            use google_cloud_gax::paginator::Paginator;
2432            self.by_page().items()
2433        }
2434
2435        /// Sets the value of [parent][crate::model::ListControlsRequest::parent].
2436        ///
2437        /// This is a **required** field for requests.
2438        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2439            self.0.request.parent = v.into();
2440            self
2441        }
2442
2443        /// Sets the value of [page_size][crate::model::ListControlsRequest::page_size].
2444        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2445            self.0.request.page_size = v.into();
2446            self
2447        }
2448
2449        /// Sets the value of [page_token][crate::model::ListControlsRequest::page_token].
2450        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2451            self.0.request.page_token = v.into();
2452            self
2453        }
2454
2455        /// Sets the value of [filter][crate::model::ListControlsRequest::filter].
2456        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
2457            self.0.request.filter = v.into();
2458            self
2459        }
2460    }
2461
2462    #[doc(hidden)]
2463    impl crate::RequestBuilder for ListControls {
2464        fn request_options(&mut self) -> &mut crate::RequestOptions {
2465            &mut self.0.options
2466        }
2467    }
2468
2469    /// The request builder for [ControlService::list_operations][crate::client::ControlService::list_operations] calls.
2470    ///
2471    /// # Example
2472    /// ```
2473    /// # use google_cloud_discoveryengine_v1::builder::control_service::ListOperations;
2474    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
2475    /// use google_cloud_gax::paginator::ItemPaginator;
2476    ///
2477    /// let builder = prepare_request_builder();
2478    /// let mut items = builder.by_item();
2479    /// while let Some(result) = items.next().await {
2480    ///   let item = result?;
2481    /// }
2482    /// # Ok(()) }
2483    ///
2484    /// fn prepare_request_builder() -> ListOperations {
2485    ///   # panic!();
2486    ///   // ... details omitted ...
2487    /// }
2488    /// ```
2489    #[derive(Clone, Debug)]
2490    pub struct ListOperations(
2491        RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
2492    );
2493
2494    impl ListOperations {
2495        pub(crate) fn new(
2496            stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2497        ) -> Self {
2498            Self(RequestBuilder::new(stub))
2499        }
2500
2501        /// Sets the full request, replacing any prior values.
2502        pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
2503            mut self,
2504            v: V,
2505        ) -> Self {
2506            self.0.request = v.into();
2507            self
2508        }
2509
2510        /// Sets all the options, replacing any prior values.
2511        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2512            self.0.options = v.into();
2513            self
2514        }
2515
2516        /// Sends the request.
2517        pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
2518            (*self.0.stub)
2519                .list_operations(self.0.request, self.0.options)
2520                .await
2521                .map(crate::Response::into_body)
2522        }
2523
2524        /// Streams each page in the collection.
2525        pub fn by_page(
2526            self,
2527        ) -> impl google_cloud_gax::paginator::Paginator<
2528            google_cloud_longrunning::model::ListOperationsResponse,
2529            crate::Error,
2530        > {
2531            use std::clone::Clone;
2532            let token = self.0.request.page_token.clone();
2533            let execute = move |token: String| {
2534                let mut builder = self.clone();
2535                builder.0.request = builder.0.request.set_page_token(token);
2536                builder.send()
2537            };
2538            google_cloud_gax::paginator::internal::new_paginator(token, execute)
2539        }
2540
2541        /// Streams each item in the collection.
2542        pub fn by_item(
2543            self,
2544        ) -> impl google_cloud_gax::paginator::ItemPaginator<
2545            google_cloud_longrunning::model::ListOperationsResponse,
2546            crate::Error,
2547        > {
2548            use google_cloud_gax::paginator::Paginator;
2549            self.by_page().items()
2550        }
2551
2552        /// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
2553        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2554            self.0.request.name = v.into();
2555            self
2556        }
2557
2558        /// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::filter].
2559        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
2560            self.0.request.filter = v.into();
2561            self
2562        }
2563
2564        /// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
2565        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2566            self.0.request.page_size = v.into();
2567            self
2568        }
2569
2570        /// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
2571        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2572            self.0.request.page_token = v.into();
2573            self
2574        }
2575
2576        /// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
2577        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
2578            self.0.request.return_partial_success = v.into();
2579            self
2580        }
2581    }
2582
2583    #[doc(hidden)]
2584    impl crate::RequestBuilder for ListOperations {
2585        fn request_options(&mut self) -> &mut crate::RequestOptions {
2586            &mut self.0.options
2587        }
2588    }
2589
2590    /// The request builder for [ControlService::get_operation][crate::client::ControlService::get_operation] calls.
2591    ///
2592    /// # Example
2593    /// ```
2594    /// # use google_cloud_discoveryengine_v1::builder::control_service::GetOperation;
2595    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
2596    ///
2597    /// let builder = prepare_request_builder();
2598    /// let response = builder.send().await?;
2599    /// # Ok(()) }
2600    ///
2601    /// fn prepare_request_builder() -> GetOperation {
2602    ///   # panic!();
2603    ///   // ... details omitted ...
2604    /// }
2605    /// ```
2606    #[derive(Clone, Debug)]
2607    pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
2608
2609    impl GetOperation {
2610        pub(crate) fn new(
2611            stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2612        ) -> Self {
2613            Self(RequestBuilder::new(stub))
2614        }
2615
2616        /// Sets the full request, replacing any prior values.
2617        pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
2618            mut self,
2619            v: V,
2620        ) -> Self {
2621            self.0.request = v.into();
2622            self
2623        }
2624
2625        /// Sets all the options, replacing any prior values.
2626        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2627            self.0.options = v.into();
2628            self
2629        }
2630
2631        /// Sends the request.
2632        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
2633            (*self.0.stub)
2634                .get_operation(self.0.request, self.0.options)
2635                .await
2636                .map(crate::Response::into_body)
2637        }
2638
2639        /// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
2640        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2641            self.0.request.name = v.into();
2642            self
2643        }
2644    }
2645
2646    #[doc(hidden)]
2647    impl crate::RequestBuilder for GetOperation {
2648        fn request_options(&mut self) -> &mut crate::RequestOptions {
2649            &mut self.0.options
2650        }
2651    }
2652
2653    /// The request builder for [ControlService::cancel_operation][crate::client::ControlService::cancel_operation] calls.
2654    ///
2655    /// # Example
2656    /// ```
2657    /// # use google_cloud_discoveryengine_v1::builder::control_service::CancelOperation;
2658    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
2659    ///
2660    /// let builder = prepare_request_builder();
2661    /// let response = builder.send().await?;
2662    /// # Ok(()) }
2663    ///
2664    /// fn prepare_request_builder() -> CancelOperation {
2665    ///   # panic!();
2666    ///   // ... details omitted ...
2667    /// }
2668    /// ```
2669    #[derive(Clone, Debug)]
2670    pub struct CancelOperation(
2671        RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
2672    );
2673
2674    impl CancelOperation {
2675        pub(crate) fn new(
2676            stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2677        ) -> Self {
2678            Self(RequestBuilder::new(stub))
2679        }
2680
2681        /// Sets the full request, replacing any prior values.
2682        pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
2683            mut self,
2684            v: V,
2685        ) -> Self {
2686            self.0.request = v.into();
2687            self
2688        }
2689
2690        /// Sets all the options, replacing any prior values.
2691        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2692            self.0.options = v.into();
2693            self
2694        }
2695
2696        /// Sends the request.
2697        pub async fn send(self) -> Result<()> {
2698            (*self.0.stub)
2699                .cancel_operation(self.0.request, self.0.options)
2700                .await
2701                .map(crate::Response::into_body)
2702        }
2703
2704        /// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::name].
2705        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2706            self.0.request.name = v.into();
2707            self
2708        }
2709    }
2710
2711    #[doc(hidden)]
2712    impl crate::RequestBuilder for CancelOperation {
2713        fn request_options(&mut self) -> &mut crate::RequestOptions {
2714            &mut self.0.options
2715        }
2716    }
2717}
2718
2719/// Request and client builders for [ConversationalSearchService][crate::client::ConversationalSearchService].
2720#[cfg(feature = "conversational-search-service")]
2721#[cfg_attr(docsrs, doc(cfg(feature = "conversational-search-service")))]
2722pub mod conversational_search_service {
2723    use crate::Result;
2724
2725    /// A builder for [ConversationalSearchService][crate::client::ConversationalSearchService].
2726    ///
2727    /// ```
2728    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
2729    /// # use google_cloud_discoveryengine_v1::*;
2730    /// # use builder::conversational_search_service::ClientBuilder;
2731    /// # use client::ConversationalSearchService;
2732    /// let builder : ClientBuilder = ConversationalSearchService::builder();
2733    /// let client = builder
2734    ///     .with_endpoint("https://discoveryengine.googleapis.com")
2735    ///     .build().await?;
2736    /// # Ok(()) }
2737    /// ```
2738    pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
2739
2740    pub(crate) mod client {
2741        use super::super::super::client::ConversationalSearchService;
2742        pub struct Factory;
2743        impl crate::ClientFactory for Factory {
2744            type Client = ConversationalSearchService;
2745            type Credentials = gaxi::options::Credentials;
2746            async fn build(
2747                self,
2748                config: gaxi::options::ClientConfig,
2749            ) -> crate::ClientBuilderResult<Self::Client> {
2750                Self::Client::new(config).await
2751            }
2752        }
2753    }
2754
2755    /// Common implementation for [crate::client::ConversationalSearchService] request builders.
2756    #[derive(Clone, Debug)]
2757    pub(crate) struct RequestBuilder<R: std::default::Default> {
2758        stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
2759        request: R,
2760        options: crate::RequestOptions,
2761    }
2762
2763    impl<R> RequestBuilder<R>
2764    where
2765        R: std::default::Default,
2766    {
2767        pub(crate) fn new(
2768            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
2769        ) -> Self {
2770            Self {
2771                stub,
2772                request: R::default(),
2773                options: crate::RequestOptions::default(),
2774            }
2775        }
2776    }
2777
2778    /// The request builder for [ConversationalSearchService::converse_conversation][crate::client::ConversationalSearchService::converse_conversation] calls.
2779    ///
2780    /// # Example
2781    /// ```
2782    /// # use google_cloud_discoveryengine_v1::builder::conversational_search_service::ConverseConversation;
2783    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
2784    ///
2785    /// let builder = prepare_request_builder();
2786    /// let response = builder.send().await?;
2787    /// # Ok(()) }
2788    ///
2789    /// fn prepare_request_builder() -> ConverseConversation {
2790    ///   # panic!();
2791    ///   // ... details omitted ...
2792    /// }
2793    /// ```
2794    #[derive(Clone, Debug)]
2795    pub struct ConverseConversation(RequestBuilder<crate::model::ConverseConversationRequest>);
2796
2797    impl ConverseConversation {
2798        pub(crate) fn new(
2799            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
2800        ) -> Self {
2801            Self(RequestBuilder::new(stub))
2802        }
2803
2804        /// Sets the full request, replacing any prior values.
2805        pub fn with_request<V: Into<crate::model::ConverseConversationRequest>>(
2806            mut self,
2807            v: V,
2808        ) -> Self {
2809            self.0.request = v.into();
2810            self
2811        }
2812
2813        /// Sets all the options, replacing any prior values.
2814        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2815            self.0.options = v.into();
2816            self
2817        }
2818
2819        /// Sends the request.
2820        pub async fn send(self) -> Result<crate::model::ConverseConversationResponse> {
2821            (*self.0.stub)
2822                .converse_conversation(self.0.request, self.0.options)
2823                .await
2824                .map(crate::Response::into_body)
2825        }
2826
2827        /// Sets the value of [name][crate::model::ConverseConversationRequest::name].
2828        ///
2829        /// This is a **required** field for requests.
2830        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2831            self.0.request.name = v.into();
2832            self
2833        }
2834
2835        /// Sets the value of [query][crate::model::ConverseConversationRequest::query].
2836        ///
2837        /// This is a **required** field for requests.
2838        pub fn set_query<T>(mut self, v: T) -> Self
2839        where
2840            T: std::convert::Into<crate::model::TextInput>,
2841        {
2842            self.0.request.query = std::option::Option::Some(v.into());
2843            self
2844        }
2845
2846        /// Sets or clears the value of [query][crate::model::ConverseConversationRequest::query].
2847        ///
2848        /// This is a **required** field for requests.
2849        pub fn set_or_clear_query<T>(mut self, v: std::option::Option<T>) -> Self
2850        where
2851            T: std::convert::Into<crate::model::TextInput>,
2852        {
2853            self.0.request.query = v.map(|x| x.into());
2854            self
2855        }
2856
2857        /// Sets the value of [serving_config][crate::model::ConverseConversationRequest::serving_config].
2858        pub fn set_serving_config<T: Into<std::string::String>>(mut self, v: T) -> Self {
2859            self.0.request.serving_config = v.into();
2860            self
2861        }
2862
2863        /// Sets the value of [conversation][crate::model::ConverseConversationRequest::conversation].
2864        pub fn set_conversation<T>(mut self, v: T) -> Self
2865        where
2866            T: std::convert::Into<crate::model::Conversation>,
2867        {
2868            self.0.request.conversation = std::option::Option::Some(v.into());
2869            self
2870        }
2871
2872        /// Sets or clears the value of [conversation][crate::model::ConverseConversationRequest::conversation].
2873        pub fn set_or_clear_conversation<T>(mut self, v: std::option::Option<T>) -> Self
2874        where
2875            T: std::convert::Into<crate::model::Conversation>,
2876        {
2877            self.0.request.conversation = v.map(|x| x.into());
2878            self
2879        }
2880
2881        /// Sets the value of [safe_search][crate::model::ConverseConversationRequest::safe_search].
2882        pub fn set_safe_search<T: Into<bool>>(mut self, v: T) -> Self {
2883            self.0.request.safe_search = v.into();
2884            self
2885        }
2886
2887        /// Sets the value of [user_labels][crate::model::ConverseConversationRequest::user_labels].
2888        pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
2889        where
2890            T: std::iter::IntoIterator<Item = (K, V)>,
2891            K: std::convert::Into<std::string::String>,
2892            V: std::convert::Into<std::string::String>,
2893        {
2894            self.0.request.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
2895            self
2896        }
2897
2898        /// Sets the value of [summary_spec][crate::model::ConverseConversationRequest::summary_spec].
2899        pub fn set_summary_spec<T>(mut self, v: T) -> Self
2900        where
2901            T: std::convert::Into<crate::model::search_request::content_search_spec::SummarySpec>,
2902        {
2903            self.0.request.summary_spec = std::option::Option::Some(v.into());
2904            self
2905        }
2906
2907        /// Sets or clears the value of [summary_spec][crate::model::ConverseConversationRequest::summary_spec].
2908        pub fn set_or_clear_summary_spec<T>(mut self, v: std::option::Option<T>) -> Self
2909        where
2910            T: std::convert::Into<crate::model::search_request::content_search_spec::SummarySpec>,
2911        {
2912            self.0.request.summary_spec = v.map(|x| x.into());
2913            self
2914        }
2915
2916        /// Sets the value of [filter][crate::model::ConverseConversationRequest::filter].
2917        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
2918            self.0.request.filter = v.into();
2919            self
2920        }
2921
2922        /// Sets the value of [boost_spec][crate::model::ConverseConversationRequest::boost_spec].
2923        pub fn set_boost_spec<T>(mut self, v: T) -> Self
2924        where
2925            T: std::convert::Into<crate::model::search_request::BoostSpec>,
2926        {
2927            self.0.request.boost_spec = std::option::Option::Some(v.into());
2928            self
2929        }
2930
2931        /// Sets or clears the value of [boost_spec][crate::model::ConverseConversationRequest::boost_spec].
2932        pub fn set_or_clear_boost_spec<T>(mut self, v: std::option::Option<T>) -> Self
2933        where
2934            T: std::convert::Into<crate::model::search_request::BoostSpec>,
2935        {
2936            self.0.request.boost_spec = v.map(|x| x.into());
2937            self
2938        }
2939    }
2940
2941    #[doc(hidden)]
2942    impl crate::RequestBuilder for ConverseConversation {
2943        fn request_options(&mut self) -> &mut crate::RequestOptions {
2944            &mut self.0.options
2945        }
2946    }
2947
2948    /// The request builder for [ConversationalSearchService::create_conversation][crate::client::ConversationalSearchService::create_conversation] calls.
2949    ///
2950    /// # Example
2951    /// ```
2952    /// # use google_cloud_discoveryengine_v1::builder::conversational_search_service::CreateConversation;
2953    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
2954    ///
2955    /// let builder = prepare_request_builder();
2956    /// let response = builder.send().await?;
2957    /// # Ok(()) }
2958    ///
2959    /// fn prepare_request_builder() -> CreateConversation {
2960    ///   # panic!();
2961    ///   // ... details omitted ...
2962    /// }
2963    /// ```
2964    #[derive(Clone, Debug)]
2965    pub struct CreateConversation(RequestBuilder<crate::model::CreateConversationRequest>);
2966
2967    impl CreateConversation {
2968        pub(crate) fn new(
2969            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
2970        ) -> Self {
2971            Self(RequestBuilder::new(stub))
2972        }
2973
2974        /// Sets the full request, replacing any prior values.
2975        pub fn with_request<V: Into<crate::model::CreateConversationRequest>>(
2976            mut self,
2977            v: V,
2978        ) -> Self {
2979            self.0.request = v.into();
2980            self
2981        }
2982
2983        /// Sets all the options, replacing any prior values.
2984        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2985            self.0.options = v.into();
2986            self
2987        }
2988
2989        /// Sends the request.
2990        pub async fn send(self) -> Result<crate::model::Conversation> {
2991            (*self.0.stub)
2992                .create_conversation(self.0.request, self.0.options)
2993                .await
2994                .map(crate::Response::into_body)
2995        }
2996
2997        /// Sets the value of [parent][crate::model::CreateConversationRequest::parent].
2998        ///
2999        /// This is a **required** field for requests.
3000        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
3001            self.0.request.parent = v.into();
3002            self
3003        }
3004
3005        /// Sets the value of [conversation][crate::model::CreateConversationRequest::conversation].
3006        ///
3007        /// This is a **required** field for requests.
3008        pub fn set_conversation<T>(mut self, v: T) -> Self
3009        where
3010            T: std::convert::Into<crate::model::Conversation>,
3011        {
3012            self.0.request.conversation = std::option::Option::Some(v.into());
3013            self
3014        }
3015
3016        /// Sets or clears the value of [conversation][crate::model::CreateConversationRequest::conversation].
3017        ///
3018        /// This is a **required** field for requests.
3019        pub fn set_or_clear_conversation<T>(mut self, v: std::option::Option<T>) -> Self
3020        where
3021            T: std::convert::Into<crate::model::Conversation>,
3022        {
3023            self.0.request.conversation = v.map(|x| x.into());
3024            self
3025        }
3026    }
3027
3028    #[doc(hidden)]
3029    impl crate::RequestBuilder for CreateConversation {
3030        fn request_options(&mut self) -> &mut crate::RequestOptions {
3031            &mut self.0.options
3032        }
3033    }
3034
3035    /// The request builder for [ConversationalSearchService::delete_conversation][crate::client::ConversationalSearchService::delete_conversation] calls.
3036    ///
3037    /// # Example
3038    /// ```
3039    /// # use google_cloud_discoveryengine_v1::builder::conversational_search_service::DeleteConversation;
3040    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
3041    ///
3042    /// let builder = prepare_request_builder();
3043    /// let response = builder.send().await?;
3044    /// # Ok(()) }
3045    ///
3046    /// fn prepare_request_builder() -> DeleteConversation {
3047    ///   # panic!();
3048    ///   // ... details omitted ...
3049    /// }
3050    /// ```
3051    #[derive(Clone, Debug)]
3052    pub struct DeleteConversation(RequestBuilder<crate::model::DeleteConversationRequest>);
3053
3054    impl DeleteConversation {
3055        pub(crate) fn new(
3056            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3057        ) -> Self {
3058            Self(RequestBuilder::new(stub))
3059        }
3060
3061        /// Sets the full request, replacing any prior values.
3062        pub fn with_request<V: Into<crate::model::DeleteConversationRequest>>(
3063            mut self,
3064            v: V,
3065        ) -> Self {
3066            self.0.request = v.into();
3067            self
3068        }
3069
3070        /// Sets all the options, replacing any prior values.
3071        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3072            self.0.options = v.into();
3073            self
3074        }
3075
3076        /// Sends the request.
3077        pub async fn send(self) -> Result<()> {
3078            (*self.0.stub)
3079                .delete_conversation(self.0.request, self.0.options)
3080                .await
3081                .map(crate::Response::into_body)
3082        }
3083
3084        /// Sets the value of [name][crate::model::DeleteConversationRequest::name].
3085        ///
3086        /// This is a **required** field for requests.
3087        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3088            self.0.request.name = v.into();
3089            self
3090        }
3091    }
3092
3093    #[doc(hidden)]
3094    impl crate::RequestBuilder for DeleteConversation {
3095        fn request_options(&mut self) -> &mut crate::RequestOptions {
3096            &mut self.0.options
3097        }
3098    }
3099
3100    /// The request builder for [ConversationalSearchService::update_conversation][crate::client::ConversationalSearchService::update_conversation] calls.
3101    ///
3102    /// # Example
3103    /// ```
3104    /// # use google_cloud_discoveryengine_v1::builder::conversational_search_service::UpdateConversation;
3105    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
3106    ///
3107    /// let builder = prepare_request_builder();
3108    /// let response = builder.send().await?;
3109    /// # Ok(()) }
3110    ///
3111    /// fn prepare_request_builder() -> UpdateConversation {
3112    ///   # panic!();
3113    ///   // ... details omitted ...
3114    /// }
3115    /// ```
3116    #[derive(Clone, Debug)]
3117    pub struct UpdateConversation(RequestBuilder<crate::model::UpdateConversationRequest>);
3118
3119    impl UpdateConversation {
3120        pub(crate) fn new(
3121            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3122        ) -> Self {
3123            Self(RequestBuilder::new(stub))
3124        }
3125
3126        /// Sets the full request, replacing any prior values.
3127        pub fn with_request<V: Into<crate::model::UpdateConversationRequest>>(
3128            mut self,
3129            v: V,
3130        ) -> Self {
3131            self.0.request = v.into();
3132            self
3133        }
3134
3135        /// Sets all the options, replacing any prior values.
3136        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3137            self.0.options = v.into();
3138            self
3139        }
3140
3141        /// Sends the request.
3142        pub async fn send(self) -> Result<crate::model::Conversation> {
3143            (*self.0.stub)
3144                .update_conversation(self.0.request, self.0.options)
3145                .await
3146                .map(crate::Response::into_body)
3147        }
3148
3149        /// Sets the value of [conversation][crate::model::UpdateConversationRequest::conversation].
3150        ///
3151        /// This is a **required** field for requests.
3152        pub fn set_conversation<T>(mut self, v: T) -> Self
3153        where
3154            T: std::convert::Into<crate::model::Conversation>,
3155        {
3156            self.0.request.conversation = std::option::Option::Some(v.into());
3157            self
3158        }
3159
3160        /// Sets or clears the value of [conversation][crate::model::UpdateConversationRequest::conversation].
3161        ///
3162        /// This is a **required** field for requests.
3163        pub fn set_or_clear_conversation<T>(mut self, v: std::option::Option<T>) -> Self
3164        where
3165            T: std::convert::Into<crate::model::Conversation>,
3166        {
3167            self.0.request.conversation = v.map(|x| x.into());
3168            self
3169        }
3170
3171        /// Sets the value of [update_mask][crate::model::UpdateConversationRequest::update_mask].
3172        pub fn set_update_mask<T>(mut self, v: T) -> Self
3173        where
3174            T: std::convert::Into<wkt::FieldMask>,
3175        {
3176            self.0.request.update_mask = std::option::Option::Some(v.into());
3177            self
3178        }
3179
3180        /// Sets or clears the value of [update_mask][crate::model::UpdateConversationRequest::update_mask].
3181        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
3182        where
3183            T: std::convert::Into<wkt::FieldMask>,
3184        {
3185            self.0.request.update_mask = v.map(|x| x.into());
3186            self
3187        }
3188    }
3189
3190    #[doc(hidden)]
3191    impl crate::RequestBuilder for UpdateConversation {
3192        fn request_options(&mut self) -> &mut crate::RequestOptions {
3193            &mut self.0.options
3194        }
3195    }
3196
3197    /// The request builder for [ConversationalSearchService::get_conversation][crate::client::ConversationalSearchService::get_conversation] calls.
3198    ///
3199    /// # Example
3200    /// ```
3201    /// # use google_cloud_discoveryengine_v1::builder::conversational_search_service::GetConversation;
3202    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
3203    ///
3204    /// let builder = prepare_request_builder();
3205    /// let response = builder.send().await?;
3206    /// # Ok(()) }
3207    ///
3208    /// fn prepare_request_builder() -> GetConversation {
3209    ///   # panic!();
3210    ///   // ... details omitted ...
3211    /// }
3212    /// ```
3213    #[derive(Clone, Debug)]
3214    pub struct GetConversation(RequestBuilder<crate::model::GetConversationRequest>);
3215
3216    impl GetConversation {
3217        pub(crate) fn new(
3218            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3219        ) -> Self {
3220            Self(RequestBuilder::new(stub))
3221        }
3222
3223        /// Sets the full request, replacing any prior values.
3224        pub fn with_request<V: Into<crate::model::GetConversationRequest>>(mut self, v: V) -> Self {
3225            self.0.request = v.into();
3226            self
3227        }
3228
3229        /// Sets all the options, replacing any prior values.
3230        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3231            self.0.options = v.into();
3232            self
3233        }
3234
3235        /// Sends the request.
3236        pub async fn send(self) -> Result<crate::model::Conversation> {
3237            (*self.0.stub)
3238                .get_conversation(self.0.request, self.0.options)
3239                .await
3240                .map(crate::Response::into_body)
3241        }
3242
3243        /// Sets the value of [name][crate::model::GetConversationRequest::name].
3244        ///
3245        /// This is a **required** field for requests.
3246        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3247            self.0.request.name = v.into();
3248            self
3249        }
3250    }
3251
3252    #[doc(hidden)]
3253    impl crate::RequestBuilder for GetConversation {
3254        fn request_options(&mut self) -> &mut crate::RequestOptions {
3255            &mut self.0.options
3256        }
3257    }
3258
3259    /// The request builder for [ConversationalSearchService::list_conversations][crate::client::ConversationalSearchService::list_conversations] calls.
3260    ///
3261    /// # Example
3262    /// ```
3263    /// # use google_cloud_discoveryengine_v1::builder::conversational_search_service::ListConversations;
3264    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
3265    /// use google_cloud_gax::paginator::ItemPaginator;
3266    ///
3267    /// let builder = prepare_request_builder();
3268    /// let mut items = builder.by_item();
3269    /// while let Some(result) = items.next().await {
3270    ///   let item = result?;
3271    /// }
3272    /// # Ok(()) }
3273    ///
3274    /// fn prepare_request_builder() -> ListConversations {
3275    ///   # panic!();
3276    ///   // ... details omitted ...
3277    /// }
3278    /// ```
3279    #[derive(Clone, Debug)]
3280    pub struct ListConversations(RequestBuilder<crate::model::ListConversationsRequest>);
3281
3282    impl ListConversations {
3283        pub(crate) fn new(
3284            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3285        ) -> Self {
3286            Self(RequestBuilder::new(stub))
3287        }
3288
3289        /// Sets the full request, replacing any prior values.
3290        pub fn with_request<V: Into<crate::model::ListConversationsRequest>>(
3291            mut self,
3292            v: V,
3293        ) -> Self {
3294            self.0.request = v.into();
3295            self
3296        }
3297
3298        /// Sets all the options, replacing any prior values.
3299        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3300            self.0.options = v.into();
3301            self
3302        }
3303
3304        /// Sends the request.
3305        pub async fn send(self) -> Result<crate::model::ListConversationsResponse> {
3306            (*self.0.stub)
3307                .list_conversations(self.0.request, self.0.options)
3308                .await
3309                .map(crate::Response::into_body)
3310        }
3311
3312        /// Streams each page in the collection.
3313        pub fn by_page(
3314            self,
3315        ) -> impl google_cloud_gax::paginator::Paginator<
3316            crate::model::ListConversationsResponse,
3317            crate::Error,
3318        > {
3319            use std::clone::Clone;
3320            let token = self.0.request.page_token.clone();
3321            let execute = move |token: String| {
3322                let mut builder = self.clone();
3323                builder.0.request = builder.0.request.set_page_token(token);
3324                builder.send()
3325            };
3326            google_cloud_gax::paginator::internal::new_paginator(token, execute)
3327        }
3328
3329        /// Streams each item in the collection.
3330        pub fn by_item(
3331            self,
3332        ) -> impl google_cloud_gax::paginator::ItemPaginator<
3333            crate::model::ListConversationsResponse,
3334            crate::Error,
3335        > {
3336            use google_cloud_gax::paginator::Paginator;
3337            self.by_page().items()
3338        }
3339
3340        /// Sets the value of [parent][crate::model::ListConversationsRequest::parent].
3341        ///
3342        /// This is a **required** field for requests.
3343        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
3344            self.0.request.parent = v.into();
3345            self
3346        }
3347
3348        /// Sets the value of [page_size][crate::model::ListConversationsRequest::page_size].
3349        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
3350            self.0.request.page_size = v.into();
3351            self
3352        }
3353
3354        /// Sets the value of [page_token][crate::model::ListConversationsRequest::page_token].
3355        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
3356            self.0.request.page_token = v.into();
3357            self
3358        }
3359
3360        /// Sets the value of [filter][crate::model::ListConversationsRequest::filter].
3361        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
3362            self.0.request.filter = v.into();
3363            self
3364        }
3365
3366        /// Sets the value of [order_by][crate::model::ListConversationsRequest::order_by].
3367        pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
3368            self.0.request.order_by = v.into();
3369            self
3370        }
3371    }
3372
3373    #[doc(hidden)]
3374    impl crate::RequestBuilder for ListConversations {
3375        fn request_options(&mut self) -> &mut crate::RequestOptions {
3376            &mut self.0.options
3377        }
3378    }
3379
3380    /// The request builder for [ConversationalSearchService::answer_query][crate::client::ConversationalSearchService::answer_query] calls.
3381    ///
3382    /// # Example
3383    /// ```
3384    /// # use google_cloud_discoveryengine_v1::builder::conversational_search_service::AnswerQuery;
3385    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
3386    ///
3387    /// let builder = prepare_request_builder();
3388    /// let response = builder.send().await?;
3389    /// # Ok(()) }
3390    ///
3391    /// fn prepare_request_builder() -> AnswerQuery {
3392    ///   # panic!();
3393    ///   // ... details omitted ...
3394    /// }
3395    /// ```
3396    #[derive(Clone, Debug)]
3397    pub struct AnswerQuery(RequestBuilder<crate::model::AnswerQueryRequest>);
3398
3399    impl AnswerQuery {
3400        pub(crate) fn new(
3401            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3402        ) -> Self {
3403            Self(RequestBuilder::new(stub))
3404        }
3405
3406        /// Sets the full request, replacing any prior values.
3407        pub fn with_request<V: Into<crate::model::AnswerQueryRequest>>(mut self, v: V) -> Self {
3408            self.0.request = v.into();
3409            self
3410        }
3411
3412        /// Sets all the options, replacing any prior values.
3413        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3414            self.0.options = v.into();
3415            self
3416        }
3417
3418        /// Sends the request.
3419        pub async fn send(self) -> Result<crate::model::AnswerQueryResponse> {
3420            (*self.0.stub)
3421                .answer_query(self.0.request, self.0.options)
3422                .await
3423                .map(crate::Response::into_body)
3424        }
3425
3426        /// Sets the value of [serving_config][crate::model::AnswerQueryRequest::serving_config].
3427        ///
3428        /// This is a **required** field for requests.
3429        pub fn set_serving_config<T: Into<std::string::String>>(mut self, v: T) -> Self {
3430            self.0.request.serving_config = v.into();
3431            self
3432        }
3433
3434        /// Sets the value of [query][crate::model::AnswerQueryRequest::query].
3435        ///
3436        /// This is a **required** field for requests.
3437        pub fn set_query<T>(mut self, v: T) -> Self
3438        where
3439            T: std::convert::Into<crate::model::Query>,
3440        {
3441            self.0.request.query = std::option::Option::Some(v.into());
3442            self
3443        }
3444
3445        /// Sets or clears the value of [query][crate::model::AnswerQueryRequest::query].
3446        ///
3447        /// This is a **required** field for requests.
3448        pub fn set_or_clear_query<T>(mut self, v: std::option::Option<T>) -> Self
3449        where
3450            T: std::convert::Into<crate::model::Query>,
3451        {
3452            self.0.request.query = v.map(|x| x.into());
3453            self
3454        }
3455
3456        /// Sets the value of [session][crate::model::AnswerQueryRequest::session].
3457        pub fn set_session<T: Into<std::string::String>>(mut self, v: T) -> Self {
3458            self.0.request.session = v.into();
3459            self
3460        }
3461
3462        /// Sets the value of [safety_spec][crate::model::AnswerQueryRequest::safety_spec].
3463        pub fn set_safety_spec<T>(mut self, v: T) -> Self
3464        where
3465            T: std::convert::Into<crate::model::answer_query_request::SafetySpec>,
3466        {
3467            self.0.request.safety_spec = std::option::Option::Some(v.into());
3468            self
3469        }
3470
3471        /// Sets or clears the value of [safety_spec][crate::model::AnswerQueryRequest::safety_spec].
3472        pub fn set_or_clear_safety_spec<T>(mut self, v: std::option::Option<T>) -> Self
3473        where
3474            T: std::convert::Into<crate::model::answer_query_request::SafetySpec>,
3475        {
3476            self.0.request.safety_spec = v.map(|x| x.into());
3477            self
3478        }
3479
3480        /// Sets the value of [related_questions_spec][crate::model::AnswerQueryRequest::related_questions_spec].
3481        pub fn set_related_questions_spec<T>(mut self, v: T) -> Self
3482        where
3483            T: std::convert::Into<crate::model::answer_query_request::RelatedQuestionsSpec>,
3484        {
3485            self.0.request.related_questions_spec = std::option::Option::Some(v.into());
3486            self
3487        }
3488
3489        /// Sets or clears the value of [related_questions_spec][crate::model::AnswerQueryRequest::related_questions_spec].
3490        pub fn set_or_clear_related_questions_spec<T>(mut self, v: std::option::Option<T>) -> Self
3491        where
3492            T: std::convert::Into<crate::model::answer_query_request::RelatedQuestionsSpec>,
3493        {
3494            self.0.request.related_questions_spec = v.map(|x| x.into());
3495            self
3496        }
3497
3498        /// Sets the value of [grounding_spec][crate::model::AnswerQueryRequest::grounding_spec].
3499        pub fn set_grounding_spec<T>(mut self, v: T) -> Self
3500        where
3501            T: std::convert::Into<crate::model::answer_query_request::GroundingSpec>,
3502        {
3503            self.0.request.grounding_spec = std::option::Option::Some(v.into());
3504            self
3505        }
3506
3507        /// Sets or clears the value of [grounding_spec][crate::model::AnswerQueryRequest::grounding_spec].
3508        pub fn set_or_clear_grounding_spec<T>(mut self, v: std::option::Option<T>) -> Self
3509        where
3510            T: std::convert::Into<crate::model::answer_query_request::GroundingSpec>,
3511        {
3512            self.0.request.grounding_spec = v.map(|x| x.into());
3513            self
3514        }
3515
3516        /// Sets the value of [answer_generation_spec][crate::model::AnswerQueryRequest::answer_generation_spec].
3517        pub fn set_answer_generation_spec<T>(mut self, v: T) -> Self
3518        where
3519            T: std::convert::Into<crate::model::answer_query_request::AnswerGenerationSpec>,
3520        {
3521            self.0.request.answer_generation_spec = std::option::Option::Some(v.into());
3522            self
3523        }
3524
3525        /// Sets or clears the value of [answer_generation_spec][crate::model::AnswerQueryRequest::answer_generation_spec].
3526        pub fn set_or_clear_answer_generation_spec<T>(mut self, v: std::option::Option<T>) -> Self
3527        where
3528            T: std::convert::Into<crate::model::answer_query_request::AnswerGenerationSpec>,
3529        {
3530            self.0.request.answer_generation_spec = v.map(|x| x.into());
3531            self
3532        }
3533
3534        /// Sets the value of [search_spec][crate::model::AnswerQueryRequest::search_spec].
3535        pub fn set_search_spec<T>(mut self, v: T) -> Self
3536        where
3537            T: std::convert::Into<crate::model::answer_query_request::SearchSpec>,
3538        {
3539            self.0.request.search_spec = std::option::Option::Some(v.into());
3540            self
3541        }
3542
3543        /// Sets or clears the value of [search_spec][crate::model::AnswerQueryRequest::search_spec].
3544        pub fn set_or_clear_search_spec<T>(mut self, v: std::option::Option<T>) -> Self
3545        where
3546            T: std::convert::Into<crate::model::answer_query_request::SearchSpec>,
3547        {
3548            self.0.request.search_spec = v.map(|x| x.into());
3549            self
3550        }
3551
3552        /// Sets the value of [query_understanding_spec][crate::model::AnswerQueryRequest::query_understanding_spec].
3553        pub fn set_query_understanding_spec<T>(mut self, v: T) -> Self
3554        where
3555            T: std::convert::Into<crate::model::answer_query_request::QueryUnderstandingSpec>,
3556        {
3557            self.0.request.query_understanding_spec = std::option::Option::Some(v.into());
3558            self
3559        }
3560
3561        /// Sets or clears the value of [query_understanding_spec][crate::model::AnswerQueryRequest::query_understanding_spec].
3562        pub fn set_or_clear_query_understanding_spec<T>(mut self, v: std::option::Option<T>) -> Self
3563        where
3564            T: std::convert::Into<crate::model::answer_query_request::QueryUnderstandingSpec>,
3565        {
3566            self.0.request.query_understanding_spec = v.map(|x| x.into());
3567            self
3568        }
3569
3570        /// Sets the value of [asynchronous_mode][crate::model::AnswerQueryRequest::asynchronous_mode].
3571        #[deprecated]
3572        pub fn set_asynchronous_mode<T: Into<bool>>(mut self, v: T) -> Self {
3573            self.0.request.asynchronous_mode = v.into();
3574            self
3575        }
3576
3577        /// Sets the value of [user_pseudo_id][crate::model::AnswerQueryRequest::user_pseudo_id].
3578        pub fn set_user_pseudo_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
3579            self.0.request.user_pseudo_id = v.into();
3580            self
3581        }
3582
3583        /// Sets the value of [user_labels][crate::model::AnswerQueryRequest::user_labels].
3584        pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
3585        where
3586            T: std::iter::IntoIterator<Item = (K, V)>,
3587            K: std::convert::Into<std::string::String>,
3588            V: std::convert::Into<std::string::String>,
3589        {
3590            self.0.request.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
3591            self
3592        }
3593
3594        /// Sets the value of [end_user_spec][crate::model::AnswerQueryRequest::end_user_spec].
3595        pub fn set_end_user_spec<T>(mut self, v: T) -> Self
3596        where
3597            T: std::convert::Into<crate::model::answer_query_request::EndUserSpec>,
3598        {
3599            self.0.request.end_user_spec = std::option::Option::Some(v.into());
3600            self
3601        }
3602
3603        /// Sets or clears the value of [end_user_spec][crate::model::AnswerQueryRequest::end_user_spec].
3604        pub fn set_or_clear_end_user_spec<T>(mut self, v: std::option::Option<T>) -> Self
3605        where
3606            T: std::convert::Into<crate::model::answer_query_request::EndUserSpec>,
3607        {
3608            self.0.request.end_user_spec = v.map(|x| x.into());
3609            self
3610        }
3611    }
3612
3613    #[doc(hidden)]
3614    impl crate::RequestBuilder for AnswerQuery {
3615        fn request_options(&mut self) -> &mut crate::RequestOptions {
3616            &mut self.0.options
3617        }
3618    }
3619
3620    /// The request builder for [ConversationalSearchService::get_answer][crate::client::ConversationalSearchService::get_answer] calls.
3621    ///
3622    /// # Example
3623    /// ```
3624    /// # use google_cloud_discoveryengine_v1::builder::conversational_search_service::GetAnswer;
3625    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
3626    ///
3627    /// let builder = prepare_request_builder();
3628    /// let response = builder.send().await?;
3629    /// # Ok(()) }
3630    ///
3631    /// fn prepare_request_builder() -> GetAnswer {
3632    ///   # panic!();
3633    ///   // ... details omitted ...
3634    /// }
3635    /// ```
3636    #[derive(Clone, Debug)]
3637    pub struct GetAnswer(RequestBuilder<crate::model::GetAnswerRequest>);
3638
3639    impl GetAnswer {
3640        pub(crate) fn new(
3641            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3642        ) -> Self {
3643            Self(RequestBuilder::new(stub))
3644        }
3645
3646        /// Sets the full request, replacing any prior values.
3647        pub fn with_request<V: Into<crate::model::GetAnswerRequest>>(mut self, v: V) -> Self {
3648            self.0.request = v.into();
3649            self
3650        }
3651
3652        /// Sets all the options, replacing any prior values.
3653        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3654            self.0.options = v.into();
3655            self
3656        }
3657
3658        /// Sends the request.
3659        pub async fn send(self) -> Result<crate::model::Answer> {
3660            (*self.0.stub)
3661                .get_answer(self.0.request, self.0.options)
3662                .await
3663                .map(crate::Response::into_body)
3664        }
3665
3666        /// Sets the value of [name][crate::model::GetAnswerRequest::name].
3667        ///
3668        /// This is a **required** field for requests.
3669        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3670            self.0.request.name = v.into();
3671            self
3672        }
3673    }
3674
3675    #[doc(hidden)]
3676    impl crate::RequestBuilder for GetAnswer {
3677        fn request_options(&mut self) -> &mut crate::RequestOptions {
3678            &mut self.0.options
3679        }
3680    }
3681
3682    /// The request builder for [ConversationalSearchService::create_session][crate::client::ConversationalSearchService::create_session] calls.
3683    ///
3684    /// # Example
3685    /// ```
3686    /// # use google_cloud_discoveryengine_v1::builder::conversational_search_service::CreateSession;
3687    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
3688    ///
3689    /// let builder = prepare_request_builder();
3690    /// let response = builder.send().await?;
3691    /// # Ok(()) }
3692    ///
3693    /// fn prepare_request_builder() -> CreateSession {
3694    ///   # panic!();
3695    ///   // ... details omitted ...
3696    /// }
3697    /// ```
3698    #[derive(Clone, Debug)]
3699    pub struct CreateSession(RequestBuilder<crate::model::CreateSessionRequest>);
3700
3701    impl CreateSession {
3702        pub(crate) fn new(
3703            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3704        ) -> Self {
3705            Self(RequestBuilder::new(stub))
3706        }
3707
3708        /// Sets the full request, replacing any prior values.
3709        pub fn with_request<V: Into<crate::model::CreateSessionRequest>>(mut self, v: V) -> Self {
3710            self.0.request = v.into();
3711            self
3712        }
3713
3714        /// Sets all the options, replacing any prior values.
3715        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3716            self.0.options = v.into();
3717            self
3718        }
3719
3720        /// Sends the request.
3721        pub async fn send(self) -> Result<crate::model::Session> {
3722            (*self.0.stub)
3723                .create_session(self.0.request, self.0.options)
3724                .await
3725                .map(crate::Response::into_body)
3726        }
3727
3728        /// Sets the value of [parent][crate::model::CreateSessionRequest::parent].
3729        ///
3730        /// This is a **required** field for requests.
3731        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
3732            self.0.request.parent = v.into();
3733            self
3734        }
3735
3736        /// Sets the value of [session][crate::model::CreateSessionRequest::session].
3737        ///
3738        /// This is a **required** field for requests.
3739        pub fn set_session<T>(mut self, v: T) -> Self
3740        where
3741            T: std::convert::Into<crate::model::Session>,
3742        {
3743            self.0.request.session = std::option::Option::Some(v.into());
3744            self
3745        }
3746
3747        /// Sets or clears the value of [session][crate::model::CreateSessionRequest::session].
3748        ///
3749        /// This is a **required** field for requests.
3750        pub fn set_or_clear_session<T>(mut self, v: std::option::Option<T>) -> Self
3751        where
3752            T: std::convert::Into<crate::model::Session>,
3753        {
3754            self.0.request.session = v.map(|x| x.into());
3755            self
3756        }
3757    }
3758
3759    #[doc(hidden)]
3760    impl crate::RequestBuilder for CreateSession {
3761        fn request_options(&mut self) -> &mut crate::RequestOptions {
3762            &mut self.0.options
3763        }
3764    }
3765
3766    /// The request builder for [ConversationalSearchService::delete_session][crate::client::ConversationalSearchService::delete_session] calls.
3767    ///
3768    /// # Example
3769    /// ```
3770    /// # use google_cloud_discoveryengine_v1::builder::conversational_search_service::DeleteSession;
3771    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
3772    ///
3773    /// let builder = prepare_request_builder();
3774    /// let response = builder.send().await?;
3775    /// # Ok(()) }
3776    ///
3777    /// fn prepare_request_builder() -> DeleteSession {
3778    ///   # panic!();
3779    ///   // ... details omitted ...
3780    /// }
3781    /// ```
3782    #[derive(Clone, Debug)]
3783    pub struct DeleteSession(RequestBuilder<crate::model::DeleteSessionRequest>);
3784
3785    impl DeleteSession {
3786        pub(crate) fn new(
3787            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3788        ) -> Self {
3789            Self(RequestBuilder::new(stub))
3790        }
3791
3792        /// Sets the full request, replacing any prior values.
3793        pub fn with_request<V: Into<crate::model::DeleteSessionRequest>>(mut self, v: V) -> Self {
3794            self.0.request = v.into();
3795            self
3796        }
3797
3798        /// Sets all the options, replacing any prior values.
3799        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3800            self.0.options = v.into();
3801            self
3802        }
3803
3804        /// Sends the request.
3805        pub async fn send(self) -> Result<()> {
3806            (*self.0.stub)
3807                .delete_session(self.0.request, self.0.options)
3808                .await
3809                .map(crate::Response::into_body)
3810        }
3811
3812        /// Sets the value of [name][crate::model::DeleteSessionRequest::name].
3813        ///
3814        /// This is a **required** field for requests.
3815        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3816            self.0.request.name = v.into();
3817            self
3818        }
3819    }
3820
3821    #[doc(hidden)]
3822    impl crate::RequestBuilder for DeleteSession {
3823        fn request_options(&mut self) -> &mut crate::RequestOptions {
3824            &mut self.0.options
3825        }
3826    }
3827
3828    /// The request builder for [ConversationalSearchService::update_session][crate::client::ConversationalSearchService::update_session] calls.
3829    ///
3830    /// # Example
3831    /// ```
3832    /// # use google_cloud_discoveryengine_v1::builder::conversational_search_service::UpdateSession;
3833    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
3834    ///
3835    /// let builder = prepare_request_builder();
3836    /// let response = builder.send().await?;
3837    /// # Ok(()) }
3838    ///
3839    /// fn prepare_request_builder() -> UpdateSession {
3840    ///   # panic!();
3841    ///   // ... details omitted ...
3842    /// }
3843    /// ```
3844    #[derive(Clone, Debug)]
3845    pub struct UpdateSession(RequestBuilder<crate::model::UpdateSessionRequest>);
3846
3847    impl UpdateSession {
3848        pub(crate) fn new(
3849            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3850        ) -> Self {
3851            Self(RequestBuilder::new(stub))
3852        }
3853
3854        /// Sets the full request, replacing any prior values.
3855        pub fn with_request<V: Into<crate::model::UpdateSessionRequest>>(mut self, v: V) -> Self {
3856            self.0.request = v.into();
3857            self
3858        }
3859
3860        /// Sets all the options, replacing any prior values.
3861        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3862            self.0.options = v.into();
3863            self
3864        }
3865
3866        /// Sends the request.
3867        pub async fn send(self) -> Result<crate::model::Session> {
3868            (*self.0.stub)
3869                .update_session(self.0.request, self.0.options)
3870                .await
3871                .map(crate::Response::into_body)
3872        }
3873
3874        /// Sets the value of [session][crate::model::UpdateSessionRequest::session].
3875        ///
3876        /// This is a **required** field for requests.
3877        pub fn set_session<T>(mut self, v: T) -> Self
3878        where
3879            T: std::convert::Into<crate::model::Session>,
3880        {
3881            self.0.request.session = std::option::Option::Some(v.into());
3882            self
3883        }
3884
3885        /// Sets or clears the value of [session][crate::model::UpdateSessionRequest::session].
3886        ///
3887        /// This is a **required** field for requests.
3888        pub fn set_or_clear_session<T>(mut self, v: std::option::Option<T>) -> Self
3889        where
3890            T: std::convert::Into<crate::model::Session>,
3891        {
3892            self.0.request.session = v.map(|x| x.into());
3893            self
3894        }
3895
3896        /// Sets the value of [update_mask][crate::model::UpdateSessionRequest::update_mask].
3897        pub fn set_update_mask<T>(mut self, v: T) -> Self
3898        where
3899            T: std::convert::Into<wkt::FieldMask>,
3900        {
3901            self.0.request.update_mask = std::option::Option::Some(v.into());
3902            self
3903        }
3904
3905        /// Sets or clears the value of [update_mask][crate::model::UpdateSessionRequest::update_mask].
3906        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
3907        where
3908            T: std::convert::Into<wkt::FieldMask>,
3909        {
3910            self.0.request.update_mask = v.map(|x| x.into());
3911            self
3912        }
3913    }
3914
3915    #[doc(hidden)]
3916    impl crate::RequestBuilder for UpdateSession {
3917        fn request_options(&mut self) -> &mut crate::RequestOptions {
3918            &mut self.0.options
3919        }
3920    }
3921
3922    /// The request builder for [ConversationalSearchService::get_session][crate::client::ConversationalSearchService::get_session] calls.
3923    ///
3924    /// # Example
3925    /// ```
3926    /// # use google_cloud_discoveryengine_v1::builder::conversational_search_service::GetSession;
3927    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
3928    ///
3929    /// let builder = prepare_request_builder();
3930    /// let response = builder.send().await?;
3931    /// # Ok(()) }
3932    ///
3933    /// fn prepare_request_builder() -> GetSession {
3934    ///   # panic!();
3935    ///   // ... details omitted ...
3936    /// }
3937    /// ```
3938    #[derive(Clone, Debug)]
3939    pub struct GetSession(RequestBuilder<crate::model::GetSessionRequest>);
3940
3941    impl GetSession {
3942        pub(crate) fn new(
3943            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3944        ) -> Self {
3945            Self(RequestBuilder::new(stub))
3946        }
3947
3948        /// Sets the full request, replacing any prior values.
3949        pub fn with_request<V: Into<crate::model::GetSessionRequest>>(mut self, v: V) -> Self {
3950            self.0.request = v.into();
3951            self
3952        }
3953
3954        /// Sets all the options, replacing any prior values.
3955        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3956            self.0.options = v.into();
3957            self
3958        }
3959
3960        /// Sends the request.
3961        pub async fn send(self) -> Result<crate::model::Session> {
3962            (*self.0.stub)
3963                .get_session(self.0.request, self.0.options)
3964                .await
3965                .map(crate::Response::into_body)
3966        }
3967
3968        /// Sets the value of [name][crate::model::GetSessionRequest::name].
3969        ///
3970        /// This is a **required** field for requests.
3971        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3972            self.0.request.name = v.into();
3973            self
3974        }
3975
3976        /// Sets the value of [include_answer_details][crate::model::GetSessionRequest::include_answer_details].
3977        pub fn set_include_answer_details<T: Into<bool>>(mut self, v: T) -> Self {
3978            self.0.request.include_answer_details = v.into();
3979            self
3980        }
3981    }
3982
3983    #[doc(hidden)]
3984    impl crate::RequestBuilder for GetSession {
3985        fn request_options(&mut self) -> &mut crate::RequestOptions {
3986            &mut self.0.options
3987        }
3988    }
3989
3990    /// The request builder for [ConversationalSearchService::list_sessions][crate::client::ConversationalSearchService::list_sessions] calls.
3991    ///
3992    /// # Example
3993    /// ```
3994    /// # use google_cloud_discoveryengine_v1::builder::conversational_search_service::ListSessions;
3995    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
3996    /// use google_cloud_gax::paginator::ItemPaginator;
3997    ///
3998    /// let builder = prepare_request_builder();
3999    /// let mut items = builder.by_item();
4000    /// while let Some(result) = items.next().await {
4001    ///   let item = result?;
4002    /// }
4003    /// # Ok(()) }
4004    ///
4005    /// fn prepare_request_builder() -> ListSessions {
4006    ///   # panic!();
4007    ///   // ... details omitted ...
4008    /// }
4009    /// ```
4010    #[derive(Clone, Debug)]
4011    pub struct ListSessions(RequestBuilder<crate::model::ListSessionsRequest>);
4012
4013    impl ListSessions {
4014        pub(crate) fn new(
4015            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
4016        ) -> Self {
4017            Self(RequestBuilder::new(stub))
4018        }
4019
4020        /// Sets the full request, replacing any prior values.
4021        pub fn with_request<V: Into<crate::model::ListSessionsRequest>>(mut self, v: V) -> Self {
4022            self.0.request = v.into();
4023            self
4024        }
4025
4026        /// Sets all the options, replacing any prior values.
4027        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4028            self.0.options = v.into();
4029            self
4030        }
4031
4032        /// Sends the request.
4033        pub async fn send(self) -> Result<crate::model::ListSessionsResponse> {
4034            (*self.0.stub)
4035                .list_sessions(self.0.request, self.0.options)
4036                .await
4037                .map(crate::Response::into_body)
4038        }
4039
4040        /// Streams each page in the collection.
4041        pub fn by_page(
4042            self,
4043        ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListSessionsResponse, crate::Error>
4044        {
4045            use std::clone::Clone;
4046            let token = self.0.request.page_token.clone();
4047            let execute = move |token: String| {
4048                let mut builder = self.clone();
4049                builder.0.request = builder.0.request.set_page_token(token);
4050                builder.send()
4051            };
4052            google_cloud_gax::paginator::internal::new_paginator(token, execute)
4053        }
4054
4055        /// Streams each item in the collection.
4056        pub fn by_item(
4057            self,
4058        ) -> impl google_cloud_gax::paginator::ItemPaginator<
4059            crate::model::ListSessionsResponse,
4060            crate::Error,
4061        > {
4062            use google_cloud_gax::paginator::Paginator;
4063            self.by_page().items()
4064        }
4065
4066        /// Sets the value of [parent][crate::model::ListSessionsRequest::parent].
4067        ///
4068        /// This is a **required** field for requests.
4069        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
4070            self.0.request.parent = v.into();
4071            self
4072        }
4073
4074        /// Sets the value of [page_size][crate::model::ListSessionsRequest::page_size].
4075        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
4076            self.0.request.page_size = v.into();
4077            self
4078        }
4079
4080        /// Sets the value of [page_token][crate::model::ListSessionsRequest::page_token].
4081        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
4082            self.0.request.page_token = v.into();
4083            self
4084        }
4085
4086        /// Sets the value of [filter][crate::model::ListSessionsRequest::filter].
4087        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
4088            self.0.request.filter = v.into();
4089            self
4090        }
4091
4092        /// Sets the value of [order_by][crate::model::ListSessionsRequest::order_by].
4093        pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
4094            self.0.request.order_by = v.into();
4095            self
4096        }
4097    }
4098
4099    #[doc(hidden)]
4100    impl crate::RequestBuilder for ListSessions {
4101        fn request_options(&mut self) -> &mut crate::RequestOptions {
4102            &mut self.0.options
4103        }
4104    }
4105
4106    /// The request builder for [ConversationalSearchService::list_operations][crate::client::ConversationalSearchService::list_operations] calls.
4107    ///
4108    /// # Example
4109    /// ```
4110    /// # use google_cloud_discoveryengine_v1::builder::conversational_search_service::ListOperations;
4111    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
4112    /// use google_cloud_gax::paginator::ItemPaginator;
4113    ///
4114    /// let builder = prepare_request_builder();
4115    /// let mut items = builder.by_item();
4116    /// while let Some(result) = items.next().await {
4117    ///   let item = result?;
4118    /// }
4119    /// # Ok(()) }
4120    ///
4121    /// fn prepare_request_builder() -> ListOperations {
4122    ///   # panic!();
4123    ///   // ... details omitted ...
4124    /// }
4125    /// ```
4126    #[derive(Clone, Debug)]
4127    pub struct ListOperations(
4128        RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
4129    );
4130
4131    impl ListOperations {
4132        pub(crate) fn new(
4133            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
4134        ) -> Self {
4135            Self(RequestBuilder::new(stub))
4136        }
4137
4138        /// Sets the full request, replacing any prior values.
4139        pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
4140            mut self,
4141            v: V,
4142        ) -> Self {
4143            self.0.request = v.into();
4144            self
4145        }
4146
4147        /// Sets all the options, replacing any prior values.
4148        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4149            self.0.options = v.into();
4150            self
4151        }
4152
4153        /// Sends the request.
4154        pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
4155            (*self.0.stub)
4156                .list_operations(self.0.request, self.0.options)
4157                .await
4158                .map(crate::Response::into_body)
4159        }
4160
4161        /// Streams each page in the collection.
4162        pub fn by_page(
4163            self,
4164        ) -> impl google_cloud_gax::paginator::Paginator<
4165            google_cloud_longrunning::model::ListOperationsResponse,
4166            crate::Error,
4167        > {
4168            use std::clone::Clone;
4169            let token = self.0.request.page_token.clone();
4170            let execute = move |token: String| {
4171                let mut builder = self.clone();
4172                builder.0.request = builder.0.request.set_page_token(token);
4173                builder.send()
4174            };
4175            google_cloud_gax::paginator::internal::new_paginator(token, execute)
4176        }
4177
4178        /// Streams each item in the collection.
4179        pub fn by_item(
4180            self,
4181        ) -> impl google_cloud_gax::paginator::ItemPaginator<
4182            google_cloud_longrunning::model::ListOperationsResponse,
4183            crate::Error,
4184        > {
4185            use google_cloud_gax::paginator::Paginator;
4186            self.by_page().items()
4187        }
4188
4189        /// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
4190        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4191            self.0.request.name = v.into();
4192            self
4193        }
4194
4195        /// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::filter].
4196        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
4197            self.0.request.filter = v.into();
4198            self
4199        }
4200
4201        /// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
4202        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
4203            self.0.request.page_size = v.into();
4204            self
4205        }
4206
4207        /// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
4208        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
4209            self.0.request.page_token = v.into();
4210            self
4211        }
4212
4213        /// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
4214        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
4215            self.0.request.return_partial_success = v.into();
4216            self
4217        }
4218    }
4219
4220    #[doc(hidden)]
4221    impl crate::RequestBuilder for ListOperations {
4222        fn request_options(&mut self) -> &mut crate::RequestOptions {
4223            &mut self.0.options
4224        }
4225    }
4226
4227    /// The request builder for [ConversationalSearchService::get_operation][crate::client::ConversationalSearchService::get_operation] calls.
4228    ///
4229    /// # Example
4230    /// ```
4231    /// # use google_cloud_discoveryengine_v1::builder::conversational_search_service::GetOperation;
4232    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
4233    ///
4234    /// let builder = prepare_request_builder();
4235    /// let response = builder.send().await?;
4236    /// # Ok(()) }
4237    ///
4238    /// fn prepare_request_builder() -> GetOperation {
4239    ///   # panic!();
4240    ///   // ... details omitted ...
4241    /// }
4242    /// ```
4243    #[derive(Clone, Debug)]
4244    pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
4245
4246    impl GetOperation {
4247        pub(crate) fn new(
4248            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
4249        ) -> Self {
4250            Self(RequestBuilder::new(stub))
4251        }
4252
4253        /// Sets the full request, replacing any prior values.
4254        pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
4255            mut self,
4256            v: V,
4257        ) -> Self {
4258            self.0.request = v.into();
4259            self
4260        }
4261
4262        /// Sets all the options, replacing any prior values.
4263        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4264            self.0.options = v.into();
4265            self
4266        }
4267
4268        /// Sends the request.
4269        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
4270            (*self.0.stub)
4271                .get_operation(self.0.request, self.0.options)
4272                .await
4273                .map(crate::Response::into_body)
4274        }
4275
4276        /// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
4277        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4278            self.0.request.name = v.into();
4279            self
4280        }
4281    }
4282
4283    #[doc(hidden)]
4284    impl crate::RequestBuilder for GetOperation {
4285        fn request_options(&mut self) -> &mut crate::RequestOptions {
4286            &mut self.0.options
4287        }
4288    }
4289
4290    /// The request builder for [ConversationalSearchService::cancel_operation][crate::client::ConversationalSearchService::cancel_operation] calls.
4291    ///
4292    /// # Example
4293    /// ```
4294    /// # use google_cloud_discoveryengine_v1::builder::conversational_search_service::CancelOperation;
4295    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
4296    ///
4297    /// let builder = prepare_request_builder();
4298    /// let response = builder.send().await?;
4299    /// # Ok(()) }
4300    ///
4301    /// fn prepare_request_builder() -> CancelOperation {
4302    ///   # panic!();
4303    ///   // ... details omitted ...
4304    /// }
4305    /// ```
4306    #[derive(Clone, Debug)]
4307    pub struct CancelOperation(
4308        RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
4309    );
4310
4311    impl CancelOperation {
4312        pub(crate) fn new(
4313            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
4314        ) -> Self {
4315            Self(RequestBuilder::new(stub))
4316        }
4317
4318        /// Sets the full request, replacing any prior values.
4319        pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
4320            mut self,
4321            v: V,
4322        ) -> Self {
4323            self.0.request = v.into();
4324            self
4325        }
4326
4327        /// Sets all the options, replacing any prior values.
4328        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4329            self.0.options = v.into();
4330            self
4331        }
4332
4333        /// Sends the request.
4334        pub async fn send(self) -> Result<()> {
4335            (*self.0.stub)
4336                .cancel_operation(self.0.request, self.0.options)
4337                .await
4338                .map(crate::Response::into_body)
4339        }
4340
4341        /// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::name].
4342        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4343            self.0.request.name = v.into();
4344            self
4345        }
4346    }
4347
4348    #[doc(hidden)]
4349    impl crate::RequestBuilder for CancelOperation {
4350        fn request_options(&mut self) -> &mut crate::RequestOptions {
4351            &mut self.0.options
4352        }
4353    }
4354}
4355
4356/// Request and client builders for [DataStoreService][crate::client::DataStoreService].
4357#[cfg(feature = "data-store-service")]
4358#[cfg_attr(docsrs, doc(cfg(feature = "data-store-service")))]
4359pub mod data_store_service {
4360    use crate::Result;
4361
4362    /// A builder for [DataStoreService][crate::client::DataStoreService].
4363    ///
4364    /// ```
4365    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
4366    /// # use google_cloud_discoveryengine_v1::*;
4367    /// # use builder::data_store_service::ClientBuilder;
4368    /// # use client::DataStoreService;
4369    /// let builder : ClientBuilder = DataStoreService::builder();
4370    /// let client = builder
4371    ///     .with_endpoint("https://discoveryengine.googleapis.com")
4372    ///     .build().await?;
4373    /// # Ok(()) }
4374    /// ```
4375    pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
4376
4377    pub(crate) mod client {
4378        use super::super::super::client::DataStoreService;
4379        pub struct Factory;
4380        impl crate::ClientFactory for Factory {
4381            type Client = DataStoreService;
4382            type Credentials = gaxi::options::Credentials;
4383            async fn build(
4384                self,
4385                config: gaxi::options::ClientConfig,
4386            ) -> crate::ClientBuilderResult<Self::Client> {
4387                Self::Client::new(config).await
4388            }
4389        }
4390    }
4391
4392    /// Common implementation for [crate::client::DataStoreService] request builders.
4393    #[derive(Clone, Debug)]
4394    pub(crate) struct RequestBuilder<R: std::default::Default> {
4395        stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
4396        request: R,
4397        options: crate::RequestOptions,
4398    }
4399
4400    impl<R> RequestBuilder<R>
4401    where
4402        R: std::default::Default,
4403    {
4404        pub(crate) fn new(
4405            stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
4406        ) -> Self {
4407            Self {
4408                stub,
4409                request: R::default(),
4410                options: crate::RequestOptions::default(),
4411            }
4412        }
4413    }
4414
4415    /// The request builder for [DataStoreService::create_data_store][crate::client::DataStoreService::create_data_store] calls.
4416    ///
4417    /// # Example
4418    /// ```
4419    /// # use google_cloud_discoveryengine_v1::builder::data_store_service::CreateDataStore;
4420    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
4421    /// use google_cloud_lro::Poller;
4422    ///
4423    /// let builder = prepare_request_builder();
4424    /// let response = builder.poller().until_done().await?;
4425    /// # Ok(()) }
4426    ///
4427    /// fn prepare_request_builder() -> CreateDataStore {
4428    ///   # panic!();
4429    ///   // ... details omitted ...
4430    /// }
4431    /// ```
4432    #[derive(Clone, Debug)]
4433    pub struct CreateDataStore(RequestBuilder<crate::model::CreateDataStoreRequest>);
4434
4435    impl CreateDataStore {
4436        pub(crate) fn new(
4437            stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
4438        ) -> Self {
4439            Self(RequestBuilder::new(stub))
4440        }
4441
4442        /// Sets the full request, replacing any prior values.
4443        pub fn with_request<V: Into<crate::model::CreateDataStoreRequest>>(mut self, v: V) -> Self {
4444            self.0.request = v.into();
4445            self
4446        }
4447
4448        /// Sets all the options, replacing any prior values.
4449        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4450            self.0.options = v.into();
4451            self
4452        }
4453
4454        /// Sends the request.
4455        ///
4456        /// # Long running operations
4457        ///
4458        /// This starts, but does not poll, a longrunning operation. More information
4459        /// on [create_data_store][crate::client::DataStoreService::create_data_store].
4460        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
4461            (*self.0.stub)
4462                .create_data_store(self.0.request, self.0.options)
4463                .await
4464                .map(crate::Response::into_body)
4465        }
4466
4467        /// Creates a [Poller][google_cloud_lro::Poller] to work with `create_data_store`.
4468        pub fn poller(
4469            self,
4470        ) -> impl google_cloud_lro::Poller<crate::model::DataStore, crate::model::CreateDataStoreMetadata>
4471        {
4472            type Operation = google_cloud_lro::internal::Operation<
4473                crate::model::DataStore,
4474                crate::model::CreateDataStoreMetadata,
4475            >;
4476            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
4477            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
4478
4479            let stub = self.0.stub.clone();
4480            let mut options = self.0.options.clone();
4481            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
4482            let query = move |name| {
4483                let stub = stub.clone();
4484                let options = options.clone();
4485                async {
4486                    let op = GetOperation::new(stub)
4487                        .set_name(name)
4488                        .with_options(options)
4489                        .send()
4490                        .await?;
4491                    Ok(Operation::new(op))
4492                }
4493            };
4494
4495            let start = move || async {
4496                let op = self.send().await?;
4497                Ok(Operation::new(op))
4498            };
4499
4500            google_cloud_lro::internal::new_poller(
4501                polling_error_policy,
4502                polling_backoff_policy,
4503                start,
4504                query,
4505            )
4506        }
4507
4508        /// Sets the value of [parent][crate::model::CreateDataStoreRequest::parent].
4509        ///
4510        /// This is a **required** field for requests.
4511        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
4512            self.0.request.parent = v.into();
4513            self
4514        }
4515
4516        /// Sets the value of [data_store][crate::model::CreateDataStoreRequest::data_store].
4517        ///
4518        /// This is a **required** field for requests.
4519        pub fn set_data_store<T>(mut self, v: T) -> Self
4520        where
4521            T: std::convert::Into<crate::model::DataStore>,
4522        {
4523            self.0.request.data_store = std::option::Option::Some(v.into());
4524            self
4525        }
4526
4527        /// Sets or clears the value of [data_store][crate::model::CreateDataStoreRequest::data_store].
4528        ///
4529        /// This is a **required** field for requests.
4530        pub fn set_or_clear_data_store<T>(mut self, v: std::option::Option<T>) -> Self
4531        where
4532            T: std::convert::Into<crate::model::DataStore>,
4533        {
4534            self.0.request.data_store = v.map(|x| x.into());
4535            self
4536        }
4537
4538        /// Sets the value of [data_store_id][crate::model::CreateDataStoreRequest::data_store_id].
4539        ///
4540        /// This is a **required** field for requests.
4541        pub fn set_data_store_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
4542            self.0.request.data_store_id = v.into();
4543            self
4544        }
4545
4546        /// Sets the value of [create_advanced_site_search][crate::model::CreateDataStoreRequest::create_advanced_site_search].
4547        pub fn set_create_advanced_site_search<T: Into<bool>>(mut self, v: T) -> Self {
4548            self.0.request.create_advanced_site_search = v.into();
4549            self
4550        }
4551
4552        /// Sets the value of [skip_default_schema_creation][crate::model::CreateDataStoreRequest::skip_default_schema_creation].
4553        pub fn set_skip_default_schema_creation<T: Into<bool>>(mut self, v: T) -> Self {
4554            self.0.request.skip_default_schema_creation = v.into();
4555            self
4556        }
4557
4558        /// Sets the value of [cmek_options][crate::model::CreateDataStoreRequest::cmek_options].
4559        ///
4560        /// Note that all the setters affecting `cmek_options` are
4561        /// mutually exclusive.
4562        pub fn set_cmek_options<
4563            T: Into<Option<crate::model::create_data_store_request::CmekOptions>>,
4564        >(
4565            mut self,
4566            v: T,
4567        ) -> Self {
4568            self.0.request.cmek_options = v.into();
4569            self
4570        }
4571
4572        /// Sets the value of [cmek_options][crate::model::CreateDataStoreRequest::cmek_options]
4573        /// to hold a `CmekConfigName`.
4574        ///
4575        /// Note that all the setters affecting `cmek_options` are
4576        /// mutually exclusive.
4577        pub fn set_cmek_config_name<T: std::convert::Into<std::string::String>>(
4578            mut self,
4579            v: T,
4580        ) -> Self {
4581            self.0.request = self.0.request.set_cmek_config_name(v);
4582            self
4583        }
4584
4585        /// Sets the value of [cmek_options][crate::model::CreateDataStoreRequest::cmek_options]
4586        /// to hold a `DisableCmek`.
4587        ///
4588        /// Note that all the setters affecting `cmek_options` are
4589        /// mutually exclusive.
4590        pub fn set_disable_cmek<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4591            self.0.request = self.0.request.set_disable_cmek(v);
4592            self
4593        }
4594    }
4595
4596    #[doc(hidden)]
4597    impl crate::RequestBuilder for CreateDataStore {
4598        fn request_options(&mut self) -> &mut crate::RequestOptions {
4599            &mut self.0.options
4600        }
4601    }
4602
4603    /// The request builder for [DataStoreService::get_data_store][crate::client::DataStoreService::get_data_store] calls.
4604    ///
4605    /// # Example
4606    /// ```
4607    /// # use google_cloud_discoveryengine_v1::builder::data_store_service::GetDataStore;
4608    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
4609    ///
4610    /// let builder = prepare_request_builder();
4611    /// let response = builder.send().await?;
4612    /// # Ok(()) }
4613    ///
4614    /// fn prepare_request_builder() -> GetDataStore {
4615    ///   # panic!();
4616    ///   // ... details omitted ...
4617    /// }
4618    /// ```
4619    #[derive(Clone, Debug)]
4620    pub struct GetDataStore(RequestBuilder<crate::model::GetDataStoreRequest>);
4621
4622    impl GetDataStore {
4623        pub(crate) fn new(
4624            stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
4625        ) -> Self {
4626            Self(RequestBuilder::new(stub))
4627        }
4628
4629        /// Sets the full request, replacing any prior values.
4630        pub fn with_request<V: Into<crate::model::GetDataStoreRequest>>(mut self, v: V) -> Self {
4631            self.0.request = v.into();
4632            self
4633        }
4634
4635        /// Sets all the options, replacing any prior values.
4636        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4637            self.0.options = v.into();
4638            self
4639        }
4640
4641        /// Sends the request.
4642        pub async fn send(self) -> Result<crate::model::DataStore> {
4643            (*self.0.stub)
4644                .get_data_store(self.0.request, self.0.options)
4645                .await
4646                .map(crate::Response::into_body)
4647        }
4648
4649        /// Sets the value of [name][crate::model::GetDataStoreRequest::name].
4650        ///
4651        /// This is a **required** field for requests.
4652        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4653            self.0.request.name = v.into();
4654            self
4655        }
4656    }
4657
4658    #[doc(hidden)]
4659    impl crate::RequestBuilder for GetDataStore {
4660        fn request_options(&mut self) -> &mut crate::RequestOptions {
4661            &mut self.0.options
4662        }
4663    }
4664
4665    /// The request builder for [DataStoreService::list_data_stores][crate::client::DataStoreService::list_data_stores] calls.
4666    ///
4667    /// # Example
4668    /// ```
4669    /// # use google_cloud_discoveryengine_v1::builder::data_store_service::ListDataStores;
4670    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
4671    /// use google_cloud_gax::paginator::ItemPaginator;
4672    ///
4673    /// let builder = prepare_request_builder();
4674    /// let mut items = builder.by_item();
4675    /// while let Some(result) = items.next().await {
4676    ///   let item = result?;
4677    /// }
4678    /// # Ok(()) }
4679    ///
4680    /// fn prepare_request_builder() -> ListDataStores {
4681    ///   # panic!();
4682    ///   // ... details omitted ...
4683    /// }
4684    /// ```
4685    #[derive(Clone, Debug)]
4686    pub struct ListDataStores(RequestBuilder<crate::model::ListDataStoresRequest>);
4687
4688    impl ListDataStores {
4689        pub(crate) fn new(
4690            stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
4691        ) -> Self {
4692            Self(RequestBuilder::new(stub))
4693        }
4694
4695        /// Sets the full request, replacing any prior values.
4696        pub fn with_request<V: Into<crate::model::ListDataStoresRequest>>(mut self, v: V) -> Self {
4697            self.0.request = v.into();
4698            self
4699        }
4700
4701        /// Sets all the options, replacing any prior values.
4702        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4703            self.0.options = v.into();
4704            self
4705        }
4706
4707        /// Sends the request.
4708        pub async fn send(self) -> Result<crate::model::ListDataStoresResponse> {
4709            (*self.0.stub)
4710                .list_data_stores(self.0.request, self.0.options)
4711                .await
4712                .map(crate::Response::into_body)
4713        }
4714
4715        /// Streams each page in the collection.
4716        pub fn by_page(
4717            self,
4718        ) -> impl google_cloud_gax::paginator::Paginator<
4719            crate::model::ListDataStoresResponse,
4720            crate::Error,
4721        > {
4722            use std::clone::Clone;
4723            let token = self.0.request.page_token.clone();
4724            let execute = move |token: String| {
4725                let mut builder = self.clone();
4726                builder.0.request = builder.0.request.set_page_token(token);
4727                builder.send()
4728            };
4729            google_cloud_gax::paginator::internal::new_paginator(token, execute)
4730        }
4731
4732        /// Streams each item in the collection.
4733        pub fn by_item(
4734            self,
4735        ) -> impl google_cloud_gax::paginator::ItemPaginator<
4736            crate::model::ListDataStoresResponse,
4737            crate::Error,
4738        > {
4739            use google_cloud_gax::paginator::Paginator;
4740            self.by_page().items()
4741        }
4742
4743        /// Sets the value of [parent][crate::model::ListDataStoresRequest::parent].
4744        ///
4745        /// This is a **required** field for requests.
4746        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
4747            self.0.request.parent = v.into();
4748            self
4749        }
4750
4751        /// Sets the value of [page_size][crate::model::ListDataStoresRequest::page_size].
4752        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
4753            self.0.request.page_size = v.into();
4754            self
4755        }
4756
4757        /// Sets the value of [page_token][crate::model::ListDataStoresRequest::page_token].
4758        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
4759            self.0.request.page_token = v.into();
4760            self
4761        }
4762
4763        /// Sets the value of [filter][crate::model::ListDataStoresRequest::filter].
4764        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
4765            self.0.request.filter = v.into();
4766            self
4767        }
4768    }
4769
4770    #[doc(hidden)]
4771    impl crate::RequestBuilder for ListDataStores {
4772        fn request_options(&mut self) -> &mut crate::RequestOptions {
4773            &mut self.0.options
4774        }
4775    }
4776
4777    /// The request builder for [DataStoreService::delete_data_store][crate::client::DataStoreService::delete_data_store] calls.
4778    ///
4779    /// # Example
4780    /// ```
4781    /// # use google_cloud_discoveryengine_v1::builder::data_store_service::DeleteDataStore;
4782    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
4783    /// use google_cloud_lro::Poller;
4784    ///
4785    /// let builder = prepare_request_builder();
4786    /// let response = builder.poller().until_done().await?;
4787    /// # Ok(()) }
4788    ///
4789    /// fn prepare_request_builder() -> DeleteDataStore {
4790    ///   # panic!();
4791    ///   // ... details omitted ...
4792    /// }
4793    /// ```
4794    #[derive(Clone, Debug)]
4795    pub struct DeleteDataStore(RequestBuilder<crate::model::DeleteDataStoreRequest>);
4796
4797    impl DeleteDataStore {
4798        pub(crate) fn new(
4799            stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
4800        ) -> Self {
4801            Self(RequestBuilder::new(stub))
4802        }
4803
4804        /// Sets the full request, replacing any prior values.
4805        pub fn with_request<V: Into<crate::model::DeleteDataStoreRequest>>(mut self, v: V) -> Self {
4806            self.0.request = v.into();
4807            self
4808        }
4809
4810        /// Sets all the options, replacing any prior values.
4811        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4812            self.0.options = v.into();
4813            self
4814        }
4815
4816        /// Sends the request.
4817        ///
4818        /// # Long running operations
4819        ///
4820        /// This starts, but does not poll, a longrunning operation. More information
4821        /// on [delete_data_store][crate::client::DataStoreService::delete_data_store].
4822        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
4823            (*self.0.stub)
4824                .delete_data_store(self.0.request, self.0.options)
4825                .await
4826                .map(crate::Response::into_body)
4827        }
4828
4829        /// Creates a [Poller][google_cloud_lro::Poller] to work with `delete_data_store`.
4830        pub fn poller(
4831            self,
4832        ) -> impl google_cloud_lro::Poller<(), crate::model::DeleteDataStoreMetadata> {
4833            type Operation = google_cloud_lro::internal::Operation<
4834                wkt::Empty,
4835                crate::model::DeleteDataStoreMetadata,
4836            >;
4837            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
4838            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
4839
4840            let stub = self.0.stub.clone();
4841            let mut options = self.0.options.clone();
4842            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
4843            let query = move |name| {
4844                let stub = stub.clone();
4845                let options = options.clone();
4846                async {
4847                    let op = GetOperation::new(stub)
4848                        .set_name(name)
4849                        .with_options(options)
4850                        .send()
4851                        .await?;
4852                    Ok(Operation::new(op))
4853                }
4854            };
4855
4856            let start = move || async {
4857                let op = self.send().await?;
4858                Ok(Operation::new(op))
4859            };
4860
4861            google_cloud_lro::internal::new_unit_response_poller(
4862                polling_error_policy,
4863                polling_backoff_policy,
4864                start,
4865                query,
4866            )
4867        }
4868
4869        /// Sets the value of [name][crate::model::DeleteDataStoreRequest::name].
4870        ///
4871        /// This is a **required** field for requests.
4872        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4873            self.0.request.name = v.into();
4874            self
4875        }
4876    }
4877
4878    #[doc(hidden)]
4879    impl crate::RequestBuilder for DeleteDataStore {
4880        fn request_options(&mut self) -> &mut crate::RequestOptions {
4881            &mut self.0.options
4882        }
4883    }
4884
4885    /// The request builder for [DataStoreService::update_data_store][crate::client::DataStoreService::update_data_store] calls.
4886    ///
4887    /// # Example
4888    /// ```
4889    /// # use google_cloud_discoveryengine_v1::builder::data_store_service::UpdateDataStore;
4890    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
4891    ///
4892    /// let builder = prepare_request_builder();
4893    /// let response = builder.send().await?;
4894    /// # Ok(()) }
4895    ///
4896    /// fn prepare_request_builder() -> UpdateDataStore {
4897    ///   # panic!();
4898    ///   // ... details omitted ...
4899    /// }
4900    /// ```
4901    #[derive(Clone, Debug)]
4902    pub struct UpdateDataStore(RequestBuilder<crate::model::UpdateDataStoreRequest>);
4903
4904    impl UpdateDataStore {
4905        pub(crate) fn new(
4906            stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
4907        ) -> Self {
4908            Self(RequestBuilder::new(stub))
4909        }
4910
4911        /// Sets the full request, replacing any prior values.
4912        pub fn with_request<V: Into<crate::model::UpdateDataStoreRequest>>(mut self, v: V) -> Self {
4913            self.0.request = v.into();
4914            self
4915        }
4916
4917        /// Sets all the options, replacing any prior values.
4918        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4919            self.0.options = v.into();
4920            self
4921        }
4922
4923        /// Sends the request.
4924        pub async fn send(self) -> Result<crate::model::DataStore> {
4925            (*self.0.stub)
4926                .update_data_store(self.0.request, self.0.options)
4927                .await
4928                .map(crate::Response::into_body)
4929        }
4930
4931        /// Sets the value of [data_store][crate::model::UpdateDataStoreRequest::data_store].
4932        ///
4933        /// This is a **required** field for requests.
4934        pub fn set_data_store<T>(mut self, v: T) -> Self
4935        where
4936            T: std::convert::Into<crate::model::DataStore>,
4937        {
4938            self.0.request.data_store = std::option::Option::Some(v.into());
4939            self
4940        }
4941
4942        /// Sets or clears the value of [data_store][crate::model::UpdateDataStoreRequest::data_store].
4943        ///
4944        /// This is a **required** field for requests.
4945        pub fn set_or_clear_data_store<T>(mut self, v: std::option::Option<T>) -> Self
4946        where
4947            T: std::convert::Into<crate::model::DataStore>,
4948        {
4949            self.0.request.data_store = v.map(|x| x.into());
4950            self
4951        }
4952
4953        /// Sets the value of [update_mask][crate::model::UpdateDataStoreRequest::update_mask].
4954        pub fn set_update_mask<T>(mut self, v: T) -> Self
4955        where
4956            T: std::convert::Into<wkt::FieldMask>,
4957        {
4958            self.0.request.update_mask = std::option::Option::Some(v.into());
4959            self
4960        }
4961
4962        /// Sets or clears the value of [update_mask][crate::model::UpdateDataStoreRequest::update_mask].
4963        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
4964        where
4965            T: std::convert::Into<wkt::FieldMask>,
4966        {
4967            self.0.request.update_mask = v.map(|x| x.into());
4968            self
4969        }
4970    }
4971
4972    #[doc(hidden)]
4973    impl crate::RequestBuilder for UpdateDataStore {
4974        fn request_options(&mut self) -> &mut crate::RequestOptions {
4975            &mut self.0.options
4976        }
4977    }
4978
4979    /// The request builder for [DataStoreService::list_operations][crate::client::DataStoreService::list_operations] calls.
4980    ///
4981    /// # Example
4982    /// ```
4983    /// # use google_cloud_discoveryengine_v1::builder::data_store_service::ListOperations;
4984    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
4985    /// use google_cloud_gax::paginator::ItemPaginator;
4986    ///
4987    /// let builder = prepare_request_builder();
4988    /// let mut items = builder.by_item();
4989    /// while let Some(result) = items.next().await {
4990    ///   let item = result?;
4991    /// }
4992    /// # Ok(()) }
4993    ///
4994    /// fn prepare_request_builder() -> ListOperations {
4995    ///   # panic!();
4996    ///   // ... details omitted ...
4997    /// }
4998    /// ```
4999    #[derive(Clone, Debug)]
5000    pub struct ListOperations(
5001        RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
5002    );
5003
5004    impl ListOperations {
5005        pub(crate) fn new(
5006            stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
5007        ) -> Self {
5008            Self(RequestBuilder::new(stub))
5009        }
5010
5011        /// Sets the full request, replacing any prior values.
5012        pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
5013            mut self,
5014            v: V,
5015        ) -> Self {
5016            self.0.request = v.into();
5017            self
5018        }
5019
5020        /// Sets all the options, replacing any prior values.
5021        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5022            self.0.options = v.into();
5023            self
5024        }
5025
5026        /// Sends the request.
5027        pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
5028            (*self.0.stub)
5029                .list_operations(self.0.request, self.0.options)
5030                .await
5031                .map(crate::Response::into_body)
5032        }
5033
5034        /// Streams each page in the collection.
5035        pub fn by_page(
5036            self,
5037        ) -> impl google_cloud_gax::paginator::Paginator<
5038            google_cloud_longrunning::model::ListOperationsResponse,
5039            crate::Error,
5040        > {
5041            use std::clone::Clone;
5042            let token = self.0.request.page_token.clone();
5043            let execute = move |token: String| {
5044                let mut builder = self.clone();
5045                builder.0.request = builder.0.request.set_page_token(token);
5046                builder.send()
5047            };
5048            google_cloud_gax::paginator::internal::new_paginator(token, execute)
5049        }
5050
5051        /// Streams each item in the collection.
5052        pub fn by_item(
5053            self,
5054        ) -> impl google_cloud_gax::paginator::ItemPaginator<
5055            google_cloud_longrunning::model::ListOperationsResponse,
5056            crate::Error,
5057        > {
5058            use google_cloud_gax::paginator::Paginator;
5059            self.by_page().items()
5060        }
5061
5062        /// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
5063        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5064            self.0.request.name = v.into();
5065            self
5066        }
5067
5068        /// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::filter].
5069        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
5070            self.0.request.filter = v.into();
5071            self
5072        }
5073
5074        /// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
5075        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
5076            self.0.request.page_size = v.into();
5077            self
5078        }
5079
5080        /// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
5081        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
5082            self.0.request.page_token = v.into();
5083            self
5084        }
5085
5086        /// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
5087        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
5088            self.0.request.return_partial_success = v.into();
5089            self
5090        }
5091    }
5092
5093    #[doc(hidden)]
5094    impl crate::RequestBuilder for ListOperations {
5095        fn request_options(&mut self) -> &mut crate::RequestOptions {
5096            &mut self.0.options
5097        }
5098    }
5099
5100    /// The request builder for [DataStoreService::get_operation][crate::client::DataStoreService::get_operation] calls.
5101    ///
5102    /// # Example
5103    /// ```
5104    /// # use google_cloud_discoveryengine_v1::builder::data_store_service::GetOperation;
5105    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
5106    ///
5107    /// let builder = prepare_request_builder();
5108    /// let response = builder.send().await?;
5109    /// # Ok(()) }
5110    ///
5111    /// fn prepare_request_builder() -> GetOperation {
5112    ///   # panic!();
5113    ///   // ... details omitted ...
5114    /// }
5115    /// ```
5116    #[derive(Clone, Debug)]
5117    pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
5118
5119    impl GetOperation {
5120        pub(crate) fn new(
5121            stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
5122        ) -> Self {
5123            Self(RequestBuilder::new(stub))
5124        }
5125
5126        /// Sets the full request, replacing any prior values.
5127        pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
5128            mut self,
5129            v: V,
5130        ) -> Self {
5131            self.0.request = v.into();
5132            self
5133        }
5134
5135        /// Sets all the options, replacing any prior values.
5136        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5137            self.0.options = v.into();
5138            self
5139        }
5140
5141        /// Sends the request.
5142        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
5143            (*self.0.stub)
5144                .get_operation(self.0.request, self.0.options)
5145                .await
5146                .map(crate::Response::into_body)
5147        }
5148
5149        /// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
5150        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5151            self.0.request.name = v.into();
5152            self
5153        }
5154    }
5155
5156    #[doc(hidden)]
5157    impl crate::RequestBuilder for GetOperation {
5158        fn request_options(&mut self) -> &mut crate::RequestOptions {
5159            &mut self.0.options
5160        }
5161    }
5162
5163    /// The request builder for [DataStoreService::cancel_operation][crate::client::DataStoreService::cancel_operation] calls.
5164    ///
5165    /// # Example
5166    /// ```
5167    /// # use google_cloud_discoveryengine_v1::builder::data_store_service::CancelOperation;
5168    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
5169    ///
5170    /// let builder = prepare_request_builder();
5171    /// let response = builder.send().await?;
5172    /// # Ok(()) }
5173    ///
5174    /// fn prepare_request_builder() -> CancelOperation {
5175    ///   # panic!();
5176    ///   // ... details omitted ...
5177    /// }
5178    /// ```
5179    #[derive(Clone, Debug)]
5180    pub struct CancelOperation(
5181        RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
5182    );
5183
5184    impl CancelOperation {
5185        pub(crate) fn new(
5186            stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
5187        ) -> Self {
5188            Self(RequestBuilder::new(stub))
5189        }
5190
5191        /// Sets the full request, replacing any prior values.
5192        pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
5193            mut self,
5194            v: V,
5195        ) -> Self {
5196            self.0.request = v.into();
5197            self
5198        }
5199
5200        /// Sets all the options, replacing any prior values.
5201        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5202            self.0.options = v.into();
5203            self
5204        }
5205
5206        /// Sends the request.
5207        pub async fn send(self) -> Result<()> {
5208            (*self.0.stub)
5209                .cancel_operation(self.0.request, self.0.options)
5210                .await
5211                .map(crate::Response::into_body)
5212        }
5213
5214        /// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::name].
5215        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5216            self.0.request.name = v.into();
5217            self
5218        }
5219    }
5220
5221    #[doc(hidden)]
5222    impl crate::RequestBuilder for CancelOperation {
5223        fn request_options(&mut self) -> &mut crate::RequestOptions {
5224            &mut self.0.options
5225        }
5226    }
5227}
5228
5229/// Request and client builders for [DocumentService][crate::client::DocumentService].
5230#[cfg(feature = "document-service")]
5231#[cfg_attr(docsrs, doc(cfg(feature = "document-service")))]
5232pub mod document_service {
5233    use crate::Result;
5234
5235    /// A builder for [DocumentService][crate::client::DocumentService].
5236    ///
5237    /// ```
5238    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
5239    /// # use google_cloud_discoveryengine_v1::*;
5240    /// # use builder::document_service::ClientBuilder;
5241    /// # use client::DocumentService;
5242    /// let builder : ClientBuilder = DocumentService::builder();
5243    /// let client = builder
5244    ///     .with_endpoint("https://discoveryengine.googleapis.com")
5245    ///     .build().await?;
5246    /// # Ok(()) }
5247    /// ```
5248    pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
5249
5250    pub(crate) mod client {
5251        use super::super::super::client::DocumentService;
5252        pub struct Factory;
5253        impl crate::ClientFactory for Factory {
5254            type Client = DocumentService;
5255            type Credentials = gaxi::options::Credentials;
5256            async fn build(
5257                self,
5258                config: gaxi::options::ClientConfig,
5259            ) -> crate::ClientBuilderResult<Self::Client> {
5260                Self::Client::new(config).await
5261            }
5262        }
5263    }
5264
5265    /// Common implementation for [crate::client::DocumentService] request builders.
5266    #[derive(Clone, Debug)]
5267    pub(crate) struct RequestBuilder<R: std::default::Default> {
5268        stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
5269        request: R,
5270        options: crate::RequestOptions,
5271    }
5272
5273    impl<R> RequestBuilder<R>
5274    where
5275        R: std::default::Default,
5276    {
5277        pub(crate) fn new(
5278            stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
5279        ) -> Self {
5280            Self {
5281                stub,
5282                request: R::default(),
5283                options: crate::RequestOptions::default(),
5284            }
5285        }
5286    }
5287
5288    /// The request builder for [DocumentService::get_document][crate::client::DocumentService::get_document] calls.
5289    ///
5290    /// # Example
5291    /// ```
5292    /// # use google_cloud_discoveryengine_v1::builder::document_service::GetDocument;
5293    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
5294    ///
5295    /// let builder = prepare_request_builder();
5296    /// let response = builder.send().await?;
5297    /// # Ok(()) }
5298    ///
5299    /// fn prepare_request_builder() -> GetDocument {
5300    ///   # panic!();
5301    ///   // ... details omitted ...
5302    /// }
5303    /// ```
5304    #[derive(Clone, Debug)]
5305    pub struct GetDocument(RequestBuilder<crate::model::GetDocumentRequest>);
5306
5307    impl GetDocument {
5308        pub(crate) fn new(
5309            stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
5310        ) -> Self {
5311            Self(RequestBuilder::new(stub))
5312        }
5313
5314        /// Sets the full request, replacing any prior values.
5315        pub fn with_request<V: Into<crate::model::GetDocumentRequest>>(mut self, v: V) -> Self {
5316            self.0.request = v.into();
5317            self
5318        }
5319
5320        /// Sets all the options, replacing any prior values.
5321        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5322            self.0.options = v.into();
5323            self
5324        }
5325
5326        /// Sends the request.
5327        pub async fn send(self) -> Result<crate::model::Document> {
5328            (*self.0.stub)
5329                .get_document(self.0.request, self.0.options)
5330                .await
5331                .map(crate::Response::into_body)
5332        }
5333
5334        /// Sets the value of [name][crate::model::GetDocumentRequest::name].
5335        ///
5336        /// This is a **required** field for requests.
5337        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5338            self.0.request.name = v.into();
5339            self
5340        }
5341    }
5342
5343    #[doc(hidden)]
5344    impl crate::RequestBuilder for GetDocument {
5345        fn request_options(&mut self) -> &mut crate::RequestOptions {
5346            &mut self.0.options
5347        }
5348    }
5349
5350    /// The request builder for [DocumentService::list_documents][crate::client::DocumentService::list_documents] calls.
5351    ///
5352    /// # Example
5353    /// ```
5354    /// # use google_cloud_discoveryengine_v1::builder::document_service::ListDocuments;
5355    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
5356    /// use google_cloud_gax::paginator::ItemPaginator;
5357    ///
5358    /// let builder = prepare_request_builder();
5359    /// let mut items = builder.by_item();
5360    /// while let Some(result) = items.next().await {
5361    ///   let item = result?;
5362    /// }
5363    /// # Ok(()) }
5364    ///
5365    /// fn prepare_request_builder() -> ListDocuments {
5366    ///   # panic!();
5367    ///   // ... details omitted ...
5368    /// }
5369    /// ```
5370    #[derive(Clone, Debug)]
5371    pub struct ListDocuments(RequestBuilder<crate::model::ListDocumentsRequest>);
5372
5373    impl ListDocuments {
5374        pub(crate) fn new(
5375            stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
5376        ) -> Self {
5377            Self(RequestBuilder::new(stub))
5378        }
5379
5380        /// Sets the full request, replacing any prior values.
5381        pub fn with_request<V: Into<crate::model::ListDocumentsRequest>>(mut self, v: V) -> Self {
5382            self.0.request = v.into();
5383            self
5384        }
5385
5386        /// Sets all the options, replacing any prior values.
5387        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5388            self.0.options = v.into();
5389            self
5390        }
5391
5392        /// Sends the request.
5393        pub async fn send(self) -> Result<crate::model::ListDocumentsResponse> {
5394            (*self.0.stub)
5395                .list_documents(self.0.request, self.0.options)
5396                .await
5397                .map(crate::Response::into_body)
5398        }
5399
5400        /// Streams each page in the collection.
5401        pub fn by_page(
5402            self,
5403        ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListDocumentsResponse, crate::Error>
5404        {
5405            use std::clone::Clone;
5406            let token = self.0.request.page_token.clone();
5407            let execute = move |token: String| {
5408                let mut builder = self.clone();
5409                builder.0.request = builder.0.request.set_page_token(token);
5410                builder.send()
5411            };
5412            google_cloud_gax::paginator::internal::new_paginator(token, execute)
5413        }
5414
5415        /// Streams each item in the collection.
5416        pub fn by_item(
5417            self,
5418        ) -> impl google_cloud_gax::paginator::ItemPaginator<
5419            crate::model::ListDocumentsResponse,
5420            crate::Error,
5421        > {
5422            use google_cloud_gax::paginator::Paginator;
5423            self.by_page().items()
5424        }
5425
5426        /// Sets the value of [parent][crate::model::ListDocumentsRequest::parent].
5427        ///
5428        /// This is a **required** field for requests.
5429        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
5430            self.0.request.parent = v.into();
5431            self
5432        }
5433
5434        /// Sets the value of [page_size][crate::model::ListDocumentsRequest::page_size].
5435        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
5436            self.0.request.page_size = v.into();
5437            self
5438        }
5439
5440        /// Sets the value of [page_token][crate::model::ListDocumentsRequest::page_token].
5441        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
5442            self.0.request.page_token = v.into();
5443            self
5444        }
5445    }
5446
5447    #[doc(hidden)]
5448    impl crate::RequestBuilder for ListDocuments {
5449        fn request_options(&mut self) -> &mut crate::RequestOptions {
5450            &mut self.0.options
5451        }
5452    }
5453
5454    /// The request builder for [DocumentService::create_document][crate::client::DocumentService::create_document] calls.
5455    ///
5456    /// # Example
5457    /// ```
5458    /// # use google_cloud_discoveryengine_v1::builder::document_service::CreateDocument;
5459    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
5460    ///
5461    /// let builder = prepare_request_builder();
5462    /// let response = builder.send().await?;
5463    /// # Ok(()) }
5464    ///
5465    /// fn prepare_request_builder() -> CreateDocument {
5466    ///   # panic!();
5467    ///   // ... details omitted ...
5468    /// }
5469    /// ```
5470    #[derive(Clone, Debug)]
5471    pub struct CreateDocument(RequestBuilder<crate::model::CreateDocumentRequest>);
5472
5473    impl CreateDocument {
5474        pub(crate) fn new(
5475            stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
5476        ) -> Self {
5477            Self(RequestBuilder::new(stub))
5478        }
5479
5480        /// Sets the full request, replacing any prior values.
5481        pub fn with_request<V: Into<crate::model::CreateDocumentRequest>>(mut self, v: V) -> Self {
5482            self.0.request = v.into();
5483            self
5484        }
5485
5486        /// Sets all the options, replacing any prior values.
5487        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5488            self.0.options = v.into();
5489            self
5490        }
5491
5492        /// Sends the request.
5493        pub async fn send(self) -> Result<crate::model::Document> {
5494            (*self.0.stub)
5495                .create_document(self.0.request, self.0.options)
5496                .await
5497                .map(crate::Response::into_body)
5498        }
5499
5500        /// Sets the value of [parent][crate::model::CreateDocumentRequest::parent].
5501        ///
5502        /// This is a **required** field for requests.
5503        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
5504            self.0.request.parent = v.into();
5505            self
5506        }
5507
5508        /// Sets the value of [document][crate::model::CreateDocumentRequest::document].
5509        ///
5510        /// This is a **required** field for requests.
5511        pub fn set_document<T>(mut self, v: T) -> Self
5512        where
5513            T: std::convert::Into<crate::model::Document>,
5514        {
5515            self.0.request.document = std::option::Option::Some(v.into());
5516            self
5517        }
5518
5519        /// Sets or clears the value of [document][crate::model::CreateDocumentRequest::document].
5520        ///
5521        /// This is a **required** field for requests.
5522        pub fn set_or_clear_document<T>(mut self, v: std::option::Option<T>) -> Self
5523        where
5524            T: std::convert::Into<crate::model::Document>,
5525        {
5526            self.0.request.document = v.map(|x| x.into());
5527            self
5528        }
5529
5530        /// Sets the value of [document_id][crate::model::CreateDocumentRequest::document_id].
5531        ///
5532        /// This is a **required** field for requests.
5533        pub fn set_document_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
5534            self.0.request.document_id = v.into();
5535            self
5536        }
5537    }
5538
5539    #[doc(hidden)]
5540    impl crate::RequestBuilder for CreateDocument {
5541        fn request_options(&mut self) -> &mut crate::RequestOptions {
5542            &mut self.0.options
5543        }
5544    }
5545
5546    /// The request builder for [DocumentService::update_document][crate::client::DocumentService::update_document] calls.
5547    ///
5548    /// # Example
5549    /// ```
5550    /// # use google_cloud_discoveryengine_v1::builder::document_service::UpdateDocument;
5551    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
5552    ///
5553    /// let builder = prepare_request_builder();
5554    /// let response = builder.send().await?;
5555    /// # Ok(()) }
5556    ///
5557    /// fn prepare_request_builder() -> UpdateDocument {
5558    ///   # panic!();
5559    ///   // ... details omitted ...
5560    /// }
5561    /// ```
5562    #[derive(Clone, Debug)]
5563    pub struct UpdateDocument(RequestBuilder<crate::model::UpdateDocumentRequest>);
5564
5565    impl UpdateDocument {
5566        pub(crate) fn new(
5567            stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
5568        ) -> Self {
5569            Self(RequestBuilder::new(stub))
5570        }
5571
5572        /// Sets the full request, replacing any prior values.
5573        pub fn with_request<V: Into<crate::model::UpdateDocumentRequest>>(mut self, v: V) -> Self {
5574            self.0.request = v.into();
5575            self
5576        }
5577
5578        /// Sets all the options, replacing any prior values.
5579        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5580            self.0.options = v.into();
5581            self
5582        }
5583
5584        /// Sends the request.
5585        pub async fn send(self) -> Result<crate::model::Document> {
5586            (*self.0.stub)
5587                .update_document(self.0.request, self.0.options)
5588                .await
5589                .map(crate::Response::into_body)
5590        }
5591
5592        /// Sets the value of [document][crate::model::UpdateDocumentRequest::document].
5593        ///
5594        /// This is a **required** field for requests.
5595        pub fn set_document<T>(mut self, v: T) -> Self
5596        where
5597            T: std::convert::Into<crate::model::Document>,
5598        {
5599            self.0.request.document = std::option::Option::Some(v.into());
5600            self
5601        }
5602
5603        /// Sets or clears the value of [document][crate::model::UpdateDocumentRequest::document].
5604        ///
5605        /// This is a **required** field for requests.
5606        pub fn set_or_clear_document<T>(mut self, v: std::option::Option<T>) -> Self
5607        where
5608            T: std::convert::Into<crate::model::Document>,
5609        {
5610            self.0.request.document = v.map(|x| x.into());
5611            self
5612        }
5613
5614        /// Sets the value of [allow_missing][crate::model::UpdateDocumentRequest::allow_missing].
5615        pub fn set_allow_missing<T: Into<bool>>(mut self, v: T) -> Self {
5616            self.0.request.allow_missing = v.into();
5617            self
5618        }
5619
5620        /// Sets the value of [update_mask][crate::model::UpdateDocumentRequest::update_mask].
5621        pub fn set_update_mask<T>(mut self, v: T) -> Self
5622        where
5623            T: std::convert::Into<wkt::FieldMask>,
5624        {
5625            self.0.request.update_mask = std::option::Option::Some(v.into());
5626            self
5627        }
5628
5629        /// Sets or clears the value of [update_mask][crate::model::UpdateDocumentRequest::update_mask].
5630        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
5631        where
5632            T: std::convert::Into<wkt::FieldMask>,
5633        {
5634            self.0.request.update_mask = v.map(|x| x.into());
5635            self
5636        }
5637    }
5638
5639    #[doc(hidden)]
5640    impl crate::RequestBuilder for UpdateDocument {
5641        fn request_options(&mut self) -> &mut crate::RequestOptions {
5642            &mut self.0.options
5643        }
5644    }
5645
5646    /// The request builder for [DocumentService::delete_document][crate::client::DocumentService::delete_document] calls.
5647    ///
5648    /// # Example
5649    /// ```
5650    /// # use google_cloud_discoveryengine_v1::builder::document_service::DeleteDocument;
5651    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
5652    ///
5653    /// let builder = prepare_request_builder();
5654    /// let response = builder.send().await?;
5655    /// # Ok(()) }
5656    ///
5657    /// fn prepare_request_builder() -> DeleteDocument {
5658    ///   # panic!();
5659    ///   // ... details omitted ...
5660    /// }
5661    /// ```
5662    #[derive(Clone, Debug)]
5663    pub struct DeleteDocument(RequestBuilder<crate::model::DeleteDocumentRequest>);
5664
5665    impl DeleteDocument {
5666        pub(crate) fn new(
5667            stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
5668        ) -> Self {
5669            Self(RequestBuilder::new(stub))
5670        }
5671
5672        /// Sets the full request, replacing any prior values.
5673        pub fn with_request<V: Into<crate::model::DeleteDocumentRequest>>(mut self, v: V) -> Self {
5674            self.0.request = v.into();
5675            self
5676        }
5677
5678        /// Sets all the options, replacing any prior values.
5679        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5680            self.0.options = v.into();
5681            self
5682        }
5683
5684        /// Sends the request.
5685        pub async fn send(self) -> Result<()> {
5686            (*self.0.stub)
5687                .delete_document(self.0.request, self.0.options)
5688                .await
5689                .map(crate::Response::into_body)
5690        }
5691
5692        /// Sets the value of [name][crate::model::DeleteDocumentRequest::name].
5693        ///
5694        /// This is a **required** field for requests.
5695        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5696            self.0.request.name = v.into();
5697            self
5698        }
5699    }
5700
5701    #[doc(hidden)]
5702    impl crate::RequestBuilder for DeleteDocument {
5703        fn request_options(&mut self) -> &mut crate::RequestOptions {
5704            &mut self.0.options
5705        }
5706    }
5707
5708    /// The request builder for [DocumentService::import_documents][crate::client::DocumentService::import_documents] calls.
5709    ///
5710    /// # Example
5711    /// ```
5712    /// # use google_cloud_discoveryengine_v1::builder::document_service::ImportDocuments;
5713    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
5714    /// use google_cloud_lro::Poller;
5715    ///
5716    /// let builder = prepare_request_builder();
5717    /// let response = builder.poller().until_done().await?;
5718    /// # Ok(()) }
5719    ///
5720    /// fn prepare_request_builder() -> ImportDocuments {
5721    ///   # panic!();
5722    ///   // ... details omitted ...
5723    /// }
5724    /// ```
5725    #[derive(Clone, Debug)]
5726    pub struct ImportDocuments(RequestBuilder<crate::model::ImportDocumentsRequest>);
5727
5728    impl ImportDocuments {
5729        pub(crate) fn new(
5730            stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
5731        ) -> Self {
5732            Self(RequestBuilder::new(stub))
5733        }
5734
5735        /// Sets the full request, replacing any prior values.
5736        pub fn with_request<V: Into<crate::model::ImportDocumentsRequest>>(mut self, v: V) -> Self {
5737            self.0.request = v.into();
5738            self
5739        }
5740
5741        /// Sets all the options, replacing any prior values.
5742        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5743            self.0.options = v.into();
5744            self
5745        }
5746
5747        /// Sends the request.
5748        ///
5749        /// # Long running operations
5750        ///
5751        /// This starts, but does not poll, a longrunning operation. More information
5752        /// on [import_documents][crate::client::DocumentService::import_documents].
5753        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
5754            (*self.0.stub)
5755                .import_documents(self.0.request, self.0.options)
5756                .await
5757                .map(crate::Response::into_body)
5758        }
5759
5760        /// Creates a [Poller][google_cloud_lro::Poller] to work with `import_documents`.
5761        pub fn poller(
5762            self,
5763        ) -> impl google_cloud_lro::Poller<
5764            crate::model::ImportDocumentsResponse,
5765            crate::model::ImportDocumentsMetadata,
5766        > {
5767            type Operation = google_cloud_lro::internal::Operation<
5768                crate::model::ImportDocumentsResponse,
5769                crate::model::ImportDocumentsMetadata,
5770            >;
5771            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
5772            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
5773
5774            let stub = self.0.stub.clone();
5775            let mut options = self.0.options.clone();
5776            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
5777            let query = move |name| {
5778                let stub = stub.clone();
5779                let options = options.clone();
5780                async {
5781                    let op = GetOperation::new(stub)
5782                        .set_name(name)
5783                        .with_options(options)
5784                        .send()
5785                        .await?;
5786                    Ok(Operation::new(op))
5787                }
5788            };
5789
5790            let start = move || async {
5791                let op = self.send().await?;
5792                Ok(Operation::new(op))
5793            };
5794
5795            google_cloud_lro::internal::new_poller(
5796                polling_error_policy,
5797                polling_backoff_policy,
5798                start,
5799                query,
5800            )
5801        }
5802
5803        /// Sets the value of [parent][crate::model::ImportDocumentsRequest::parent].
5804        ///
5805        /// This is a **required** field for requests.
5806        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
5807            self.0.request.parent = v.into();
5808            self
5809        }
5810
5811        /// Sets the value of [error_config][crate::model::ImportDocumentsRequest::error_config].
5812        pub fn set_error_config<T>(mut self, v: T) -> Self
5813        where
5814            T: std::convert::Into<crate::model::ImportErrorConfig>,
5815        {
5816            self.0.request.error_config = std::option::Option::Some(v.into());
5817            self
5818        }
5819
5820        /// Sets or clears the value of [error_config][crate::model::ImportDocumentsRequest::error_config].
5821        pub fn set_or_clear_error_config<T>(mut self, v: std::option::Option<T>) -> Self
5822        where
5823            T: std::convert::Into<crate::model::ImportErrorConfig>,
5824        {
5825            self.0.request.error_config = v.map(|x| x.into());
5826            self
5827        }
5828
5829        /// Sets the value of [reconciliation_mode][crate::model::ImportDocumentsRequest::reconciliation_mode].
5830        pub fn set_reconciliation_mode<
5831            T: Into<crate::model::import_documents_request::ReconciliationMode>,
5832        >(
5833            mut self,
5834            v: T,
5835        ) -> Self {
5836            self.0.request.reconciliation_mode = v.into();
5837            self
5838        }
5839
5840        /// Sets the value of [update_mask][crate::model::ImportDocumentsRequest::update_mask].
5841        pub fn set_update_mask<T>(mut self, v: T) -> Self
5842        where
5843            T: std::convert::Into<wkt::FieldMask>,
5844        {
5845            self.0.request.update_mask = std::option::Option::Some(v.into());
5846            self
5847        }
5848
5849        /// Sets or clears the value of [update_mask][crate::model::ImportDocumentsRequest::update_mask].
5850        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
5851        where
5852            T: std::convert::Into<wkt::FieldMask>,
5853        {
5854            self.0.request.update_mask = v.map(|x| x.into());
5855            self
5856        }
5857
5858        /// Sets the value of [auto_generate_ids][crate::model::ImportDocumentsRequest::auto_generate_ids].
5859        pub fn set_auto_generate_ids<T: Into<bool>>(mut self, v: T) -> Self {
5860            self.0.request.auto_generate_ids = v.into();
5861            self
5862        }
5863
5864        /// Sets the value of [id_field][crate::model::ImportDocumentsRequest::id_field].
5865        pub fn set_id_field<T: Into<std::string::String>>(mut self, v: T) -> Self {
5866            self.0.request.id_field = v.into();
5867            self
5868        }
5869
5870        /// Sets the value of [force_refresh_content][crate::model::ImportDocumentsRequest::force_refresh_content].
5871        pub fn set_force_refresh_content<T: Into<bool>>(mut self, v: T) -> Self {
5872            self.0.request.force_refresh_content = v.into();
5873            self
5874        }
5875
5876        /// Sets the value of [source][crate::model::ImportDocumentsRequest::source].
5877        ///
5878        /// Note that all the setters affecting `source` are
5879        /// mutually exclusive.
5880        pub fn set_source<T: Into<Option<crate::model::import_documents_request::Source>>>(
5881            mut self,
5882            v: T,
5883        ) -> Self {
5884            self.0.request.source = v.into();
5885            self
5886        }
5887
5888        /// Sets the value of [source][crate::model::ImportDocumentsRequest::source]
5889        /// to hold a `InlineSource`.
5890        ///
5891        /// Note that all the setters affecting `source` are
5892        /// mutually exclusive.
5893        pub fn set_inline_source<
5894            T: std::convert::Into<
5895                    std::boxed::Box<crate::model::import_documents_request::InlineSource>,
5896                >,
5897        >(
5898            mut self,
5899            v: T,
5900        ) -> Self {
5901            self.0.request = self.0.request.set_inline_source(v);
5902            self
5903        }
5904
5905        /// Sets the value of [source][crate::model::ImportDocumentsRequest::source]
5906        /// to hold a `GcsSource`.
5907        ///
5908        /// Note that all the setters affecting `source` are
5909        /// mutually exclusive.
5910        pub fn set_gcs_source<T: std::convert::Into<std::boxed::Box<crate::model::GcsSource>>>(
5911            mut self,
5912            v: T,
5913        ) -> Self {
5914            self.0.request = self.0.request.set_gcs_source(v);
5915            self
5916        }
5917
5918        /// Sets the value of [source][crate::model::ImportDocumentsRequest::source]
5919        /// to hold a `BigquerySource`.
5920        ///
5921        /// Note that all the setters affecting `source` are
5922        /// mutually exclusive.
5923        pub fn set_bigquery_source<
5924            T: std::convert::Into<std::boxed::Box<crate::model::BigQuerySource>>,
5925        >(
5926            mut self,
5927            v: T,
5928        ) -> Self {
5929            self.0.request = self.0.request.set_bigquery_source(v);
5930            self
5931        }
5932
5933        /// Sets the value of [source][crate::model::ImportDocumentsRequest::source]
5934        /// to hold a `FhirStoreSource`.
5935        ///
5936        /// Note that all the setters affecting `source` are
5937        /// mutually exclusive.
5938        pub fn set_fhir_store_source<
5939            T: std::convert::Into<std::boxed::Box<crate::model::FhirStoreSource>>,
5940        >(
5941            mut self,
5942            v: T,
5943        ) -> Self {
5944            self.0.request = self.0.request.set_fhir_store_source(v);
5945            self
5946        }
5947
5948        /// Sets the value of [source][crate::model::ImportDocumentsRequest::source]
5949        /// to hold a `SpannerSource`.
5950        ///
5951        /// Note that all the setters affecting `source` are
5952        /// mutually exclusive.
5953        pub fn set_spanner_source<
5954            T: std::convert::Into<std::boxed::Box<crate::model::SpannerSource>>,
5955        >(
5956            mut self,
5957            v: T,
5958        ) -> Self {
5959            self.0.request = self.0.request.set_spanner_source(v);
5960            self
5961        }
5962
5963        /// Sets the value of [source][crate::model::ImportDocumentsRequest::source]
5964        /// to hold a `CloudSqlSource`.
5965        ///
5966        /// Note that all the setters affecting `source` are
5967        /// mutually exclusive.
5968        pub fn set_cloud_sql_source<
5969            T: std::convert::Into<std::boxed::Box<crate::model::CloudSqlSource>>,
5970        >(
5971            mut self,
5972            v: T,
5973        ) -> Self {
5974            self.0.request = self.0.request.set_cloud_sql_source(v);
5975            self
5976        }
5977
5978        /// Sets the value of [source][crate::model::ImportDocumentsRequest::source]
5979        /// to hold a `FirestoreSource`.
5980        ///
5981        /// Note that all the setters affecting `source` are
5982        /// mutually exclusive.
5983        pub fn set_firestore_source<
5984            T: std::convert::Into<std::boxed::Box<crate::model::FirestoreSource>>,
5985        >(
5986            mut self,
5987            v: T,
5988        ) -> Self {
5989            self.0.request = self.0.request.set_firestore_source(v);
5990            self
5991        }
5992
5993        /// Sets the value of [source][crate::model::ImportDocumentsRequest::source]
5994        /// to hold a `AlloyDbSource`.
5995        ///
5996        /// Note that all the setters affecting `source` are
5997        /// mutually exclusive.
5998        pub fn set_alloy_db_source<
5999            T: std::convert::Into<std::boxed::Box<crate::model::AlloyDbSource>>,
6000        >(
6001            mut self,
6002            v: T,
6003        ) -> Self {
6004            self.0.request = self.0.request.set_alloy_db_source(v);
6005            self
6006        }
6007
6008        /// Sets the value of [source][crate::model::ImportDocumentsRequest::source]
6009        /// to hold a `BigtableSource`.
6010        ///
6011        /// Note that all the setters affecting `source` are
6012        /// mutually exclusive.
6013        pub fn set_bigtable_source<
6014            T: std::convert::Into<std::boxed::Box<crate::model::BigtableSource>>,
6015        >(
6016            mut self,
6017            v: T,
6018        ) -> Self {
6019            self.0.request = self.0.request.set_bigtable_source(v);
6020            self
6021        }
6022    }
6023
6024    #[doc(hidden)]
6025    impl crate::RequestBuilder for ImportDocuments {
6026        fn request_options(&mut self) -> &mut crate::RequestOptions {
6027            &mut self.0.options
6028        }
6029    }
6030
6031    /// The request builder for [DocumentService::purge_documents][crate::client::DocumentService::purge_documents] calls.
6032    ///
6033    /// # Example
6034    /// ```
6035    /// # use google_cloud_discoveryengine_v1::builder::document_service::PurgeDocuments;
6036    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
6037    /// use google_cloud_lro::Poller;
6038    ///
6039    /// let builder = prepare_request_builder();
6040    /// let response = builder.poller().until_done().await?;
6041    /// # Ok(()) }
6042    ///
6043    /// fn prepare_request_builder() -> PurgeDocuments {
6044    ///   # panic!();
6045    ///   // ... details omitted ...
6046    /// }
6047    /// ```
6048    #[derive(Clone, Debug)]
6049    pub struct PurgeDocuments(RequestBuilder<crate::model::PurgeDocumentsRequest>);
6050
6051    impl PurgeDocuments {
6052        pub(crate) fn new(
6053            stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
6054        ) -> Self {
6055            Self(RequestBuilder::new(stub))
6056        }
6057
6058        /// Sets the full request, replacing any prior values.
6059        pub fn with_request<V: Into<crate::model::PurgeDocumentsRequest>>(mut self, v: V) -> Self {
6060            self.0.request = v.into();
6061            self
6062        }
6063
6064        /// Sets all the options, replacing any prior values.
6065        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6066            self.0.options = v.into();
6067            self
6068        }
6069
6070        /// Sends the request.
6071        ///
6072        /// # Long running operations
6073        ///
6074        /// This starts, but does not poll, a longrunning operation. More information
6075        /// on [purge_documents][crate::client::DocumentService::purge_documents].
6076        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
6077            (*self.0.stub)
6078                .purge_documents(self.0.request, self.0.options)
6079                .await
6080                .map(crate::Response::into_body)
6081        }
6082
6083        /// Creates a [Poller][google_cloud_lro::Poller] to work with `purge_documents`.
6084        pub fn poller(
6085            self,
6086        ) -> impl google_cloud_lro::Poller<
6087            crate::model::PurgeDocumentsResponse,
6088            crate::model::PurgeDocumentsMetadata,
6089        > {
6090            type Operation = google_cloud_lro::internal::Operation<
6091                crate::model::PurgeDocumentsResponse,
6092                crate::model::PurgeDocumentsMetadata,
6093            >;
6094            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
6095            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
6096
6097            let stub = self.0.stub.clone();
6098            let mut options = self.0.options.clone();
6099            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
6100            let query = move |name| {
6101                let stub = stub.clone();
6102                let options = options.clone();
6103                async {
6104                    let op = GetOperation::new(stub)
6105                        .set_name(name)
6106                        .with_options(options)
6107                        .send()
6108                        .await?;
6109                    Ok(Operation::new(op))
6110                }
6111            };
6112
6113            let start = move || async {
6114                let op = self.send().await?;
6115                Ok(Operation::new(op))
6116            };
6117
6118            google_cloud_lro::internal::new_poller(
6119                polling_error_policy,
6120                polling_backoff_policy,
6121                start,
6122                query,
6123            )
6124        }
6125
6126        /// Sets the value of [parent][crate::model::PurgeDocumentsRequest::parent].
6127        ///
6128        /// This is a **required** field for requests.
6129        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
6130            self.0.request.parent = v.into();
6131            self
6132        }
6133
6134        /// Sets the value of [filter][crate::model::PurgeDocumentsRequest::filter].
6135        ///
6136        /// This is a **required** field for requests.
6137        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
6138            self.0.request.filter = v.into();
6139            self
6140        }
6141
6142        /// Sets the value of [error_config][crate::model::PurgeDocumentsRequest::error_config].
6143        pub fn set_error_config<T>(mut self, v: T) -> Self
6144        where
6145            T: std::convert::Into<crate::model::PurgeErrorConfig>,
6146        {
6147            self.0.request.error_config = std::option::Option::Some(v.into());
6148            self
6149        }
6150
6151        /// Sets or clears the value of [error_config][crate::model::PurgeDocumentsRequest::error_config].
6152        pub fn set_or_clear_error_config<T>(mut self, v: std::option::Option<T>) -> Self
6153        where
6154            T: std::convert::Into<crate::model::PurgeErrorConfig>,
6155        {
6156            self.0.request.error_config = v.map(|x| x.into());
6157            self
6158        }
6159
6160        /// Sets the value of [force][crate::model::PurgeDocumentsRequest::force].
6161        pub fn set_force<T: Into<bool>>(mut self, v: T) -> Self {
6162            self.0.request.force = v.into();
6163            self
6164        }
6165
6166        /// Sets the value of [source][crate::model::PurgeDocumentsRequest::source].
6167        ///
6168        /// Note that all the setters affecting `source` are
6169        /// mutually exclusive.
6170        pub fn set_source<T: Into<Option<crate::model::purge_documents_request::Source>>>(
6171            mut self,
6172            v: T,
6173        ) -> Self {
6174            self.0.request.source = v.into();
6175            self
6176        }
6177
6178        /// Sets the value of [source][crate::model::PurgeDocumentsRequest::source]
6179        /// to hold a `GcsSource`.
6180        ///
6181        /// Note that all the setters affecting `source` are
6182        /// mutually exclusive.
6183        pub fn set_gcs_source<T: std::convert::Into<std::boxed::Box<crate::model::GcsSource>>>(
6184            mut self,
6185            v: T,
6186        ) -> Self {
6187            self.0.request = self.0.request.set_gcs_source(v);
6188            self
6189        }
6190
6191        /// Sets the value of [source][crate::model::PurgeDocumentsRequest::source]
6192        /// to hold a `InlineSource`.
6193        ///
6194        /// Note that all the setters affecting `source` are
6195        /// mutually exclusive.
6196        pub fn set_inline_source<
6197            T: std::convert::Into<
6198                    std::boxed::Box<crate::model::purge_documents_request::InlineSource>,
6199                >,
6200        >(
6201            mut self,
6202            v: T,
6203        ) -> Self {
6204            self.0.request = self.0.request.set_inline_source(v);
6205            self
6206        }
6207    }
6208
6209    #[doc(hidden)]
6210    impl crate::RequestBuilder for PurgeDocuments {
6211        fn request_options(&mut self) -> &mut crate::RequestOptions {
6212            &mut self.0.options
6213        }
6214    }
6215
6216    /// The request builder for [DocumentService::batch_get_documents_metadata][crate::client::DocumentService::batch_get_documents_metadata] calls.
6217    ///
6218    /// # Example
6219    /// ```
6220    /// # use google_cloud_discoveryengine_v1::builder::document_service::BatchGetDocumentsMetadata;
6221    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
6222    ///
6223    /// let builder = prepare_request_builder();
6224    /// let response = builder.send().await?;
6225    /// # Ok(()) }
6226    ///
6227    /// fn prepare_request_builder() -> BatchGetDocumentsMetadata {
6228    ///   # panic!();
6229    ///   // ... details omitted ...
6230    /// }
6231    /// ```
6232    #[derive(Clone, Debug)]
6233    pub struct BatchGetDocumentsMetadata(
6234        RequestBuilder<crate::model::BatchGetDocumentsMetadataRequest>,
6235    );
6236
6237    impl BatchGetDocumentsMetadata {
6238        pub(crate) fn new(
6239            stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
6240        ) -> Self {
6241            Self(RequestBuilder::new(stub))
6242        }
6243
6244        /// Sets the full request, replacing any prior values.
6245        pub fn with_request<V: Into<crate::model::BatchGetDocumentsMetadataRequest>>(
6246            mut self,
6247            v: V,
6248        ) -> Self {
6249            self.0.request = v.into();
6250            self
6251        }
6252
6253        /// Sets all the options, replacing any prior values.
6254        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6255            self.0.options = v.into();
6256            self
6257        }
6258
6259        /// Sends the request.
6260        pub async fn send(self) -> Result<crate::model::BatchGetDocumentsMetadataResponse> {
6261            (*self.0.stub)
6262                .batch_get_documents_metadata(self.0.request, self.0.options)
6263                .await
6264                .map(crate::Response::into_body)
6265        }
6266
6267        /// Sets the value of [parent][crate::model::BatchGetDocumentsMetadataRequest::parent].
6268        ///
6269        /// This is a **required** field for requests.
6270        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
6271            self.0.request.parent = v.into();
6272            self
6273        }
6274
6275        /// Sets the value of [matcher][crate::model::BatchGetDocumentsMetadataRequest::matcher].
6276        ///
6277        /// This is a **required** field for requests.
6278        pub fn set_matcher<T>(mut self, v: T) -> Self
6279        where
6280            T: std::convert::Into<crate::model::batch_get_documents_metadata_request::Matcher>,
6281        {
6282            self.0.request.matcher = std::option::Option::Some(v.into());
6283            self
6284        }
6285
6286        /// Sets or clears the value of [matcher][crate::model::BatchGetDocumentsMetadataRequest::matcher].
6287        ///
6288        /// This is a **required** field for requests.
6289        pub fn set_or_clear_matcher<T>(mut self, v: std::option::Option<T>) -> Self
6290        where
6291            T: std::convert::Into<crate::model::batch_get_documents_metadata_request::Matcher>,
6292        {
6293            self.0.request.matcher = v.map(|x| x.into());
6294            self
6295        }
6296    }
6297
6298    #[doc(hidden)]
6299    impl crate::RequestBuilder for BatchGetDocumentsMetadata {
6300        fn request_options(&mut self) -> &mut crate::RequestOptions {
6301            &mut self.0.options
6302        }
6303    }
6304
6305    /// The request builder for [DocumentService::list_operations][crate::client::DocumentService::list_operations] calls.
6306    ///
6307    /// # Example
6308    /// ```
6309    /// # use google_cloud_discoveryengine_v1::builder::document_service::ListOperations;
6310    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
6311    /// use google_cloud_gax::paginator::ItemPaginator;
6312    ///
6313    /// let builder = prepare_request_builder();
6314    /// let mut items = builder.by_item();
6315    /// while let Some(result) = items.next().await {
6316    ///   let item = result?;
6317    /// }
6318    /// # Ok(()) }
6319    ///
6320    /// fn prepare_request_builder() -> ListOperations {
6321    ///   # panic!();
6322    ///   // ... details omitted ...
6323    /// }
6324    /// ```
6325    #[derive(Clone, Debug)]
6326    pub struct ListOperations(
6327        RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
6328    );
6329
6330    impl ListOperations {
6331        pub(crate) fn new(
6332            stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
6333        ) -> Self {
6334            Self(RequestBuilder::new(stub))
6335        }
6336
6337        /// Sets the full request, replacing any prior values.
6338        pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
6339            mut self,
6340            v: V,
6341        ) -> Self {
6342            self.0.request = v.into();
6343            self
6344        }
6345
6346        /// Sets all the options, replacing any prior values.
6347        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6348            self.0.options = v.into();
6349            self
6350        }
6351
6352        /// Sends the request.
6353        pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
6354            (*self.0.stub)
6355                .list_operations(self.0.request, self.0.options)
6356                .await
6357                .map(crate::Response::into_body)
6358        }
6359
6360        /// Streams each page in the collection.
6361        pub fn by_page(
6362            self,
6363        ) -> impl google_cloud_gax::paginator::Paginator<
6364            google_cloud_longrunning::model::ListOperationsResponse,
6365            crate::Error,
6366        > {
6367            use std::clone::Clone;
6368            let token = self.0.request.page_token.clone();
6369            let execute = move |token: String| {
6370                let mut builder = self.clone();
6371                builder.0.request = builder.0.request.set_page_token(token);
6372                builder.send()
6373            };
6374            google_cloud_gax::paginator::internal::new_paginator(token, execute)
6375        }
6376
6377        /// Streams each item in the collection.
6378        pub fn by_item(
6379            self,
6380        ) -> impl google_cloud_gax::paginator::ItemPaginator<
6381            google_cloud_longrunning::model::ListOperationsResponse,
6382            crate::Error,
6383        > {
6384            use google_cloud_gax::paginator::Paginator;
6385            self.by_page().items()
6386        }
6387
6388        /// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
6389        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6390            self.0.request.name = v.into();
6391            self
6392        }
6393
6394        /// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::filter].
6395        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
6396            self.0.request.filter = v.into();
6397            self
6398        }
6399
6400        /// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
6401        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
6402            self.0.request.page_size = v.into();
6403            self
6404        }
6405
6406        /// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
6407        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
6408            self.0.request.page_token = v.into();
6409            self
6410        }
6411
6412        /// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
6413        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
6414            self.0.request.return_partial_success = v.into();
6415            self
6416        }
6417    }
6418
6419    #[doc(hidden)]
6420    impl crate::RequestBuilder for ListOperations {
6421        fn request_options(&mut self) -> &mut crate::RequestOptions {
6422            &mut self.0.options
6423        }
6424    }
6425
6426    /// The request builder for [DocumentService::get_operation][crate::client::DocumentService::get_operation] calls.
6427    ///
6428    /// # Example
6429    /// ```
6430    /// # use google_cloud_discoveryengine_v1::builder::document_service::GetOperation;
6431    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
6432    ///
6433    /// let builder = prepare_request_builder();
6434    /// let response = builder.send().await?;
6435    /// # Ok(()) }
6436    ///
6437    /// fn prepare_request_builder() -> GetOperation {
6438    ///   # panic!();
6439    ///   // ... details omitted ...
6440    /// }
6441    /// ```
6442    #[derive(Clone, Debug)]
6443    pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
6444
6445    impl GetOperation {
6446        pub(crate) fn new(
6447            stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
6448        ) -> Self {
6449            Self(RequestBuilder::new(stub))
6450        }
6451
6452        /// Sets the full request, replacing any prior values.
6453        pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
6454            mut self,
6455            v: V,
6456        ) -> Self {
6457            self.0.request = v.into();
6458            self
6459        }
6460
6461        /// Sets all the options, replacing any prior values.
6462        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6463            self.0.options = v.into();
6464            self
6465        }
6466
6467        /// Sends the request.
6468        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
6469            (*self.0.stub)
6470                .get_operation(self.0.request, self.0.options)
6471                .await
6472                .map(crate::Response::into_body)
6473        }
6474
6475        /// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
6476        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6477            self.0.request.name = v.into();
6478            self
6479        }
6480    }
6481
6482    #[doc(hidden)]
6483    impl crate::RequestBuilder for GetOperation {
6484        fn request_options(&mut self) -> &mut crate::RequestOptions {
6485            &mut self.0.options
6486        }
6487    }
6488
6489    /// The request builder for [DocumentService::cancel_operation][crate::client::DocumentService::cancel_operation] calls.
6490    ///
6491    /// # Example
6492    /// ```
6493    /// # use google_cloud_discoveryengine_v1::builder::document_service::CancelOperation;
6494    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
6495    ///
6496    /// let builder = prepare_request_builder();
6497    /// let response = builder.send().await?;
6498    /// # Ok(()) }
6499    ///
6500    /// fn prepare_request_builder() -> CancelOperation {
6501    ///   # panic!();
6502    ///   // ... details omitted ...
6503    /// }
6504    /// ```
6505    #[derive(Clone, Debug)]
6506    pub struct CancelOperation(
6507        RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
6508    );
6509
6510    impl CancelOperation {
6511        pub(crate) fn new(
6512            stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
6513        ) -> Self {
6514            Self(RequestBuilder::new(stub))
6515        }
6516
6517        /// Sets the full request, replacing any prior values.
6518        pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
6519            mut self,
6520            v: V,
6521        ) -> Self {
6522            self.0.request = v.into();
6523            self
6524        }
6525
6526        /// Sets all the options, replacing any prior values.
6527        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6528            self.0.options = v.into();
6529            self
6530        }
6531
6532        /// Sends the request.
6533        pub async fn send(self) -> Result<()> {
6534            (*self.0.stub)
6535                .cancel_operation(self.0.request, self.0.options)
6536                .await
6537                .map(crate::Response::into_body)
6538        }
6539
6540        /// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::name].
6541        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6542            self.0.request.name = v.into();
6543            self
6544        }
6545    }
6546
6547    #[doc(hidden)]
6548    impl crate::RequestBuilder for CancelOperation {
6549        fn request_options(&mut self) -> &mut crate::RequestOptions {
6550            &mut self.0.options
6551        }
6552    }
6553}
6554
6555/// Request and client builders for [EngineService][crate::client::EngineService].
6556#[cfg(feature = "engine-service")]
6557#[cfg_attr(docsrs, doc(cfg(feature = "engine-service")))]
6558pub mod engine_service {
6559    use crate::Result;
6560
6561    /// A builder for [EngineService][crate::client::EngineService].
6562    ///
6563    /// ```
6564    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
6565    /// # use google_cloud_discoveryengine_v1::*;
6566    /// # use builder::engine_service::ClientBuilder;
6567    /// # use client::EngineService;
6568    /// let builder : ClientBuilder = EngineService::builder();
6569    /// let client = builder
6570    ///     .with_endpoint("https://discoveryengine.googleapis.com")
6571    ///     .build().await?;
6572    /// # Ok(()) }
6573    /// ```
6574    pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
6575
6576    pub(crate) mod client {
6577        use super::super::super::client::EngineService;
6578        pub struct Factory;
6579        impl crate::ClientFactory for Factory {
6580            type Client = EngineService;
6581            type Credentials = gaxi::options::Credentials;
6582            async fn build(
6583                self,
6584                config: gaxi::options::ClientConfig,
6585            ) -> crate::ClientBuilderResult<Self::Client> {
6586                Self::Client::new(config).await
6587            }
6588        }
6589    }
6590
6591    /// Common implementation for [crate::client::EngineService] request builders.
6592    #[derive(Clone, Debug)]
6593    pub(crate) struct RequestBuilder<R: std::default::Default> {
6594        stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
6595        request: R,
6596        options: crate::RequestOptions,
6597    }
6598
6599    impl<R> RequestBuilder<R>
6600    where
6601        R: std::default::Default,
6602    {
6603        pub(crate) fn new(
6604            stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
6605        ) -> Self {
6606            Self {
6607                stub,
6608                request: R::default(),
6609                options: crate::RequestOptions::default(),
6610            }
6611        }
6612    }
6613
6614    /// The request builder for [EngineService::create_engine][crate::client::EngineService::create_engine] calls.
6615    ///
6616    /// # Example
6617    /// ```
6618    /// # use google_cloud_discoveryengine_v1::builder::engine_service::CreateEngine;
6619    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
6620    /// use google_cloud_lro::Poller;
6621    ///
6622    /// let builder = prepare_request_builder();
6623    /// let response = builder.poller().until_done().await?;
6624    /// # Ok(()) }
6625    ///
6626    /// fn prepare_request_builder() -> CreateEngine {
6627    ///   # panic!();
6628    ///   // ... details omitted ...
6629    /// }
6630    /// ```
6631    #[derive(Clone, Debug)]
6632    pub struct CreateEngine(RequestBuilder<crate::model::CreateEngineRequest>);
6633
6634    impl CreateEngine {
6635        pub(crate) fn new(
6636            stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
6637        ) -> Self {
6638            Self(RequestBuilder::new(stub))
6639        }
6640
6641        /// Sets the full request, replacing any prior values.
6642        pub fn with_request<V: Into<crate::model::CreateEngineRequest>>(mut self, v: V) -> Self {
6643            self.0.request = v.into();
6644            self
6645        }
6646
6647        /// Sets all the options, replacing any prior values.
6648        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6649            self.0.options = v.into();
6650            self
6651        }
6652
6653        /// Sends the request.
6654        ///
6655        /// # Long running operations
6656        ///
6657        /// This starts, but does not poll, a longrunning operation. More information
6658        /// on [create_engine][crate::client::EngineService::create_engine].
6659        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
6660            (*self.0.stub)
6661                .create_engine(self.0.request, self.0.options)
6662                .await
6663                .map(crate::Response::into_body)
6664        }
6665
6666        /// Creates a [Poller][google_cloud_lro::Poller] to work with `create_engine`.
6667        pub fn poller(
6668            self,
6669        ) -> impl google_cloud_lro::Poller<crate::model::Engine, crate::model::CreateEngineMetadata>
6670        {
6671            type Operation = google_cloud_lro::internal::Operation<
6672                crate::model::Engine,
6673                crate::model::CreateEngineMetadata,
6674            >;
6675            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
6676            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
6677
6678            let stub = self.0.stub.clone();
6679            let mut options = self.0.options.clone();
6680            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
6681            let query = move |name| {
6682                let stub = stub.clone();
6683                let options = options.clone();
6684                async {
6685                    let op = GetOperation::new(stub)
6686                        .set_name(name)
6687                        .with_options(options)
6688                        .send()
6689                        .await?;
6690                    Ok(Operation::new(op))
6691                }
6692            };
6693
6694            let start = move || async {
6695                let op = self.send().await?;
6696                Ok(Operation::new(op))
6697            };
6698
6699            google_cloud_lro::internal::new_poller(
6700                polling_error_policy,
6701                polling_backoff_policy,
6702                start,
6703                query,
6704            )
6705        }
6706
6707        /// Sets the value of [parent][crate::model::CreateEngineRequest::parent].
6708        ///
6709        /// This is a **required** field for requests.
6710        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
6711            self.0.request.parent = v.into();
6712            self
6713        }
6714
6715        /// Sets the value of [engine][crate::model::CreateEngineRequest::engine].
6716        ///
6717        /// This is a **required** field for requests.
6718        pub fn set_engine<T>(mut self, v: T) -> Self
6719        where
6720            T: std::convert::Into<crate::model::Engine>,
6721        {
6722            self.0.request.engine = std::option::Option::Some(v.into());
6723            self
6724        }
6725
6726        /// Sets or clears the value of [engine][crate::model::CreateEngineRequest::engine].
6727        ///
6728        /// This is a **required** field for requests.
6729        pub fn set_or_clear_engine<T>(mut self, v: std::option::Option<T>) -> Self
6730        where
6731            T: std::convert::Into<crate::model::Engine>,
6732        {
6733            self.0.request.engine = v.map(|x| x.into());
6734            self
6735        }
6736
6737        /// Sets the value of [engine_id][crate::model::CreateEngineRequest::engine_id].
6738        ///
6739        /// This is a **required** field for requests.
6740        pub fn set_engine_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
6741            self.0.request.engine_id = v.into();
6742            self
6743        }
6744    }
6745
6746    #[doc(hidden)]
6747    impl crate::RequestBuilder for CreateEngine {
6748        fn request_options(&mut self) -> &mut crate::RequestOptions {
6749            &mut self.0.options
6750        }
6751    }
6752
6753    /// The request builder for [EngineService::delete_engine][crate::client::EngineService::delete_engine] calls.
6754    ///
6755    /// # Example
6756    /// ```
6757    /// # use google_cloud_discoveryengine_v1::builder::engine_service::DeleteEngine;
6758    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
6759    /// use google_cloud_lro::Poller;
6760    ///
6761    /// let builder = prepare_request_builder();
6762    /// let response = builder.poller().until_done().await?;
6763    /// # Ok(()) }
6764    ///
6765    /// fn prepare_request_builder() -> DeleteEngine {
6766    ///   # panic!();
6767    ///   // ... details omitted ...
6768    /// }
6769    /// ```
6770    #[derive(Clone, Debug)]
6771    pub struct DeleteEngine(RequestBuilder<crate::model::DeleteEngineRequest>);
6772
6773    impl DeleteEngine {
6774        pub(crate) fn new(
6775            stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
6776        ) -> Self {
6777            Self(RequestBuilder::new(stub))
6778        }
6779
6780        /// Sets the full request, replacing any prior values.
6781        pub fn with_request<V: Into<crate::model::DeleteEngineRequest>>(mut self, v: V) -> Self {
6782            self.0.request = v.into();
6783            self
6784        }
6785
6786        /// Sets all the options, replacing any prior values.
6787        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6788            self.0.options = v.into();
6789            self
6790        }
6791
6792        /// Sends the request.
6793        ///
6794        /// # Long running operations
6795        ///
6796        /// This starts, but does not poll, a longrunning operation. More information
6797        /// on [delete_engine][crate::client::EngineService::delete_engine].
6798        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
6799            (*self.0.stub)
6800                .delete_engine(self.0.request, self.0.options)
6801                .await
6802                .map(crate::Response::into_body)
6803        }
6804
6805        /// Creates a [Poller][google_cloud_lro::Poller] to work with `delete_engine`.
6806        pub fn poller(
6807            self,
6808        ) -> impl google_cloud_lro::Poller<(), crate::model::DeleteEngineMetadata> {
6809            type Operation = google_cloud_lro::internal::Operation<
6810                wkt::Empty,
6811                crate::model::DeleteEngineMetadata,
6812            >;
6813            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
6814            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
6815
6816            let stub = self.0.stub.clone();
6817            let mut options = self.0.options.clone();
6818            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
6819            let query = move |name| {
6820                let stub = stub.clone();
6821                let options = options.clone();
6822                async {
6823                    let op = GetOperation::new(stub)
6824                        .set_name(name)
6825                        .with_options(options)
6826                        .send()
6827                        .await?;
6828                    Ok(Operation::new(op))
6829                }
6830            };
6831
6832            let start = move || async {
6833                let op = self.send().await?;
6834                Ok(Operation::new(op))
6835            };
6836
6837            google_cloud_lro::internal::new_unit_response_poller(
6838                polling_error_policy,
6839                polling_backoff_policy,
6840                start,
6841                query,
6842            )
6843        }
6844
6845        /// Sets the value of [name][crate::model::DeleteEngineRequest::name].
6846        ///
6847        /// This is a **required** field for requests.
6848        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6849            self.0.request.name = v.into();
6850            self
6851        }
6852    }
6853
6854    #[doc(hidden)]
6855    impl crate::RequestBuilder for DeleteEngine {
6856        fn request_options(&mut self) -> &mut crate::RequestOptions {
6857            &mut self.0.options
6858        }
6859    }
6860
6861    /// The request builder for [EngineService::update_engine][crate::client::EngineService::update_engine] calls.
6862    ///
6863    /// # Example
6864    /// ```
6865    /// # use google_cloud_discoveryengine_v1::builder::engine_service::UpdateEngine;
6866    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
6867    ///
6868    /// let builder = prepare_request_builder();
6869    /// let response = builder.send().await?;
6870    /// # Ok(()) }
6871    ///
6872    /// fn prepare_request_builder() -> UpdateEngine {
6873    ///   # panic!();
6874    ///   // ... details omitted ...
6875    /// }
6876    /// ```
6877    #[derive(Clone, Debug)]
6878    pub struct UpdateEngine(RequestBuilder<crate::model::UpdateEngineRequest>);
6879
6880    impl UpdateEngine {
6881        pub(crate) fn new(
6882            stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
6883        ) -> Self {
6884            Self(RequestBuilder::new(stub))
6885        }
6886
6887        /// Sets the full request, replacing any prior values.
6888        pub fn with_request<V: Into<crate::model::UpdateEngineRequest>>(mut self, v: V) -> Self {
6889            self.0.request = v.into();
6890            self
6891        }
6892
6893        /// Sets all the options, replacing any prior values.
6894        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6895            self.0.options = v.into();
6896            self
6897        }
6898
6899        /// Sends the request.
6900        pub async fn send(self) -> Result<crate::model::Engine> {
6901            (*self.0.stub)
6902                .update_engine(self.0.request, self.0.options)
6903                .await
6904                .map(crate::Response::into_body)
6905        }
6906
6907        /// Sets the value of [engine][crate::model::UpdateEngineRequest::engine].
6908        ///
6909        /// This is a **required** field for requests.
6910        pub fn set_engine<T>(mut self, v: T) -> Self
6911        where
6912            T: std::convert::Into<crate::model::Engine>,
6913        {
6914            self.0.request.engine = std::option::Option::Some(v.into());
6915            self
6916        }
6917
6918        /// Sets or clears the value of [engine][crate::model::UpdateEngineRequest::engine].
6919        ///
6920        /// This is a **required** field for requests.
6921        pub fn set_or_clear_engine<T>(mut self, v: std::option::Option<T>) -> Self
6922        where
6923            T: std::convert::Into<crate::model::Engine>,
6924        {
6925            self.0.request.engine = v.map(|x| x.into());
6926            self
6927        }
6928
6929        /// Sets the value of [update_mask][crate::model::UpdateEngineRequest::update_mask].
6930        pub fn set_update_mask<T>(mut self, v: T) -> Self
6931        where
6932            T: std::convert::Into<wkt::FieldMask>,
6933        {
6934            self.0.request.update_mask = std::option::Option::Some(v.into());
6935            self
6936        }
6937
6938        /// Sets or clears the value of [update_mask][crate::model::UpdateEngineRequest::update_mask].
6939        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
6940        where
6941            T: std::convert::Into<wkt::FieldMask>,
6942        {
6943            self.0.request.update_mask = v.map(|x| x.into());
6944            self
6945        }
6946    }
6947
6948    #[doc(hidden)]
6949    impl crate::RequestBuilder for UpdateEngine {
6950        fn request_options(&mut self) -> &mut crate::RequestOptions {
6951            &mut self.0.options
6952        }
6953    }
6954
6955    /// The request builder for [EngineService::get_engine][crate::client::EngineService::get_engine] calls.
6956    ///
6957    /// # Example
6958    /// ```
6959    /// # use google_cloud_discoveryengine_v1::builder::engine_service::GetEngine;
6960    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
6961    ///
6962    /// let builder = prepare_request_builder();
6963    /// let response = builder.send().await?;
6964    /// # Ok(()) }
6965    ///
6966    /// fn prepare_request_builder() -> GetEngine {
6967    ///   # panic!();
6968    ///   // ... details omitted ...
6969    /// }
6970    /// ```
6971    #[derive(Clone, Debug)]
6972    pub struct GetEngine(RequestBuilder<crate::model::GetEngineRequest>);
6973
6974    impl GetEngine {
6975        pub(crate) fn new(
6976            stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
6977        ) -> Self {
6978            Self(RequestBuilder::new(stub))
6979        }
6980
6981        /// Sets the full request, replacing any prior values.
6982        pub fn with_request<V: Into<crate::model::GetEngineRequest>>(mut self, v: V) -> Self {
6983            self.0.request = v.into();
6984            self
6985        }
6986
6987        /// Sets all the options, replacing any prior values.
6988        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6989            self.0.options = v.into();
6990            self
6991        }
6992
6993        /// Sends the request.
6994        pub async fn send(self) -> Result<crate::model::Engine> {
6995            (*self.0.stub)
6996                .get_engine(self.0.request, self.0.options)
6997                .await
6998                .map(crate::Response::into_body)
6999        }
7000
7001        /// Sets the value of [name][crate::model::GetEngineRequest::name].
7002        ///
7003        /// This is a **required** field for requests.
7004        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7005            self.0.request.name = v.into();
7006            self
7007        }
7008    }
7009
7010    #[doc(hidden)]
7011    impl crate::RequestBuilder for GetEngine {
7012        fn request_options(&mut self) -> &mut crate::RequestOptions {
7013            &mut self.0.options
7014        }
7015    }
7016
7017    /// The request builder for [EngineService::list_engines][crate::client::EngineService::list_engines] calls.
7018    ///
7019    /// # Example
7020    /// ```
7021    /// # use google_cloud_discoveryengine_v1::builder::engine_service::ListEngines;
7022    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
7023    /// use google_cloud_gax::paginator::ItemPaginator;
7024    ///
7025    /// let builder = prepare_request_builder();
7026    /// let mut items = builder.by_item();
7027    /// while let Some(result) = items.next().await {
7028    ///   let item = result?;
7029    /// }
7030    /// # Ok(()) }
7031    ///
7032    /// fn prepare_request_builder() -> ListEngines {
7033    ///   # panic!();
7034    ///   // ... details omitted ...
7035    /// }
7036    /// ```
7037    #[derive(Clone, Debug)]
7038    pub struct ListEngines(RequestBuilder<crate::model::ListEnginesRequest>);
7039
7040    impl ListEngines {
7041        pub(crate) fn new(
7042            stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
7043        ) -> Self {
7044            Self(RequestBuilder::new(stub))
7045        }
7046
7047        /// Sets the full request, replacing any prior values.
7048        pub fn with_request<V: Into<crate::model::ListEnginesRequest>>(mut self, v: V) -> Self {
7049            self.0.request = v.into();
7050            self
7051        }
7052
7053        /// Sets all the options, replacing any prior values.
7054        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7055            self.0.options = v.into();
7056            self
7057        }
7058
7059        /// Sends the request.
7060        pub async fn send(self) -> Result<crate::model::ListEnginesResponse> {
7061            (*self.0.stub)
7062                .list_engines(self.0.request, self.0.options)
7063                .await
7064                .map(crate::Response::into_body)
7065        }
7066
7067        /// Streams each page in the collection.
7068        pub fn by_page(
7069            self,
7070        ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListEnginesResponse, crate::Error>
7071        {
7072            use std::clone::Clone;
7073            let token = self.0.request.page_token.clone();
7074            let execute = move |token: String| {
7075                let mut builder = self.clone();
7076                builder.0.request = builder.0.request.set_page_token(token);
7077                builder.send()
7078            };
7079            google_cloud_gax::paginator::internal::new_paginator(token, execute)
7080        }
7081
7082        /// Streams each item in the collection.
7083        pub fn by_item(
7084            self,
7085        ) -> impl google_cloud_gax::paginator::ItemPaginator<
7086            crate::model::ListEnginesResponse,
7087            crate::Error,
7088        > {
7089            use google_cloud_gax::paginator::Paginator;
7090            self.by_page().items()
7091        }
7092
7093        /// Sets the value of [parent][crate::model::ListEnginesRequest::parent].
7094        ///
7095        /// This is a **required** field for requests.
7096        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
7097            self.0.request.parent = v.into();
7098            self
7099        }
7100
7101        /// Sets the value of [page_size][crate::model::ListEnginesRequest::page_size].
7102        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
7103            self.0.request.page_size = v.into();
7104            self
7105        }
7106
7107        /// Sets the value of [page_token][crate::model::ListEnginesRequest::page_token].
7108        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
7109            self.0.request.page_token = v.into();
7110            self
7111        }
7112
7113        /// Sets the value of [filter][crate::model::ListEnginesRequest::filter].
7114        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
7115            self.0.request.filter = v.into();
7116            self
7117        }
7118    }
7119
7120    #[doc(hidden)]
7121    impl crate::RequestBuilder for ListEngines {
7122        fn request_options(&mut self) -> &mut crate::RequestOptions {
7123            &mut self.0.options
7124        }
7125    }
7126
7127    /// The request builder for [EngineService::list_operations][crate::client::EngineService::list_operations] calls.
7128    ///
7129    /// # Example
7130    /// ```
7131    /// # use google_cloud_discoveryengine_v1::builder::engine_service::ListOperations;
7132    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
7133    /// use google_cloud_gax::paginator::ItemPaginator;
7134    ///
7135    /// let builder = prepare_request_builder();
7136    /// let mut items = builder.by_item();
7137    /// while let Some(result) = items.next().await {
7138    ///   let item = result?;
7139    /// }
7140    /// # Ok(()) }
7141    ///
7142    /// fn prepare_request_builder() -> ListOperations {
7143    ///   # panic!();
7144    ///   // ... details omitted ...
7145    /// }
7146    /// ```
7147    #[derive(Clone, Debug)]
7148    pub struct ListOperations(
7149        RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
7150    );
7151
7152    impl ListOperations {
7153        pub(crate) fn new(
7154            stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
7155        ) -> Self {
7156            Self(RequestBuilder::new(stub))
7157        }
7158
7159        /// Sets the full request, replacing any prior values.
7160        pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
7161            mut self,
7162            v: V,
7163        ) -> Self {
7164            self.0.request = v.into();
7165            self
7166        }
7167
7168        /// Sets all the options, replacing any prior values.
7169        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7170            self.0.options = v.into();
7171            self
7172        }
7173
7174        /// Sends the request.
7175        pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
7176            (*self.0.stub)
7177                .list_operations(self.0.request, self.0.options)
7178                .await
7179                .map(crate::Response::into_body)
7180        }
7181
7182        /// Streams each page in the collection.
7183        pub fn by_page(
7184            self,
7185        ) -> impl google_cloud_gax::paginator::Paginator<
7186            google_cloud_longrunning::model::ListOperationsResponse,
7187            crate::Error,
7188        > {
7189            use std::clone::Clone;
7190            let token = self.0.request.page_token.clone();
7191            let execute = move |token: String| {
7192                let mut builder = self.clone();
7193                builder.0.request = builder.0.request.set_page_token(token);
7194                builder.send()
7195            };
7196            google_cloud_gax::paginator::internal::new_paginator(token, execute)
7197        }
7198
7199        /// Streams each item in the collection.
7200        pub fn by_item(
7201            self,
7202        ) -> impl google_cloud_gax::paginator::ItemPaginator<
7203            google_cloud_longrunning::model::ListOperationsResponse,
7204            crate::Error,
7205        > {
7206            use google_cloud_gax::paginator::Paginator;
7207            self.by_page().items()
7208        }
7209
7210        /// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
7211        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7212            self.0.request.name = v.into();
7213            self
7214        }
7215
7216        /// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::filter].
7217        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
7218            self.0.request.filter = v.into();
7219            self
7220        }
7221
7222        /// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
7223        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
7224            self.0.request.page_size = v.into();
7225            self
7226        }
7227
7228        /// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
7229        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
7230            self.0.request.page_token = v.into();
7231            self
7232        }
7233
7234        /// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
7235        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
7236            self.0.request.return_partial_success = v.into();
7237            self
7238        }
7239    }
7240
7241    #[doc(hidden)]
7242    impl crate::RequestBuilder for ListOperations {
7243        fn request_options(&mut self) -> &mut crate::RequestOptions {
7244            &mut self.0.options
7245        }
7246    }
7247
7248    /// The request builder for [EngineService::get_operation][crate::client::EngineService::get_operation] calls.
7249    ///
7250    /// # Example
7251    /// ```
7252    /// # use google_cloud_discoveryengine_v1::builder::engine_service::GetOperation;
7253    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
7254    ///
7255    /// let builder = prepare_request_builder();
7256    /// let response = builder.send().await?;
7257    /// # Ok(()) }
7258    ///
7259    /// fn prepare_request_builder() -> GetOperation {
7260    ///   # panic!();
7261    ///   // ... details omitted ...
7262    /// }
7263    /// ```
7264    #[derive(Clone, Debug)]
7265    pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
7266
7267    impl GetOperation {
7268        pub(crate) fn new(
7269            stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
7270        ) -> Self {
7271            Self(RequestBuilder::new(stub))
7272        }
7273
7274        /// Sets the full request, replacing any prior values.
7275        pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
7276            mut self,
7277            v: V,
7278        ) -> Self {
7279            self.0.request = v.into();
7280            self
7281        }
7282
7283        /// Sets all the options, replacing any prior values.
7284        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7285            self.0.options = v.into();
7286            self
7287        }
7288
7289        /// Sends the request.
7290        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
7291            (*self.0.stub)
7292                .get_operation(self.0.request, self.0.options)
7293                .await
7294                .map(crate::Response::into_body)
7295        }
7296
7297        /// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
7298        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7299            self.0.request.name = v.into();
7300            self
7301        }
7302    }
7303
7304    #[doc(hidden)]
7305    impl crate::RequestBuilder for GetOperation {
7306        fn request_options(&mut self) -> &mut crate::RequestOptions {
7307            &mut self.0.options
7308        }
7309    }
7310
7311    /// The request builder for [EngineService::cancel_operation][crate::client::EngineService::cancel_operation] calls.
7312    ///
7313    /// # Example
7314    /// ```
7315    /// # use google_cloud_discoveryengine_v1::builder::engine_service::CancelOperation;
7316    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
7317    ///
7318    /// let builder = prepare_request_builder();
7319    /// let response = builder.send().await?;
7320    /// # Ok(()) }
7321    ///
7322    /// fn prepare_request_builder() -> CancelOperation {
7323    ///   # panic!();
7324    ///   // ... details omitted ...
7325    /// }
7326    /// ```
7327    #[derive(Clone, Debug)]
7328    pub struct CancelOperation(
7329        RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
7330    );
7331
7332    impl CancelOperation {
7333        pub(crate) fn new(
7334            stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
7335        ) -> Self {
7336            Self(RequestBuilder::new(stub))
7337        }
7338
7339        /// Sets the full request, replacing any prior values.
7340        pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
7341            mut self,
7342            v: V,
7343        ) -> Self {
7344            self.0.request = v.into();
7345            self
7346        }
7347
7348        /// Sets all the options, replacing any prior values.
7349        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7350            self.0.options = v.into();
7351            self
7352        }
7353
7354        /// Sends the request.
7355        pub async fn send(self) -> Result<()> {
7356            (*self.0.stub)
7357                .cancel_operation(self.0.request, self.0.options)
7358                .await
7359                .map(crate::Response::into_body)
7360        }
7361
7362        /// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::name].
7363        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7364            self.0.request.name = v.into();
7365            self
7366        }
7367    }
7368
7369    #[doc(hidden)]
7370    impl crate::RequestBuilder for CancelOperation {
7371        fn request_options(&mut self) -> &mut crate::RequestOptions {
7372            &mut self.0.options
7373        }
7374    }
7375}
7376
7377/// Request and client builders for [GroundedGenerationService][crate::client::GroundedGenerationService].
7378#[cfg(feature = "grounded-generation-service")]
7379#[cfg_attr(docsrs, doc(cfg(feature = "grounded-generation-service")))]
7380pub mod grounded_generation_service {
7381    use crate::Result;
7382
7383    /// A builder for [GroundedGenerationService][crate::client::GroundedGenerationService].
7384    ///
7385    /// ```
7386    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
7387    /// # use google_cloud_discoveryengine_v1::*;
7388    /// # use builder::grounded_generation_service::ClientBuilder;
7389    /// # use client::GroundedGenerationService;
7390    /// let builder : ClientBuilder = GroundedGenerationService::builder();
7391    /// let client = builder
7392    ///     .with_endpoint("https://discoveryengine.googleapis.com")
7393    ///     .build().await?;
7394    /// # Ok(()) }
7395    /// ```
7396    pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
7397
7398    pub(crate) mod client {
7399        use super::super::super::client::GroundedGenerationService;
7400        pub struct Factory;
7401        impl crate::ClientFactory for Factory {
7402            type Client = GroundedGenerationService;
7403            type Credentials = gaxi::options::Credentials;
7404            async fn build(
7405                self,
7406                config: gaxi::options::ClientConfig,
7407            ) -> crate::ClientBuilderResult<Self::Client> {
7408                Self::Client::new(config).await
7409            }
7410        }
7411    }
7412
7413    /// Common implementation for [crate::client::GroundedGenerationService] request builders.
7414    #[derive(Clone, Debug)]
7415    pub(crate) struct RequestBuilder<R: std::default::Default> {
7416        stub: std::sync::Arc<dyn super::super::stub::dynamic::GroundedGenerationService>,
7417        request: R,
7418        options: crate::RequestOptions,
7419    }
7420
7421    impl<R> RequestBuilder<R>
7422    where
7423        R: std::default::Default,
7424    {
7425        pub(crate) fn new(
7426            stub: std::sync::Arc<dyn super::super::stub::dynamic::GroundedGenerationService>,
7427        ) -> Self {
7428            Self {
7429                stub,
7430                request: R::default(),
7431                options: crate::RequestOptions::default(),
7432            }
7433        }
7434    }
7435
7436    /// The request builder for [GroundedGenerationService::generate_grounded_content][crate::client::GroundedGenerationService::generate_grounded_content] calls.
7437    ///
7438    /// # Example
7439    /// ```
7440    /// # use google_cloud_discoveryengine_v1::builder::grounded_generation_service::GenerateGroundedContent;
7441    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
7442    ///
7443    /// let builder = prepare_request_builder();
7444    /// let response = builder.send().await?;
7445    /// # Ok(()) }
7446    ///
7447    /// fn prepare_request_builder() -> GenerateGroundedContent {
7448    ///   # panic!();
7449    ///   // ... details omitted ...
7450    /// }
7451    /// ```
7452    #[derive(Clone, Debug)]
7453    pub struct GenerateGroundedContent(
7454        RequestBuilder<crate::model::GenerateGroundedContentRequest>,
7455    );
7456
7457    impl GenerateGroundedContent {
7458        pub(crate) fn new(
7459            stub: std::sync::Arc<dyn super::super::stub::dynamic::GroundedGenerationService>,
7460        ) -> Self {
7461            Self(RequestBuilder::new(stub))
7462        }
7463
7464        /// Sets the full request, replacing any prior values.
7465        pub fn with_request<V: Into<crate::model::GenerateGroundedContentRequest>>(
7466            mut self,
7467            v: V,
7468        ) -> Self {
7469            self.0.request = v.into();
7470            self
7471        }
7472
7473        /// Sets all the options, replacing any prior values.
7474        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7475            self.0.options = v.into();
7476            self
7477        }
7478
7479        /// Sends the request.
7480        pub async fn send(self) -> Result<crate::model::GenerateGroundedContentResponse> {
7481            (*self.0.stub)
7482                .generate_grounded_content(self.0.request, self.0.options)
7483                .await
7484                .map(crate::Response::into_body)
7485        }
7486
7487        /// Sets the value of [location][crate::model::GenerateGroundedContentRequest::location].
7488        ///
7489        /// This is a **required** field for requests.
7490        pub fn set_location<T: Into<std::string::String>>(mut self, v: T) -> Self {
7491            self.0.request.location = v.into();
7492            self
7493        }
7494
7495        /// Sets the value of [system_instruction][crate::model::GenerateGroundedContentRequest::system_instruction].
7496        pub fn set_system_instruction<T>(mut self, v: T) -> Self
7497        where
7498            T: std::convert::Into<crate::model::GroundedGenerationContent>,
7499        {
7500            self.0.request.system_instruction = std::option::Option::Some(v.into());
7501            self
7502        }
7503
7504        /// Sets or clears the value of [system_instruction][crate::model::GenerateGroundedContentRequest::system_instruction].
7505        pub fn set_or_clear_system_instruction<T>(mut self, v: std::option::Option<T>) -> Self
7506        where
7507            T: std::convert::Into<crate::model::GroundedGenerationContent>,
7508        {
7509            self.0.request.system_instruction = v.map(|x| x.into());
7510            self
7511        }
7512
7513        /// Sets the value of [contents][crate::model::GenerateGroundedContentRequest::contents].
7514        pub fn set_contents<T, V>(mut self, v: T) -> Self
7515        where
7516            T: std::iter::IntoIterator<Item = V>,
7517            V: std::convert::Into<crate::model::GroundedGenerationContent>,
7518        {
7519            use std::iter::Iterator;
7520            self.0.request.contents = v.into_iter().map(|i| i.into()).collect();
7521            self
7522        }
7523
7524        /// Sets the value of [generation_spec][crate::model::GenerateGroundedContentRequest::generation_spec].
7525        pub fn set_generation_spec<T>(mut self, v: T) -> Self
7526        where
7527            T: std::convert::Into<crate::model::generate_grounded_content_request::GenerationSpec>,
7528        {
7529            self.0.request.generation_spec = std::option::Option::Some(v.into());
7530            self
7531        }
7532
7533        /// Sets or clears the value of [generation_spec][crate::model::GenerateGroundedContentRequest::generation_spec].
7534        pub fn set_or_clear_generation_spec<T>(mut self, v: std::option::Option<T>) -> Self
7535        where
7536            T: std::convert::Into<crate::model::generate_grounded_content_request::GenerationSpec>,
7537        {
7538            self.0.request.generation_spec = v.map(|x| x.into());
7539            self
7540        }
7541
7542        /// Sets the value of [grounding_spec][crate::model::GenerateGroundedContentRequest::grounding_spec].
7543        pub fn set_grounding_spec<T>(mut self, v: T) -> Self
7544        where
7545            T: std::convert::Into<crate::model::generate_grounded_content_request::GroundingSpec>,
7546        {
7547            self.0.request.grounding_spec = std::option::Option::Some(v.into());
7548            self
7549        }
7550
7551        /// Sets or clears the value of [grounding_spec][crate::model::GenerateGroundedContentRequest::grounding_spec].
7552        pub fn set_or_clear_grounding_spec<T>(mut self, v: std::option::Option<T>) -> Self
7553        where
7554            T: std::convert::Into<crate::model::generate_grounded_content_request::GroundingSpec>,
7555        {
7556            self.0.request.grounding_spec = v.map(|x| x.into());
7557            self
7558        }
7559
7560        /// Sets the value of [user_labels][crate::model::GenerateGroundedContentRequest::user_labels].
7561        pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
7562        where
7563            T: std::iter::IntoIterator<Item = (K, V)>,
7564            K: std::convert::Into<std::string::String>,
7565            V: std::convert::Into<std::string::String>,
7566        {
7567            self.0.request.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
7568            self
7569        }
7570    }
7571
7572    #[doc(hidden)]
7573    impl crate::RequestBuilder for GenerateGroundedContent {
7574        fn request_options(&mut self) -> &mut crate::RequestOptions {
7575            &mut self.0.options
7576        }
7577    }
7578
7579    /// The request builder for [GroundedGenerationService::check_grounding][crate::client::GroundedGenerationService::check_grounding] calls.
7580    ///
7581    /// # Example
7582    /// ```
7583    /// # use google_cloud_discoveryengine_v1::builder::grounded_generation_service::CheckGrounding;
7584    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
7585    ///
7586    /// let builder = prepare_request_builder();
7587    /// let response = builder.send().await?;
7588    /// # Ok(()) }
7589    ///
7590    /// fn prepare_request_builder() -> CheckGrounding {
7591    ///   # panic!();
7592    ///   // ... details omitted ...
7593    /// }
7594    /// ```
7595    #[derive(Clone, Debug)]
7596    pub struct CheckGrounding(RequestBuilder<crate::model::CheckGroundingRequest>);
7597
7598    impl CheckGrounding {
7599        pub(crate) fn new(
7600            stub: std::sync::Arc<dyn super::super::stub::dynamic::GroundedGenerationService>,
7601        ) -> Self {
7602            Self(RequestBuilder::new(stub))
7603        }
7604
7605        /// Sets the full request, replacing any prior values.
7606        pub fn with_request<V: Into<crate::model::CheckGroundingRequest>>(mut self, v: V) -> Self {
7607            self.0.request = v.into();
7608            self
7609        }
7610
7611        /// Sets all the options, replacing any prior values.
7612        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7613            self.0.options = v.into();
7614            self
7615        }
7616
7617        /// Sends the request.
7618        pub async fn send(self) -> Result<crate::model::CheckGroundingResponse> {
7619            (*self.0.stub)
7620                .check_grounding(self.0.request, self.0.options)
7621                .await
7622                .map(crate::Response::into_body)
7623        }
7624
7625        /// Sets the value of [grounding_config][crate::model::CheckGroundingRequest::grounding_config].
7626        ///
7627        /// This is a **required** field for requests.
7628        pub fn set_grounding_config<T: Into<std::string::String>>(mut self, v: T) -> Self {
7629            self.0.request.grounding_config = v.into();
7630            self
7631        }
7632
7633        /// Sets the value of [answer_candidate][crate::model::CheckGroundingRequest::answer_candidate].
7634        pub fn set_answer_candidate<T: Into<std::string::String>>(mut self, v: T) -> Self {
7635            self.0.request.answer_candidate = v.into();
7636            self
7637        }
7638
7639        /// Sets the value of [facts][crate::model::CheckGroundingRequest::facts].
7640        pub fn set_facts<T, V>(mut self, v: T) -> Self
7641        where
7642            T: std::iter::IntoIterator<Item = V>,
7643            V: std::convert::Into<crate::model::GroundingFact>,
7644        {
7645            use std::iter::Iterator;
7646            self.0.request.facts = v.into_iter().map(|i| i.into()).collect();
7647            self
7648        }
7649
7650        /// Sets the value of [grounding_spec][crate::model::CheckGroundingRequest::grounding_spec].
7651        pub fn set_grounding_spec<T>(mut self, v: T) -> Self
7652        where
7653            T: std::convert::Into<crate::model::CheckGroundingSpec>,
7654        {
7655            self.0.request.grounding_spec = std::option::Option::Some(v.into());
7656            self
7657        }
7658
7659        /// Sets or clears the value of [grounding_spec][crate::model::CheckGroundingRequest::grounding_spec].
7660        pub fn set_or_clear_grounding_spec<T>(mut self, v: std::option::Option<T>) -> Self
7661        where
7662            T: std::convert::Into<crate::model::CheckGroundingSpec>,
7663        {
7664            self.0.request.grounding_spec = v.map(|x| x.into());
7665            self
7666        }
7667
7668        /// Sets the value of [user_labels][crate::model::CheckGroundingRequest::user_labels].
7669        pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
7670        where
7671            T: std::iter::IntoIterator<Item = (K, V)>,
7672            K: std::convert::Into<std::string::String>,
7673            V: std::convert::Into<std::string::String>,
7674        {
7675            self.0.request.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
7676            self
7677        }
7678    }
7679
7680    #[doc(hidden)]
7681    impl crate::RequestBuilder for CheckGrounding {
7682        fn request_options(&mut self) -> &mut crate::RequestOptions {
7683            &mut self.0.options
7684        }
7685    }
7686
7687    /// The request builder for [GroundedGenerationService::list_operations][crate::client::GroundedGenerationService::list_operations] calls.
7688    ///
7689    /// # Example
7690    /// ```
7691    /// # use google_cloud_discoveryengine_v1::builder::grounded_generation_service::ListOperations;
7692    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
7693    /// use google_cloud_gax::paginator::ItemPaginator;
7694    ///
7695    /// let builder = prepare_request_builder();
7696    /// let mut items = builder.by_item();
7697    /// while let Some(result) = items.next().await {
7698    ///   let item = result?;
7699    /// }
7700    /// # Ok(()) }
7701    ///
7702    /// fn prepare_request_builder() -> ListOperations {
7703    ///   # panic!();
7704    ///   // ... details omitted ...
7705    /// }
7706    /// ```
7707    #[derive(Clone, Debug)]
7708    pub struct ListOperations(
7709        RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
7710    );
7711
7712    impl ListOperations {
7713        pub(crate) fn new(
7714            stub: std::sync::Arc<dyn super::super::stub::dynamic::GroundedGenerationService>,
7715        ) -> Self {
7716            Self(RequestBuilder::new(stub))
7717        }
7718
7719        /// Sets the full request, replacing any prior values.
7720        pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
7721            mut self,
7722            v: V,
7723        ) -> Self {
7724            self.0.request = v.into();
7725            self
7726        }
7727
7728        /// Sets all the options, replacing any prior values.
7729        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7730            self.0.options = v.into();
7731            self
7732        }
7733
7734        /// Sends the request.
7735        pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
7736            (*self.0.stub)
7737                .list_operations(self.0.request, self.0.options)
7738                .await
7739                .map(crate::Response::into_body)
7740        }
7741
7742        /// Streams each page in the collection.
7743        pub fn by_page(
7744            self,
7745        ) -> impl google_cloud_gax::paginator::Paginator<
7746            google_cloud_longrunning::model::ListOperationsResponse,
7747            crate::Error,
7748        > {
7749            use std::clone::Clone;
7750            let token = self.0.request.page_token.clone();
7751            let execute = move |token: String| {
7752                let mut builder = self.clone();
7753                builder.0.request = builder.0.request.set_page_token(token);
7754                builder.send()
7755            };
7756            google_cloud_gax::paginator::internal::new_paginator(token, execute)
7757        }
7758
7759        /// Streams each item in the collection.
7760        pub fn by_item(
7761            self,
7762        ) -> impl google_cloud_gax::paginator::ItemPaginator<
7763            google_cloud_longrunning::model::ListOperationsResponse,
7764            crate::Error,
7765        > {
7766            use google_cloud_gax::paginator::Paginator;
7767            self.by_page().items()
7768        }
7769
7770        /// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
7771        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7772            self.0.request.name = v.into();
7773            self
7774        }
7775
7776        /// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::filter].
7777        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
7778            self.0.request.filter = v.into();
7779            self
7780        }
7781
7782        /// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
7783        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
7784            self.0.request.page_size = v.into();
7785            self
7786        }
7787
7788        /// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
7789        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
7790            self.0.request.page_token = v.into();
7791            self
7792        }
7793
7794        /// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
7795        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
7796            self.0.request.return_partial_success = v.into();
7797            self
7798        }
7799    }
7800
7801    #[doc(hidden)]
7802    impl crate::RequestBuilder for ListOperations {
7803        fn request_options(&mut self) -> &mut crate::RequestOptions {
7804            &mut self.0.options
7805        }
7806    }
7807
7808    /// The request builder for [GroundedGenerationService::get_operation][crate::client::GroundedGenerationService::get_operation] calls.
7809    ///
7810    /// # Example
7811    /// ```
7812    /// # use google_cloud_discoveryengine_v1::builder::grounded_generation_service::GetOperation;
7813    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
7814    ///
7815    /// let builder = prepare_request_builder();
7816    /// let response = builder.send().await?;
7817    /// # Ok(()) }
7818    ///
7819    /// fn prepare_request_builder() -> GetOperation {
7820    ///   # panic!();
7821    ///   // ... details omitted ...
7822    /// }
7823    /// ```
7824    #[derive(Clone, Debug)]
7825    pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
7826
7827    impl GetOperation {
7828        pub(crate) fn new(
7829            stub: std::sync::Arc<dyn super::super::stub::dynamic::GroundedGenerationService>,
7830        ) -> Self {
7831            Self(RequestBuilder::new(stub))
7832        }
7833
7834        /// Sets the full request, replacing any prior values.
7835        pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
7836            mut self,
7837            v: V,
7838        ) -> Self {
7839            self.0.request = v.into();
7840            self
7841        }
7842
7843        /// Sets all the options, replacing any prior values.
7844        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7845            self.0.options = v.into();
7846            self
7847        }
7848
7849        /// Sends the request.
7850        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
7851            (*self.0.stub)
7852                .get_operation(self.0.request, self.0.options)
7853                .await
7854                .map(crate::Response::into_body)
7855        }
7856
7857        /// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
7858        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7859            self.0.request.name = v.into();
7860            self
7861        }
7862    }
7863
7864    #[doc(hidden)]
7865    impl crate::RequestBuilder for GetOperation {
7866        fn request_options(&mut self) -> &mut crate::RequestOptions {
7867            &mut self.0.options
7868        }
7869    }
7870
7871    /// The request builder for [GroundedGenerationService::cancel_operation][crate::client::GroundedGenerationService::cancel_operation] calls.
7872    ///
7873    /// # Example
7874    /// ```
7875    /// # use google_cloud_discoveryengine_v1::builder::grounded_generation_service::CancelOperation;
7876    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
7877    ///
7878    /// let builder = prepare_request_builder();
7879    /// let response = builder.send().await?;
7880    /// # Ok(()) }
7881    ///
7882    /// fn prepare_request_builder() -> CancelOperation {
7883    ///   # panic!();
7884    ///   // ... details omitted ...
7885    /// }
7886    /// ```
7887    #[derive(Clone, Debug)]
7888    pub struct CancelOperation(
7889        RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
7890    );
7891
7892    impl CancelOperation {
7893        pub(crate) fn new(
7894            stub: std::sync::Arc<dyn super::super::stub::dynamic::GroundedGenerationService>,
7895        ) -> Self {
7896            Self(RequestBuilder::new(stub))
7897        }
7898
7899        /// Sets the full request, replacing any prior values.
7900        pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
7901            mut self,
7902            v: V,
7903        ) -> Self {
7904            self.0.request = v.into();
7905            self
7906        }
7907
7908        /// Sets all the options, replacing any prior values.
7909        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7910            self.0.options = v.into();
7911            self
7912        }
7913
7914        /// Sends the request.
7915        pub async fn send(self) -> Result<()> {
7916            (*self.0.stub)
7917                .cancel_operation(self.0.request, self.0.options)
7918                .await
7919                .map(crate::Response::into_body)
7920        }
7921
7922        /// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::name].
7923        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7924            self.0.request.name = v.into();
7925            self
7926        }
7927    }
7928
7929    #[doc(hidden)]
7930    impl crate::RequestBuilder for CancelOperation {
7931        fn request_options(&mut self) -> &mut crate::RequestOptions {
7932            &mut self.0.options
7933        }
7934    }
7935}
7936
7937/// Request and client builders for [IdentityMappingStoreService][crate::client::IdentityMappingStoreService].
7938#[cfg(feature = "identity-mapping-store-service")]
7939#[cfg_attr(docsrs, doc(cfg(feature = "identity-mapping-store-service")))]
7940pub mod identity_mapping_store_service {
7941    use crate::Result;
7942
7943    /// A builder for [IdentityMappingStoreService][crate::client::IdentityMappingStoreService].
7944    ///
7945    /// ```
7946    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
7947    /// # use google_cloud_discoveryengine_v1::*;
7948    /// # use builder::identity_mapping_store_service::ClientBuilder;
7949    /// # use client::IdentityMappingStoreService;
7950    /// let builder : ClientBuilder = IdentityMappingStoreService::builder();
7951    /// let client = builder
7952    ///     .with_endpoint("https://discoveryengine.googleapis.com")
7953    ///     .build().await?;
7954    /// # Ok(()) }
7955    /// ```
7956    pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
7957
7958    pub(crate) mod client {
7959        use super::super::super::client::IdentityMappingStoreService;
7960        pub struct Factory;
7961        impl crate::ClientFactory for Factory {
7962            type Client = IdentityMappingStoreService;
7963            type Credentials = gaxi::options::Credentials;
7964            async fn build(
7965                self,
7966                config: gaxi::options::ClientConfig,
7967            ) -> crate::ClientBuilderResult<Self::Client> {
7968                Self::Client::new(config).await
7969            }
7970        }
7971    }
7972
7973    /// Common implementation for [crate::client::IdentityMappingStoreService] request builders.
7974    #[derive(Clone, Debug)]
7975    pub(crate) struct RequestBuilder<R: std::default::Default> {
7976        stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
7977        request: R,
7978        options: crate::RequestOptions,
7979    }
7980
7981    impl<R> RequestBuilder<R>
7982    where
7983        R: std::default::Default,
7984    {
7985        pub(crate) fn new(
7986            stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
7987        ) -> Self {
7988            Self {
7989                stub,
7990                request: R::default(),
7991                options: crate::RequestOptions::default(),
7992            }
7993        }
7994    }
7995
7996    /// The request builder for [IdentityMappingStoreService::create_identity_mapping_store][crate::client::IdentityMappingStoreService::create_identity_mapping_store] calls.
7997    ///
7998    /// # Example
7999    /// ```
8000    /// # use google_cloud_discoveryengine_v1::builder::identity_mapping_store_service::CreateIdentityMappingStore;
8001    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
8002    ///
8003    /// let builder = prepare_request_builder();
8004    /// let response = builder.send().await?;
8005    /// # Ok(()) }
8006    ///
8007    /// fn prepare_request_builder() -> CreateIdentityMappingStore {
8008    ///   # panic!();
8009    ///   // ... details omitted ...
8010    /// }
8011    /// ```
8012    #[derive(Clone, Debug)]
8013    pub struct CreateIdentityMappingStore(
8014        RequestBuilder<crate::model::CreateIdentityMappingStoreRequest>,
8015    );
8016
8017    impl CreateIdentityMappingStore {
8018        pub(crate) fn new(
8019            stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
8020        ) -> Self {
8021            Self(RequestBuilder::new(stub))
8022        }
8023
8024        /// Sets the full request, replacing any prior values.
8025        pub fn with_request<V: Into<crate::model::CreateIdentityMappingStoreRequest>>(
8026            mut self,
8027            v: V,
8028        ) -> Self {
8029            self.0.request = v.into();
8030            self
8031        }
8032
8033        /// Sets all the options, replacing any prior values.
8034        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
8035            self.0.options = v.into();
8036            self
8037        }
8038
8039        /// Sends the request.
8040        pub async fn send(self) -> Result<crate::model::IdentityMappingStore> {
8041            (*self.0.stub)
8042                .create_identity_mapping_store(self.0.request, self.0.options)
8043                .await
8044                .map(crate::Response::into_body)
8045        }
8046
8047        /// Sets the value of [parent][crate::model::CreateIdentityMappingStoreRequest::parent].
8048        ///
8049        /// This is a **required** field for requests.
8050        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
8051            self.0.request.parent = v.into();
8052            self
8053        }
8054
8055        /// Sets the value of [identity_mapping_store_id][crate::model::CreateIdentityMappingStoreRequest::identity_mapping_store_id].
8056        ///
8057        /// This is a **required** field for requests.
8058        pub fn set_identity_mapping_store_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
8059            self.0.request.identity_mapping_store_id = v.into();
8060            self
8061        }
8062
8063        /// Sets the value of [identity_mapping_store][crate::model::CreateIdentityMappingStoreRequest::identity_mapping_store].
8064        ///
8065        /// This is a **required** field for requests.
8066        pub fn set_identity_mapping_store<T>(mut self, v: T) -> Self
8067        where
8068            T: std::convert::Into<crate::model::IdentityMappingStore>,
8069        {
8070            self.0.request.identity_mapping_store = std::option::Option::Some(v.into());
8071            self
8072        }
8073
8074        /// Sets or clears the value of [identity_mapping_store][crate::model::CreateIdentityMappingStoreRequest::identity_mapping_store].
8075        ///
8076        /// This is a **required** field for requests.
8077        pub fn set_or_clear_identity_mapping_store<T>(mut self, v: std::option::Option<T>) -> Self
8078        where
8079            T: std::convert::Into<crate::model::IdentityMappingStore>,
8080        {
8081            self.0.request.identity_mapping_store = v.map(|x| x.into());
8082            self
8083        }
8084
8085        /// Sets the value of [cmek_options][crate::model::CreateIdentityMappingStoreRequest::cmek_options].
8086        ///
8087        /// Note that all the setters affecting `cmek_options` are
8088        /// mutually exclusive.
8089        pub fn set_cmek_options<
8090            T: Into<Option<crate::model::create_identity_mapping_store_request::CmekOptions>>,
8091        >(
8092            mut self,
8093            v: T,
8094        ) -> Self {
8095            self.0.request.cmek_options = v.into();
8096            self
8097        }
8098
8099        /// Sets the value of [cmek_options][crate::model::CreateIdentityMappingStoreRequest::cmek_options]
8100        /// to hold a `CmekConfigName`.
8101        ///
8102        /// Note that all the setters affecting `cmek_options` are
8103        /// mutually exclusive.
8104        pub fn set_cmek_config_name<T: std::convert::Into<std::string::String>>(
8105            mut self,
8106            v: T,
8107        ) -> Self {
8108            self.0.request = self.0.request.set_cmek_config_name(v);
8109            self
8110        }
8111
8112        /// Sets the value of [cmek_options][crate::model::CreateIdentityMappingStoreRequest::cmek_options]
8113        /// to hold a `DisableCmek`.
8114        ///
8115        /// Note that all the setters affecting `cmek_options` are
8116        /// mutually exclusive.
8117        pub fn set_disable_cmek<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
8118            self.0.request = self.0.request.set_disable_cmek(v);
8119            self
8120        }
8121    }
8122
8123    #[doc(hidden)]
8124    impl crate::RequestBuilder for CreateIdentityMappingStore {
8125        fn request_options(&mut self) -> &mut crate::RequestOptions {
8126            &mut self.0.options
8127        }
8128    }
8129
8130    /// The request builder for [IdentityMappingStoreService::get_identity_mapping_store][crate::client::IdentityMappingStoreService::get_identity_mapping_store] calls.
8131    ///
8132    /// # Example
8133    /// ```
8134    /// # use google_cloud_discoveryengine_v1::builder::identity_mapping_store_service::GetIdentityMappingStore;
8135    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
8136    ///
8137    /// let builder = prepare_request_builder();
8138    /// let response = builder.send().await?;
8139    /// # Ok(()) }
8140    ///
8141    /// fn prepare_request_builder() -> GetIdentityMappingStore {
8142    ///   # panic!();
8143    ///   // ... details omitted ...
8144    /// }
8145    /// ```
8146    #[derive(Clone, Debug)]
8147    pub struct GetIdentityMappingStore(
8148        RequestBuilder<crate::model::GetIdentityMappingStoreRequest>,
8149    );
8150
8151    impl GetIdentityMappingStore {
8152        pub(crate) fn new(
8153            stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
8154        ) -> Self {
8155            Self(RequestBuilder::new(stub))
8156        }
8157
8158        /// Sets the full request, replacing any prior values.
8159        pub fn with_request<V: Into<crate::model::GetIdentityMappingStoreRequest>>(
8160            mut self,
8161            v: V,
8162        ) -> Self {
8163            self.0.request = v.into();
8164            self
8165        }
8166
8167        /// Sets all the options, replacing any prior values.
8168        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
8169            self.0.options = v.into();
8170            self
8171        }
8172
8173        /// Sends the request.
8174        pub async fn send(self) -> Result<crate::model::IdentityMappingStore> {
8175            (*self.0.stub)
8176                .get_identity_mapping_store(self.0.request, self.0.options)
8177                .await
8178                .map(crate::Response::into_body)
8179        }
8180
8181        /// Sets the value of [name][crate::model::GetIdentityMappingStoreRequest::name].
8182        ///
8183        /// This is a **required** field for requests.
8184        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
8185            self.0.request.name = v.into();
8186            self
8187        }
8188    }
8189
8190    #[doc(hidden)]
8191    impl crate::RequestBuilder for GetIdentityMappingStore {
8192        fn request_options(&mut self) -> &mut crate::RequestOptions {
8193            &mut self.0.options
8194        }
8195    }
8196
8197    /// The request builder for [IdentityMappingStoreService::delete_identity_mapping_store][crate::client::IdentityMappingStoreService::delete_identity_mapping_store] calls.
8198    ///
8199    /// # Example
8200    /// ```
8201    /// # use google_cloud_discoveryengine_v1::builder::identity_mapping_store_service::DeleteIdentityMappingStore;
8202    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
8203    /// use google_cloud_lro::Poller;
8204    ///
8205    /// let builder = prepare_request_builder();
8206    /// let response = builder.poller().until_done().await?;
8207    /// # Ok(()) }
8208    ///
8209    /// fn prepare_request_builder() -> DeleteIdentityMappingStore {
8210    ///   # panic!();
8211    ///   // ... details omitted ...
8212    /// }
8213    /// ```
8214    #[derive(Clone, Debug)]
8215    pub struct DeleteIdentityMappingStore(
8216        RequestBuilder<crate::model::DeleteIdentityMappingStoreRequest>,
8217    );
8218
8219    impl DeleteIdentityMappingStore {
8220        pub(crate) fn new(
8221            stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
8222        ) -> Self {
8223            Self(RequestBuilder::new(stub))
8224        }
8225
8226        /// Sets the full request, replacing any prior values.
8227        pub fn with_request<V: Into<crate::model::DeleteIdentityMappingStoreRequest>>(
8228            mut self,
8229            v: V,
8230        ) -> Self {
8231            self.0.request = v.into();
8232            self
8233        }
8234
8235        /// Sets all the options, replacing any prior values.
8236        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
8237            self.0.options = v.into();
8238            self
8239        }
8240
8241        /// Sends the request.
8242        ///
8243        /// # Long running operations
8244        ///
8245        /// This starts, but does not poll, a longrunning operation. More information
8246        /// on [delete_identity_mapping_store][crate::client::IdentityMappingStoreService::delete_identity_mapping_store].
8247        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
8248            (*self.0.stub)
8249                .delete_identity_mapping_store(self.0.request, self.0.options)
8250                .await
8251                .map(crate::Response::into_body)
8252        }
8253
8254        /// Creates a [Poller][google_cloud_lro::Poller] to work with `delete_identity_mapping_store`.
8255        pub fn poller(
8256            self,
8257        ) -> impl google_cloud_lro::Poller<(), crate::model::DeleteIdentityMappingStoreMetadata>
8258        {
8259            type Operation = google_cloud_lro::internal::Operation<
8260                wkt::Empty,
8261                crate::model::DeleteIdentityMappingStoreMetadata,
8262            >;
8263            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
8264            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
8265
8266            let stub = self.0.stub.clone();
8267            let mut options = self.0.options.clone();
8268            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
8269            let query = move |name| {
8270                let stub = stub.clone();
8271                let options = options.clone();
8272                async {
8273                    let op = GetOperation::new(stub)
8274                        .set_name(name)
8275                        .with_options(options)
8276                        .send()
8277                        .await?;
8278                    Ok(Operation::new(op))
8279                }
8280            };
8281
8282            let start = move || async {
8283                let op = self.send().await?;
8284                Ok(Operation::new(op))
8285            };
8286
8287            google_cloud_lro::internal::new_unit_response_poller(
8288                polling_error_policy,
8289                polling_backoff_policy,
8290                start,
8291                query,
8292            )
8293        }
8294
8295        /// Sets the value of [name][crate::model::DeleteIdentityMappingStoreRequest::name].
8296        ///
8297        /// This is a **required** field for requests.
8298        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
8299            self.0.request.name = v.into();
8300            self
8301        }
8302    }
8303
8304    #[doc(hidden)]
8305    impl crate::RequestBuilder for DeleteIdentityMappingStore {
8306        fn request_options(&mut self) -> &mut crate::RequestOptions {
8307            &mut self.0.options
8308        }
8309    }
8310
8311    /// The request builder for [IdentityMappingStoreService::import_identity_mappings][crate::client::IdentityMappingStoreService::import_identity_mappings] calls.
8312    ///
8313    /// # Example
8314    /// ```
8315    /// # use google_cloud_discoveryengine_v1::builder::identity_mapping_store_service::ImportIdentityMappings;
8316    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
8317    /// use google_cloud_lro::Poller;
8318    ///
8319    /// let builder = prepare_request_builder();
8320    /// let response = builder.poller().until_done().await?;
8321    /// # Ok(()) }
8322    ///
8323    /// fn prepare_request_builder() -> ImportIdentityMappings {
8324    ///   # panic!();
8325    ///   // ... details omitted ...
8326    /// }
8327    /// ```
8328    #[derive(Clone, Debug)]
8329    pub struct ImportIdentityMappings(RequestBuilder<crate::model::ImportIdentityMappingsRequest>);
8330
8331    impl ImportIdentityMappings {
8332        pub(crate) fn new(
8333            stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
8334        ) -> Self {
8335            Self(RequestBuilder::new(stub))
8336        }
8337
8338        /// Sets the full request, replacing any prior values.
8339        pub fn with_request<V: Into<crate::model::ImportIdentityMappingsRequest>>(
8340            mut self,
8341            v: V,
8342        ) -> Self {
8343            self.0.request = v.into();
8344            self
8345        }
8346
8347        /// Sets all the options, replacing any prior values.
8348        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
8349            self.0.options = v.into();
8350            self
8351        }
8352
8353        /// Sends the request.
8354        ///
8355        /// # Long running operations
8356        ///
8357        /// This starts, but does not poll, a longrunning operation. More information
8358        /// on [import_identity_mappings][crate::client::IdentityMappingStoreService::import_identity_mappings].
8359        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
8360            (*self.0.stub)
8361                .import_identity_mappings(self.0.request, self.0.options)
8362                .await
8363                .map(crate::Response::into_body)
8364        }
8365
8366        /// Creates a [Poller][google_cloud_lro::Poller] to work with `import_identity_mappings`.
8367        pub fn poller(
8368            self,
8369        ) -> impl google_cloud_lro::Poller<
8370            crate::model::ImportIdentityMappingsResponse,
8371            crate::model::IdentityMappingEntryOperationMetadata,
8372        > {
8373            type Operation = google_cloud_lro::internal::Operation<
8374                crate::model::ImportIdentityMappingsResponse,
8375                crate::model::IdentityMappingEntryOperationMetadata,
8376            >;
8377            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
8378            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
8379
8380            let stub = self.0.stub.clone();
8381            let mut options = self.0.options.clone();
8382            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
8383            let query = move |name| {
8384                let stub = stub.clone();
8385                let options = options.clone();
8386                async {
8387                    let op = GetOperation::new(stub)
8388                        .set_name(name)
8389                        .with_options(options)
8390                        .send()
8391                        .await?;
8392                    Ok(Operation::new(op))
8393                }
8394            };
8395
8396            let start = move || async {
8397                let op = self.send().await?;
8398                Ok(Operation::new(op))
8399            };
8400
8401            google_cloud_lro::internal::new_poller(
8402                polling_error_policy,
8403                polling_backoff_policy,
8404                start,
8405                query,
8406            )
8407        }
8408
8409        /// Sets the value of [identity_mapping_store][crate::model::ImportIdentityMappingsRequest::identity_mapping_store].
8410        ///
8411        /// This is a **required** field for requests.
8412        pub fn set_identity_mapping_store<T: Into<std::string::String>>(mut self, v: T) -> Self {
8413            self.0.request.identity_mapping_store = v.into();
8414            self
8415        }
8416
8417        /// Sets the value of [source][crate::model::ImportIdentityMappingsRequest::source].
8418        ///
8419        /// Note that all the setters affecting `source` are
8420        /// mutually exclusive.
8421        pub fn set_source<
8422            T: Into<Option<crate::model::import_identity_mappings_request::Source>>,
8423        >(
8424            mut self,
8425            v: T,
8426        ) -> Self {
8427            self.0.request.source = v.into();
8428            self
8429        }
8430
8431        /// Sets the value of [source][crate::model::ImportIdentityMappingsRequest::source]
8432        /// to hold a `InlineSource`.
8433        ///
8434        /// Note that all the setters affecting `source` are
8435        /// mutually exclusive.
8436        pub fn set_inline_source<
8437            T: std::convert::Into<
8438                    std::boxed::Box<crate::model::import_identity_mappings_request::InlineSource>,
8439                >,
8440        >(
8441            mut self,
8442            v: T,
8443        ) -> Self {
8444            self.0.request = self.0.request.set_inline_source(v);
8445            self
8446        }
8447    }
8448
8449    #[doc(hidden)]
8450    impl crate::RequestBuilder for ImportIdentityMappings {
8451        fn request_options(&mut self) -> &mut crate::RequestOptions {
8452            &mut self.0.options
8453        }
8454    }
8455
8456    /// The request builder for [IdentityMappingStoreService::purge_identity_mappings][crate::client::IdentityMappingStoreService::purge_identity_mappings] calls.
8457    ///
8458    /// # Example
8459    /// ```
8460    /// # use google_cloud_discoveryengine_v1::builder::identity_mapping_store_service::PurgeIdentityMappings;
8461    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
8462    /// use google_cloud_lro::Poller;
8463    ///
8464    /// let builder = prepare_request_builder();
8465    /// let response = builder.poller().until_done().await?;
8466    /// # Ok(()) }
8467    ///
8468    /// fn prepare_request_builder() -> PurgeIdentityMappings {
8469    ///   # panic!();
8470    ///   // ... details omitted ...
8471    /// }
8472    /// ```
8473    #[derive(Clone, Debug)]
8474    pub struct PurgeIdentityMappings(RequestBuilder<crate::model::PurgeIdentityMappingsRequest>);
8475
8476    impl PurgeIdentityMappings {
8477        pub(crate) fn new(
8478            stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
8479        ) -> Self {
8480            Self(RequestBuilder::new(stub))
8481        }
8482
8483        /// Sets the full request, replacing any prior values.
8484        pub fn with_request<V: Into<crate::model::PurgeIdentityMappingsRequest>>(
8485            mut self,
8486            v: V,
8487        ) -> Self {
8488            self.0.request = v.into();
8489            self
8490        }
8491
8492        /// Sets all the options, replacing any prior values.
8493        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
8494            self.0.options = v.into();
8495            self
8496        }
8497
8498        /// Sends the request.
8499        ///
8500        /// # Long running operations
8501        ///
8502        /// This starts, but does not poll, a longrunning operation. More information
8503        /// on [purge_identity_mappings][crate::client::IdentityMappingStoreService::purge_identity_mappings].
8504        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
8505            (*self.0.stub)
8506                .purge_identity_mappings(self.0.request, self.0.options)
8507                .await
8508                .map(crate::Response::into_body)
8509        }
8510
8511        /// Creates a [Poller][google_cloud_lro::Poller] to work with `purge_identity_mappings`.
8512        pub fn poller(
8513            self,
8514        ) -> impl google_cloud_lro::Poller<(), crate::model::IdentityMappingEntryOperationMetadata>
8515        {
8516            type Operation = google_cloud_lro::internal::Operation<
8517                wkt::Empty,
8518                crate::model::IdentityMappingEntryOperationMetadata,
8519            >;
8520            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
8521            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
8522
8523            let stub = self.0.stub.clone();
8524            let mut options = self.0.options.clone();
8525            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
8526            let query = move |name| {
8527                let stub = stub.clone();
8528                let options = options.clone();
8529                async {
8530                    let op = GetOperation::new(stub)
8531                        .set_name(name)
8532                        .with_options(options)
8533                        .send()
8534                        .await?;
8535                    Ok(Operation::new(op))
8536                }
8537            };
8538
8539            let start = move || async {
8540                let op = self.send().await?;
8541                Ok(Operation::new(op))
8542            };
8543
8544            google_cloud_lro::internal::new_unit_response_poller(
8545                polling_error_policy,
8546                polling_backoff_policy,
8547                start,
8548                query,
8549            )
8550        }
8551
8552        /// Sets the value of [identity_mapping_store][crate::model::PurgeIdentityMappingsRequest::identity_mapping_store].
8553        ///
8554        /// This is a **required** field for requests.
8555        pub fn set_identity_mapping_store<T: Into<std::string::String>>(mut self, v: T) -> Self {
8556            self.0.request.identity_mapping_store = v.into();
8557            self
8558        }
8559
8560        /// Sets the value of [filter][crate::model::PurgeIdentityMappingsRequest::filter].
8561        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
8562            self.0.request.filter = v.into();
8563            self
8564        }
8565
8566        /// Sets the value of [force][crate::model::PurgeIdentityMappingsRequest::force].
8567        pub fn set_force<T>(mut self, v: T) -> Self
8568        where
8569            T: std::convert::Into<bool>,
8570        {
8571            self.0.request.force = std::option::Option::Some(v.into());
8572            self
8573        }
8574
8575        /// Sets or clears the value of [force][crate::model::PurgeIdentityMappingsRequest::force].
8576        pub fn set_or_clear_force<T>(mut self, v: std::option::Option<T>) -> Self
8577        where
8578            T: std::convert::Into<bool>,
8579        {
8580            self.0.request.force = v.map(|x| x.into());
8581            self
8582        }
8583
8584        /// Sets the value of [source][crate::model::PurgeIdentityMappingsRequest::source].
8585        ///
8586        /// Note that all the setters affecting `source` are
8587        /// mutually exclusive.
8588        pub fn set_source<
8589            T: Into<Option<crate::model::purge_identity_mappings_request::Source>>,
8590        >(
8591            mut self,
8592            v: T,
8593        ) -> Self {
8594            self.0.request.source = v.into();
8595            self
8596        }
8597
8598        /// Sets the value of [source][crate::model::PurgeIdentityMappingsRequest::source]
8599        /// to hold a `InlineSource`.
8600        ///
8601        /// Note that all the setters affecting `source` are
8602        /// mutually exclusive.
8603        pub fn set_inline_source<
8604            T: std::convert::Into<
8605                    std::boxed::Box<crate::model::purge_identity_mappings_request::InlineSource>,
8606                >,
8607        >(
8608            mut self,
8609            v: T,
8610        ) -> Self {
8611            self.0.request = self.0.request.set_inline_source(v);
8612            self
8613        }
8614    }
8615
8616    #[doc(hidden)]
8617    impl crate::RequestBuilder for PurgeIdentityMappings {
8618        fn request_options(&mut self) -> &mut crate::RequestOptions {
8619            &mut self.0.options
8620        }
8621    }
8622
8623    /// The request builder for [IdentityMappingStoreService::list_identity_mappings][crate::client::IdentityMappingStoreService::list_identity_mappings] calls.
8624    ///
8625    /// # Example
8626    /// ```
8627    /// # use google_cloud_discoveryengine_v1::builder::identity_mapping_store_service::ListIdentityMappings;
8628    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
8629    /// use google_cloud_gax::paginator::ItemPaginator;
8630    ///
8631    /// let builder = prepare_request_builder();
8632    /// let mut items = builder.by_item();
8633    /// while let Some(result) = items.next().await {
8634    ///   let item = result?;
8635    /// }
8636    /// # Ok(()) }
8637    ///
8638    /// fn prepare_request_builder() -> ListIdentityMappings {
8639    ///   # panic!();
8640    ///   // ... details omitted ...
8641    /// }
8642    /// ```
8643    #[derive(Clone, Debug)]
8644    pub struct ListIdentityMappings(RequestBuilder<crate::model::ListIdentityMappingsRequest>);
8645
8646    impl ListIdentityMappings {
8647        pub(crate) fn new(
8648            stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
8649        ) -> Self {
8650            Self(RequestBuilder::new(stub))
8651        }
8652
8653        /// Sets the full request, replacing any prior values.
8654        pub fn with_request<V: Into<crate::model::ListIdentityMappingsRequest>>(
8655            mut self,
8656            v: V,
8657        ) -> Self {
8658            self.0.request = v.into();
8659            self
8660        }
8661
8662        /// Sets all the options, replacing any prior values.
8663        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
8664            self.0.options = v.into();
8665            self
8666        }
8667
8668        /// Sends the request.
8669        pub async fn send(self) -> Result<crate::model::ListIdentityMappingsResponse> {
8670            (*self.0.stub)
8671                .list_identity_mappings(self.0.request, self.0.options)
8672                .await
8673                .map(crate::Response::into_body)
8674        }
8675
8676        /// Streams each page in the collection.
8677        pub fn by_page(
8678            self,
8679        ) -> impl google_cloud_gax::paginator::Paginator<
8680            crate::model::ListIdentityMappingsResponse,
8681            crate::Error,
8682        > {
8683            use std::clone::Clone;
8684            let token = self.0.request.page_token.clone();
8685            let execute = move |token: String| {
8686                let mut builder = self.clone();
8687                builder.0.request = builder.0.request.set_page_token(token);
8688                builder.send()
8689            };
8690            google_cloud_gax::paginator::internal::new_paginator(token, execute)
8691        }
8692
8693        /// Streams each item in the collection.
8694        pub fn by_item(
8695            self,
8696        ) -> impl google_cloud_gax::paginator::ItemPaginator<
8697            crate::model::ListIdentityMappingsResponse,
8698            crate::Error,
8699        > {
8700            use google_cloud_gax::paginator::Paginator;
8701            self.by_page().items()
8702        }
8703
8704        /// Sets the value of [identity_mapping_store][crate::model::ListIdentityMappingsRequest::identity_mapping_store].
8705        ///
8706        /// This is a **required** field for requests.
8707        pub fn set_identity_mapping_store<T: Into<std::string::String>>(mut self, v: T) -> Self {
8708            self.0.request.identity_mapping_store = v.into();
8709            self
8710        }
8711
8712        /// Sets the value of [page_size][crate::model::ListIdentityMappingsRequest::page_size].
8713        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
8714            self.0.request.page_size = v.into();
8715            self
8716        }
8717
8718        /// Sets the value of [page_token][crate::model::ListIdentityMappingsRequest::page_token].
8719        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
8720            self.0.request.page_token = v.into();
8721            self
8722        }
8723    }
8724
8725    #[doc(hidden)]
8726    impl crate::RequestBuilder for ListIdentityMappings {
8727        fn request_options(&mut self) -> &mut crate::RequestOptions {
8728            &mut self.0.options
8729        }
8730    }
8731
8732    /// The request builder for [IdentityMappingStoreService::list_identity_mapping_stores][crate::client::IdentityMappingStoreService::list_identity_mapping_stores] calls.
8733    ///
8734    /// # Example
8735    /// ```
8736    /// # use google_cloud_discoveryengine_v1::builder::identity_mapping_store_service::ListIdentityMappingStores;
8737    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
8738    /// use google_cloud_gax::paginator::ItemPaginator;
8739    ///
8740    /// let builder = prepare_request_builder();
8741    /// let mut items = builder.by_item();
8742    /// while let Some(result) = items.next().await {
8743    ///   let item = result?;
8744    /// }
8745    /// # Ok(()) }
8746    ///
8747    /// fn prepare_request_builder() -> ListIdentityMappingStores {
8748    ///   # panic!();
8749    ///   // ... details omitted ...
8750    /// }
8751    /// ```
8752    #[derive(Clone, Debug)]
8753    pub struct ListIdentityMappingStores(
8754        RequestBuilder<crate::model::ListIdentityMappingStoresRequest>,
8755    );
8756
8757    impl ListIdentityMappingStores {
8758        pub(crate) fn new(
8759            stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
8760        ) -> Self {
8761            Self(RequestBuilder::new(stub))
8762        }
8763
8764        /// Sets the full request, replacing any prior values.
8765        pub fn with_request<V: Into<crate::model::ListIdentityMappingStoresRequest>>(
8766            mut self,
8767            v: V,
8768        ) -> Self {
8769            self.0.request = v.into();
8770            self
8771        }
8772
8773        /// Sets all the options, replacing any prior values.
8774        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
8775            self.0.options = v.into();
8776            self
8777        }
8778
8779        /// Sends the request.
8780        pub async fn send(self) -> Result<crate::model::ListIdentityMappingStoresResponse> {
8781            (*self.0.stub)
8782                .list_identity_mapping_stores(self.0.request, self.0.options)
8783                .await
8784                .map(crate::Response::into_body)
8785        }
8786
8787        /// Streams each page in the collection.
8788        pub fn by_page(
8789            self,
8790        ) -> impl google_cloud_gax::paginator::Paginator<
8791            crate::model::ListIdentityMappingStoresResponse,
8792            crate::Error,
8793        > {
8794            use std::clone::Clone;
8795            let token = self.0.request.page_token.clone();
8796            let execute = move |token: String| {
8797                let mut builder = self.clone();
8798                builder.0.request = builder.0.request.set_page_token(token);
8799                builder.send()
8800            };
8801            google_cloud_gax::paginator::internal::new_paginator(token, execute)
8802        }
8803
8804        /// Streams each item in the collection.
8805        pub fn by_item(
8806            self,
8807        ) -> impl google_cloud_gax::paginator::ItemPaginator<
8808            crate::model::ListIdentityMappingStoresResponse,
8809            crate::Error,
8810        > {
8811            use google_cloud_gax::paginator::Paginator;
8812            self.by_page().items()
8813        }
8814
8815        /// Sets the value of [parent][crate::model::ListIdentityMappingStoresRequest::parent].
8816        ///
8817        /// This is a **required** field for requests.
8818        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
8819            self.0.request.parent = v.into();
8820            self
8821        }
8822
8823        /// Sets the value of [page_size][crate::model::ListIdentityMappingStoresRequest::page_size].
8824        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
8825            self.0.request.page_size = v.into();
8826            self
8827        }
8828
8829        /// Sets the value of [page_token][crate::model::ListIdentityMappingStoresRequest::page_token].
8830        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
8831            self.0.request.page_token = v.into();
8832            self
8833        }
8834    }
8835
8836    #[doc(hidden)]
8837    impl crate::RequestBuilder for ListIdentityMappingStores {
8838        fn request_options(&mut self) -> &mut crate::RequestOptions {
8839            &mut self.0.options
8840        }
8841    }
8842
8843    /// The request builder for [IdentityMappingStoreService::list_operations][crate::client::IdentityMappingStoreService::list_operations] calls.
8844    ///
8845    /// # Example
8846    /// ```
8847    /// # use google_cloud_discoveryengine_v1::builder::identity_mapping_store_service::ListOperations;
8848    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
8849    /// use google_cloud_gax::paginator::ItemPaginator;
8850    ///
8851    /// let builder = prepare_request_builder();
8852    /// let mut items = builder.by_item();
8853    /// while let Some(result) = items.next().await {
8854    ///   let item = result?;
8855    /// }
8856    /// # Ok(()) }
8857    ///
8858    /// fn prepare_request_builder() -> ListOperations {
8859    ///   # panic!();
8860    ///   // ... details omitted ...
8861    /// }
8862    /// ```
8863    #[derive(Clone, Debug)]
8864    pub struct ListOperations(
8865        RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
8866    );
8867
8868    impl ListOperations {
8869        pub(crate) fn new(
8870            stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
8871        ) -> Self {
8872            Self(RequestBuilder::new(stub))
8873        }
8874
8875        /// Sets the full request, replacing any prior values.
8876        pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
8877            mut self,
8878            v: V,
8879        ) -> Self {
8880            self.0.request = v.into();
8881            self
8882        }
8883
8884        /// Sets all the options, replacing any prior values.
8885        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
8886            self.0.options = v.into();
8887            self
8888        }
8889
8890        /// Sends the request.
8891        pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
8892            (*self.0.stub)
8893                .list_operations(self.0.request, self.0.options)
8894                .await
8895                .map(crate::Response::into_body)
8896        }
8897
8898        /// Streams each page in the collection.
8899        pub fn by_page(
8900            self,
8901        ) -> impl google_cloud_gax::paginator::Paginator<
8902            google_cloud_longrunning::model::ListOperationsResponse,
8903            crate::Error,
8904        > {
8905            use std::clone::Clone;
8906            let token = self.0.request.page_token.clone();
8907            let execute = move |token: String| {
8908                let mut builder = self.clone();
8909                builder.0.request = builder.0.request.set_page_token(token);
8910                builder.send()
8911            };
8912            google_cloud_gax::paginator::internal::new_paginator(token, execute)
8913        }
8914
8915        /// Streams each item in the collection.
8916        pub fn by_item(
8917            self,
8918        ) -> impl google_cloud_gax::paginator::ItemPaginator<
8919            google_cloud_longrunning::model::ListOperationsResponse,
8920            crate::Error,
8921        > {
8922            use google_cloud_gax::paginator::Paginator;
8923            self.by_page().items()
8924        }
8925
8926        /// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
8927        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
8928            self.0.request.name = v.into();
8929            self
8930        }
8931
8932        /// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::filter].
8933        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
8934            self.0.request.filter = v.into();
8935            self
8936        }
8937
8938        /// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
8939        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
8940            self.0.request.page_size = v.into();
8941            self
8942        }
8943
8944        /// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
8945        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
8946            self.0.request.page_token = v.into();
8947            self
8948        }
8949
8950        /// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
8951        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
8952            self.0.request.return_partial_success = v.into();
8953            self
8954        }
8955    }
8956
8957    #[doc(hidden)]
8958    impl crate::RequestBuilder for ListOperations {
8959        fn request_options(&mut self) -> &mut crate::RequestOptions {
8960            &mut self.0.options
8961        }
8962    }
8963
8964    /// The request builder for [IdentityMappingStoreService::get_operation][crate::client::IdentityMappingStoreService::get_operation] calls.
8965    ///
8966    /// # Example
8967    /// ```
8968    /// # use google_cloud_discoveryengine_v1::builder::identity_mapping_store_service::GetOperation;
8969    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
8970    ///
8971    /// let builder = prepare_request_builder();
8972    /// let response = builder.send().await?;
8973    /// # Ok(()) }
8974    ///
8975    /// fn prepare_request_builder() -> GetOperation {
8976    ///   # panic!();
8977    ///   // ... details omitted ...
8978    /// }
8979    /// ```
8980    #[derive(Clone, Debug)]
8981    pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
8982
8983    impl GetOperation {
8984        pub(crate) fn new(
8985            stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
8986        ) -> Self {
8987            Self(RequestBuilder::new(stub))
8988        }
8989
8990        /// Sets the full request, replacing any prior values.
8991        pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
8992            mut self,
8993            v: V,
8994        ) -> Self {
8995            self.0.request = v.into();
8996            self
8997        }
8998
8999        /// Sets all the options, replacing any prior values.
9000        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
9001            self.0.options = v.into();
9002            self
9003        }
9004
9005        /// Sends the request.
9006        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
9007            (*self.0.stub)
9008                .get_operation(self.0.request, self.0.options)
9009                .await
9010                .map(crate::Response::into_body)
9011        }
9012
9013        /// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
9014        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9015            self.0.request.name = v.into();
9016            self
9017        }
9018    }
9019
9020    #[doc(hidden)]
9021    impl crate::RequestBuilder for GetOperation {
9022        fn request_options(&mut self) -> &mut crate::RequestOptions {
9023            &mut self.0.options
9024        }
9025    }
9026
9027    /// The request builder for [IdentityMappingStoreService::cancel_operation][crate::client::IdentityMappingStoreService::cancel_operation] calls.
9028    ///
9029    /// # Example
9030    /// ```
9031    /// # use google_cloud_discoveryengine_v1::builder::identity_mapping_store_service::CancelOperation;
9032    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
9033    ///
9034    /// let builder = prepare_request_builder();
9035    /// let response = builder.send().await?;
9036    /// # Ok(()) }
9037    ///
9038    /// fn prepare_request_builder() -> CancelOperation {
9039    ///   # panic!();
9040    ///   // ... details omitted ...
9041    /// }
9042    /// ```
9043    #[derive(Clone, Debug)]
9044    pub struct CancelOperation(
9045        RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
9046    );
9047
9048    impl CancelOperation {
9049        pub(crate) fn new(
9050            stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
9051        ) -> Self {
9052            Self(RequestBuilder::new(stub))
9053        }
9054
9055        /// Sets the full request, replacing any prior values.
9056        pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
9057            mut self,
9058            v: V,
9059        ) -> Self {
9060            self.0.request = v.into();
9061            self
9062        }
9063
9064        /// Sets all the options, replacing any prior values.
9065        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
9066            self.0.options = v.into();
9067            self
9068        }
9069
9070        /// Sends the request.
9071        pub async fn send(self) -> Result<()> {
9072            (*self.0.stub)
9073                .cancel_operation(self.0.request, self.0.options)
9074                .await
9075                .map(crate::Response::into_body)
9076        }
9077
9078        /// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::name].
9079        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9080            self.0.request.name = v.into();
9081            self
9082        }
9083    }
9084
9085    #[doc(hidden)]
9086    impl crate::RequestBuilder for CancelOperation {
9087        fn request_options(&mut self) -> &mut crate::RequestOptions {
9088            &mut self.0.options
9089        }
9090    }
9091}
9092
9093/// Request and client builders for [ProjectService][crate::client::ProjectService].
9094#[cfg(feature = "project-service")]
9095#[cfg_attr(docsrs, doc(cfg(feature = "project-service")))]
9096pub mod project_service {
9097    use crate::Result;
9098
9099    /// A builder for [ProjectService][crate::client::ProjectService].
9100    ///
9101    /// ```
9102    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
9103    /// # use google_cloud_discoveryengine_v1::*;
9104    /// # use builder::project_service::ClientBuilder;
9105    /// # use client::ProjectService;
9106    /// let builder : ClientBuilder = ProjectService::builder();
9107    /// let client = builder
9108    ///     .with_endpoint("https://discoveryengine.googleapis.com")
9109    ///     .build().await?;
9110    /// # Ok(()) }
9111    /// ```
9112    pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
9113
9114    pub(crate) mod client {
9115        use super::super::super::client::ProjectService;
9116        pub struct Factory;
9117        impl crate::ClientFactory for Factory {
9118            type Client = ProjectService;
9119            type Credentials = gaxi::options::Credentials;
9120            async fn build(
9121                self,
9122                config: gaxi::options::ClientConfig,
9123            ) -> crate::ClientBuilderResult<Self::Client> {
9124                Self::Client::new(config).await
9125            }
9126        }
9127    }
9128
9129    /// Common implementation for [crate::client::ProjectService] request builders.
9130    #[derive(Clone, Debug)]
9131    pub(crate) struct RequestBuilder<R: std::default::Default> {
9132        stub: std::sync::Arc<dyn super::super::stub::dynamic::ProjectService>,
9133        request: R,
9134        options: crate::RequestOptions,
9135    }
9136
9137    impl<R> RequestBuilder<R>
9138    where
9139        R: std::default::Default,
9140    {
9141        pub(crate) fn new(
9142            stub: std::sync::Arc<dyn super::super::stub::dynamic::ProjectService>,
9143        ) -> Self {
9144            Self {
9145                stub,
9146                request: R::default(),
9147                options: crate::RequestOptions::default(),
9148            }
9149        }
9150    }
9151
9152    /// The request builder for [ProjectService::provision_project][crate::client::ProjectService::provision_project] calls.
9153    ///
9154    /// # Example
9155    /// ```
9156    /// # use google_cloud_discoveryengine_v1::builder::project_service::ProvisionProject;
9157    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
9158    /// use google_cloud_lro::Poller;
9159    ///
9160    /// let builder = prepare_request_builder();
9161    /// let response = builder.poller().until_done().await?;
9162    /// # Ok(()) }
9163    ///
9164    /// fn prepare_request_builder() -> ProvisionProject {
9165    ///   # panic!();
9166    ///   // ... details omitted ...
9167    /// }
9168    /// ```
9169    #[derive(Clone, Debug)]
9170    pub struct ProvisionProject(RequestBuilder<crate::model::ProvisionProjectRequest>);
9171
9172    impl ProvisionProject {
9173        pub(crate) fn new(
9174            stub: std::sync::Arc<dyn super::super::stub::dynamic::ProjectService>,
9175        ) -> Self {
9176            Self(RequestBuilder::new(stub))
9177        }
9178
9179        /// Sets the full request, replacing any prior values.
9180        pub fn with_request<V: Into<crate::model::ProvisionProjectRequest>>(
9181            mut self,
9182            v: V,
9183        ) -> Self {
9184            self.0.request = v.into();
9185            self
9186        }
9187
9188        /// Sets all the options, replacing any prior values.
9189        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
9190            self.0.options = v.into();
9191            self
9192        }
9193
9194        /// Sends the request.
9195        ///
9196        /// # Long running operations
9197        ///
9198        /// This starts, but does not poll, a longrunning operation. More information
9199        /// on [provision_project][crate::client::ProjectService::provision_project].
9200        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
9201            (*self.0.stub)
9202                .provision_project(self.0.request, self.0.options)
9203                .await
9204                .map(crate::Response::into_body)
9205        }
9206
9207        /// Creates a [Poller][google_cloud_lro::Poller] to work with `provision_project`.
9208        pub fn poller(
9209            self,
9210        ) -> impl google_cloud_lro::Poller<crate::model::Project, crate::model::ProvisionProjectMetadata>
9211        {
9212            type Operation = google_cloud_lro::internal::Operation<
9213                crate::model::Project,
9214                crate::model::ProvisionProjectMetadata,
9215            >;
9216            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
9217            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
9218
9219            let stub = self.0.stub.clone();
9220            let mut options = self.0.options.clone();
9221            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
9222            let query = move |name| {
9223                let stub = stub.clone();
9224                let options = options.clone();
9225                async {
9226                    let op = GetOperation::new(stub)
9227                        .set_name(name)
9228                        .with_options(options)
9229                        .send()
9230                        .await?;
9231                    Ok(Operation::new(op))
9232                }
9233            };
9234
9235            let start = move || async {
9236                let op = self.send().await?;
9237                Ok(Operation::new(op))
9238            };
9239
9240            google_cloud_lro::internal::new_poller(
9241                polling_error_policy,
9242                polling_backoff_policy,
9243                start,
9244                query,
9245            )
9246        }
9247
9248        /// Sets the value of [name][crate::model::ProvisionProjectRequest::name].
9249        ///
9250        /// This is a **required** field for requests.
9251        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9252            self.0.request.name = v.into();
9253            self
9254        }
9255
9256        /// Sets the value of [accept_data_use_terms][crate::model::ProvisionProjectRequest::accept_data_use_terms].
9257        ///
9258        /// This is a **required** field for requests.
9259        pub fn set_accept_data_use_terms<T: Into<bool>>(mut self, v: T) -> Self {
9260            self.0.request.accept_data_use_terms = v.into();
9261            self
9262        }
9263
9264        /// Sets the value of [data_use_terms_version][crate::model::ProvisionProjectRequest::data_use_terms_version].
9265        ///
9266        /// This is a **required** field for requests.
9267        pub fn set_data_use_terms_version<T: Into<std::string::String>>(mut self, v: T) -> Self {
9268            self.0.request.data_use_terms_version = v.into();
9269            self
9270        }
9271    }
9272
9273    #[doc(hidden)]
9274    impl crate::RequestBuilder for ProvisionProject {
9275        fn request_options(&mut self) -> &mut crate::RequestOptions {
9276            &mut self.0.options
9277        }
9278    }
9279
9280    /// The request builder for [ProjectService::list_operations][crate::client::ProjectService::list_operations] calls.
9281    ///
9282    /// # Example
9283    /// ```
9284    /// # use google_cloud_discoveryengine_v1::builder::project_service::ListOperations;
9285    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
9286    /// use google_cloud_gax::paginator::ItemPaginator;
9287    ///
9288    /// let builder = prepare_request_builder();
9289    /// let mut items = builder.by_item();
9290    /// while let Some(result) = items.next().await {
9291    ///   let item = result?;
9292    /// }
9293    /// # Ok(()) }
9294    ///
9295    /// fn prepare_request_builder() -> ListOperations {
9296    ///   # panic!();
9297    ///   // ... details omitted ...
9298    /// }
9299    /// ```
9300    #[derive(Clone, Debug)]
9301    pub struct ListOperations(
9302        RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
9303    );
9304
9305    impl ListOperations {
9306        pub(crate) fn new(
9307            stub: std::sync::Arc<dyn super::super::stub::dynamic::ProjectService>,
9308        ) -> Self {
9309            Self(RequestBuilder::new(stub))
9310        }
9311
9312        /// Sets the full request, replacing any prior values.
9313        pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
9314            mut self,
9315            v: V,
9316        ) -> Self {
9317            self.0.request = v.into();
9318            self
9319        }
9320
9321        /// Sets all the options, replacing any prior values.
9322        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
9323            self.0.options = v.into();
9324            self
9325        }
9326
9327        /// Sends the request.
9328        pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
9329            (*self.0.stub)
9330                .list_operations(self.0.request, self.0.options)
9331                .await
9332                .map(crate::Response::into_body)
9333        }
9334
9335        /// Streams each page in the collection.
9336        pub fn by_page(
9337            self,
9338        ) -> impl google_cloud_gax::paginator::Paginator<
9339            google_cloud_longrunning::model::ListOperationsResponse,
9340            crate::Error,
9341        > {
9342            use std::clone::Clone;
9343            let token = self.0.request.page_token.clone();
9344            let execute = move |token: String| {
9345                let mut builder = self.clone();
9346                builder.0.request = builder.0.request.set_page_token(token);
9347                builder.send()
9348            };
9349            google_cloud_gax::paginator::internal::new_paginator(token, execute)
9350        }
9351
9352        /// Streams each item in the collection.
9353        pub fn by_item(
9354            self,
9355        ) -> impl google_cloud_gax::paginator::ItemPaginator<
9356            google_cloud_longrunning::model::ListOperationsResponse,
9357            crate::Error,
9358        > {
9359            use google_cloud_gax::paginator::Paginator;
9360            self.by_page().items()
9361        }
9362
9363        /// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
9364        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9365            self.0.request.name = v.into();
9366            self
9367        }
9368
9369        /// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::filter].
9370        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
9371            self.0.request.filter = v.into();
9372            self
9373        }
9374
9375        /// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
9376        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
9377            self.0.request.page_size = v.into();
9378            self
9379        }
9380
9381        /// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
9382        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
9383            self.0.request.page_token = v.into();
9384            self
9385        }
9386
9387        /// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
9388        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
9389            self.0.request.return_partial_success = v.into();
9390            self
9391        }
9392    }
9393
9394    #[doc(hidden)]
9395    impl crate::RequestBuilder for ListOperations {
9396        fn request_options(&mut self) -> &mut crate::RequestOptions {
9397            &mut self.0.options
9398        }
9399    }
9400
9401    /// The request builder for [ProjectService::get_operation][crate::client::ProjectService::get_operation] calls.
9402    ///
9403    /// # Example
9404    /// ```
9405    /// # use google_cloud_discoveryengine_v1::builder::project_service::GetOperation;
9406    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
9407    ///
9408    /// let builder = prepare_request_builder();
9409    /// let response = builder.send().await?;
9410    /// # Ok(()) }
9411    ///
9412    /// fn prepare_request_builder() -> GetOperation {
9413    ///   # panic!();
9414    ///   // ... details omitted ...
9415    /// }
9416    /// ```
9417    #[derive(Clone, Debug)]
9418    pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
9419
9420    impl GetOperation {
9421        pub(crate) fn new(
9422            stub: std::sync::Arc<dyn super::super::stub::dynamic::ProjectService>,
9423        ) -> Self {
9424            Self(RequestBuilder::new(stub))
9425        }
9426
9427        /// Sets the full request, replacing any prior values.
9428        pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
9429            mut self,
9430            v: V,
9431        ) -> Self {
9432            self.0.request = v.into();
9433            self
9434        }
9435
9436        /// Sets all the options, replacing any prior values.
9437        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
9438            self.0.options = v.into();
9439            self
9440        }
9441
9442        /// Sends the request.
9443        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
9444            (*self.0.stub)
9445                .get_operation(self.0.request, self.0.options)
9446                .await
9447                .map(crate::Response::into_body)
9448        }
9449
9450        /// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
9451        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9452            self.0.request.name = v.into();
9453            self
9454        }
9455    }
9456
9457    #[doc(hidden)]
9458    impl crate::RequestBuilder for GetOperation {
9459        fn request_options(&mut self) -> &mut crate::RequestOptions {
9460            &mut self.0.options
9461        }
9462    }
9463
9464    /// The request builder for [ProjectService::cancel_operation][crate::client::ProjectService::cancel_operation] calls.
9465    ///
9466    /// # Example
9467    /// ```
9468    /// # use google_cloud_discoveryengine_v1::builder::project_service::CancelOperation;
9469    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
9470    ///
9471    /// let builder = prepare_request_builder();
9472    /// let response = builder.send().await?;
9473    /// # Ok(()) }
9474    ///
9475    /// fn prepare_request_builder() -> CancelOperation {
9476    ///   # panic!();
9477    ///   // ... details omitted ...
9478    /// }
9479    /// ```
9480    #[derive(Clone, Debug)]
9481    pub struct CancelOperation(
9482        RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
9483    );
9484
9485    impl CancelOperation {
9486        pub(crate) fn new(
9487            stub: std::sync::Arc<dyn super::super::stub::dynamic::ProjectService>,
9488        ) -> Self {
9489            Self(RequestBuilder::new(stub))
9490        }
9491
9492        /// Sets the full request, replacing any prior values.
9493        pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
9494            mut self,
9495            v: V,
9496        ) -> Self {
9497            self.0.request = v.into();
9498            self
9499        }
9500
9501        /// Sets all the options, replacing any prior values.
9502        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
9503            self.0.options = v.into();
9504            self
9505        }
9506
9507        /// Sends the request.
9508        pub async fn send(self) -> Result<()> {
9509            (*self.0.stub)
9510                .cancel_operation(self.0.request, self.0.options)
9511                .await
9512                .map(crate::Response::into_body)
9513        }
9514
9515        /// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::name].
9516        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9517            self.0.request.name = v.into();
9518            self
9519        }
9520    }
9521
9522    #[doc(hidden)]
9523    impl crate::RequestBuilder for CancelOperation {
9524        fn request_options(&mut self) -> &mut crate::RequestOptions {
9525            &mut self.0.options
9526        }
9527    }
9528}
9529
9530/// Request and client builders for [RankService][crate::client::RankService].
9531#[cfg(feature = "rank-service")]
9532#[cfg_attr(docsrs, doc(cfg(feature = "rank-service")))]
9533pub mod rank_service {
9534    use crate::Result;
9535
9536    /// A builder for [RankService][crate::client::RankService].
9537    ///
9538    /// ```
9539    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
9540    /// # use google_cloud_discoveryengine_v1::*;
9541    /// # use builder::rank_service::ClientBuilder;
9542    /// # use client::RankService;
9543    /// let builder : ClientBuilder = RankService::builder();
9544    /// let client = builder
9545    ///     .with_endpoint("https://discoveryengine.googleapis.com")
9546    ///     .build().await?;
9547    /// # Ok(()) }
9548    /// ```
9549    pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
9550
9551    pub(crate) mod client {
9552        use super::super::super::client::RankService;
9553        pub struct Factory;
9554        impl crate::ClientFactory for Factory {
9555            type Client = RankService;
9556            type Credentials = gaxi::options::Credentials;
9557            async fn build(
9558                self,
9559                config: gaxi::options::ClientConfig,
9560            ) -> crate::ClientBuilderResult<Self::Client> {
9561                Self::Client::new(config).await
9562            }
9563        }
9564    }
9565
9566    /// Common implementation for [crate::client::RankService] request builders.
9567    #[derive(Clone, Debug)]
9568    pub(crate) struct RequestBuilder<R: std::default::Default> {
9569        stub: std::sync::Arc<dyn super::super::stub::dynamic::RankService>,
9570        request: R,
9571        options: crate::RequestOptions,
9572    }
9573
9574    impl<R> RequestBuilder<R>
9575    where
9576        R: std::default::Default,
9577    {
9578        pub(crate) fn new(
9579            stub: std::sync::Arc<dyn super::super::stub::dynamic::RankService>,
9580        ) -> Self {
9581            Self {
9582                stub,
9583                request: R::default(),
9584                options: crate::RequestOptions::default(),
9585            }
9586        }
9587    }
9588
9589    /// The request builder for [RankService::rank][crate::client::RankService::rank] calls.
9590    ///
9591    /// # Example
9592    /// ```
9593    /// # use google_cloud_discoveryengine_v1::builder::rank_service::Rank;
9594    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
9595    ///
9596    /// let builder = prepare_request_builder();
9597    /// let response = builder.send().await?;
9598    /// # Ok(()) }
9599    ///
9600    /// fn prepare_request_builder() -> Rank {
9601    ///   # panic!();
9602    ///   // ... details omitted ...
9603    /// }
9604    /// ```
9605    #[derive(Clone, Debug)]
9606    pub struct Rank(RequestBuilder<crate::model::RankRequest>);
9607
9608    impl Rank {
9609        pub(crate) fn new(
9610            stub: std::sync::Arc<dyn super::super::stub::dynamic::RankService>,
9611        ) -> Self {
9612            Self(RequestBuilder::new(stub))
9613        }
9614
9615        /// Sets the full request, replacing any prior values.
9616        pub fn with_request<V: Into<crate::model::RankRequest>>(mut self, v: V) -> Self {
9617            self.0.request = v.into();
9618            self
9619        }
9620
9621        /// Sets all the options, replacing any prior values.
9622        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
9623            self.0.options = v.into();
9624            self
9625        }
9626
9627        /// Sends the request.
9628        pub async fn send(self) -> Result<crate::model::RankResponse> {
9629            (*self.0.stub)
9630                .rank(self.0.request, self.0.options)
9631                .await
9632                .map(crate::Response::into_body)
9633        }
9634
9635        /// Sets the value of [ranking_config][crate::model::RankRequest::ranking_config].
9636        ///
9637        /// This is a **required** field for requests.
9638        pub fn set_ranking_config<T: Into<std::string::String>>(mut self, v: T) -> Self {
9639            self.0.request.ranking_config = v.into();
9640            self
9641        }
9642
9643        /// Sets the value of [model][crate::model::RankRequest::model].
9644        pub fn set_model<T: Into<std::string::String>>(mut self, v: T) -> Self {
9645            self.0.request.model = v.into();
9646            self
9647        }
9648
9649        /// Sets the value of [top_n][crate::model::RankRequest::top_n].
9650        pub fn set_top_n<T: Into<i32>>(mut self, v: T) -> Self {
9651            self.0.request.top_n = v.into();
9652            self
9653        }
9654
9655        /// Sets the value of [query][crate::model::RankRequest::query].
9656        pub fn set_query<T: Into<std::string::String>>(mut self, v: T) -> Self {
9657            self.0.request.query = v.into();
9658            self
9659        }
9660
9661        /// Sets the value of [records][crate::model::RankRequest::records].
9662        ///
9663        /// This is a **required** field for requests.
9664        pub fn set_records<T, V>(mut self, v: T) -> Self
9665        where
9666            T: std::iter::IntoIterator<Item = V>,
9667            V: std::convert::Into<crate::model::RankingRecord>,
9668        {
9669            use std::iter::Iterator;
9670            self.0.request.records = v.into_iter().map(|i| i.into()).collect();
9671            self
9672        }
9673
9674        /// Sets the value of [ignore_record_details_in_response][crate::model::RankRequest::ignore_record_details_in_response].
9675        pub fn set_ignore_record_details_in_response<T: Into<bool>>(mut self, v: T) -> Self {
9676            self.0.request.ignore_record_details_in_response = v.into();
9677            self
9678        }
9679
9680        /// Sets the value of [user_labels][crate::model::RankRequest::user_labels].
9681        pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
9682        where
9683            T: std::iter::IntoIterator<Item = (K, V)>,
9684            K: std::convert::Into<std::string::String>,
9685            V: std::convert::Into<std::string::String>,
9686        {
9687            self.0.request.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
9688            self
9689        }
9690    }
9691
9692    #[doc(hidden)]
9693    impl crate::RequestBuilder for Rank {
9694        fn request_options(&mut self) -> &mut crate::RequestOptions {
9695            &mut self.0.options
9696        }
9697    }
9698
9699    /// The request builder for [RankService::list_operations][crate::client::RankService::list_operations] calls.
9700    ///
9701    /// # Example
9702    /// ```
9703    /// # use google_cloud_discoveryengine_v1::builder::rank_service::ListOperations;
9704    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
9705    /// use google_cloud_gax::paginator::ItemPaginator;
9706    ///
9707    /// let builder = prepare_request_builder();
9708    /// let mut items = builder.by_item();
9709    /// while let Some(result) = items.next().await {
9710    ///   let item = result?;
9711    /// }
9712    /// # Ok(()) }
9713    ///
9714    /// fn prepare_request_builder() -> ListOperations {
9715    ///   # panic!();
9716    ///   // ... details omitted ...
9717    /// }
9718    /// ```
9719    #[derive(Clone, Debug)]
9720    pub struct ListOperations(
9721        RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
9722    );
9723
9724    impl ListOperations {
9725        pub(crate) fn new(
9726            stub: std::sync::Arc<dyn super::super::stub::dynamic::RankService>,
9727        ) -> Self {
9728            Self(RequestBuilder::new(stub))
9729        }
9730
9731        /// Sets the full request, replacing any prior values.
9732        pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
9733            mut self,
9734            v: V,
9735        ) -> Self {
9736            self.0.request = v.into();
9737            self
9738        }
9739
9740        /// Sets all the options, replacing any prior values.
9741        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
9742            self.0.options = v.into();
9743            self
9744        }
9745
9746        /// Sends the request.
9747        pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
9748            (*self.0.stub)
9749                .list_operations(self.0.request, self.0.options)
9750                .await
9751                .map(crate::Response::into_body)
9752        }
9753
9754        /// Streams each page in the collection.
9755        pub fn by_page(
9756            self,
9757        ) -> impl google_cloud_gax::paginator::Paginator<
9758            google_cloud_longrunning::model::ListOperationsResponse,
9759            crate::Error,
9760        > {
9761            use std::clone::Clone;
9762            let token = self.0.request.page_token.clone();
9763            let execute = move |token: String| {
9764                let mut builder = self.clone();
9765                builder.0.request = builder.0.request.set_page_token(token);
9766                builder.send()
9767            };
9768            google_cloud_gax::paginator::internal::new_paginator(token, execute)
9769        }
9770
9771        /// Streams each item in the collection.
9772        pub fn by_item(
9773            self,
9774        ) -> impl google_cloud_gax::paginator::ItemPaginator<
9775            google_cloud_longrunning::model::ListOperationsResponse,
9776            crate::Error,
9777        > {
9778            use google_cloud_gax::paginator::Paginator;
9779            self.by_page().items()
9780        }
9781
9782        /// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
9783        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9784            self.0.request.name = v.into();
9785            self
9786        }
9787
9788        /// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::filter].
9789        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
9790            self.0.request.filter = v.into();
9791            self
9792        }
9793
9794        /// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
9795        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
9796            self.0.request.page_size = v.into();
9797            self
9798        }
9799
9800        /// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
9801        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
9802            self.0.request.page_token = v.into();
9803            self
9804        }
9805
9806        /// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
9807        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
9808            self.0.request.return_partial_success = v.into();
9809            self
9810        }
9811    }
9812
9813    #[doc(hidden)]
9814    impl crate::RequestBuilder for ListOperations {
9815        fn request_options(&mut self) -> &mut crate::RequestOptions {
9816            &mut self.0.options
9817        }
9818    }
9819
9820    /// The request builder for [RankService::get_operation][crate::client::RankService::get_operation] calls.
9821    ///
9822    /// # Example
9823    /// ```
9824    /// # use google_cloud_discoveryengine_v1::builder::rank_service::GetOperation;
9825    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
9826    ///
9827    /// let builder = prepare_request_builder();
9828    /// let response = builder.send().await?;
9829    /// # Ok(()) }
9830    ///
9831    /// fn prepare_request_builder() -> GetOperation {
9832    ///   # panic!();
9833    ///   // ... details omitted ...
9834    /// }
9835    /// ```
9836    #[derive(Clone, Debug)]
9837    pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
9838
9839    impl GetOperation {
9840        pub(crate) fn new(
9841            stub: std::sync::Arc<dyn super::super::stub::dynamic::RankService>,
9842        ) -> Self {
9843            Self(RequestBuilder::new(stub))
9844        }
9845
9846        /// Sets the full request, replacing any prior values.
9847        pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
9848            mut self,
9849            v: V,
9850        ) -> Self {
9851            self.0.request = v.into();
9852            self
9853        }
9854
9855        /// Sets all the options, replacing any prior values.
9856        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
9857            self.0.options = v.into();
9858            self
9859        }
9860
9861        /// Sends the request.
9862        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
9863            (*self.0.stub)
9864                .get_operation(self.0.request, self.0.options)
9865                .await
9866                .map(crate::Response::into_body)
9867        }
9868
9869        /// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
9870        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9871            self.0.request.name = v.into();
9872            self
9873        }
9874    }
9875
9876    #[doc(hidden)]
9877    impl crate::RequestBuilder for GetOperation {
9878        fn request_options(&mut self) -> &mut crate::RequestOptions {
9879            &mut self.0.options
9880        }
9881    }
9882
9883    /// The request builder for [RankService::cancel_operation][crate::client::RankService::cancel_operation] calls.
9884    ///
9885    /// # Example
9886    /// ```
9887    /// # use google_cloud_discoveryengine_v1::builder::rank_service::CancelOperation;
9888    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
9889    ///
9890    /// let builder = prepare_request_builder();
9891    /// let response = builder.send().await?;
9892    /// # Ok(()) }
9893    ///
9894    /// fn prepare_request_builder() -> CancelOperation {
9895    ///   # panic!();
9896    ///   // ... details omitted ...
9897    /// }
9898    /// ```
9899    #[derive(Clone, Debug)]
9900    pub struct CancelOperation(
9901        RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
9902    );
9903
9904    impl CancelOperation {
9905        pub(crate) fn new(
9906            stub: std::sync::Arc<dyn super::super::stub::dynamic::RankService>,
9907        ) -> Self {
9908            Self(RequestBuilder::new(stub))
9909        }
9910
9911        /// Sets the full request, replacing any prior values.
9912        pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
9913            mut self,
9914            v: V,
9915        ) -> Self {
9916            self.0.request = v.into();
9917            self
9918        }
9919
9920        /// Sets all the options, replacing any prior values.
9921        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
9922            self.0.options = v.into();
9923            self
9924        }
9925
9926        /// Sends the request.
9927        pub async fn send(self) -> Result<()> {
9928            (*self.0.stub)
9929                .cancel_operation(self.0.request, self.0.options)
9930                .await
9931                .map(crate::Response::into_body)
9932        }
9933
9934        /// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::name].
9935        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9936            self.0.request.name = v.into();
9937            self
9938        }
9939    }
9940
9941    #[doc(hidden)]
9942    impl crate::RequestBuilder for CancelOperation {
9943        fn request_options(&mut self) -> &mut crate::RequestOptions {
9944            &mut self.0.options
9945        }
9946    }
9947}
9948
9949/// Request and client builders for [RecommendationService][crate::client::RecommendationService].
9950#[cfg(feature = "recommendation-service")]
9951#[cfg_attr(docsrs, doc(cfg(feature = "recommendation-service")))]
9952pub mod recommendation_service {
9953    use crate::Result;
9954
9955    /// A builder for [RecommendationService][crate::client::RecommendationService].
9956    ///
9957    /// ```
9958    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
9959    /// # use google_cloud_discoveryengine_v1::*;
9960    /// # use builder::recommendation_service::ClientBuilder;
9961    /// # use client::RecommendationService;
9962    /// let builder : ClientBuilder = RecommendationService::builder();
9963    /// let client = builder
9964    ///     .with_endpoint("https://discoveryengine.googleapis.com")
9965    ///     .build().await?;
9966    /// # Ok(()) }
9967    /// ```
9968    pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
9969
9970    pub(crate) mod client {
9971        use super::super::super::client::RecommendationService;
9972        pub struct Factory;
9973        impl crate::ClientFactory for Factory {
9974            type Client = RecommendationService;
9975            type Credentials = gaxi::options::Credentials;
9976            async fn build(
9977                self,
9978                config: gaxi::options::ClientConfig,
9979            ) -> crate::ClientBuilderResult<Self::Client> {
9980                Self::Client::new(config).await
9981            }
9982        }
9983    }
9984
9985    /// Common implementation for [crate::client::RecommendationService] request builders.
9986    #[derive(Clone, Debug)]
9987    pub(crate) struct RequestBuilder<R: std::default::Default> {
9988        stub: std::sync::Arc<dyn super::super::stub::dynamic::RecommendationService>,
9989        request: R,
9990        options: crate::RequestOptions,
9991    }
9992
9993    impl<R> RequestBuilder<R>
9994    where
9995        R: std::default::Default,
9996    {
9997        pub(crate) fn new(
9998            stub: std::sync::Arc<dyn super::super::stub::dynamic::RecommendationService>,
9999        ) -> Self {
10000            Self {
10001                stub,
10002                request: R::default(),
10003                options: crate::RequestOptions::default(),
10004            }
10005        }
10006    }
10007
10008    /// The request builder for [RecommendationService::recommend][crate::client::RecommendationService::recommend] calls.
10009    ///
10010    /// # Example
10011    /// ```
10012    /// # use google_cloud_discoveryengine_v1::builder::recommendation_service::Recommend;
10013    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
10014    ///
10015    /// let builder = prepare_request_builder();
10016    /// let response = builder.send().await?;
10017    /// # Ok(()) }
10018    ///
10019    /// fn prepare_request_builder() -> Recommend {
10020    ///   # panic!();
10021    ///   // ... details omitted ...
10022    /// }
10023    /// ```
10024    #[derive(Clone, Debug)]
10025    pub struct Recommend(RequestBuilder<crate::model::RecommendRequest>);
10026
10027    impl Recommend {
10028        pub(crate) fn new(
10029            stub: std::sync::Arc<dyn super::super::stub::dynamic::RecommendationService>,
10030        ) -> Self {
10031            Self(RequestBuilder::new(stub))
10032        }
10033
10034        /// Sets the full request, replacing any prior values.
10035        pub fn with_request<V: Into<crate::model::RecommendRequest>>(mut self, v: V) -> Self {
10036            self.0.request = v.into();
10037            self
10038        }
10039
10040        /// Sets all the options, replacing any prior values.
10041        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
10042            self.0.options = v.into();
10043            self
10044        }
10045
10046        /// Sends the request.
10047        pub async fn send(self) -> Result<crate::model::RecommendResponse> {
10048            (*self.0.stub)
10049                .recommend(self.0.request, self.0.options)
10050                .await
10051                .map(crate::Response::into_body)
10052        }
10053
10054        /// Sets the value of [serving_config][crate::model::RecommendRequest::serving_config].
10055        ///
10056        /// This is a **required** field for requests.
10057        pub fn set_serving_config<T: Into<std::string::String>>(mut self, v: T) -> Self {
10058            self.0.request.serving_config = v.into();
10059            self
10060        }
10061
10062        /// Sets the value of [user_event][crate::model::RecommendRequest::user_event].
10063        ///
10064        /// This is a **required** field for requests.
10065        pub fn set_user_event<T>(mut self, v: T) -> Self
10066        where
10067            T: std::convert::Into<crate::model::UserEvent>,
10068        {
10069            self.0.request.user_event = std::option::Option::Some(v.into());
10070            self
10071        }
10072
10073        /// Sets or clears the value of [user_event][crate::model::RecommendRequest::user_event].
10074        ///
10075        /// This is a **required** field for requests.
10076        pub fn set_or_clear_user_event<T>(mut self, v: std::option::Option<T>) -> Self
10077        where
10078            T: std::convert::Into<crate::model::UserEvent>,
10079        {
10080            self.0.request.user_event = v.map(|x| x.into());
10081            self
10082        }
10083
10084        /// Sets the value of [page_size][crate::model::RecommendRequest::page_size].
10085        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
10086            self.0.request.page_size = v.into();
10087            self
10088        }
10089
10090        /// Sets the value of [filter][crate::model::RecommendRequest::filter].
10091        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
10092            self.0.request.filter = v.into();
10093            self
10094        }
10095
10096        /// Sets the value of [validate_only][crate::model::RecommendRequest::validate_only].
10097        pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
10098            self.0.request.validate_only = v.into();
10099            self
10100        }
10101
10102        /// Sets the value of [params][crate::model::RecommendRequest::params].
10103        pub fn set_params<T, K, V>(mut self, v: T) -> Self
10104        where
10105            T: std::iter::IntoIterator<Item = (K, V)>,
10106            K: std::convert::Into<std::string::String>,
10107            V: std::convert::Into<wkt::Value>,
10108        {
10109            self.0.request.params = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
10110            self
10111        }
10112
10113        /// Sets the value of [user_labels][crate::model::RecommendRequest::user_labels].
10114        pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
10115        where
10116            T: std::iter::IntoIterator<Item = (K, V)>,
10117            K: std::convert::Into<std::string::String>,
10118            V: std::convert::Into<std::string::String>,
10119        {
10120            self.0.request.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
10121            self
10122        }
10123    }
10124
10125    #[doc(hidden)]
10126    impl crate::RequestBuilder for Recommend {
10127        fn request_options(&mut self) -> &mut crate::RequestOptions {
10128            &mut self.0.options
10129        }
10130    }
10131
10132    /// The request builder for [RecommendationService::list_operations][crate::client::RecommendationService::list_operations] calls.
10133    ///
10134    /// # Example
10135    /// ```
10136    /// # use google_cloud_discoveryengine_v1::builder::recommendation_service::ListOperations;
10137    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
10138    /// use google_cloud_gax::paginator::ItemPaginator;
10139    ///
10140    /// let builder = prepare_request_builder();
10141    /// let mut items = builder.by_item();
10142    /// while let Some(result) = items.next().await {
10143    ///   let item = result?;
10144    /// }
10145    /// # Ok(()) }
10146    ///
10147    /// fn prepare_request_builder() -> ListOperations {
10148    ///   # panic!();
10149    ///   // ... details omitted ...
10150    /// }
10151    /// ```
10152    #[derive(Clone, Debug)]
10153    pub struct ListOperations(
10154        RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
10155    );
10156
10157    impl ListOperations {
10158        pub(crate) fn new(
10159            stub: std::sync::Arc<dyn super::super::stub::dynamic::RecommendationService>,
10160        ) -> Self {
10161            Self(RequestBuilder::new(stub))
10162        }
10163
10164        /// Sets the full request, replacing any prior values.
10165        pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
10166            mut self,
10167            v: V,
10168        ) -> Self {
10169            self.0.request = v.into();
10170            self
10171        }
10172
10173        /// Sets all the options, replacing any prior values.
10174        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
10175            self.0.options = v.into();
10176            self
10177        }
10178
10179        /// Sends the request.
10180        pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
10181            (*self.0.stub)
10182                .list_operations(self.0.request, self.0.options)
10183                .await
10184                .map(crate::Response::into_body)
10185        }
10186
10187        /// Streams each page in the collection.
10188        pub fn by_page(
10189            self,
10190        ) -> impl google_cloud_gax::paginator::Paginator<
10191            google_cloud_longrunning::model::ListOperationsResponse,
10192            crate::Error,
10193        > {
10194            use std::clone::Clone;
10195            let token = self.0.request.page_token.clone();
10196            let execute = move |token: String| {
10197                let mut builder = self.clone();
10198                builder.0.request = builder.0.request.set_page_token(token);
10199                builder.send()
10200            };
10201            google_cloud_gax::paginator::internal::new_paginator(token, execute)
10202        }
10203
10204        /// Streams each item in the collection.
10205        pub fn by_item(
10206            self,
10207        ) -> impl google_cloud_gax::paginator::ItemPaginator<
10208            google_cloud_longrunning::model::ListOperationsResponse,
10209            crate::Error,
10210        > {
10211            use google_cloud_gax::paginator::Paginator;
10212            self.by_page().items()
10213        }
10214
10215        /// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
10216        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
10217            self.0.request.name = v.into();
10218            self
10219        }
10220
10221        /// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::filter].
10222        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
10223            self.0.request.filter = v.into();
10224            self
10225        }
10226
10227        /// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
10228        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
10229            self.0.request.page_size = v.into();
10230            self
10231        }
10232
10233        /// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
10234        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
10235            self.0.request.page_token = v.into();
10236            self
10237        }
10238
10239        /// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
10240        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
10241            self.0.request.return_partial_success = v.into();
10242            self
10243        }
10244    }
10245
10246    #[doc(hidden)]
10247    impl crate::RequestBuilder for ListOperations {
10248        fn request_options(&mut self) -> &mut crate::RequestOptions {
10249            &mut self.0.options
10250        }
10251    }
10252
10253    /// The request builder for [RecommendationService::get_operation][crate::client::RecommendationService::get_operation] calls.
10254    ///
10255    /// # Example
10256    /// ```
10257    /// # use google_cloud_discoveryengine_v1::builder::recommendation_service::GetOperation;
10258    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
10259    ///
10260    /// let builder = prepare_request_builder();
10261    /// let response = builder.send().await?;
10262    /// # Ok(()) }
10263    ///
10264    /// fn prepare_request_builder() -> GetOperation {
10265    ///   # panic!();
10266    ///   // ... details omitted ...
10267    /// }
10268    /// ```
10269    #[derive(Clone, Debug)]
10270    pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
10271
10272    impl GetOperation {
10273        pub(crate) fn new(
10274            stub: std::sync::Arc<dyn super::super::stub::dynamic::RecommendationService>,
10275        ) -> Self {
10276            Self(RequestBuilder::new(stub))
10277        }
10278
10279        /// Sets the full request, replacing any prior values.
10280        pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
10281            mut self,
10282            v: V,
10283        ) -> Self {
10284            self.0.request = v.into();
10285            self
10286        }
10287
10288        /// Sets all the options, replacing any prior values.
10289        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
10290            self.0.options = v.into();
10291            self
10292        }
10293
10294        /// Sends the request.
10295        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
10296            (*self.0.stub)
10297                .get_operation(self.0.request, self.0.options)
10298                .await
10299                .map(crate::Response::into_body)
10300        }
10301
10302        /// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
10303        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
10304            self.0.request.name = v.into();
10305            self
10306        }
10307    }
10308
10309    #[doc(hidden)]
10310    impl crate::RequestBuilder for GetOperation {
10311        fn request_options(&mut self) -> &mut crate::RequestOptions {
10312            &mut self.0.options
10313        }
10314    }
10315
10316    /// The request builder for [RecommendationService::cancel_operation][crate::client::RecommendationService::cancel_operation] calls.
10317    ///
10318    /// # Example
10319    /// ```
10320    /// # use google_cloud_discoveryengine_v1::builder::recommendation_service::CancelOperation;
10321    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
10322    ///
10323    /// let builder = prepare_request_builder();
10324    /// let response = builder.send().await?;
10325    /// # Ok(()) }
10326    ///
10327    /// fn prepare_request_builder() -> CancelOperation {
10328    ///   # panic!();
10329    ///   // ... details omitted ...
10330    /// }
10331    /// ```
10332    #[derive(Clone, Debug)]
10333    pub struct CancelOperation(
10334        RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
10335    );
10336
10337    impl CancelOperation {
10338        pub(crate) fn new(
10339            stub: std::sync::Arc<dyn super::super::stub::dynamic::RecommendationService>,
10340        ) -> Self {
10341            Self(RequestBuilder::new(stub))
10342        }
10343
10344        /// Sets the full request, replacing any prior values.
10345        pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
10346            mut self,
10347            v: V,
10348        ) -> Self {
10349            self.0.request = v.into();
10350            self
10351        }
10352
10353        /// Sets all the options, replacing any prior values.
10354        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
10355            self.0.options = v.into();
10356            self
10357        }
10358
10359        /// Sends the request.
10360        pub async fn send(self) -> Result<()> {
10361            (*self.0.stub)
10362                .cancel_operation(self.0.request, self.0.options)
10363                .await
10364                .map(crate::Response::into_body)
10365        }
10366
10367        /// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::name].
10368        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
10369            self.0.request.name = v.into();
10370            self
10371        }
10372    }
10373
10374    #[doc(hidden)]
10375    impl crate::RequestBuilder for CancelOperation {
10376        fn request_options(&mut self) -> &mut crate::RequestOptions {
10377            &mut self.0.options
10378        }
10379    }
10380}
10381
10382/// Request and client builders for [SchemaService][crate::client::SchemaService].
10383#[cfg(feature = "schema-service")]
10384#[cfg_attr(docsrs, doc(cfg(feature = "schema-service")))]
10385pub mod schema_service {
10386    use crate::Result;
10387
10388    /// A builder for [SchemaService][crate::client::SchemaService].
10389    ///
10390    /// ```
10391    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
10392    /// # use google_cloud_discoveryengine_v1::*;
10393    /// # use builder::schema_service::ClientBuilder;
10394    /// # use client::SchemaService;
10395    /// let builder : ClientBuilder = SchemaService::builder();
10396    /// let client = builder
10397    ///     .with_endpoint("https://discoveryengine.googleapis.com")
10398    ///     .build().await?;
10399    /// # Ok(()) }
10400    /// ```
10401    pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
10402
10403    pub(crate) mod client {
10404        use super::super::super::client::SchemaService;
10405        pub struct Factory;
10406        impl crate::ClientFactory for Factory {
10407            type Client = SchemaService;
10408            type Credentials = gaxi::options::Credentials;
10409            async fn build(
10410                self,
10411                config: gaxi::options::ClientConfig,
10412            ) -> crate::ClientBuilderResult<Self::Client> {
10413                Self::Client::new(config).await
10414            }
10415        }
10416    }
10417
10418    /// Common implementation for [crate::client::SchemaService] request builders.
10419    #[derive(Clone, Debug)]
10420    pub(crate) struct RequestBuilder<R: std::default::Default> {
10421        stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
10422        request: R,
10423        options: crate::RequestOptions,
10424    }
10425
10426    impl<R> RequestBuilder<R>
10427    where
10428        R: std::default::Default,
10429    {
10430        pub(crate) fn new(
10431            stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
10432        ) -> Self {
10433            Self {
10434                stub,
10435                request: R::default(),
10436                options: crate::RequestOptions::default(),
10437            }
10438        }
10439    }
10440
10441    /// The request builder for [SchemaService::get_schema][crate::client::SchemaService::get_schema] calls.
10442    ///
10443    /// # Example
10444    /// ```
10445    /// # use google_cloud_discoveryengine_v1::builder::schema_service::GetSchema;
10446    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
10447    ///
10448    /// let builder = prepare_request_builder();
10449    /// let response = builder.send().await?;
10450    /// # Ok(()) }
10451    ///
10452    /// fn prepare_request_builder() -> GetSchema {
10453    ///   # panic!();
10454    ///   // ... details omitted ...
10455    /// }
10456    /// ```
10457    #[derive(Clone, Debug)]
10458    pub struct GetSchema(RequestBuilder<crate::model::GetSchemaRequest>);
10459
10460    impl GetSchema {
10461        pub(crate) fn new(
10462            stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
10463        ) -> Self {
10464            Self(RequestBuilder::new(stub))
10465        }
10466
10467        /// Sets the full request, replacing any prior values.
10468        pub fn with_request<V: Into<crate::model::GetSchemaRequest>>(mut self, v: V) -> Self {
10469            self.0.request = v.into();
10470            self
10471        }
10472
10473        /// Sets all the options, replacing any prior values.
10474        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
10475            self.0.options = v.into();
10476            self
10477        }
10478
10479        /// Sends the request.
10480        pub async fn send(self) -> Result<crate::model::Schema> {
10481            (*self.0.stub)
10482                .get_schema(self.0.request, self.0.options)
10483                .await
10484                .map(crate::Response::into_body)
10485        }
10486
10487        /// Sets the value of [name][crate::model::GetSchemaRequest::name].
10488        ///
10489        /// This is a **required** field for requests.
10490        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
10491            self.0.request.name = v.into();
10492            self
10493        }
10494    }
10495
10496    #[doc(hidden)]
10497    impl crate::RequestBuilder for GetSchema {
10498        fn request_options(&mut self) -> &mut crate::RequestOptions {
10499            &mut self.0.options
10500        }
10501    }
10502
10503    /// The request builder for [SchemaService::list_schemas][crate::client::SchemaService::list_schemas] calls.
10504    ///
10505    /// # Example
10506    /// ```
10507    /// # use google_cloud_discoveryengine_v1::builder::schema_service::ListSchemas;
10508    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
10509    /// use google_cloud_gax::paginator::ItemPaginator;
10510    ///
10511    /// let builder = prepare_request_builder();
10512    /// let mut items = builder.by_item();
10513    /// while let Some(result) = items.next().await {
10514    ///   let item = result?;
10515    /// }
10516    /// # Ok(()) }
10517    ///
10518    /// fn prepare_request_builder() -> ListSchemas {
10519    ///   # panic!();
10520    ///   // ... details omitted ...
10521    /// }
10522    /// ```
10523    #[derive(Clone, Debug)]
10524    pub struct ListSchemas(RequestBuilder<crate::model::ListSchemasRequest>);
10525
10526    impl ListSchemas {
10527        pub(crate) fn new(
10528            stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
10529        ) -> Self {
10530            Self(RequestBuilder::new(stub))
10531        }
10532
10533        /// Sets the full request, replacing any prior values.
10534        pub fn with_request<V: Into<crate::model::ListSchemasRequest>>(mut self, v: V) -> Self {
10535            self.0.request = v.into();
10536            self
10537        }
10538
10539        /// Sets all the options, replacing any prior values.
10540        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
10541            self.0.options = v.into();
10542            self
10543        }
10544
10545        /// Sends the request.
10546        pub async fn send(self) -> Result<crate::model::ListSchemasResponse> {
10547            (*self.0.stub)
10548                .list_schemas(self.0.request, self.0.options)
10549                .await
10550                .map(crate::Response::into_body)
10551        }
10552
10553        /// Streams each page in the collection.
10554        pub fn by_page(
10555            self,
10556        ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListSchemasResponse, crate::Error>
10557        {
10558            use std::clone::Clone;
10559            let token = self.0.request.page_token.clone();
10560            let execute = move |token: String| {
10561                let mut builder = self.clone();
10562                builder.0.request = builder.0.request.set_page_token(token);
10563                builder.send()
10564            };
10565            google_cloud_gax::paginator::internal::new_paginator(token, execute)
10566        }
10567
10568        /// Streams each item in the collection.
10569        pub fn by_item(
10570            self,
10571        ) -> impl google_cloud_gax::paginator::ItemPaginator<
10572            crate::model::ListSchemasResponse,
10573            crate::Error,
10574        > {
10575            use google_cloud_gax::paginator::Paginator;
10576            self.by_page().items()
10577        }
10578
10579        /// Sets the value of [parent][crate::model::ListSchemasRequest::parent].
10580        ///
10581        /// This is a **required** field for requests.
10582        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
10583            self.0.request.parent = v.into();
10584            self
10585        }
10586
10587        /// Sets the value of [page_size][crate::model::ListSchemasRequest::page_size].
10588        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
10589            self.0.request.page_size = v.into();
10590            self
10591        }
10592
10593        /// Sets the value of [page_token][crate::model::ListSchemasRequest::page_token].
10594        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
10595            self.0.request.page_token = v.into();
10596            self
10597        }
10598    }
10599
10600    #[doc(hidden)]
10601    impl crate::RequestBuilder for ListSchemas {
10602        fn request_options(&mut self) -> &mut crate::RequestOptions {
10603            &mut self.0.options
10604        }
10605    }
10606
10607    /// The request builder for [SchemaService::create_schema][crate::client::SchemaService::create_schema] calls.
10608    ///
10609    /// # Example
10610    /// ```
10611    /// # use google_cloud_discoveryengine_v1::builder::schema_service::CreateSchema;
10612    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
10613    /// use google_cloud_lro::Poller;
10614    ///
10615    /// let builder = prepare_request_builder();
10616    /// let response = builder.poller().until_done().await?;
10617    /// # Ok(()) }
10618    ///
10619    /// fn prepare_request_builder() -> CreateSchema {
10620    ///   # panic!();
10621    ///   // ... details omitted ...
10622    /// }
10623    /// ```
10624    #[derive(Clone, Debug)]
10625    pub struct CreateSchema(RequestBuilder<crate::model::CreateSchemaRequest>);
10626
10627    impl CreateSchema {
10628        pub(crate) fn new(
10629            stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
10630        ) -> Self {
10631            Self(RequestBuilder::new(stub))
10632        }
10633
10634        /// Sets the full request, replacing any prior values.
10635        pub fn with_request<V: Into<crate::model::CreateSchemaRequest>>(mut self, v: V) -> Self {
10636            self.0.request = v.into();
10637            self
10638        }
10639
10640        /// Sets all the options, replacing any prior values.
10641        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
10642            self.0.options = v.into();
10643            self
10644        }
10645
10646        /// Sends the request.
10647        ///
10648        /// # Long running operations
10649        ///
10650        /// This starts, but does not poll, a longrunning operation. More information
10651        /// on [create_schema][crate::client::SchemaService::create_schema].
10652        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
10653            (*self.0.stub)
10654                .create_schema(self.0.request, self.0.options)
10655                .await
10656                .map(crate::Response::into_body)
10657        }
10658
10659        /// Creates a [Poller][google_cloud_lro::Poller] to work with `create_schema`.
10660        pub fn poller(
10661            self,
10662        ) -> impl google_cloud_lro::Poller<crate::model::Schema, crate::model::CreateSchemaMetadata>
10663        {
10664            type Operation = google_cloud_lro::internal::Operation<
10665                crate::model::Schema,
10666                crate::model::CreateSchemaMetadata,
10667            >;
10668            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
10669            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
10670
10671            let stub = self.0.stub.clone();
10672            let mut options = self.0.options.clone();
10673            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
10674            let query = move |name| {
10675                let stub = stub.clone();
10676                let options = options.clone();
10677                async {
10678                    let op = GetOperation::new(stub)
10679                        .set_name(name)
10680                        .with_options(options)
10681                        .send()
10682                        .await?;
10683                    Ok(Operation::new(op))
10684                }
10685            };
10686
10687            let start = move || async {
10688                let op = self.send().await?;
10689                Ok(Operation::new(op))
10690            };
10691
10692            google_cloud_lro::internal::new_poller(
10693                polling_error_policy,
10694                polling_backoff_policy,
10695                start,
10696                query,
10697            )
10698        }
10699
10700        /// Sets the value of [parent][crate::model::CreateSchemaRequest::parent].
10701        ///
10702        /// This is a **required** field for requests.
10703        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
10704            self.0.request.parent = v.into();
10705            self
10706        }
10707
10708        /// Sets the value of [schema][crate::model::CreateSchemaRequest::schema].
10709        ///
10710        /// This is a **required** field for requests.
10711        pub fn set_schema<T>(mut self, v: T) -> Self
10712        where
10713            T: std::convert::Into<crate::model::Schema>,
10714        {
10715            self.0.request.schema = std::option::Option::Some(v.into());
10716            self
10717        }
10718
10719        /// Sets or clears the value of [schema][crate::model::CreateSchemaRequest::schema].
10720        ///
10721        /// This is a **required** field for requests.
10722        pub fn set_or_clear_schema<T>(mut self, v: std::option::Option<T>) -> Self
10723        where
10724            T: std::convert::Into<crate::model::Schema>,
10725        {
10726            self.0.request.schema = v.map(|x| x.into());
10727            self
10728        }
10729
10730        /// Sets the value of [schema_id][crate::model::CreateSchemaRequest::schema_id].
10731        ///
10732        /// This is a **required** field for requests.
10733        pub fn set_schema_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
10734            self.0.request.schema_id = v.into();
10735            self
10736        }
10737    }
10738
10739    #[doc(hidden)]
10740    impl crate::RequestBuilder for CreateSchema {
10741        fn request_options(&mut self) -> &mut crate::RequestOptions {
10742            &mut self.0.options
10743        }
10744    }
10745
10746    /// The request builder for [SchemaService::update_schema][crate::client::SchemaService::update_schema] calls.
10747    ///
10748    /// # Example
10749    /// ```
10750    /// # use google_cloud_discoveryengine_v1::builder::schema_service::UpdateSchema;
10751    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
10752    /// use google_cloud_lro::Poller;
10753    ///
10754    /// let builder = prepare_request_builder();
10755    /// let response = builder.poller().until_done().await?;
10756    /// # Ok(()) }
10757    ///
10758    /// fn prepare_request_builder() -> UpdateSchema {
10759    ///   # panic!();
10760    ///   // ... details omitted ...
10761    /// }
10762    /// ```
10763    #[derive(Clone, Debug)]
10764    pub struct UpdateSchema(RequestBuilder<crate::model::UpdateSchemaRequest>);
10765
10766    impl UpdateSchema {
10767        pub(crate) fn new(
10768            stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
10769        ) -> Self {
10770            Self(RequestBuilder::new(stub))
10771        }
10772
10773        /// Sets the full request, replacing any prior values.
10774        pub fn with_request<V: Into<crate::model::UpdateSchemaRequest>>(mut self, v: V) -> Self {
10775            self.0.request = v.into();
10776            self
10777        }
10778
10779        /// Sets all the options, replacing any prior values.
10780        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
10781            self.0.options = v.into();
10782            self
10783        }
10784
10785        /// Sends the request.
10786        ///
10787        /// # Long running operations
10788        ///
10789        /// This starts, but does not poll, a longrunning operation. More information
10790        /// on [update_schema][crate::client::SchemaService::update_schema].
10791        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
10792            (*self.0.stub)
10793                .update_schema(self.0.request, self.0.options)
10794                .await
10795                .map(crate::Response::into_body)
10796        }
10797
10798        /// Creates a [Poller][google_cloud_lro::Poller] to work with `update_schema`.
10799        pub fn poller(
10800            self,
10801        ) -> impl google_cloud_lro::Poller<crate::model::Schema, crate::model::UpdateSchemaMetadata>
10802        {
10803            type Operation = google_cloud_lro::internal::Operation<
10804                crate::model::Schema,
10805                crate::model::UpdateSchemaMetadata,
10806            >;
10807            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
10808            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
10809
10810            let stub = self.0.stub.clone();
10811            let mut options = self.0.options.clone();
10812            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
10813            let query = move |name| {
10814                let stub = stub.clone();
10815                let options = options.clone();
10816                async {
10817                    let op = GetOperation::new(stub)
10818                        .set_name(name)
10819                        .with_options(options)
10820                        .send()
10821                        .await?;
10822                    Ok(Operation::new(op))
10823                }
10824            };
10825
10826            let start = move || async {
10827                let op = self.send().await?;
10828                Ok(Operation::new(op))
10829            };
10830
10831            google_cloud_lro::internal::new_poller(
10832                polling_error_policy,
10833                polling_backoff_policy,
10834                start,
10835                query,
10836            )
10837        }
10838
10839        /// Sets the value of [schema][crate::model::UpdateSchemaRequest::schema].
10840        ///
10841        /// This is a **required** field for requests.
10842        pub fn set_schema<T>(mut self, v: T) -> Self
10843        where
10844            T: std::convert::Into<crate::model::Schema>,
10845        {
10846            self.0.request.schema = std::option::Option::Some(v.into());
10847            self
10848        }
10849
10850        /// Sets or clears the value of [schema][crate::model::UpdateSchemaRequest::schema].
10851        ///
10852        /// This is a **required** field for requests.
10853        pub fn set_or_clear_schema<T>(mut self, v: std::option::Option<T>) -> Self
10854        where
10855            T: std::convert::Into<crate::model::Schema>,
10856        {
10857            self.0.request.schema = v.map(|x| x.into());
10858            self
10859        }
10860
10861        /// Sets the value of [allow_missing][crate::model::UpdateSchemaRequest::allow_missing].
10862        pub fn set_allow_missing<T: Into<bool>>(mut self, v: T) -> Self {
10863            self.0.request.allow_missing = v.into();
10864            self
10865        }
10866    }
10867
10868    #[doc(hidden)]
10869    impl crate::RequestBuilder for UpdateSchema {
10870        fn request_options(&mut self) -> &mut crate::RequestOptions {
10871            &mut self.0.options
10872        }
10873    }
10874
10875    /// The request builder for [SchemaService::delete_schema][crate::client::SchemaService::delete_schema] calls.
10876    ///
10877    /// # Example
10878    /// ```
10879    /// # use google_cloud_discoveryengine_v1::builder::schema_service::DeleteSchema;
10880    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
10881    /// use google_cloud_lro::Poller;
10882    ///
10883    /// let builder = prepare_request_builder();
10884    /// let response = builder.poller().until_done().await?;
10885    /// # Ok(()) }
10886    ///
10887    /// fn prepare_request_builder() -> DeleteSchema {
10888    ///   # panic!();
10889    ///   // ... details omitted ...
10890    /// }
10891    /// ```
10892    #[derive(Clone, Debug)]
10893    pub struct DeleteSchema(RequestBuilder<crate::model::DeleteSchemaRequest>);
10894
10895    impl DeleteSchema {
10896        pub(crate) fn new(
10897            stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
10898        ) -> Self {
10899            Self(RequestBuilder::new(stub))
10900        }
10901
10902        /// Sets the full request, replacing any prior values.
10903        pub fn with_request<V: Into<crate::model::DeleteSchemaRequest>>(mut self, v: V) -> Self {
10904            self.0.request = v.into();
10905            self
10906        }
10907
10908        /// Sets all the options, replacing any prior values.
10909        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
10910            self.0.options = v.into();
10911            self
10912        }
10913
10914        /// Sends the request.
10915        ///
10916        /// # Long running operations
10917        ///
10918        /// This starts, but does not poll, a longrunning operation. More information
10919        /// on [delete_schema][crate::client::SchemaService::delete_schema].
10920        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
10921            (*self.0.stub)
10922                .delete_schema(self.0.request, self.0.options)
10923                .await
10924                .map(crate::Response::into_body)
10925        }
10926
10927        /// Creates a [Poller][google_cloud_lro::Poller] to work with `delete_schema`.
10928        pub fn poller(
10929            self,
10930        ) -> impl google_cloud_lro::Poller<(), crate::model::DeleteSchemaMetadata> {
10931            type Operation = google_cloud_lro::internal::Operation<
10932                wkt::Empty,
10933                crate::model::DeleteSchemaMetadata,
10934            >;
10935            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
10936            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
10937
10938            let stub = self.0.stub.clone();
10939            let mut options = self.0.options.clone();
10940            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
10941            let query = move |name| {
10942                let stub = stub.clone();
10943                let options = options.clone();
10944                async {
10945                    let op = GetOperation::new(stub)
10946                        .set_name(name)
10947                        .with_options(options)
10948                        .send()
10949                        .await?;
10950                    Ok(Operation::new(op))
10951                }
10952            };
10953
10954            let start = move || async {
10955                let op = self.send().await?;
10956                Ok(Operation::new(op))
10957            };
10958
10959            google_cloud_lro::internal::new_unit_response_poller(
10960                polling_error_policy,
10961                polling_backoff_policy,
10962                start,
10963                query,
10964            )
10965        }
10966
10967        /// Sets the value of [name][crate::model::DeleteSchemaRequest::name].
10968        ///
10969        /// This is a **required** field for requests.
10970        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
10971            self.0.request.name = v.into();
10972            self
10973        }
10974    }
10975
10976    #[doc(hidden)]
10977    impl crate::RequestBuilder for DeleteSchema {
10978        fn request_options(&mut self) -> &mut crate::RequestOptions {
10979            &mut self.0.options
10980        }
10981    }
10982
10983    /// The request builder for [SchemaService::list_operations][crate::client::SchemaService::list_operations] calls.
10984    ///
10985    /// # Example
10986    /// ```
10987    /// # use google_cloud_discoveryengine_v1::builder::schema_service::ListOperations;
10988    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
10989    /// use google_cloud_gax::paginator::ItemPaginator;
10990    ///
10991    /// let builder = prepare_request_builder();
10992    /// let mut items = builder.by_item();
10993    /// while let Some(result) = items.next().await {
10994    ///   let item = result?;
10995    /// }
10996    /// # Ok(()) }
10997    ///
10998    /// fn prepare_request_builder() -> ListOperations {
10999    ///   # panic!();
11000    ///   // ... details omitted ...
11001    /// }
11002    /// ```
11003    #[derive(Clone, Debug)]
11004    pub struct ListOperations(
11005        RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
11006    );
11007
11008    impl ListOperations {
11009        pub(crate) fn new(
11010            stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
11011        ) -> Self {
11012            Self(RequestBuilder::new(stub))
11013        }
11014
11015        /// Sets the full request, replacing any prior values.
11016        pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
11017            mut self,
11018            v: V,
11019        ) -> Self {
11020            self.0.request = v.into();
11021            self
11022        }
11023
11024        /// Sets all the options, replacing any prior values.
11025        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
11026            self.0.options = v.into();
11027            self
11028        }
11029
11030        /// Sends the request.
11031        pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
11032            (*self.0.stub)
11033                .list_operations(self.0.request, self.0.options)
11034                .await
11035                .map(crate::Response::into_body)
11036        }
11037
11038        /// Streams each page in the collection.
11039        pub fn by_page(
11040            self,
11041        ) -> impl google_cloud_gax::paginator::Paginator<
11042            google_cloud_longrunning::model::ListOperationsResponse,
11043            crate::Error,
11044        > {
11045            use std::clone::Clone;
11046            let token = self.0.request.page_token.clone();
11047            let execute = move |token: String| {
11048                let mut builder = self.clone();
11049                builder.0.request = builder.0.request.set_page_token(token);
11050                builder.send()
11051            };
11052            google_cloud_gax::paginator::internal::new_paginator(token, execute)
11053        }
11054
11055        /// Streams each item in the collection.
11056        pub fn by_item(
11057            self,
11058        ) -> impl google_cloud_gax::paginator::ItemPaginator<
11059            google_cloud_longrunning::model::ListOperationsResponse,
11060            crate::Error,
11061        > {
11062            use google_cloud_gax::paginator::Paginator;
11063            self.by_page().items()
11064        }
11065
11066        /// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
11067        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
11068            self.0.request.name = v.into();
11069            self
11070        }
11071
11072        /// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::filter].
11073        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
11074            self.0.request.filter = v.into();
11075            self
11076        }
11077
11078        /// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
11079        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
11080            self.0.request.page_size = v.into();
11081            self
11082        }
11083
11084        /// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
11085        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
11086            self.0.request.page_token = v.into();
11087            self
11088        }
11089
11090        /// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
11091        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
11092            self.0.request.return_partial_success = v.into();
11093            self
11094        }
11095    }
11096
11097    #[doc(hidden)]
11098    impl crate::RequestBuilder for ListOperations {
11099        fn request_options(&mut self) -> &mut crate::RequestOptions {
11100            &mut self.0.options
11101        }
11102    }
11103
11104    /// The request builder for [SchemaService::get_operation][crate::client::SchemaService::get_operation] calls.
11105    ///
11106    /// # Example
11107    /// ```
11108    /// # use google_cloud_discoveryengine_v1::builder::schema_service::GetOperation;
11109    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
11110    ///
11111    /// let builder = prepare_request_builder();
11112    /// let response = builder.send().await?;
11113    /// # Ok(()) }
11114    ///
11115    /// fn prepare_request_builder() -> GetOperation {
11116    ///   # panic!();
11117    ///   // ... details omitted ...
11118    /// }
11119    /// ```
11120    #[derive(Clone, Debug)]
11121    pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
11122
11123    impl GetOperation {
11124        pub(crate) fn new(
11125            stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
11126        ) -> Self {
11127            Self(RequestBuilder::new(stub))
11128        }
11129
11130        /// Sets the full request, replacing any prior values.
11131        pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
11132            mut self,
11133            v: V,
11134        ) -> Self {
11135            self.0.request = v.into();
11136            self
11137        }
11138
11139        /// Sets all the options, replacing any prior values.
11140        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
11141            self.0.options = v.into();
11142            self
11143        }
11144
11145        /// Sends the request.
11146        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
11147            (*self.0.stub)
11148                .get_operation(self.0.request, self.0.options)
11149                .await
11150                .map(crate::Response::into_body)
11151        }
11152
11153        /// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
11154        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
11155            self.0.request.name = v.into();
11156            self
11157        }
11158    }
11159
11160    #[doc(hidden)]
11161    impl crate::RequestBuilder for GetOperation {
11162        fn request_options(&mut self) -> &mut crate::RequestOptions {
11163            &mut self.0.options
11164        }
11165    }
11166
11167    /// The request builder for [SchemaService::cancel_operation][crate::client::SchemaService::cancel_operation] calls.
11168    ///
11169    /// # Example
11170    /// ```
11171    /// # use google_cloud_discoveryengine_v1::builder::schema_service::CancelOperation;
11172    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
11173    ///
11174    /// let builder = prepare_request_builder();
11175    /// let response = builder.send().await?;
11176    /// # Ok(()) }
11177    ///
11178    /// fn prepare_request_builder() -> CancelOperation {
11179    ///   # panic!();
11180    ///   // ... details omitted ...
11181    /// }
11182    /// ```
11183    #[derive(Clone, Debug)]
11184    pub struct CancelOperation(
11185        RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
11186    );
11187
11188    impl CancelOperation {
11189        pub(crate) fn new(
11190            stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
11191        ) -> Self {
11192            Self(RequestBuilder::new(stub))
11193        }
11194
11195        /// Sets the full request, replacing any prior values.
11196        pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
11197            mut self,
11198            v: V,
11199        ) -> Self {
11200            self.0.request = v.into();
11201            self
11202        }
11203
11204        /// Sets all the options, replacing any prior values.
11205        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
11206            self.0.options = v.into();
11207            self
11208        }
11209
11210        /// Sends the request.
11211        pub async fn send(self) -> Result<()> {
11212            (*self.0.stub)
11213                .cancel_operation(self.0.request, self.0.options)
11214                .await
11215                .map(crate::Response::into_body)
11216        }
11217
11218        /// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::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
11225    #[doc(hidden)]
11226    impl crate::RequestBuilder for CancelOperation {
11227        fn request_options(&mut self) -> &mut crate::RequestOptions {
11228            &mut self.0.options
11229        }
11230    }
11231}
11232
11233/// Request and client builders for [SearchService][crate::client::SearchService].
11234#[cfg(feature = "search-service")]
11235#[cfg_attr(docsrs, doc(cfg(feature = "search-service")))]
11236pub mod search_service {
11237    use crate::Result;
11238
11239    /// A builder for [SearchService][crate::client::SearchService].
11240    ///
11241    /// ```
11242    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
11243    /// # use google_cloud_discoveryengine_v1::*;
11244    /// # use builder::search_service::ClientBuilder;
11245    /// # use client::SearchService;
11246    /// let builder : ClientBuilder = SearchService::builder();
11247    /// let client = builder
11248    ///     .with_endpoint("https://discoveryengine.googleapis.com")
11249    ///     .build().await?;
11250    /// # Ok(()) }
11251    /// ```
11252    pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
11253
11254    pub(crate) mod client {
11255        use super::super::super::client::SearchService;
11256        pub struct Factory;
11257        impl crate::ClientFactory for Factory {
11258            type Client = SearchService;
11259            type Credentials = gaxi::options::Credentials;
11260            async fn build(
11261                self,
11262                config: gaxi::options::ClientConfig,
11263            ) -> crate::ClientBuilderResult<Self::Client> {
11264                Self::Client::new(config).await
11265            }
11266        }
11267    }
11268
11269    /// Common implementation for [crate::client::SearchService] request builders.
11270    #[derive(Clone, Debug)]
11271    pub(crate) struct RequestBuilder<R: std::default::Default> {
11272        stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchService>,
11273        request: R,
11274        options: crate::RequestOptions,
11275    }
11276
11277    impl<R> RequestBuilder<R>
11278    where
11279        R: std::default::Default,
11280    {
11281        pub(crate) fn new(
11282            stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchService>,
11283        ) -> Self {
11284            Self {
11285                stub,
11286                request: R::default(),
11287                options: crate::RequestOptions::default(),
11288            }
11289        }
11290    }
11291
11292    /// The request builder for [SearchService::search][crate::client::SearchService::search] calls.
11293    ///
11294    /// # Example
11295    /// ```
11296    /// # use google_cloud_discoveryengine_v1::builder::search_service::Search;
11297    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
11298    /// use google_cloud_gax::paginator::ItemPaginator;
11299    ///
11300    /// let builder = prepare_request_builder();
11301    /// let mut items = builder.by_item();
11302    /// while let Some(result) = items.next().await {
11303    ///   let item = result?;
11304    /// }
11305    /// # Ok(()) }
11306    ///
11307    /// fn prepare_request_builder() -> Search {
11308    ///   # panic!();
11309    ///   // ... details omitted ...
11310    /// }
11311    /// ```
11312    #[derive(Clone, Debug)]
11313    pub struct Search(RequestBuilder<crate::model::SearchRequest>);
11314
11315    impl Search {
11316        pub(crate) fn new(
11317            stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchService>,
11318        ) -> Self {
11319            Self(RequestBuilder::new(stub))
11320        }
11321
11322        /// Sets the full request, replacing any prior values.
11323        pub fn with_request<V: Into<crate::model::SearchRequest>>(mut self, v: V) -> Self {
11324            self.0.request = v.into();
11325            self
11326        }
11327
11328        /// Sets all the options, replacing any prior values.
11329        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
11330            self.0.options = v.into();
11331            self
11332        }
11333
11334        /// Sends the request.
11335        pub async fn send(self) -> Result<crate::model::SearchResponse> {
11336            (*self.0.stub)
11337                .search(self.0.request, self.0.options)
11338                .await
11339                .map(crate::Response::into_body)
11340        }
11341
11342        /// Streams each page in the collection.
11343        pub fn by_page(
11344            self,
11345        ) -> impl google_cloud_gax::paginator::Paginator<crate::model::SearchResponse, crate::Error>
11346        {
11347            use std::clone::Clone;
11348            let token = self.0.request.page_token.clone();
11349            let execute = move |token: String| {
11350                let mut builder = self.clone();
11351                builder.0.request = builder.0.request.set_page_token(token);
11352                builder.send()
11353            };
11354            google_cloud_gax::paginator::internal::new_paginator(token, execute)
11355        }
11356
11357        /// Streams each item in the collection.
11358        pub fn by_item(
11359            self,
11360        ) -> impl google_cloud_gax::paginator::ItemPaginator<crate::model::SearchResponse, crate::Error>
11361        {
11362            use google_cloud_gax::paginator::Paginator;
11363            self.by_page().items()
11364        }
11365
11366        /// Sets the value of [serving_config][crate::model::SearchRequest::serving_config].
11367        ///
11368        /// This is a **required** field for requests.
11369        pub fn set_serving_config<T: Into<std::string::String>>(mut self, v: T) -> Self {
11370            self.0.request.serving_config = v.into();
11371            self
11372        }
11373
11374        /// Sets the value of [branch][crate::model::SearchRequest::branch].
11375        pub fn set_branch<T: Into<std::string::String>>(mut self, v: T) -> Self {
11376            self.0.request.branch = v.into();
11377            self
11378        }
11379
11380        /// Sets the value of [query][crate::model::SearchRequest::query].
11381        pub fn set_query<T: Into<std::string::String>>(mut self, v: T) -> Self {
11382            self.0.request.query = v.into();
11383            self
11384        }
11385
11386        /// Sets the value of [page_categories][crate::model::SearchRequest::page_categories].
11387        pub fn set_page_categories<T, V>(mut self, v: T) -> Self
11388        where
11389            T: std::iter::IntoIterator<Item = V>,
11390            V: std::convert::Into<std::string::String>,
11391        {
11392            use std::iter::Iterator;
11393            self.0.request.page_categories = v.into_iter().map(|i| i.into()).collect();
11394            self
11395        }
11396
11397        /// Sets the value of [image_query][crate::model::SearchRequest::image_query].
11398        pub fn set_image_query<T>(mut self, v: T) -> Self
11399        where
11400            T: std::convert::Into<crate::model::search_request::ImageQuery>,
11401        {
11402            self.0.request.image_query = std::option::Option::Some(v.into());
11403            self
11404        }
11405
11406        /// Sets or clears the value of [image_query][crate::model::SearchRequest::image_query].
11407        pub fn set_or_clear_image_query<T>(mut self, v: std::option::Option<T>) -> Self
11408        where
11409            T: std::convert::Into<crate::model::search_request::ImageQuery>,
11410        {
11411            self.0.request.image_query = v.map(|x| x.into());
11412            self
11413        }
11414
11415        /// Sets the value of [page_size][crate::model::SearchRequest::page_size].
11416        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
11417            self.0.request.page_size = v.into();
11418            self
11419        }
11420
11421        /// Sets the value of [page_token][crate::model::SearchRequest::page_token].
11422        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
11423            self.0.request.page_token = v.into();
11424            self
11425        }
11426
11427        /// Sets the value of [offset][crate::model::SearchRequest::offset].
11428        pub fn set_offset<T: Into<i32>>(mut self, v: T) -> Self {
11429            self.0.request.offset = v.into();
11430            self
11431        }
11432
11433        /// Sets the value of [one_box_page_size][crate::model::SearchRequest::one_box_page_size].
11434        pub fn set_one_box_page_size<T: Into<i32>>(mut self, v: T) -> Self {
11435            self.0.request.one_box_page_size = v.into();
11436            self
11437        }
11438
11439        /// Sets the value of [data_store_specs][crate::model::SearchRequest::data_store_specs].
11440        pub fn set_data_store_specs<T, V>(mut self, v: T) -> Self
11441        where
11442            T: std::iter::IntoIterator<Item = V>,
11443            V: std::convert::Into<crate::model::search_request::DataStoreSpec>,
11444        {
11445            use std::iter::Iterator;
11446            self.0.request.data_store_specs = v.into_iter().map(|i| i.into()).collect();
11447            self
11448        }
11449
11450        /// Sets the value of [filter][crate::model::SearchRequest::filter].
11451        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
11452            self.0.request.filter = v.into();
11453            self
11454        }
11455
11456        /// Sets the value of [canonical_filter][crate::model::SearchRequest::canonical_filter].
11457        pub fn set_canonical_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
11458            self.0.request.canonical_filter = v.into();
11459            self
11460        }
11461
11462        /// Sets the value of [order_by][crate::model::SearchRequest::order_by].
11463        pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
11464            self.0.request.order_by = v.into();
11465            self
11466        }
11467
11468        /// Sets the value of [user_info][crate::model::SearchRequest::user_info].
11469        pub fn set_user_info<T>(mut self, v: T) -> Self
11470        where
11471            T: std::convert::Into<crate::model::UserInfo>,
11472        {
11473            self.0.request.user_info = std::option::Option::Some(v.into());
11474            self
11475        }
11476
11477        /// Sets or clears the value of [user_info][crate::model::SearchRequest::user_info].
11478        pub fn set_or_clear_user_info<T>(mut self, v: std::option::Option<T>) -> Self
11479        where
11480            T: std::convert::Into<crate::model::UserInfo>,
11481        {
11482            self.0.request.user_info = v.map(|x| x.into());
11483            self
11484        }
11485
11486        /// Sets the value of [language_code][crate::model::SearchRequest::language_code].
11487        pub fn set_language_code<T: Into<std::string::String>>(mut self, v: T) -> Self {
11488            self.0.request.language_code = v.into();
11489            self
11490        }
11491
11492        /// Sets the value of [facet_specs][crate::model::SearchRequest::facet_specs].
11493        pub fn set_facet_specs<T, V>(mut self, v: T) -> Self
11494        where
11495            T: std::iter::IntoIterator<Item = V>,
11496            V: std::convert::Into<crate::model::search_request::FacetSpec>,
11497        {
11498            use std::iter::Iterator;
11499            self.0.request.facet_specs = v.into_iter().map(|i| i.into()).collect();
11500            self
11501        }
11502
11503        /// Sets the value of [boost_spec][crate::model::SearchRequest::boost_spec].
11504        pub fn set_boost_spec<T>(mut self, v: T) -> Self
11505        where
11506            T: std::convert::Into<crate::model::search_request::BoostSpec>,
11507        {
11508            self.0.request.boost_spec = std::option::Option::Some(v.into());
11509            self
11510        }
11511
11512        /// Sets or clears the value of [boost_spec][crate::model::SearchRequest::boost_spec].
11513        pub fn set_or_clear_boost_spec<T>(mut self, v: std::option::Option<T>) -> Self
11514        where
11515            T: std::convert::Into<crate::model::search_request::BoostSpec>,
11516        {
11517            self.0.request.boost_spec = v.map(|x| x.into());
11518            self
11519        }
11520
11521        /// Sets the value of [params][crate::model::SearchRequest::params].
11522        pub fn set_params<T, K, V>(mut self, v: T) -> Self
11523        where
11524            T: std::iter::IntoIterator<Item = (K, V)>,
11525            K: std::convert::Into<std::string::String>,
11526            V: std::convert::Into<wkt::Value>,
11527        {
11528            self.0.request.params = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
11529            self
11530        }
11531
11532        /// Sets the value of [query_expansion_spec][crate::model::SearchRequest::query_expansion_spec].
11533        pub fn set_query_expansion_spec<T>(mut self, v: T) -> Self
11534        where
11535            T: std::convert::Into<crate::model::search_request::QueryExpansionSpec>,
11536        {
11537            self.0.request.query_expansion_spec = std::option::Option::Some(v.into());
11538            self
11539        }
11540
11541        /// Sets or clears the value of [query_expansion_spec][crate::model::SearchRequest::query_expansion_spec].
11542        pub fn set_or_clear_query_expansion_spec<T>(mut self, v: std::option::Option<T>) -> Self
11543        where
11544            T: std::convert::Into<crate::model::search_request::QueryExpansionSpec>,
11545        {
11546            self.0.request.query_expansion_spec = v.map(|x| x.into());
11547            self
11548        }
11549
11550        /// Sets the value of [spell_correction_spec][crate::model::SearchRequest::spell_correction_spec].
11551        pub fn set_spell_correction_spec<T>(mut self, v: T) -> Self
11552        where
11553            T: std::convert::Into<crate::model::search_request::SpellCorrectionSpec>,
11554        {
11555            self.0.request.spell_correction_spec = std::option::Option::Some(v.into());
11556            self
11557        }
11558
11559        /// Sets or clears the value of [spell_correction_spec][crate::model::SearchRequest::spell_correction_spec].
11560        pub fn set_or_clear_spell_correction_spec<T>(mut self, v: std::option::Option<T>) -> Self
11561        where
11562            T: std::convert::Into<crate::model::search_request::SpellCorrectionSpec>,
11563        {
11564            self.0.request.spell_correction_spec = v.map(|x| x.into());
11565            self
11566        }
11567
11568        /// Sets the value of [user_pseudo_id][crate::model::SearchRequest::user_pseudo_id].
11569        pub fn set_user_pseudo_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
11570            self.0.request.user_pseudo_id = v.into();
11571            self
11572        }
11573
11574        /// Sets the value of [content_search_spec][crate::model::SearchRequest::content_search_spec].
11575        pub fn set_content_search_spec<T>(mut self, v: T) -> Self
11576        where
11577            T: std::convert::Into<crate::model::search_request::ContentSearchSpec>,
11578        {
11579            self.0.request.content_search_spec = std::option::Option::Some(v.into());
11580            self
11581        }
11582
11583        /// Sets or clears the value of [content_search_spec][crate::model::SearchRequest::content_search_spec].
11584        pub fn set_or_clear_content_search_spec<T>(mut self, v: std::option::Option<T>) -> Self
11585        where
11586            T: std::convert::Into<crate::model::search_request::ContentSearchSpec>,
11587        {
11588            self.0.request.content_search_spec = v.map(|x| x.into());
11589            self
11590        }
11591
11592        /// Sets the value of [ranking_expression][crate::model::SearchRequest::ranking_expression].
11593        pub fn set_ranking_expression<T: Into<std::string::String>>(mut self, v: T) -> Self {
11594            self.0.request.ranking_expression = v.into();
11595            self
11596        }
11597
11598        /// Sets the value of [ranking_expression_backend][crate::model::SearchRequest::ranking_expression_backend].
11599        pub fn set_ranking_expression_backend<
11600            T: Into<crate::model::search_request::RankingExpressionBackend>,
11601        >(
11602            mut self,
11603            v: T,
11604        ) -> Self {
11605            self.0.request.ranking_expression_backend = v.into();
11606            self
11607        }
11608
11609        /// Sets the value of [safe_search][crate::model::SearchRequest::safe_search].
11610        pub fn set_safe_search<T: Into<bool>>(mut self, v: T) -> Self {
11611            self.0.request.safe_search = v.into();
11612            self
11613        }
11614
11615        /// Sets the value of [user_labels][crate::model::SearchRequest::user_labels].
11616        pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
11617        where
11618            T: std::iter::IntoIterator<Item = (K, V)>,
11619            K: std::convert::Into<std::string::String>,
11620            V: std::convert::Into<std::string::String>,
11621        {
11622            self.0.request.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
11623            self
11624        }
11625
11626        /// Sets the value of [natural_language_query_understanding_spec][crate::model::SearchRequest::natural_language_query_understanding_spec].
11627        pub fn set_natural_language_query_understanding_spec<T>(mut self, v: T) -> Self
11628        where
11629            T: std::convert::Into<
11630                    crate::model::search_request::NaturalLanguageQueryUnderstandingSpec,
11631                >,
11632        {
11633            self.0.request.natural_language_query_understanding_spec =
11634                std::option::Option::Some(v.into());
11635            self
11636        }
11637
11638        /// Sets or clears the value of [natural_language_query_understanding_spec][crate::model::SearchRequest::natural_language_query_understanding_spec].
11639        pub fn set_or_clear_natural_language_query_understanding_spec<T>(
11640            mut self,
11641            v: std::option::Option<T>,
11642        ) -> Self
11643        where
11644            T: std::convert::Into<
11645                    crate::model::search_request::NaturalLanguageQueryUnderstandingSpec,
11646                >,
11647        {
11648            self.0.request.natural_language_query_understanding_spec = v.map(|x| x.into());
11649            self
11650        }
11651
11652        /// Sets the value of [search_as_you_type_spec][crate::model::SearchRequest::search_as_you_type_spec].
11653        pub fn set_search_as_you_type_spec<T>(mut self, v: T) -> Self
11654        where
11655            T: std::convert::Into<crate::model::search_request::SearchAsYouTypeSpec>,
11656        {
11657            self.0.request.search_as_you_type_spec = std::option::Option::Some(v.into());
11658            self
11659        }
11660
11661        /// Sets or clears the value of [search_as_you_type_spec][crate::model::SearchRequest::search_as_you_type_spec].
11662        pub fn set_or_clear_search_as_you_type_spec<T>(mut self, v: std::option::Option<T>) -> Self
11663        where
11664            T: std::convert::Into<crate::model::search_request::SearchAsYouTypeSpec>,
11665        {
11666            self.0.request.search_as_you_type_spec = v.map(|x| x.into());
11667            self
11668        }
11669
11670        /// Sets the value of [display_spec][crate::model::SearchRequest::display_spec].
11671        pub fn set_display_spec<T>(mut self, v: T) -> Self
11672        where
11673            T: std::convert::Into<crate::model::search_request::DisplaySpec>,
11674        {
11675            self.0.request.display_spec = std::option::Option::Some(v.into());
11676            self
11677        }
11678
11679        /// Sets or clears the value of [display_spec][crate::model::SearchRequest::display_spec].
11680        pub fn set_or_clear_display_spec<T>(mut self, v: std::option::Option<T>) -> Self
11681        where
11682            T: std::convert::Into<crate::model::search_request::DisplaySpec>,
11683        {
11684            self.0.request.display_spec = v.map(|x| x.into());
11685            self
11686        }
11687
11688        /// Sets the value of [crowding_specs][crate::model::SearchRequest::crowding_specs].
11689        pub fn set_crowding_specs<T, V>(mut self, v: T) -> Self
11690        where
11691            T: std::iter::IntoIterator<Item = V>,
11692            V: std::convert::Into<crate::model::search_request::CrowdingSpec>,
11693        {
11694            use std::iter::Iterator;
11695            self.0.request.crowding_specs = v.into_iter().map(|i| i.into()).collect();
11696            self
11697        }
11698
11699        /// Sets the value of [session][crate::model::SearchRequest::session].
11700        pub fn set_session<T: Into<std::string::String>>(mut self, v: T) -> Self {
11701            self.0.request.session = v.into();
11702            self
11703        }
11704
11705        /// Sets the value of [session_spec][crate::model::SearchRequest::session_spec].
11706        pub fn set_session_spec<T>(mut self, v: T) -> Self
11707        where
11708            T: std::convert::Into<crate::model::search_request::SessionSpec>,
11709        {
11710            self.0.request.session_spec = std::option::Option::Some(v.into());
11711            self
11712        }
11713
11714        /// Sets or clears the value of [session_spec][crate::model::SearchRequest::session_spec].
11715        pub fn set_or_clear_session_spec<T>(mut self, v: std::option::Option<T>) -> Self
11716        where
11717            T: std::convert::Into<crate::model::search_request::SessionSpec>,
11718        {
11719            self.0.request.session_spec = v.map(|x| x.into());
11720            self
11721        }
11722
11723        /// Sets the value of [relevance_threshold][crate::model::SearchRequest::relevance_threshold].
11724        pub fn set_relevance_threshold<
11725            T: Into<crate::model::search_request::RelevanceThreshold>,
11726        >(
11727            mut self,
11728            v: T,
11729        ) -> Self {
11730            self.0.request.relevance_threshold = v.into();
11731            self
11732        }
11733
11734        /// Sets the value of [relevance_score_spec][crate::model::SearchRequest::relevance_score_spec].
11735        pub fn set_relevance_score_spec<T>(mut self, v: T) -> Self
11736        where
11737            T: std::convert::Into<crate::model::search_request::RelevanceScoreSpec>,
11738        {
11739            self.0.request.relevance_score_spec = std::option::Option::Some(v.into());
11740            self
11741        }
11742
11743        /// Sets or clears the value of [relevance_score_spec][crate::model::SearchRequest::relevance_score_spec].
11744        pub fn set_or_clear_relevance_score_spec<T>(mut self, v: std::option::Option<T>) -> Self
11745        where
11746            T: std::convert::Into<crate::model::search_request::RelevanceScoreSpec>,
11747        {
11748            self.0.request.relevance_score_spec = v.map(|x| x.into());
11749            self
11750        }
11751    }
11752
11753    #[doc(hidden)]
11754    impl crate::RequestBuilder for Search {
11755        fn request_options(&mut self) -> &mut crate::RequestOptions {
11756            &mut self.0.options
11757        }
11758    }
11759
11760    /// The request builder for [SearchService::search_lite][crate::client::SearchService::search_lite] calls.
11761    ///
11762    /// # Example
11763    /// ```
11764    /// # use google_cloud_discoveryengine_v1::builder::search_service::SearchLite;
11765    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
11766    /// use google_cloud_gax::paginator::ItemPaginator;
11767    ///
11768    /// let builder = prepare_request_builder();
11769    /// let mut items = builder.by_item();
11770    /// while let Some(result) = items.next().await {
11771    ///   let item = result?;
11772    /// }
11773    /// # Ok(()) }
11774    ///
11775    /// fn prepare_request_builder() -> SearchLite {
11776    ///   # panic!();
11777    ///   // ... details omitted ...
11778    /// }
11779    /// ```
11780    #[derive(Clone, Debug)]
11781    pub struct SearchLite(RequestBuilder<crate::model::SearchRequest>);
11782
11783    impl SearchLite {
11784        pub(crate) fn new(
11785            stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchService>,
11786        ) -> Self {
11787            Self(RequestBuilder::new(stub))
11788        }
11789
11790        /// Sets the full request, replacing any prior values.
11791        pub fn with_request<V: Into<crate::model::SearchRequest>>(mut self, v: V) -> Self {
11792            self.0.request = v.into();
11793            self
11794        }
11795
11796        /// Sets all the options, replacing any prior values.
11797        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
11798            self.0.options = v.into();
11799            self
11800        }
11801
11802        /// Sends the request.
11803        pub async fn send(self) -> Result<crate::model::SearchResponse> {
11804            (*self.0.stub)
11805                .search_lite(self.0.request, self.0.options)
11806                .await
11807                .map(crate::Response::into_body)
11808        }
11809
11810        /// Streams each page in the collection.
11811        pub fn by_page(
11812            self,
11813        ) -> impl google_cloud_gax::paginator::Paginator<crate::model::SearchResponse, crate::Error>
11814        {
11815            use std::clone::Clone;
11816            let token = self.0.request.page_token.clone();
11817            let execute = move |token: String| {
11818                let mut builder = self.clone();
11819                builder.0.request = builder.0.request.set_page_token(token);
11820                builder.send()
11821            };
11822            google_cloud_gax::paginator::internal::new_paginator(token, execute)
11823        }
11824
11825        /// Streams each item in the collection.
11826        pub fn by_item(
11827            self,
11828        ) -> impl google_cloud_gax::paginator::ItemPaginator<crate::model::SearchResponse, crate::Error>
11829        {
11830            use google_cloud_gax::paginator::Paginator;
11831            self.by_page().items()
11832        }
11833
11834        /// Sets the value of [serving_config][crate::model::SearchRequest::serving_config].
11835        ///
11836        /// This is a **required** field for requests.
11837        pub fn set_serving_config<T: Into<std::string::String>>(mut self, v: T) -> Self {
11838            self.0.request.serving_config = v.into();
11839            self
11840        }
11841
11842        /// Sets the value of [branch][crate::model::SearchRequest::branch].
11843        pub fn set_branch<T: Into<std::string::String>>(mut self, v: T) -> Self {
11844            self.0.request.branch = v.into();
11845            self
11846        }
11847
11848        /// Sets the value of [query][crate::model::SearchRequest::query].
11849        pub fn set_query<T: Into<std::string::String>>(mut self, v: T) -> Self {
11850            self.0.request.query = v.into();
11851            self
11852        }
11853
11854        /// Sets the value of [page_categories][crate::model::SearchRequest::page_categories].
11855        pub fn set_page_categories<T, V>(mut self, v: T) -> Self
11856        where
11857            T: std::iter::IntoIterator<Item = V>,
11858            V: std::convert::Into<std::string::String>,
11859        {
11860            use std::iter::Iterator;
11861            self.0.request.page_categories = v.into_iter().map(|i| i.into()).collect();
11862            self
11863        }
11864
11865        /// Sets the value of [image_query][crate::model::SearchRequest::image_query].
11866        pub fn set_image_query<T>(mut self, v: T) -> Self
11867        where
11868            T: std::convert::Into<crate::model::search_request::ImageQuery>,
11869        {
11870            self.0.request.image_query = std::option::Option::Some(v.into());
11871            self
11872        }
11873
11874        /// Sets or clears the value of [image_query][crate::model::SearchRequest::image_query].
11875        pub fn set_or_clear_image_query<T>(mut self, v: std::option::Option<T>) -> Self
11876        where
11877            T: std::convert::Into<crate::model::search_request::ImageQuery>,
11878        {
11879            self.0.request.image_query = v.map(|x| x.into());
11880            self
11881        }
11882
11883        /// Sets the value of [page_size][crate::model::SearchRequest::page_size].
11884        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
11885            self.0.request.page_size = v.into();
11886            self
11887        }
11888
11889        /// Sets the value of [page_token][crate::model::SearchRequest::page_token].
11890        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
11891            self.0.request.page_token = v.into();
11892            self
11893        }
11894
11895        /// Sets the value of [offset][crate::model::SearchRequest::offset].
11896        pub fn set_offset<T: Into<i32>>(mut self, v: T) -> Self {
11897            self.0.request.offset = v.into();
11898            self
11899        }
11900
11901        /// Sets the value of [one_box_page_size][crate::model::SearchRequest::one_box_page_size].
11902        pub fn set_one_box_page_size<T: Into<i32>>(mut self, v: T) -> Self {
11903            self.0.request.one_box_page_size = v.into();
11904            self
11905        }
11906
11907        /// Sets the value of [data_store_specs][crate::model::SearchRequest::data_store_specs].
11908        pub fn set_data_store_specs<T, V>(mut self, v: T) -> Self
11909        where
11910            T: std::iter::IntoIterator<Item = V>,
11911            V: std::convert::Into<crate::model::search_request::DataStoreSpec>,
11912        {
11913            use std::iter::Iterator;
11914            self.0.request.data_store_specs = v.into_iter().map(|i| i.into()).collect();
11915            self
11916        }
11917
11918        /// Sets the value of [filter][crate::model::SearchRequest::filter].
11919        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
11920            self.0.request.filter = v.into();
11921            self
11922        }
11923
11924        /// Sets the value of [canonical_filter][crate::model::SearchRequest::canonical_filter].
11925        pub fn set_canonical_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
11926            self.0.request.canonical_filter = v.into();
11927            self
11928        }
11929
11930        /// Sets the value of [order_by][crate::model::SearchRequest::order_by].
11931        pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
11932            self.0.request.order_by = v.into();
11933            self
11934        }
11935
11936        /// Sets the value of [user_info][crate::model::SearchRequest::user_info].
11937        pub fn set_user_info<T>(mut self, v: T) -> Self
11938        where
11939            T: std::convert::Into<crate::model::UserInfo>,
11940        {
11941            self.0.request.user_info = std::option::Option::Some(v.into());
11942            self
11943        }
11944
11945        /// Sets or clears the value of [user_info][crate::model::SearchRequest::user_info].
11946        pub fn set_or_clear_user_info<T>(mut self, v: std::option::Option<T>) -> Self
11947        where
11948            T: std::convert::Into<crate::model::UserInfo>,
11949        {
11950            self.0.request.user_info = v.map(|x| x.into());
11951            self
11952        }
11953
11954        /// Sets the value of [language_code][crate::model::SearchRequest::language_code].
11955        pub fn set_language_code<T: Into<std::string::String>>(mut self, v: T) -> Self {
11956            self.0.request.language_code = v.into();
11957            self
11958        }
11959
11960        /// Sets the value of [facet_specs][crate::model::SearchRequest::facet_specs].
11961        pub fn set_facet_specs<T, V>(mut self, v: T) -> Self
11962        where
11963            T: std::iter::IntoIterator<Item = V>,
11964            V: std::convert::Into<crate::model::search_request::FacetSpec>,
11965        {
11966            use std::iter::Iterator;
11967            self.0.request.facet_specs = v.into_iter().map(|i| i.into()).collect();
11968            self
11969        }
11970
11971        /// Sets the value of [boost_spec][crate::model::SearchRequest::boost_spec].
11972        pub fn set_boost_spec<T>(mut self, v: T) -> Self
11973        where
11974            T: std::convert::Into<crate::model::search_request::BoostSpec>,
11975        {
11976            self.0.request.boost_spec = std::option::Option::Some(v.into());
11977            self
11978        }
11979
11980        /// Sets or clears the value of [boost_spec][crate::model::SearchRequest::boost_spec].
11981        pub fn set_or_clear_boost_spec<T>(mut self, v: std::option::Option<T>) -> Self
11982        where
11983            T: std::convert::Into<crate::model::search_request::BoostSpec>,
11984        {
11985            self.0.request.boost_spec = v.map(|x| x.into());
11986            self
11987        }
11988
11989        /// Sets the value of [params][crate::model::SearchRequest::params].
11990        pub fn set_params<T, K, V>(mut self, v: T) -> Self
11991        where
11992            T: std::iter::IntoIterator<Item = (K, V)>,
11993            K: std::convert::Into<std::string::String>,
11994            V: std::convert::Into<wkt::Value>,
11995        {
11996            self.0.request.params = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
11997            self
11998        }
11999
12000        /// Sets the value of [query_expansion_spec][crate::model::SearchRequest::query_expansion_spec].
12001        pub fn set_query_expansion_spec<T>(mut self, v: T) -> Self
12002        where
12003            T: std::convert::Into<crate::model::search_request::QueryExpansionSpec>,
12004        {
12005            self.0.request.query_expansion_spec = std::option::Option::Some(v.into());
12006            self
12007        }
12008
12009        /// Sets or clears the value of [query_expansion_spec][crate::model::SearchRequest::query_expansion_spec].
12010        pub fn set_or_clear_query_expansion_spec<T>(mut self, v: std::option::Option<T>) -> Self
12011        where
12012            T: std::convert::Into<crate::model::search_request::QueryExpansionSpec>,
12013        {
12014            self.0.request.query_expansion_spec = v.map(|x| x.into());
12015            self
12016        }
12017
12018        /// Sets the value of [spell_correction_spec][crate::model::SearchRequest::spell_correction_spec].
12019        pub fn set_spell_correction_spec<T>(mut self, v: T) -> Self
12020        where
12021            T: std::convert::Into<crate::model::search_request::SpellCorrectionSpec>,
12022        {
12023            self.0.request.spell_correction_spec = std::option::Option::Some(v.into());
12024            self
12025        }
12026
12027        /// Sets or clears the value of [spell_correction_spec][crate::model::SearchRequest::spell_correction_spec].
12028        pub fn set_or_clear_spell_correction_spec<T>(mut self, v: std::option::Option<T>) -> Self
12029        where
12030            T: std::convert::Into<crate::model::search_request::SpellCorrectionSpec>,
12031        {
12032            self.0.request.spell_correction_spec = v.map(|x| x.into());
12033            self
12034        }
12035
12036        /// Sets the value of [user_pseudo_id][crate::model::SearchRequest::user_pseudo_id].
12037        pub fn set_user_pseudo_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
12038            self.0.request.user_pseudo_id = v.into();
12039            self
12040        }
12041
12042        /// Sets the value of [content_search_spec][crate::model::SearchRequest::content_search_spec].
12043        pub fn set_content_search_spec<T>(mut self, v: T) -> Self
12044        where
12045            T: std::convert::Into<crate::model::search_request::ContentSearchSpec>,
12046        {
12047            self.0.request.content_search_spec = std::option::Option::Some(v.into());
12048            self
12049        }
12050
12051        /// Sets or clears the value of [content_search_spec][crate::model::SearchRequest::content_search_spec].
12052        pub fn set_or_clear_content_search_spec<T>(mut self, v: std::option::Option<T>) -> Self
12053        where
12054            T: std::convert::Into<crate::model::search_request::ContentSearchSpec>,
12055        {
12056            self.0.request.content_search_spec = v.map(|x| x.into());
12057            self
12058        }
12059
12060        /// Sets the value of [ranking_expression][crate::model::SearchRequest::ranking_expression].
12061        pub fn set_ranking_expression<T: Into<std::string::String>>(mut self, v: T) -> Self {
12062            self.0.request.ranking_expression = v.into();
12063            self
12064        }
12065
12066        /// Sets the value of [ranking_expression_backend][crate::model::SearchRequest::ranking_expression_backend].
12067        pub fn set_ranking_expression_backend<
12068            T: Into<crate::model::search_request::RankingExpressionBackend>,
12069        >(
12070            mut self,
12071            v: T,
12072        ) -> Self {
12073            self.0.request.ranking_expression_backend = v.into();
12074            self
12075        }
12076
12077        /// Sets the value of [safe_search][crate::model::SearchRequest::safe_search].
12078        pub fn set_safe_search<T: Into<bool>>(mut self, v: T) -> Self {
12079            self.0.request.safe_search = v.into();
12080            self
12081        }
12082
12083        /// Sets the value of [user_labels][crate::model::SearchRequest::user_labels].
12084        pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
12085        where
12086            T: std::iter::IntoIterator<Item = (K, V)>,
12087            K: std::convert::Into<std::string::String>,
12088            V: std::convert::Into<std::string::String>,
12089        {
12090            self.0.request.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
12091            self
12092        }
12093
12094        /// Sets the value of [natural_language_query_understanding_spec][crate::model::SearchRequest::natural_language_query_understanding_spec].
12095        pub fn set_natural_language_query_understanding_spec<T>(mut self, v: T) -> Self
12096        where
12097            T: std::convert::Into<
12098                    crate::model::search_request::NaturalLanguageQueryUnderstandingSpec,
12099                >,
12100        {
12101            self.0.request.natural_language_query_understanding_spec =
12102                std::option::Option::Some(v.into());
12103            self
12104        }
12105
12106        /// Sets or clears the value of [natural_language_query_understanding_spec][crate::model::SearchRequest::natural_language_query_understanding_spec].
12107        pub fn set_or_clear_natural_language_query_understanding_spec<T>(
12108            mut self,
12109            v: std::option::Option<T>,
12110        ) -> Self
12111        where
12112            T: std::convert::Into<
12113                    crate::model::search_request::NaturalLanguageQueryUnderstandingSpec,
12114                >,
12115        {
12116            self.0.request.natural_language_query_understanding_spec = v.map(|x| x.into());
12117            self
12118        }
12119
12120        /// Sets the value of [search_as_you_type_spec][crate::model::SearchRequest::search_as_you_type_spec].
12121        pub fn set_search_as_you_type_spec<T>(mut self, v: T) -> Self
12122        where
12123            T: std::convert::Into<crate::model::search_request::SearchAsYouTypeSpec>,
12124        {
12125            self.0.request.search_as_you_type_spec = std::option::Option::Some(v.into());
12126            self
12127        }
12128
12129        /// Sets or clears the value of [search_as_you_type_spec][crate::model::SearchRequest::search_as_you_type_spec].
12130        pub fn set_or_clear_search_as_you_type_spec<T>(mut self, v: std::option::Option<T>) -> Self
12131        where
12132            T: std::convert::Into<crate::model::search_request::SearchAsYouTypeSpec>,
12133        {
12134            self.0.request.search_as_you_type_spec = v.map(|x| x.into());
12135            self
12136        }
12137
12138        /// Sets the value of [display_spec][crate::model::SearchRequest::display_spec].
12139        pub fn set_display_spec<T>(mut self, v: T) -> Self
12140        where
12141            T: std::convert::Into<crate::model::search_request::DisplaySpec>,
12142        {
12143            self.0.request.display_spec = std::option::Option::Some(v.into());
12144            self
12145        }
12146
12147        /// Sets or clears the value of [display_spec][crate::model::SearchRequest::display_spec].
12148        pub fn set_or_clear_display_spec<T>(mut self, v: std::option::Option<T>) -> Self
12149        where
12150            T: std::convert::Into<crate::model::search_request::DisplaySpec>,
12151        {
12152            self.0.request.display_spec = v.map(|x| x.into());
12153            self
12154        }
12155
12156        /// Sets the value of [crowding_specs][crate::model::SearchRequest::crowding_specs].
12157        pub fn set_crowding_specs<T, V>(mut self, v: T) -> Self
12158        where
12159            T: std::iter::IntoIterator<Item = V>,
12160            V: std::convert::Into<crate::model::search_request::CrowdingSpec>,
12161        {
12162            use std::iter::Iterator;
12163            self.0.request.crowding_specs = v.into_iter().map(|i| i.into()).collect();
12164            self
12165        }
12166
12167        /// Sets the value of [session][crate::model::SearchRequest::session].
12168        pub fn set_session<T: Into<std::string::String>>(mut self, v: T) -> Self {
12169            self.0.request.session = v.into();
12170            self
12171        }
12172
12173        /// Sets the value of [session_spec][crate::model::SearchRequest::session_spec].
12174        pub fn set_session_spec<T>(mut self, v: T) -> Self
12175        where
12176            T: std::convert::Into<crate::model::search_request::SessionSpec>,
12177        {
12178            self.0.request.session_spec = std::option::Option::Some(v.into());
12179            self
12180        }
12181
12182        /// Sets or clears the value of [session_spec][crate::model::SearchRequest::session_spec].
12183        pub fn set_or_clear_session_spec<T>(mut self, v: std::option::Option<T>) -> Self
12184        where
12185            T: std::convert::Into<crate::model::search_request::SessionSpec>,
12186        {
12187            self.0.request.session_spec = v.map(|x| x.into());
12188            self
12189        }
12190
12191        /// Sets the value of [relevance_threshold][crate::model::SearchRequest::relevance_threshold].
12192        pub fn set_relevance_threshold<
12193            T: Into<crate::model::search_request::RelevanceThreshold>,
12194        >(
12195            mut self,
12196            v: T,
12197        ) -> Self {
12198            self.0.request.relevance_threshold = v.into();
12199            self
12200        }
12201
12202        /// Sets the value of [relevance_score_spec][crate::model::SearchRequest::relevance_score_spec].
12203        pub fn set_relevance_score_spec<T>(mut self, v: T) -> Self
12204        where
12205            T: std::convert::Into<crate::model::search_request::RelevanceScoreSpec>,
12206        {
12207            self.0.request.relevance_score_spec = std::option::Option::Some(v.into());
12208            self
12209        }
12210
12211        /// Sets or clears the value of [relevance_score_spec][crate::model::SearchRequest::relevance_score_spec].
12212        pub fn set_or_clear_relevance_score_spec<T>(mut self, v: std::option::Option<T>) -> Self
12213        where
12214            T: std::convert::Into<crate::model::search_request::RelevanceScoreSpec>,
12215        {
12216            self.0.request.relevance_score_spec = v.map(|x| x.into());
12217            self
12218        }
12219    }
12220
12221    #[doc(hidden)]
12222    impl crate::RequestBuilder for SearchLite {
12223        fn request_options(&mut self) -> &mut crate::RequestOptions {
12224            &mut self.0.options
12225        }
12226    }
12227
12228    /// The request builder for [SearchService::list_operations][crate::client::SearchService::list_operations] calls.
12229    ///
12230    /// # Example
12231    /// ```
12232    /// # use google_cloud_discoveryengine_v1::builder::search_service::ListOperations;
12233    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
12234    /// use google_cloud_gax::paginator::ItemPaginator;
12235    ///
12236    /// let builder = prepare_request_builder();
12237    /// let mut items = builder.by_item();
12238    /// while let Some(result) = items.next().await {
12239    ///   let item = result?;
12240    /// }
12241    /// # Ok(()) }
12242    ///
12243    /// fn prepare_request_builder() -> ListOperations {
12244    ///   # panic!();
12245    ///   // ... details omitted ...
12246    /// }
12247    /// ```
12248    #[derive(Clone, Debug)]
12249    pub struct ListOperations(
12250        RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
12251    );
12252
12253    impl ListOperations {
12254        pub(crate) fn new(
12255            stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchService>,
12256        ) -> Self {
12257            Self(RequestBuilder::new(stub))
12258        }
12259
12260        /// Sets the full request, replacing any prior values.
12261        pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
12262            mut self,
12263            v: V,
12264        ) -> Self {
12265            self.0.request = v.into();
12266            self
12267        }
12268
12269        /// Sets all the options, replacing any prior values.
12270        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
12271            self.0.options = v.into();
12272            self
12273        }
12274
12275        /// Sends the request.
12276        pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
12277            (*self.0.stub)
12278                .list_operations(self.0.request, self.0.options)
12279                .await
12280                .map(crate::Response::into_body)
12281        }
12282
12283        /// Streams each page in the collection.
12284        pub fn by_page(
12285            self,
12286        ) -> impl google_cloud_gax::paginator::Paginator<
12287            google_cloud_longrunning::model::ListOperationsResponse,
12288            crate::Error,
12289        > {
12290            use std::clone::Clone;
12291            let token = self.0.request.page_token.clone();
12292            let execute = move |token: String| {
12293                let mut builder = self.clone();
12294                builder.0.request = builder.0.request.set_page_token(token);
12295                builder.send()
12296            };
12297            google_cloud_gax::paginator::internal::new_paginator(token, execute)
12298        }
12299
12300        /// Streams each item in the collection.
12301        pub fn by_item(
12302            self,
12303        ) -> impl google_cloud_gax::paginator::ItemPaginator<
12304            google_cloud_longrunning::model::ListOperationsResponse,
12305            crate::Error,
12306        > {
12307            use google_cloud_gax::paginator::Paginator;
12308            self.by_page().items()
12309        }
12310
12311        /// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
12312        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
12313            self.0.request.name = v.into();
12314            self
12315        }
12316
12317        /// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::filter].
12318        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
12319            self.0.request.filter = v.into();
12320            self
12321        }
12322
12323        /// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
12324        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
12325            self.0.request.page_size = v.into();
12326            self
12327        }
12328
12329        /// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
12330        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
12331            self.0.request.page_token = v.into();
12332            self
12333        }
12334
12335        /// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
12336        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
12337            self.0.request.return_partial_success = v.into();
12338            self
12339        }
12340    }
12341
12342    #[doc(hidden)]
12343    impl crate::RequestBuilder for ListOperations {
12344        fn request_options(&mut self) -> &mut crate::RequestOptions {
12345            &mut self.0.options
12346        }
12347    }
12348
12349    /// The request builder for [SearchService::get_operation][crate::client::SearchService::get_operation] calls.
12350    ///
12351    /// # Example
12352    /// ```
12353    /// # use google_cloud_discoveryengine_v1::builder::search_service::GetOperation;
12354    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
12355    ///
12356    /// let builder = prepare_request_builder();
12357    /// let response = builder.send().await?;
12358    /// # Ok(()) }
12359    ///
12360    /// fn prepare_request_builder() -> GetOperation {
12361    ///   # panic!();
12362    ///   // ... details omitted ...
12363    /// }
12364    /// ```
12365    #[derive(Clone, Debug)]
12366    pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
12367
12368    impl GetOperation {
12369        pub(crate) fn new(
12370            stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchService>,
12371        ) -> Self {
12372            Self(RequestBuilder::new(stub))
12373        }
12374
12375        /// Sets the full request, replacing any prior values.
12376        pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
12377            mut self,
12378            v: V,
12379        ) -> Self {
12380            self.0.request = v.into();
12381            self
12382        }
12383
12384        /// Sets all the options, replacing any prior values.
12385        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
12386            self.0.options = v.into();
12387            self
12388        }
12389
12390        /// Sends the request.
12391        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
12392            (*self.0.stub)
12393                .get_operation(self.0.request, self.0.options)
12394                .await
12395                .map(crate::Response::into_body)
12396        }
12397
12398        /// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
12399        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
12400            self.0.request.name = v.into();
12401            self
12402        }
12403    }
12404
12405    #[doc(hidden)]
12406    impl crate::RequestBuilder for GetOperation {
12407        fn request_options(&mut self) -> &mut crate::RequestOptions {
12408            &mut self.0.options
12409        }
12410    }
12411
12412    /// The request builder for [SearchService::cancel_operation][crate::client::SearchService::cancel_operation] calls.
12413    ///
12414    /// # Example
12415    /// ```
12416    /// # use google_cloud_discoveryengine_v1::builder::search_service::CancelOperation;
12417    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
12418    ///
12419    /// let builder = prepare_request_builder();
12420    /// let response = builder.send().await?;
12421    /// # Ok(()) }
12422    ///
12423    /// fn prepare_request_builder() -> CancelOperation {
12424    ///   # panic!();
12425    ///   // ... details omitted ...
12426    /// }
12427    /// ```
12428    #[derive(Clone, Debug)]
12429    pub struct CancelOperation(
12430        RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
12431    );
12432
12433    impl CancelOperation {
12434        pub(crate) fn new(
12435            stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchService>,
12436        ) -> Self {
12437            Self(RequestBuilder::new(stub))
12438        }
12439
12440        /// Sets the full request, replacing any prior values.
12441        pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
12442            mut self,
12443            v: V,
12444        ) -> Self {
12445            self.0.request = v.into();
12446            self
12447        }
12448
12449        /// Sets all the options, replacing any prior values.
12450        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
12451            self.0.options = v.into();
12452            self
12453        }
12454
12455        /// Sends the request.
12456        pub async fn send(self) -> Result<()> {
12457            (*self.0.stub)
12458                .cancel_operation(self.0.request, self.0.options)
12459                .await
12460                .map(crate::Response::into_body)
12461        }
12462
12463        /// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::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
12470    #[doc(hidden)]
12471    impl crate::RequestBuilder for CancelOperation {
12472        fn request_options(&mut self) -> &mut crate::RequestOptions {
12473            &mut self.0.options
12474        }
12475    }
12476}
12477
12478/// Request and client builders for [SearchTuningService][crate::client::SearchTuningService].
12479#[cfg(feature = "search-tuning-service")]
12480#[cfg_attr(docsrs, doc(cfg(feature = "search-tuning-service")))]
12481pub mod search_tuning_service {
12482    use crate::Result;
12483
12484    /// A builder for [SearchTuningService][crate::client::SearchTuningService].
12485    ///
12486    /// ```
12487    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
12488    /// # use google_cloud_discoveryengine_v1::*;
12489    /// # use builder::search_tuning_service::ClientBuilder;
12490    /// # use client::SearchTuningService;
12491    /// let builder : ClientBuilder = SearchTuningService::builder();
12492    /// let client = builder
12493    ///     .with_endpoint("https://discoveryengine.googleapis.com")
12494    ///     .build().await?;
12495    /// # Ok(()) }
12496    /// ```
12497    pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
12498
12499    pub(crate) mod client {
12500        use super::super::super::client::SearchTuningService;
12501        pub struct Factory;
12502        impl crate::ClientFactory for Factory {
12503            type Client = SearchTuningService;
12504            type Credentials = gaxi::options::Credentials;
12505            async fn build(
12506                self,
12507                config: gaxi::options::ClientConfig,
12508            ) -> crate::ClientBuilderResult<Self::Client> {
12509                Self::Client::new(config).await
12510            }
12511        }
12512    }
12513
12514    /// Common implementation for [crate::client::SearchTuningService] request builders.
12515    #[derive(Clone, Debug)]
12516    pub(crate) struct RequestBuilder<R: std::default::Default> {
12517        stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchTuningService>,
12518        request: R,
12519        options: crate::RequestOptions,
12520    }
12521
12522    impl<R> RequestBuilder<R>
12523    where
12524        R: std::default::Default,
12525    {
12526        pub(crate) fn new(
12527            stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchTuningService>,
12528        ) -> Self {
12529            Self {
12530                stub,
12531                request: R::default(),
12532                options: crate::RequestOptions::default(),
12533            }
12534        }
12535    }
12536
12537    /// The request builder for [SearchTuningService::train_custom_model][crate::client::SearchTuningService::train_custom_model] calls.
12538    ///
12539    /// # Example
12540    /// ```
12541    /// # use google_cloud_discoveryengine_v1::builder::search_tuning_service::TrainCustomModel;
12542    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
12543    /// use google_cloud_lro::Poller;
12544    ///
12545    /// let builder = prepare_request_builder();
12546    /// let response = builder.poller().until_done().await?;
12547    /// # Ok(()) }
12548    ///
12549    /// fn prepare_request_builder() -> TrainCustomModel {
12550    ///   # panic!();
12551    ///   // ... details omitted ...
12552    /// }
12553    /// ```
12554    #[derive(Clone, Debug)]
12555    pub struct TrainCustomModel(RequestBuilder<crate::model::TrainCustomModelRequest>);
12556
12557    impl TrainCustomModel {
12558        pub(crate) fn new(
12559            stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchTuningService>,
12560        ) -> Self {
12561            Self(RequestBuilder::new(stub))
12562        }
12563
12564        /// Sets the full request, replacing any prior values.
12565        pub fn with_request<V: Into<crate::model::TrainCustomModelRequest>>(
12566            mut self,
12567            v: V,
12568        ) -> Self {
12569            self.0.request = v.into();
12570            self
12571        }
12572
12573        /// Sets all the options, replacing any prior values.
12574        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
12575            self.0.options = v.into();
12576            self
12577        }
12578
12579        /// Sends the request.
12580        ///
12581        /// # Long running operations
12582        ///
12583        /// This starts, but does not poll, a longrunning operation. More information
12584        /// on [train_custom_model][crate::client::SearchTuningService::train_custom_model].
12585        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
12586            (*self.0.stub)
12587                .train_custom_model(self.0.request, self.0.options)
12588                .await
12589                .map(crate::Response::into_body)
12590        }
12591
12592        /// Creates a [Poller][google_cloud_lro::Poller] to work with `train_custom_model`.
12593        pub fn poller(
12594            self,
12595        ) -> impl google_cloud_lro::Poller<
12596            crate::model::TrainCustomModelResponse,
12597            crate::model::TrainCustomModelMetadata,
12598        > {
12599            type Operation = google_cloud_lro::internal::Operation<
12600                crate::model::TrainCustomModelResponse,
12601                crate::model::TrainCustomModelMetadata,
12602            >;
12603            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
12604            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
12605
12606            let stub = self.0.stub.clone();
12607            let mut options = self.0.options.clone();
12608            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
12609            let query = move |name| {
12610                let stub = stub.clone();
12611                let options = options.clone();
12612                async {
12613                    let op = GetOperation::new(stub)
12614                        .set_name(name)
12615                        .with_options(options)
12616                        .send()
12617                        .await?;
12618                    Ok(Operation::new(op))
12619                }
12620            };
12621
12622            let start = move || async {
12623                let op = self.send().await?;
12624                Ok(Operation::new(op))
12625            };
12626
12627            google_cloud_lro::internal::new_poller(
12628                polling_error_policy,
12629                polling_backoff_policy,
12630                start,
12631                query,
12632            )
12633        }
12634
12635        /// Sets the value of [data_store][crate::model::TrainCustomModelRequest::data_store].
12636        ///
12637        /// This is a **required** field for requests.
12638        pub fn set_data_store<T: Into<std::string::String>>(mut self, v: T) -> Self {
12639            self.0.request.data_store = v.into();
12640            self
12641        }
12642
12643        /// Sets the value of [model_type][crate::model::TrainCustomModelRequest::model_type].
12644        pub fn set_model_type<T: Into<std::string::String>>(mut self, v: T) -> Self {
12645            self.0.request.model_type = v.into();
12646            self
12647        }
12648
12649        /// Sets the value of [error_config][crate::model::TrainCustomModelRequest::error_config].
12650        pub fn set_error_config<T>(mut self, v: T) -> Self
12651        where
12652            T: std::convert::Into<crate::model::ImportErrorConfig>,
12653        {
12654            self.0.request.error_config = std::option::Option::Some(v.into());
12655            self
12656        }
12657
12658        /// Sets or clears the value of [error_config][crate::model::TrainCustomModelRequest::error_config].
12659        pub fn set_or_clear_error_config<T>(mut self, v: std::option::Option<T>) -> Self
12660        where
12661            T: std::convert::Into<crate::model::ImportErrorConfig>,
12662        {
12663            self.0.request.error_config = v.map(|x| x.into());
12664            self
12665        }
12666
12667        /// Sets the value of [model_id][crate::model::TrainCustomModelRequest::model_id].
12668        pub fn set_model_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
12669            self.0.request.model_id = v.into();
12670            self
12671        }
12672
12673        /// Sets the value of [training_input][crate::model::TrainCustomModelRequest::training_input].
12674        ///
12675        /// Note that all the setters affecting `training_input` are
12676        /// mutually exclusive.
12677        pub fn set_training_input<
12678            T: Into<Option<crate::model::train_custom_model_request::TrainingInput>>,
12679        >(
12680            mut self,
12681            v: T,
12682        ) -> Self {
12683            self.0.request.training_input = v.into();
12684            self
12685        }
12686
12687        /// Sets the value of [training_input][crate::model::TrainCustomModelRequest::training_input]
12688        /// to hold a `GcsTrainingInput`.
12689        ///
12690        /// Note that all the setters affecting `training_input` are
12691        /// mutually exclusive.
12692        pub fn set_gcs_training_input<
12693            T: std::convert::Into<
12694                    std::boxed::Box<crate::model::train_custom_model_request::GcsTrainingInput>,
12695                >,
12696        >(
12697            mut self,
12698            v: T,
12699        ) -> Self {
12700            self.0.request = self.0.request.set_gcs_training_input(v);
12701            self
12702        }
12703    }
12704
12705    #[doc(hidden)]
12706    impl crate::RequestBuilder for TrainCustomModel {
12707        fn request_options(&mut self) -> &mut crate::RequestOptions {
12708            &mut self.0.options
12709        }
12710    }
12711
12712    /// The request builder for [SearchTuningService::list_custom_models][crate::client::SearchTuningService::list_custom_models] calls.
12713    ///
12714    /// # Example
12715    /// ```
12716    /// # use google_cloud_discoveryengine_v1::builder::search_tuning_service::ListCustomModels;
12717    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
12718    ///
12719    /// let builder = prepare_request_builder();
12720    /// let response = builder.send().await?;
12721    /// # Ok(()) }
12722    ///
12723    /// fn prepare_request_builder() -> ListCustomModels {
12724    ///   # panic!();
12725    ///   // ... details omitted ...
12726    /// }
12727    /// ```
12728    #[derive(Clone, Debug)]
12729    pub struct ListCustomModels(RequestBuilder<crate::model::ListCustomModelsRequest>);
12730
12731    impl ListCustomModels {
12732        pub(crate) fn new(
12733            stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchTuningService>,
12734        ) -> Self {
12735            Self(RequestBuilder::new(stub))
12736        }
12737
12738        /// Sets the full request, replacing any prior values.
12739        pub fn with_request<V: Into<crate::model::ListCustomModelsRequest>>(
12740            mut self,
12741            v: V,
12742        ) -> Self {
12743            self.0.request = v.into();
12744            self
12745        }
12746
12747        /// Sets all the options, replacing any prior values.
12748        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
12749            self.0.options = v.into();
12750            self
12751        }
12752
12753        /// Sends the request.
12754        pub async fn send(self) -> Result<crate::model::ListCustomModelsResponse> {
12755            (*self.0.stub)
12756                .list_custom_models(self.0.request, self.0.options)
12757                .await
12758                .map(crate::Response::into_body)
12759        }
12760
12761        /// Sets the value of [data_store][crate::model::ListCustomModelsRequest::data_store].
12762        ///
12763        /// This is a **required** field for requests.
12764        pub fn set_data_store<T: Into<std::string::String>>(mut self, v: T) -> Self {
12765            self.0.request.data_store = v.into();
12766            self
12767        }
12768    }
12769
12770    #[doc(hidden)]
12771    impl crate::RequestBuilder for ListCustomModels {
12772        fn request_options(&mut self) -> &mut crate::RequestOptions {
12773            &mut self.0.options
12774        }
12775    }
12776
12777    /// The request builder for [SearchTuningService::list_operations][crate::client::SearchTuningService::list_operations] calls.
12778    ///
12779    /// # Example
12780    /// ```
12781    /// # use google_cloud_discoveryengine_v1::builder::search_tuning_service::ListOperations;
12782    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
12783    /// use google_cloud_gax::paginator::ItemPaginator;
12784    ///
12785    /// let builder = prepare_request_builder();
12786    /// let mut items = builder.by_item();
12787    /// while let Some(result) = items.next().await {
12788    ///   let item = result?;
12789    /// }
12790    /// # Ok(()) }
12791    ///
12792    /// fn prepare_request_builder() -> ListOperations {
12793    ///   # panic!();
12794    ///   // ... details omitted ...
12795    /// }
12796    /// ```
12797    #[derive(Clone, Debug)]
12798    pub struct ListOperations(
12799        RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
12800    );
12801
12802    impl ListOperations {
12803        pub(crate) fn new(
12804            stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchTuningService>,
12805        ) -> Self {
12806            Self(RequestBuilder::new(stub))
12807        }
12808
12809        /// Sets the full request, replacing any prior values.
12810        pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
12811            mut self,
12812            v: V,
12813        ) -> Self {
12814            self.0.request = v.into();
12815            self
12816        }
12817
12818        /// Sets all the options, replacing any prior values.
12819        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
12820            self.0.options = v.into();
12821            self
12822        }
12823
12824        /// Sends the request.
12825        pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
12826            (*self.0.stub)
12827                .list_operations(self.0.request, self.0.options)
12828                .await
12829                .map(crate::Response::into_body)
12830        }
12831
12832        /// Streams each page in the collection.
12833        pub fn by_page(
12834            self,
12835        ) -> impl google_cloud_gax::paginator::Paginator<
12836            google_cloud_longrunning::model::ListOperationsResponse,
12837            crate::Error,
12838        > {
12839            use std::clone::Clone;
12840            let token = self.0.request.page_token.clone();
12841            let execute = move |token: String| {
12842                let mut builder = self.clone();
12843                builder.0.request = builder.0.request.set_page_token(token);
12844                builder.send()
12845            };
12846            google_cloud_gax::paginator::internal::new_paginator(token, execute)
12847        }
12848
12849        /// Streams each item in the collection.
12850        pub fn by_item(
12851            self,
12852        ) -> impl google_cloud_gax::paginator::ItemPaginator<
12853            google_cloud_longrunning::model::ListOperationsResponse,
12854            crate::Error,
12855        > {
12856            use google_cloud_gax::paginator::Paginator;
12857            self.by_page().items()
12858        }
12859
12860        /// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
12861        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
12862            self.0.request.name = v.into();
12863            self
12864        }
12865
12866        /// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::filter].
12867        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
12868            self.0.request.filter = v.into();
12869            self
12870        }
12871
12872        /// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
12873        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
12874            self.0.request.page_size = v.into();
12875            self
12876        }
12877
12878        /// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
12879        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
12880            self.0.request.page_token = v.into();
12881            self
12882        }
12883
12884        /// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
12885        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
12886            self.0.request.return_partial_success = v.into();
12887            self
12888        }
12889    }
12890
12891    #[doc(hidden)]
12892    impl crate::RequestBuilder for ListOperations {
12893        fn request_options(&mut self) -> &mut crate::RequestOptions {
12894            &mut self.0.options
12895        }
12896    }
12897
12898    /// The request builder for [SearchTuningService::get_operation][crate::client::SearchTuningService::get_operation] calls.
12899    ///
12900    /// # Example
12901    /// ```
12902    /// # use google_cloud_discoveryengine_v1::builder::search_tuning_service::GetOperation;
12903    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
12904    ///
12905    /// let builder = prepare_request_builder();
12906    /// let response = builder.send().await?;
12907    /// # Ok(()) }
12908    ///
12909    /// fn prepare_request_builder() -> GetOperation {
12910    ///   # panic!();
12911    ///   // ... details omitted ...
12912    /// }
12913    /// ```
12914    #[derive(Clone, Debug)]
12915    pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
12916
12917    impl GetOperation {
12918        pub(crate) fn new(
12919            stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchTuningService>,
12920        ) -> Self {
12921            Self(RequestBuilder::new(stub))
12922        }
12923
12924        /// Sets the full request, replacing any prior values.
12925        pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
12926            mut self,
12927            v: V,
12928        ) -> Self {
12929            self.0.request = v.into();
12930            self
12931        }
12932
12933        /// Sets all the options, replacing any prior values.
12934        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
12935            self.0.options = v.into();
12936            self
12937        }
12938
12939        /// Sends the request.
12940        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
12941            (*self.0.stub)
12942                .get_operation(self.0.request, self.0.options)
12943                .await
12944                .map(crate::Response::into_body)
12945        }
12946
12947        /// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
12948        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
12949            self.0.request.name = v.into();
12950            self
12951        }
12952    }
12953
12954    #[doc(hidden)]
12955    impl crate::RequestBuilder for GetOperation {
12956        fn request_options(&mut self) -> &mut crate::RequestOptions {
12957            &mut self.0.options
12958        }
12959    }
12960
12961    /// The request builder for [SearchTuningService::cancel_operation][crate::client::SearchTuningService::cancel_operation] calls.
12962    ///
12963    /// # Example
12964    /// ```
12965    /// # use google_cloud_discoveryengine_v1::builder::search_tuning_service::CancelOperation;
12966    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
12967    ///
12968    /// let builder = prepare_request_builder();
12969    /// let response = builder.send().await?;
12970    /// # Ok(()) }
12971    ///
12972    /// fn prepare_request_builder() -> CancelOperation {
12973    ///   # panic!();
12974    ///   // ... details omitted ...
12975    /// }
12976    /// ```
12977    #[derive(Clone, Debug)]
12978    pub struct CancelOperation(
12979        RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
12980    );
12981
12982    impl CancelOperation {
12983        pub(crate) fn new(
12984            stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchTuningService>,
12985        ) -> Self {
12986            Self(RequestBuilder::new(stub))
12987        }
12988
12989        /// Sets the full request, replacing any prior values.
12990        pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
12991            mut self,
12992            v: V,
12993        ) -> Self {
12994            self.0.request = v.into();
12995            self
12996        }
12997
12998        /// Sets all the options, replacing any prior values.
12999        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
13000            self.0.options = v.into();
13001            self
13002        }
13003
13004        /// Sends the request.
13005        pub async fn send(self) -> Result<()> {
13006            (*self.0.stub)
13007                .cancel_operation(self.0.request, self.0.options)
13008                .await
13009                .map(crate::Response::into_body)
13010        }
13011
13012        /// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::name].
13013        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13014            self.0.request.name = v.into();
13015            self
13016        }
13017    }
13018
13019    #[doc(hidden)]
13020    impl crate::RequestBuilder for CancelOperation {
13021        fn request_options(&mut self) -> &mut crate::RequestOptions {
13022            &mut self.0.options
13023        }
13024    }
13025}
13026
13027/// Request and client builders for [ServingConfigService][crate::client::ServingConfigService].
13028#[cfg(feature = "serving-config-service")]
13029#[cfg_attr(docsrs, doc(cfg(feature = "serving-config-service")))]
13030pub mod serving_config_service {
13031    use crate::Result;
13032
13033    /// A builder for [ServingConfigService][crate::client::ServingConfigService].
13034    ///
13035    /// ```
13036    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
13037    /// # use google_cloud_discoveryengine_v1::*;
13038    /// # use builder::serving_config_service::ClientBuilder;
13039    /// # use client::ServingConfigService;
13040    /// let builder : ClientBuilder = ServingConfigService::builder();
13041    /// let client = builder
13042    ///     .with_endpoint("https://discoveryengine.googleapis.com")
13043    ///     .build().await?;
13044    /// # Ok(()) }
13045    /// ```
13046    pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
13047
13048    pub(crate) mod client {
13049        use super::super::super::client::ServingConfigService;
13050        pub struct Factory;
13051        impl crate::ClientFactory for Factory {
13052            type Client = ServingConfigService;
13053            type Credentials = gaxi::options::Credentials;
13054            async fn build(
13055                self,
13056                config: gaxi::options::ClientConfig,
13057            ) -> crate::ClientBuilderResult<Self::Client> {
13058                Self::Client::new(config).await
13059            }
13060        }
13061    }
13062
13063    /// Common implementation for [crate::client::ServingConfigService] request builders.
13064    #[derive(Clone, Debug)]
13065    pub(crate) struct RequestBuilder<R: std::default::Default> {
13066        stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
13067        request: R,
13068        options: crate::RequestOptions,
13069    }
13070
13071    impl<R> RequestBuilder<R>
13072    where
13073        R: std::default::Default,
13074    {
13075        pub(crate) fn new(
13076            stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
13077        ) -> Self {
13078            Self {
13079                stub,
13080                request: R::default(),
13081                options: crate::RequestOptions::default(),
13082            }
13083        }
13084    }
13085
13086    /// The request builder for [ServingConfigService::update_serving_config][crate::client::ServingConfigService::update_serving_config] calls.
13087    ///
13088    /// # Example
13089    /// ```
13090    /// # use google_cloud_discoveryengine_v1::builder::serving_config_service::UpdateServingConfig;
13091    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
13092    ///
13093    /// let builder = prepare_request_builder();
13094    /// let response = builder.send().await?;
13095    /// # Ok(()) }
13096    ///
13097    /// fn prepare_request_builder() -> UpdateServingConfig {
13098    ///   # panic!();
13099    ///   // ... details omitted ...
13100    /// }
13101    /// ```
13102    #[derive(Clone, Debug)]
13103    pub struct UpdateServingConfig(RequestBuilder<crate::model::UpdateServingConfigRequest>);
13104
13105    impl UpdateServingConfig {
13106        pub(crate) fn new(
13107            stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
13108        ) -> Self {
13109            Self(RequestBuilder::new(stub))
13110        }
13111
13112        /// Sets the full request, replacing any prior values.
13113        pub fn with_request<V: Into<crate::model::UpdateServingConfigRequest>>(
13114            mut self,
13115            v: V,
13116        ) -> Self {
13117            self.0.request = v.into();
13118            self
13119        }
13120
13121        /// Sets all the options, replacing any prior values.
13122        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
13123            self.0.options = v.into();
13124            self
13125        }
13126
13127        /// Sends the request.
13128        pub async fn send(self) -> Result<crate::model::ServingConfig> {
13129            (*self.0.stub)
13130                .update_serving_config(self.0.request, self.0.options)
13131                .await
13132                .map(crate::Response::into_body)
13133        }
13134
13135        /// Sets the value of [serving_config][crate::model::UpdateServingConfigRequest::serving_config].
13136        ///
13137        /// This is a **required** field for requests.
13138        pub fn set_serving_config<T>(mut self, v: T) -> Self
13139        where
13140            T: std::convert::Into<crate::model::ServingConfig>,
13141        {
13142            self.0.request.serving_config = std::option::Option::Some(v.into());
13143            self
13144        }
13145
13146        /// Sets or clears the value of [serving_config][crate::model::UpdateServingConfigRequest::serving_config].
13147        ///
13148        /// This is a **required** field for requests.
13149        pub fn set_or_clear_serving_config<T>(mut self, v: std::option::Option<T>) -> Self
13150        where
13151            T: std::convert::Into<crate::model::ServingConfig>,
13152        {
13153            self.0.request.serving_config = v.map(|x| x.into());
13154            self
13155        }
13156
13157        /// Sets the value of [update_mask][crate::model::UpdateServingConfigRequest::update_mask].
13158        pub fn set_update_mask<T>(mut self, v: T) -> Self
13159        where
13160            T: std::convert::Into<wkt::FieldMask>,
13161        {
13162            self.0.request.update_mask = std::option::Option::Some(v.into());
13163            self
13164        }
13165
13166        /// Sets or clears the value of [update_mask][crate::model::UpdateServingConfigRequest::update_mask].
13167        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
13168        where
13169            T: std::convert::Into<wkt::FieldMask>,
13170        {
13171            self.0.request.update_mask = v.map(|x| x.into());
13172            self
13173        }
13174    }
13175
13176    #[doc(hidden)]
13177    impl crate::RequestBuilder for UpdateServingConfig {
13178        fn request_options(&mut self) -> &mut crate::RequestOptions {
13179            &mut self.0.options
13180        }
13181    }
13182
13183    /// The request builder for [ServingConfigService::list_operations][crate::client::ServingConfigService::list_operations] calls.
13184    ///
13185    /// # Example
13186    /// ```
13187    /// # use google_cloud_discoveryengine_v1::builder::serving_config_service::ListOperations;
13188    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
13189    /// use google_cloud_gax::paginator::ItemPaginator;
13190    ///
13191    /// let builder = prepare_request_builder();
13192    /// let mut items = builder.by_item();
13193    /// while let Some(result) = items.next().await {
13194    ///   let item = result?;
13195    /// }
13196    /// # Ok(()) }
13197    ///
13198    /// fn prepare_request_builder() -> ListOperations {
13199    ///   # panic!();
13200    ///   // ... details omitted ...
13201    /// }
13202    /// ```
13203    #[derive(Clone, Debug)]
13204    pub struct ListOperations(
13205        RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
13206    );
13207
13208    impl ListOperations {
13209        pub(crate) fn new(
13210            stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
13211        ) -> Self {
13212            Self(RequestBuilder::new(stub))
13213        }
13214
13215        /// Sets the full request, replacing any prior values.
13216        pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
13217            mut self,
13218            v: V,
13219        ) -> Self {
13220            self.0.request = v.into();
13221            self
13222        }
13223
13224        /// Sets all the options, replacing any prior values.
13225        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
13226            self.0.options = v.into();
13227            self
13228        }
13229
13230        /// Sends the request.
13231        pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
13232            (*self.0.stub)
13233                .list_operations(self.0.request, self.0.options)
13234                .await
13235                .map(crate::Response::into_body)
13236        }
13237
13238        /// Streams each page in the collection.
13239        pub fn by_page(
13240            self,
13241        ) -> impl google_cloud_gax::paginator::Paginator<
13242            google_cloud_longrunning::model::ListOperationsResponse,
13243            crate::Error,
13244        > {
13245            use std::clone::Clone;
13246            let token = self.0.request.page_token.clone();
13247            let execute = move |token: String| {
13248                let mut builder = self.clone();
13249                builder.0.request = builder.0.request.set_page_token(token);
13250                builder.send()
13251            };
13252            google_cloud_gax::paginator::internal::new_paginator(token, execute)
13253        }
13254
13255        /// Streams each item in the collection.
13256        pub fn by_item(
13257            self,
13258        ) -> impl google_cloud_gax::paginator::ItemPaginator<
13259            google_cloud_longrunning::model::ListOperationsResponse,
13260            crate::Error,
13261        > {
13262            use google_cloud_gax::paginator::Paginator;
13263            self.by_page().items()
13264        }
13265
13266        /// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
13267        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13268            self.0.request.name = v.into();
13269            self
13270        }
13271
13272        /// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::filter].
13273        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
13274            self.0.request.filter = v.into();
13275            self
13276        }
13277
13278        /// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
13279        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
13280            self.0.request.page_size = v.into();
13281            self
13282        }
13283
13284        /// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
13285        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
13286            self.0.request.page_token = v.into();
13287            self
13288        }
13289
13290        /// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
13291        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
13292            self.0.request.return_partial_success = v.into();
13293            self
13294        }
13295    }
13296
13297    #[doc(hidden)]
13298    impl crate::RequestBuilder for ListOperations {
13299        fn request_options(&mut self) -> &mut crate::RequestOptions {
13300            &mut self.0.options
13301        }
13302    }
13303
13304    /// The request builder for [ServingConfigService::get_operation][crate::client::ServingConfigService::get_operation] calls.
13305    ///
13306    /// # Example
13307    /// ```
13308    /// # use google_cloud_discoveryengine_v1::builder::serving_config_service::GetOperation;
13309    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
13310    ///
13311    /// let builder = prepare_request_builder();
13312    /// let response = builder.send().await?;
13313    /// # Ok(()) }
13314    ///
13315    /// fn prepare_request_builder() -> GetOperation {
13316    ///   # panic!();
13317    ///   // ... details omitted ...
13318    /// }
13319    /// ```
13320    #[derive(Clone, Debug)]
13321    pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
13322
13323    impl GetOperation {
13324        pub(crate) fn new(
13325            stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
13326        ) -> Self {
13327            Self(RequestBuilder::new(stub))
13328        }
13329
13330        /// Sets the full request, replacing any prior values.
13331        pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
13332            mut self,
13333            v: V,
13334        ) -> Self {
13335            self.0.request = v.into();
13336            self
13337        }
13338
13339        /// Sets all the options, replacing any prior values.
13340        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
13341            self.0.options = v.into();
13342            self
13343        }
13344
13345        /// Sends the request.
13346        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
13347            (*self.0.stub)
13348                .get_operation(self.0.request, self.0.options)
13349                .await
13350                .map(crate::Response::into_body)
13351        }
13352
13353        /// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
13354        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13355            self.0.request.name = v.into();
13356            self
13357        }
13358    }
13359
13360    #[doc(hidden)]
13361    impl crate::RequestBuilder for GetOperation {
13362        fn request_options(&mut self) -> &mut crate::RequestOptions {
13363            &mut self.0.options
13364        }
13365    }
13366
13367    /// The request builder for [ServingConfigService::cancel_operation][crate::client::ServingConfigService::cancel_operation] calls.
13368    ///
13369    /// # Example
13370    /// ```
13371    /// # use google_cloud_discoveryengine_v1::builder::serving_config_service::CancelOperation;
13372    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
13373    ///
13374    /// let builder = prepare_request_builder();
13375    /// let response = builder.send().await?;
13376    /// # Ok(()) }
13377    ///
13378    /// fn prepare_request_builder() -> CancelOperation {
13379    ///   # panic!();
13380    ///   // ... details omitted ...
13381    /// }
13382    /// ```
13383    #[derive(Clone, Debug)]
13384    pub struct CancelOperation(
13385        RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
13386    );
13387
13388    impl CancelOperation {
13389        pub(crate) fn new(
13390            stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
13391        ) -> Self {
13392            Self(RequestBuilder::new(stub))
13393        }
13394
13395        /// Sets the full request, replacing any prior values.
13396        pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
13397            mut self,
13398            v: V,
13399        ) -> Self {
13400            self.0.request = v.into();
13401            self
13402        }
13403
13404        /// Sets all the options, replacing any prior values.
13405        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
13406            self.0.options = v.into();
13407            self
13408        }
13409
13410        /// Sends the request.
13411        pub async fn send(self) -> Result<()> {
13412            (*self.0.stub)
13413                .cancel_operation(self.0.request, self.0.options)
13414                .await
13415                .map(crate::Response::into_body)
13416        }
13417
13418        /// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::name].
13419        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13420            self.0.request.name = v.into();
13421            self
13422        }
13423    }
13424
13425    #[doc(hidden)]
13426    impl crate::RequestBuilder for CancelOperation {
13427        fn request_options(&mut self) -> &mut crate::RequestOptions {
13428            &mut self.0.options
13429        }
13430    }
13431}
13432
13433/// Request and client builders for [SessionService][crate::client::SessionService].
13434#[cfg(feature = "session-service")]
13435#[cfg_attr(docsrs, doc(cfg(feature = "session-service")))]
13436pub mod session_service {
13437    use crate::Result;
13438
13439    /// A builder for [SessionService][crate::client::SessionService].
13440    ///
13441    /// ```
13442    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
13443    /// # use google_cloud_discoveryengine_v1::*;
13444    /// # use builder::session_service::ClientBuilder;
13445    /// # use client::SessionService;
13446    /// let builder : ClientBuilder = SessionService::builder();
13447    /// let client = builder
13448    ///     .with_endpoint("https://discoveryengine.googleapis.com")
13449    ///     .build().await?;
13450    /// # Ok(()) }
13451    /// ```
13452    pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
13453
13454    pub(crate) mod client {
13455        use super::super::super::client::SessionService;
13456        pub struct Factory;
13457        impl crate::ClientFactory for Factory {
13458            type Client = SessionService;
13459            type Credentials = gaxi::options::Credentials;
13460            async fn build(
13461                self,
13462                config: gaxi::options::ClientConfig,
13463            ) -> crate::ClientBuilderResult<Self::Client> {
13464                Self::Client::new(config).await
13465            }
13466        }
13467    }
13468
13469    /// Common implementation for [crate::client::SessionService] request builders.
13470    #[derive(Clone, Debug)]
13471    pub(crate) struct RequestBuilder<R: std::default::Default> {
13472        stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
13473        request: R,
13474        options: crate::RequestOptions,
13475    }
13476
13477    impl<R> RequestBuilder<R>
13478    where
13479        R: std::default::Default,
13480    {
13481        pub(crate) fn new(
13482            stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
13483        ) -> Self {
13484            Self {
13485                stub,
13486                request: R::default(),
13487                options: crate::RequestOptions::default(),
13488            }
13489        }
13490    }
13491
13492    /// The request builder for [SessionService::create_session][crate::client::SessionService::create_session] calls.
13493    ///
13494    /// # Example
13495    /// ```
13496    /// # use google_cloud_discoveryengine_v1::builder::session_service::CreateSession;
13497    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
13498    ///
13499    /// let builder = prepare_request_builder();
13500    /// let response = builder.send().await?;
13501    /// # Ok(()) }
13502    ///
13503    /// fn prepare_request_builder() -> CreateSession {
13504    ///   # panic!();
13505    ///   // ... details omitted ...
13506    /// }
13507    /// ```
13508    #[derive(Clone, Debug)]
13509    pub struct CreateSession(RequestBuilder<crate::model::CreateSessionRequest>);
13510
13511    impl CreateSession {
13512        pub(crate) fn new(
13513            stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
13514        ) -> Self {
13515            Self(RequestBuilder::new(stub))
13516        }
13517
13518        /// Sets the full request, replacing any prior values.
13519        pub fn with_request<V: Into<crate::model::CreateSessionRequest>>(mut self, v: V) -> Self {
13520            self.0.request = v.into();
13521            self
13522        }
13523
13524        /// Sets all the options, replacing any prior values.
13525        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
13526            self.0.options = v.into();
13527            self
13528        }
13529
13530        /// Sends the request.
13531        pub async fn send(self) -> Result<crate::model::Session> {
13532            (*self.0.stub)
13533                .create_session(self.0.request, self.0.options)
13534                .await
13535                .map(crate::Response::into_body)
13536        }
13537
13538        /// Sets the value of [parent][crate::model::CreateSessionRequest::parent].
13539        ///
13540        /// This is a **required** field for requests.
13541        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
13542            self.0.request.parent = v.into();
13543            self
13544        }
13545
13546        /// Sets the value of [session][crate::model::CreateSessionRequest::session].
13547        ///
13548        /// This is a **required** field for requests.
13549        pub fn set_session<T>(mut self, v: T) -> Self
13550        where
13551            T: std::convert::Into<crate::model::Session>,
13552        {
13553            self.0.request.session = std::option::Option::Some(v.into());
13554            self
13555        }
13556
13557        /// Sets or clears the value of [session][crate::model::CreateSessionRequest::session].
13558        ///
13559        /// This is a **required** field for requests.
13560        pub fn set_or_clear_session<T>(mut self, v: std::option::Option<T>) -> Self
13561        where
13562            T: std::convert::Into<crate::model::Session>,
13563        {
13564            self.0.request.session = v.map(|x| x.into());
13565            self
13566        }
13567    }
13568
13569    #[doc(hidden)]
13570    impl crate::RequestBuilder for CreateSession {
13571        fn request_options(&mut self) -> &mut crate::RequestOptions {
13572            &mut self.0.options
13573        }
13574    }
13575
13576    /// The request builder for [SessionService::delete_session][crate::client::SessionService::delete_session] calls.
13577    ///
13578    /// # Example
13579    /// ```
13580    /// # use google_cloud_discoveryengine_v1::builder::session_service::DeleteSession;
13581    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
13582    ///
13583    /// let builder = prepare_request_builder();
13584    /// let response = builder.send().await?;
13585    /// # Ok(()) }
13586    ///
13587    /// fn prepare_request_builder() -> DeleteSession {
13588    ///   # panic!();
13589    ///   // ... details omitted ...
13590    /// }
13591    /// ```
13592    #[derive(Clone, Debug)]
13593    pub struct DeleteSession(RequestBuilder<crate::model::DeleteSessionRequest>);
13594
13595    impl DeleteSession {
13596        pub(crate) fn new(
13597            stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
13598        ) -> Self {
13599            Self(RequestBuilder::new(stub))
13600        }
13601
13602        /// Sets the full request, replacing any prior values.
13603        pub fn with_request<V: Into<crate::model::DeleteSessionRequest>>(mut self, v: V) -> Self {
13604            self.0.request = v.into();
13605            self
13606        }
13607
13608        /// Sets all the options, replacing any prior values.
13609        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
13610            self.0.options = v.into();
13611            self
13612        }
13613
13614        /// Sends the request.
13615        pub async fn send(self) -> Result<()> {
13616            (*self.0.stub)
13617                .delete_session(self.0.request, self.0.options)
13618                .await
13619                .map(crate::Response::into_body)
13620        }
13621
13622        /// Sets the value of [name][crate::model::DeleteSessionRequest::name].
13623        ///
13624        /// This is a **required** field for requests.
13625        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13626            self.0.request.name = v.into();
13627            self
13628        }
13629    }
13630
13631    #[doc(hidden)]
13632    impl crate::RequestBuilder for DeleteSession {
13633        fn request_options(&mut self) -> &mut crate::RequestOptions {
13634            &mut self.0.options
13635        }
13636    }
13637
13638    /// The request builder for [SessionService::update_session][crate::client::SessionService::update_session] calls.
13639    ///
13640    /// # Example
13641    /// ```
13642    /// # use google_cloud_discoveryengine_v1::builder::session_service::UpdateSession;
13643    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
13644    ///
13645    /// let builder = prepare_request_builder();
13646    /// let response = builder.send().await?;
13647    /// # Ok(()) }
13648    ///
13649    /// fn prepare_request_builder() -> UpdateSession {
13650    ///   # panic!();
13651    ///   // ... details omitted ...
13652    /// }
13653    /// ```
13654    #[derive(Clone, Debug)]
13655    pub struct UpdateSession(RequestBuilder<crate::model::UpdateSessionRequest>);
13656
13657    impl UpdateSession {
13658        pub(crate) fn new(
13659            stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
13660        ) -> Self {
13661            Self(RequestBuilder::new(stub))
13662        }
13663
13664        /// Sets the full request, replacing any prior values.
13665        pub fn with_request<V: Into<crate::model::UpdateSessionRequest>>(mut self, v: V) -> Self {
13666            self.0.request = v.into();
13667            self
13668        }
13669
13670        /// Sets all the options, replacing any prior values.
13671        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
13672            self.0.options = v.into();
13673            self
13674        }
13675
13676        /// Sends the request.
13677        pub async fn send(self) -> Result<crate::model::Session> {
13678            (*self.0.stub)
13679                .update_session(self.0.request, self.0.options)
13680                .await
13681                .map(crate::Response::into_body)
13682        }
13683
13684        /// Sets the value of [session][crate::model::UpdateSessionRequest::session].
13685        ///
13686        /// This is a **required** field for requests.
13687        pub fn set_session<T>(mut self, v: T) -> Self
13688        where
13689            T: std::convert::Into<crate::model::Session>,
13690        {
13691            self.0.request.session = std::option::Option::Some(v.into());
13692            self
13693        }
13694
13695        /// Sets or clears the value of [session][crate::model::UpdateSessionRequest::session].
13696        ///
13697        /// This is a **required** field for requests.
13698        pub fn set_or_clear_session<T>(mut self, v: std::option::Option<T>) -> Self
13699        where
13700            T: std::convert::Into<crate::model::Session>,
13701        {
13702            self.0.request.session = v.map(|x| x.into());
13703            self
13704        }
13705
13706        /// Sets the value of [update_mask][crate::model::UpdateSessionRequest::update_mask].
13707        pub fn set_update_mask<T>(mut self, v: T) -> Self
13708        where
13709            T: std::convert::Into<wkt::FieldMask>,
13710        {
13711            self.0.request.update_mask = std::option::Option::Some(v.into());
13712            self
13713        }
13714
13715        /// Sets or clears the value of [update_mask][crate::model::UpdateSessionRequest::update_mask].
13716        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
13717        where
13718            T: std::convert::Into<wkt::FieldMask>,
13719        {
13720            self.0.request.update_mask = v.map(|x| x.into());
13721            self
13722        }
13723    }
13724
13725    #[doc(hidden)]
13726    impl crate::RequestBuilder for UpdateSession {
13727        fn request_options(&mut self) -> &mut crate::RequestOptions {
13728            &mut self.0.options
13729        }
13730    }
13731
13732    /// The request builder for [SessionService::get_session][crate::client::SessionService::get_session] calls.
13733    ///
13734    /// # Example
13735    /// ```
13736    /// # use google_cloud_discoveryengine_v1::builder::session_service::GetSession;
13737    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
13738    ///
13739    /// let builder = prepare_request_builder();
13740    /// let response = builder.send().await?;
13741    /// # Ok(()) }
13742    ///
13743    /// fn prepare_request_builder() -> GetSession {
13744    ///   # panic!();
13745    ///   // ... details omitted ...
13746    /// }
13747    /// ```
13748    #[derive(Clone, Debug)]
13749    pub struct GetSession(RequestBuilder<crate::model::GetSessionRequest>);
13750
13751    impl GetSession {
13752        pub(crate) fn new(
13753            stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
13754        ) -> Self {
13755            Self(RequestBuilder::new(stub))
13756        }
13757
13758        /// Sets the full request, replacing any prior values.
13759        pub fn with_request<V: Into<crate::model::GetSessionRequest>>(mut self, v: V) -> Self {
13760            self.0.request = v.into();
13761            self
13762        }
13763
13764        /// Sets all the options, replacing any prior values.
13765        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
13766            self.0.options = v.into();
13767            self
13768        }
13769
13770        /// Sends the request.
13771        pub async fn send(self) -> Result<crate::model::Session> {
13772            (*self.0.stub)
13773                .get_session(self.0.request, self.0.options)
13774                .await
13775                .map(crate::Response::into_body)
13776        }
13777
13778        /// Sets the value of [name][crate::model::GetSessionRequest::name].
13779        ///
13780        /// This is a **required** field for requests.
13781        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13782            self.0.request.name = v.into();
13783            self
13784        }
13785
13786        /// Sets the value of [include_answer_details][crate::model::GetSessionRequest::include_answer_details].
13787        pub fn set_include_answer_details<T: Into<bool>>(mut self, v: T) -> Self {
13788            self.0.request.include_answer_details = v.into();
13789            self
13790        }
13791    }
13792
13793    #[doc(hidden)]
13794    impl crate::RequestBuilder for GetSession {
13795        fn request_options(&mut self) -> &mut crate::RequestOptions {
13796            &mut self.0.options
13797        }
13798    }
13799
13800    /// The request builder for [SessionService::list_sessions][crate::client::SessionService::list_sessions] calls.
13801    ///
13802    /// # Example
13803    /// ```
13804    /// # use google_cloud_discoveryengine_v1::builder::session_service::ListSessions;
13805    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
13806    /// use google_cloud_gax::paginator::ItemPaginator;
13807    ///
13808    /// let builder = prepare_request_builder();
13809    /// let mut items = builder.by_item();
13810    /// while let Some(result) = items.next().await {
13811    ///   let item = result?;
13812    /// }
13813    /// # Ok(()) }
13814    ///
13815    /// fn prepare_request_builder() -> ListSessions {
13816    ///   # panic!();
13817    ///   // ... details omitted ...
13818    /// }
13819    /// ```
13820    #[derive(Clone, Debug)]
13821    pub struct ListSessions(RequestBuilder<crate::model::ListSessionsRequest>);
13822
13823    impl ListSessions {
13824        pub(crate) fn new(
13825            stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
13826        ) -> Self {
13827            Self(RequestBuilder::new(stub))
13828        }
13829
13830        /// Sets the full request, replacing any prior values.
13831        pub fn with_request<V: Into<crate::model::ListSessionsRequest>>(mut self, v: V) -> Self {
13832            self.0.request = v.into();
13833            self
13834        }
13835
13836        /// Sets all the options, replacing any prior values.
13837        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
13838            self.0.options = v.into();
13839            self
13840        }
13841
13842        /// Sends the request.
13843        pub async fn send(self) -> Result<crate::model::ListSessionsResponse> {
13844            (*self.0.stub)
13845                .list_sessions(self.0.request, self.0.options)
13846                .await
13847                .map(crate::Response::into_body)
13848        }
13849
13850        /// Streams each page in the collection.
13851        pub fn by_page(
13852            self,
13853        ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListSessionsResponse, crate::Error>
13854        {
13855            use std::clone::Clone;
13856            let token = self.0.request.page_token.clone();
13857            let execute = move |token: String| {
13858                let mut builder = self.clone();
13859                builder.0.request = builder.0.request.set_page_token(token);
13860                builder.send()
13861            };
13862            google_cloud_gax::paginator::internal::new_paginator(token, execute)
13863        }
13864
13865        /// Streams each item in the collection.
13866        pub fn by_item(
13867            self,
13868        ) -> impl google_cloud_gax::paginator::ItemPaginator<
13869            crate::model::ListSessionsResponse,
13870            crate::Error,
13871        > {
13872            use google_cloud_gax::paginator::Paginator;
13873            self.by_page().items()
13874        }
13875
13876        /// Sets the value of [parent][crate::model::ListSessionsRequest::parent].
13877        ///
13878        /// This is a **required** field for requests.
13879        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
13880            self.0.request.parent = v.into();
13881            self
13882        }
13883
13884        /// Sets the value of [page_size][crate::model::ListSessionsRequest::page_size].
13885        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
13886            self.0.request.page_size = v.into();
13887            self
13888        }
13889
13890        /// Sets the value of [page_token][crate::model::ListSessionsRequest::page_token].
13891        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
13892            self.0.request.page_token = v.into();
13893            self
13894        }
13895
13896        /// Sets the value of [filter][crate::model::ListSessionsRequest::filter].
13897        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
13898            self.0.request.filter = v.into();
13899            self
13900        }
13901
13902        /// Sets the value of [order_by][crate::model::ListSessionsRequest::order_by].
13903        pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
13904            self.0.request.order_by = v.into();
13905            self
13906        }
13907    }
13908
13909    #[doc(hidden)]
13910    impl crate::RequestBuilder for ListSessions {
13911        fn request_options(&mut self) -> &mut crate::RequestOptions {
13912            &mut self.0.options
13913        }
13914    }
13915
13916    /// The request builder for [SessionService::list_operations][crate::client::SessionService::list_operations] calls.
13917    ///
13918    /// # Example
13919    /// ```
13920    /// # use google_cloud_discoveryengine_v1::builder::session_service::ListOperations;
13921    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
13922    /// use google_cloud_gax::paginator::ItemPaginator;
13923    ///
13924    /// let builder = prepare_request_builder();
13925    /// let mut items = builder.by_item();
13926    /// while let Some(result) = items.next().await {
13927    ///   let item = result?;
13928    /// }
13929    /// # Ok(()) }
13930    ///
13931    /// fn prepare_request_builder() -> ListOperations {
13932    ///   # panic!();
13933    ///   // ... details omitted ...
13934    /// }
13935    /// ```
13936    #[derive(Clone, Debug)]
13937    pub struct ListOperations(
13938        RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
13939    );
13940
13941    impl ListOperations {
13942        pub(crate) fn new(
13943            stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
13944        ) -> Self {
13945            Self(RequestBuilder::new(stub))
13946        }
13947
13948        /// Sets the full request, replacing any prior values.
13949        pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
13950            mut self,
13951            v: V,
13952        ) -> Self {
13953            self.0.request = v.into();
13954            self
13955        }
13956
13957        /// Sets all the options, replacing any prior values.
13958        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
13959            self.0.options = v.into();
13960            self
13961        }
13962
13963        /// Sends the request.
13964        pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
13965            (*self.0.stub)
13966                .list_operations(self.0.request, self.0.options)
13967                .await
13968                .map(crate::Response::into_body)
13969        }
13970
13971        /// Streams each page in the collection.
13972        pub fn by_page(
13973            self,
13974        ) -> impl google_cloud_gax::paginator::Paginator<
13975            google_cloud_longrunning::model::ListOperationsResponse,
13976            crate::Error,
13977        > {
13978            use std::clone::Clone;
13979            let token = self.0.request.page_token.clone();
13980            let execute = move |token: String| {
13981                let mut builder = self.clone();
13982                builder.0.request = builder.0.request.set_page_token(token);
13983                builder.send()
13984            };
13985            google_cloud_gax::paginator::internal::new_paginator(token, execute)
13986        }
13987
13988        /// Streams each item in the collection.
13989        pub fn by_item(
13990            self,
13991        ) -> impl google_cloud_gax::paginator::ItemPaginator<
13992            google_cloud_longrunning::model::ListOperationsResponse,
13993            crate::Error,
13994        > {
13995            use google_cloud_gax::paginator::Paginator;
13996            self.by_page().items()
13997        }
13998
13999        /// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
14000        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
14001            self.0.request.name = v.into();
14002            self
14003        }
14004
14005        /// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::filter].
14006        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
14007            self.0.request.filter = v.into();
14008            self
14009        }
14010
14011        /// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
14012        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
14013            self.0.request.page_size = v.into();
14014            self
14015        }
14016
14017        /// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
14018        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
14019            self.0.request.page_token = v.into();
14020            self
14021        }
14022
14023        /// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
14024        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
14025            self.0.request.return_partial_success = v.into();
14026            self
14027        }
14028    }
14029
14030    #[doc(hidden)]
14031    impl crate::RequestBuilder for ListOperations {
14032        fn request_options(&mut self) -> &mut crate::RequestOptions {
14033            &mut self.0.options
14034        }
14035    }
14036
14037    /// The request builder for [SessionService::get_operation][crate::client::SessionService::get_operation] calls.
14038    ///
14039    /// # Example
14040    /// ```
14041    /// # use google_cloud_discoveryengine_v1::builder::session_service::GetOperation;
14042    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
14043    ///
14044    /// let builder = prepare_request_builder();
14045    /// let response = builder.send().await?;
14046    /// # Ok(()) }
14047    ///
14048    /// fn prepare_request_builder() -> GetOperation {
14049    ///   # panic!();
14050    ///   // ... details omitted ...
14051    /// }
14052    /// ```
14053    #[derive(Clone, Debug)]
14054    pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
14055
14056    impl GetOperation {
14057        pub(crate) fn new(
14058            stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
14059        ) -> Self {
14060            Self(RequestBuilder::new(stub))
14061        }
14062
14063        /// Sets the full request, replacing any prior values.
14064        pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
14065            mut self,
14066            v: V,
14067        ) -> Self {
14068            self.0.request = v.into();
14069            self
14070        }
14071
14072        /// Sets all the options, replacing any prior values.
14073        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
14074            self.0.options = v.into();
14075            self
14076        }
14077
14078        /// Sends the request.
14079        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
14080            (*self.0.stub)
14081                .get_operation(self.0.request, self.0.options)
14082                .await
14083                .map(crate::Response::into_body)
14084        }
14085
14086        /// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
14087        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
14088            self.0.request.name = v.into();
14089            self
14090        }
14091    }
14092
14093    #[doc(hidden)]
14094    impl crate::RequestBuilder for GetOperation {
14095        fn request_options(&mut self) -> &mut crate::RequestOptions {
14096            &mut self.0.options
14097        }
14098    }
14099
14100    /// The request builder for [SessionService::cancel_operation][crate::client::SessionService::cancel_operation] calls.
14101    ///
14102    /// # Example
14103    /// ```
14104    /// # use google_cloud_discoveryengine_v1::builder::session_service::CancelOperation;
14105    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
14106    ///
14107    /// let builder = prepare_request_builder();
14108    /// let response = builder.send().await?;
14109    /// # Ok(()) }
14110    ///
14111    /// fn prepare_request_builder() -> CancelOperation {
14112    ///   # panic!();
14113    ///   // ... details omitted ...
14114    /// }
14115    /// ```
14116    #[derive(Clone, Debug)]
14117    pub struct CancelOperation(
14118        RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
14119    );
14120
14121    impl CancelOperation {
14122        pub(crate) fn new(
14123            stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
14124        ) -> Self {
14125            Self(RequestBuilder::new(stub))
14126        }
14127
14128        /// Sets the full request, replacing any prior values.
14129        pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
14130            mut self,
14131            v: V,
14132        ) -> Self {
14133            self.0.request = v.into();
14134            self
14135        }
14136
14137        /// Sets all the options, replacing any prior values.
14138        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
14139            self.0.options = v.into();
14140            self
14141        }
14142
14143        /// Sends the request.
14144        pub async fn send(self) -> Result<()> {
14145            (*self.0.stub)
14146                .cancel_operation(self.0.request, self.0.options)
14147                .await
14148                .map(crate::Response::into_body)
14149        }
14150
14151        /// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::name].
14152        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
14153            self.0.request.name = v.into();
14154            self
14155        }
14156    }
14157
14158    #[doc(hidden)]
14159    impl crate::RequestBuilder for CancelOperation {
14160        fn request_options(&mut self) -> &mut crate::RequestOptions {
14161            &mut self.0.options
14162        }
14163    }
14164}
14165
14166/// Request and client builders for [SiteSearchEngineService][crate::client::SiteSearchEngineService].
14167#[cfg(feature = "site-search-engine-service")]
14168#[cfg_attr(docsrs, doc(cfg(feature = "site-search-engine-service")))]
14169pub mod site_search_engine_service {
14170    use crate::Result;
14171
14172    /// A builder for [SiteSearchEngineService][crate::client::SiteSearchEngineService].
14173    ///
14174    /// ```
14175    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
14176    /// # use google_cloud_discoveryengine_v1::*;
14177    /// # use builder::site_search_engine_service::ClientBuilder;
14178    /// # use client::SiteSearchEngineService;
14179    /// let builder : ClientBuilder = SiteSearchEngineService::builder();
14180    /// let client = builder
14181    ///     .with_endpoint("https://discoveryengine.googleapis.com")
14182    ///     .build().await?;
14183    /// # Ok(()) }
14184    /// ```
14185    pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
14186
14187    pub(crate) mod client {
14188        use super::super::super::client::SiteSearchEngineService;
14189        pub struct Factory;
14190        impl crate::ClientFactory for Factory {
14191            type Client = SiteSearchEngineService;
14192            type Credentials = gaxi::options::Credentials;
14193            async fn build(
14194                self,
14195                config: gaxi::options::ClientConfig,
14196            ) -> crate::ClientBuilderResult<Self::Client> {
14197                Self::Client::new(config).await
14198            }
14199        }
14200    }
14201
14202    /// Common implementation for [crate::client::SiteSearchEngineService] request builders.
14203    #[derive(Clone, Debug)]
14204    pub(crate) struct RequestBuilder<R: std::default::Default> {
14205        stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14206        request: R,
14207        options: crate::RequestOptions,
14208    }
14209
14210    impl<R> RequestBuilder<R>
14211    where
14212        R: std::default::Default,
14213    {
14214        pub(crate) fn new(
14215            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14216        ) -> Self {
14217            Self {
14218                stub,
14219                request: R::default(),
14220                options: crate::RequestOptions::default(),
14221            }
14222        }
14223    }
14224
14225    /// The request builder for [SiteSearchEngineService::get_site_search_engine][crate::client::SiteSearchEngineService::get_site_search_engine] calls.
14226    ///
14227    /// # Example
14228    /// ```
14229    /// # use google_cloud_discoveryengine_v1::builder::site_search_engine_service::GetSiteSearchEngine;
14230    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
14231    ///
14232    /// let builder = prepare_request_builder();
14233    /// let response = builder.send().await?;
14234    /// # Ok(()) }
14235    ///
14236    /// fn prepare_request_builder() -> GetSiteSearchEngine {
14237    ///   # panic!();
14238    ///   // ... details omitted ...
14239    /// }
14240    /// ```
14241    #[derive(Clone, Debug)]
14242    pub struct GetSiteSearchEngine(RequestBuilder<crate::model::GetSiteSearchEngineRequest>);
14243
14244    impl GetSiteSearchEngine {
14245        pub(crate) fn new(
14246            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14247        ) -> Self {
14248            Self(RequestBuilder::new(stub))
14249        }
14250
14251        /// Sets the full request, replacing any prior values.
14252        pub fn with_request<V: Into<crate::model::GetSiteSearchEngineRequest>>(
14253            mut self,
14254            v: V,
14255        ) -> Self {
14256            self.0.request = v.into();
14257            self
14258        }
14259
14260        /// Sets all the options, replacing any prior values.
14261        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
14262            self.0.options = v.into();
14263            self
14264        }
14265
14266        /// Sends the request.
14267        pub async fn send(self) -> Result<crate::model::SiteSearchEngine> {
14268            (*self.0.stub)
14269                .get_site_search_engine(self.0.request, self.0.options)
14270                .await
14271                .map(crate::Response::into_body)
14272        }
14273
14274        /// Sets the value of [name][crate::model::GetSiteSearchEngineRequest::name].
14275        ///
14276        /// This is a **required** field for requests.
14277        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
14278            self.0.request.name = v.into();
14279            self
14280        }
14281    }
14282
14283    #[doc(hidden)]
14284    impl crate::RequestBuilder for GetSiteSearchEngine {
14285        fn request_options(&mut self) -> &mut crate::RequestOptions {
14286            &mut self.0.options
14287        }
14288    }
14289
14290    /// The request builder for [SiteSearchEngineService::create_target_site][crate::client::SiteSearchEngineService::create_target_site] calls.
14291    ///
14292    /// # Example
14293    /// ```
14294    /// # use google_cloud_discoveryengine_v1::builder::site_search_engine_service::CreateTargetSite;
14295    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
14296    /// use google_cloud_lro::Poller;
14297    ///
14298    /// let builder = prepare_request_builder();
14299    /// let response = builder.poller().until_done().await?;
14300    /// # Ok(()) }
14301    ///
14302    /// fn prepare_request_builder() -> CreateTargetSite {
14303    ///   # panic!();
14304    ///   // ... details omitted ...
14305    /// }
14306    /// ```
14307    #[derive(Clone, Debug)]
14308    pub struct CreateTargetSite(RequestBuilder<crate::model::CreateTargetSiteRequest>);
14309
14310    impl CreateTargetSite {
14311        pub(crate) fn new(
14312            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14313        ) -> Self {
14314            Self(RequestBuilder::new(stub))
14315        }
14316
14317        /// Sets the full request, replacing any prior values.
14318        pub fn with_request<V: Into<crate::model::CreateTargetSiteRequest>>(
14319            mut self,
14320            v: V,
14321        ) -> Self {
14322            self.0.request = v.into();
14323            self
14324        }
14325
14326        /// Sets all the options, replacing any prior values.
14327        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
14328            self.0.options = v.into();
14329            self
14330        }
14331
14332        /// Sends the request.
14333        ///
14334        /// # Long running operations
14335        ///
14336        /// This starts, but does not poll, a longrunning operation. More information
14337        /// on [create_target_site][crate::client::SiteSearchEngineService::create_target_site].
14338        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
14339            (*self.0.stub)
14340                .create_target_site(self.0.request, self.0.options)
14341                .await
14342                .map(crate::Response::into_body)
14343        }
14344
14345        /// Creates a [Poller][google_cloud_lro::Poller] to work with `create_target_site`.
14346        pub fn poller(
14347            self,
14348        ) -> impl google_cloud_lro::Poller<
14349            crate::model::TargetSite,
14350            crate::model::CreateTargetSiteMetadata,
14351        > {
14352            type Operation = google_cloud_lro::internal::Operation<
14353                crate::model::TargetSite,
14354                crate::model::CreateTargetSiteMetadata,
14355            >;
14356            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
14357            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
14358
14359            let stub = self.0.stub.clone();
14360            let mut options = self.0.options.clone();
14361            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
14362            let query = move |name| {
14363                let stub = stub.clone();
14364                let options = options.clone();
14365                async {
14366                    let op = GetOperation::new(stub)
14367                        .set_name(name)
14368                        .with_options(options)
14369                        .send()
14370                        .await?;
14371                    Ok(Operation::new(op))
14372                }
14373            };
14374
14375            let start = move || async {
14376                let op = self.send().await?;
14377                Ok(Operation::new(op))
14378            };
14379
14380            google_cloud_lro::internal::new_poller(
14381                polling_error_policy,
14382                polling_backoff_policy,
14383                start,
14384                query,
14385            )
14386        }
14387
14388        /// Sets the value of [parent][crate::model::CreateTargetSiteRequest::parent].
14389        ///
14390        /// This is a **required** field for requests.
14391        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
14392            self.0.request.parent = v.into();
14393            self
14394        }
14395
14396        /// Sets the value of [target_site][crate::model::CreateTargetSiteRequest::target_site].
14397        ///
14398        /// This is a **required** field for requests.
14399        pub fn set_target_site<T>(mut self, v: T) -> Self
14400        where
14401            T: std::convert::Into<crate::model::TargetSite>,
14402        {
14403            self.0.request.target_site = std::option::Option::Some(v.into());
14404            self
14405        }
14406
14407        /// Sets or clears the value of [target_site][crate::model::CreateTargetSiteRequest::target_site].
14408        ///
14409        /// This is a **required** field for requests.
14410        pub fn set_or_clear_target_site<T>(mut self, v: std::option::Option<T>) -> Self
14411        where
14412            T: std::convert::Into<crate::model::TargetSite>,
14413        {
14414            self.0.request.target_site = v.map(|x| x.into());
14415            self
14416        }
14417    }
14418
14419    #[doc(hidden)]
14420    impl crate::RequestBuilder for CreateTargetSite {
14421        fn request_options(&mut self) -> &mut crate::RequestOptions {
14422            &mut self.0.options
14423        }
14424    }
14425
14426    /// The request builder for [SiteSearchEngineService::batch_create_target_sites][crate::client::SiteSearchEngineService::batch_create_target_sites] calls.
14427    ///
14428    /// # Example
14429    /// ```
14430    /// # use google_cloud_discoveryengine_v1::builder::site_search_engine_service::BatchCreateTargetSites;
14431    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
14432    /// use google_cloud_lro::Poller;
14433    ///
14434    /// let builder = prepare_request_builder();
14435    /// let response = builder.poller().until_done().await?;
14436    /// # Ok(()) }
14437    ///
14438    /// fn prepare_request_builder() -> BatchCreateTargetSites {
14439    ///   # panic!();
14440    ///   // ... details omitted ...
14441    /// }
14442    /// ```
14443    #[derive(Clone, Debug)]
14444    pub struct BatchCreateTargetSites(RequestBuilder<crate::model::BatchCreateTargetSitesRequest>);
14445
14446    impl BatchCreateTargetSites {
14447        pub(crate) fn new(
14448            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14449        ) -> Self {
14450            Self(RequestBuilder::new(stub))
14451        }
14452
14453        /// Sets the full request, replacing any prior values.
14454        pub fn with_request<V: Into<crate::model::BatchCreateTargetSitesRequest>>(
14455            mut self,
14456            v: V,
14457        ) -> Self {
14458            self.0.request = v.into();
14459            self
14460        }
14461
14462        /// Sets all the options, replacing any prior values.
14463        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
14464            self.0.options = v.into();
14465            self
14466        }
14467
14468        /// Sends the request.
14469        ///
14470        /// # Long running operations
14471        ///
14472        /// This starts, but does not poll, a longrunning operation. More information
14473        /// on [batch_create_target_sites][crate::client::SiteSearchEngineService::batch_create_target_sites].
14474        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
14475            (*self.0.stub)
14476                .batch_create_target_sites(self.0.request, self.0.options)
14477                .await
14478                .map(crate::Response::into_body)
14479        }
14480
14481        /// Creates a [Poller][google_cloud_lro::Poller] to work with `batch_create_target_sites`.
14482        pub fn poller(
14483            self,
14484        ) -> impl google_cloud_lro::Poller<
14485            crate::model::BatchCreateTargetSitesResponse,
14486            crate::model::BatchCreateTargetSiteMetadata,
14487        > {
14488            type Operation = google_cloud_lro::internal::Operation<
14489                crate::model::BatchCreateTargetSitesResponse,
14490                crate::model::BatchCreateTargetSiteMetadata,
14491            >;
14492            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
14493            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
14494
14495            let stub = self.0.stub.clone();
14496            let mut options = self.0.options.clone();
14497            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
14498            let query = move |name| {
14499                let stub = stub.clone();
14500                let options = options.clone();
14501                async {
14502                    let op = GetOperation::new(stub)
14503                        .set_name(name)
14504                        .with_options(options)
14505                        .send()
14506                        .await?;
14507                    Ok(Operation::new(op))
14508                }
14509            };
14510
14511            let start = move || async {
14512                let op = self.send().await?;
14513                Ok(Operation::new(op))
14514            };
14515
14516            google_cloud_lro::internal::new_poller(
14517                polling_error_policy,
14518                polling_backoff_policy,
14519                start,
14520                query,
14521            )
14522        }
14523
14524        /// Sets the value of [parent][crate::model::BatchCreateTargetSitesRequest::parent].
14525        ///
14526        /// This is a **required** field for requests.
14527        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
14528            self.0.request.parent = v.into();
14529            self
14530        }
14531
14532        /// Sets the value of [requests][crate::model::BatchCreateTargetSitesRequest::requests].
14533        ///
14534        /// This is a **required** field for requests.
14535        pub fn set_requests<T, V>(mut self, v: T) -> Self
14536        where
14537            T: std::iter::IntoIterator<Item = V>,
14538            V: std::convert::Into<crate::model::CreateTargetSiteRequest>,
14539        {
14540            use std::iter::Iterator;
14541            self.0.request.requests = v.into_iter().map(|i| i.into()).collect();
14542            self
14543        }
14544    }
14545
14546    #[doc(hidden)]
14547    impl crate::RequestBuilder for BatchCreateTargetSites {
14548        fn request_options(&mut self) -> &mut crate::RequestOptions {
14549            &mut self.0.options
14550        }
14551    }
14552
14553    /// The request builder for [SiteSearchEngineService::get_target_site][crate::client::SiteSearchEngineService::get_target_site] calls.
14554    ///
14555    /// # Example
14556    /// ```
14557    /// # use google_cloud_discoveryengine_v1::builder::site_search_engine_service::GetTargetSite;
14558    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
14559    ///
14560    /// let builder = prepare_request_builder();
14561    /// let response = builder.send().await?;
14562    /// # Ok(()) }
14563    ///
14564    /// fn prepare_request_builder() -> GetTargetSite {
14565    ///   # panic!();
14566    ///   // ... details omitted ...
14567    /// }
14568    /// ```
14569    #[derive(Clone, Debug)]
14570    pub struct GetTargetSite(RequestBuilder<crate::model::GetTargetSiteRequest>);
14571
14572    impl GetTargetSite {
14573        pub(crate) fn new(
14574            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14575        ) -> Self {
14576            Self(RequestBuilder::new(stub))
14577        }
14578
14579        /// Sets the full request, replacing any prior values.
14580        pub fn with_request<V: Into<crate::model::GetTargetSiteRequest>>(mut self, v: V) -> Self {
14581            self.0.request = v.into();
14582            self
14583        }
14584
14585        /// Sets all the options, replacing any prior values.
14586        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
14587            self.0.options = v.into();
14588            self
14589        }
14590
14591        /// Sends the request.
14592        pub async fn send(self) -> Result<crate::model::TargetSite> {
14593            (*self.0.stub)
14594                .get_target_site(self.0.request, self.0.options)
14595                .await
14596                .map(crate::Response::into_body)
14597        }
14598
14599        /// Sets the value of [name][crate::model::GetTargetSiteRequest::name].
14600        ///
14601        /// This is a **required** field for requests.
14602        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
14603            self.0.request.name = v.into();
14604            self
14605        }
14606    }
14607
14608    #[doc(hidden)]
14609    impl crate::RequestBuilder for GetTargetSite {
14610        fn request_options(&mut self) -> &mut crate::RequestOptions {
14611            &mut self.0.options
14612        }
14613    }
14614
14615    /// The request builder for [SiteSearchEngineService::update_target_site][crate::client::SiteSearchEngineService::update_target_site] calls.
14616    ///
14617    /// # Example
14618    /// ```
14619    /// # use google_cloud_discoveryengine_v1::builder::site_search_engine_service::UpdateTargetSite;
14620    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
14621    /// use google_cloud_lro::Poller;
14622    ///
14623    /// let builder = prepare_request_builder();
14624    /// let response = builder.poller().until_done().await?;
14625    /// # Ok(()) }
14626    ///
14627    /// fn prepare_request_builder() -> UpdateTargetSite {
14628    ///   # panic!();
14629    ///   // ... details omitted ...
14630    /// }
14631    /// ```
14632    #[derive(Clone, Debug)]
14633    pub struct UpdateTargetSite(RequestBuilder<crate::model::UpdateTargetSiteRequest>);
14634
14635    impl UpdateTargetSite {
14636        pub(crate) fn new(
14637            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14638        ) -> Self {
14639            Self(RequestBuilder::new(stub))
14640        }
14641
14642        /// Sets the full request, replacing any prior values.
14643        pub fn with_request<V: Into<crate::model::UpdateTargetSiteRequest>>(
14644            mut self,
14645            v: V,
14646        ) -> Self {
14647            self.0.request = v.into();
14648            self
14649        }
14650
14651        /// Sets all the options, replacing any prior values.
14652        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
14653            self.0.options = v.into();
14654            self
14655        }
14656
14657        /// Sends the request.
14658        ///
14659        /// # Long running operations
14660        ///
14661        /// This starts, but does not poll, a longrunning operation. More information
14662        /// on [update_target_site][crate::client::SiteSearchEngineService::update_target_site].
14663        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
14664            (*self.0.stub)
14665                .update_target_site(self.0.request, self.0.options)
14666                .await
14667                .map(crate::Response::into_body)
14668        }
14669
14670        /// Creates a [Poller][google_cloud_lro::Poller] to work with `update_target_site`.
14671        pub fn poller(
14672            self,
14673        ) -> impl google_cloud_lro::Poller<
14674            crate::model::TargetSite,
14675            crate::model::UpdateTargetSiteMetadata,
14676        > {
14677            type Operation = google_cloud_lro::internal::Operation<
14678                crate::model::TargetSite,
14679                crate::model::UpdateTargetSiteMetadata,
14680            >;
14681            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
14682            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
14683
14684            let stub = self.0.stub.clone();
14685            let mut options = self.0.options.clone();
14686            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
14687            let query = move |name| {
14688                let stub = stub.clone();
14689                let options = options.clone();
14690                async {
14691                    let op = GetOperation::new(stub)
14692                        .set_name(name)
14693                        .with_options(options)
14694                        .send()
14695                        .await?;
14696                    Ok(Operation::new(op))
14697                }
14698            };
14699
14700            let start = move || async {
14701                let op = self.send().await?;
14702                Ok(Operation::new(op))
14703            };
14704
14705            google_cloud_lro::internal::new_poller(
14706                polling_error_policy,
14707                polling_backoff_policy,
14708                start,
14709                query,
14710            )
14711        }
14712
14713        /// Sets the value of [target_site][crate::model::UpdateTargetSiteRequest::target_site].
14714        ///
14715        /// This is a **required** field for requests.
14716        pub fn set_target_site<T>(mut self, v: T) -> Self
14717        where
14718            T: std::convert::Into<crate::model::TargetSite>,
14719        {
14720            self.0.request.target_site = std::option::Option::Some(v.into());
14721            self
14722        }
14723
14724        /// Sets or clears the value of [target_site][crate::model::UpdateTargetSiteRequest::target_site].
14725        ///
14726        /// This is a **required** field for requests.
14727        pub fn set_or_clear_target_site<T>(mut self, v: std::option::Option<T>) -> Self
14728        where
14729            T: std::convert::Into<crate::model::TargetSite>,
14730        {
14731            self.0.request.target_site = v.map(|x| x.into());
14732            self
14733        }
14734    }
14735
14736    #[doc(hidden)]
14737    impl crate::RequestBuilder for UpdateTargetSite {
14738        fn request_options(&mut self) -> &mut crate::RequestOptions {
14739            &mut self.0.options
14740        }
14741    }
14742
14743    /// The request builder for [SiteSearchEngineService::delete_target_site][crate::client::SiteSearchEngineService::delete_target_site] calls.
14744    ///
14745    /// # Example
14746    /// ```
14747    /// # use google_cloud_discoveryengine_v1::builder::site_search_engine_service::DeleteTargetSite;
14748    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
14749    /// use google_cloud_lro::Poller;
14750    ///
14751    /// let builder = prepare_request_builder();
14752    /// let response = builder.poller().until_done().await?;
14753    /// # Ok(()) }
14754    ///
14755    /// fn prepare_request_builder() -> DeleteTargetSite {
14756    ///   # panic!();
14757    ///   // ... details omitted ...
14758    /// }
14759    /// ```
14760    #[derive(Clone, Debug)]
14761    pub struct DeleteTargetSite(RequestBuilder<crate::model::DeleteTargetSiteRequest>);
14762
14763    impl DeleteTargetSite {
14764        pub(crate) fn new(
14765            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14766        ) -> Self {
14767            Self(RequestBuilder::new(stub))
14768        }
14769
14770        /// Sets the full request, replacing any prior values.
14771        pub fn with_request<V: Into<crate::model::DeleteTargetSiteRequest>>(
14772            mut self,
14773            v: V,
14774        ) -> Self {
14775            self.0.request = v.into();
14776            self
14777        }
14778
14779        /// Sets all the options, replacing any prior values.
14780        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
14781            self.0.options = v.into();
14782            self
14783        }
14784
14785        /// Sends the request.
14786        ///
14787        /// # Long running operations
14788        ///
14789        /// This starts, but does not poll, a longrunning operation. More information
14790        /// on [delete_target_site][crate::client::SiteSearchEngineService::delete_target_site].
14791        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
14792            (*self.0.stub)
14793                .delete_target_site(self.0.request, self.0.options)
14794                .await
14795                .map(crate::Response::into_body)
14796        }
14797
14798        /// Creates a [Poller][google_cloud_lro::Poller] to work with `delete_target_site`.
14799        pub fn poller(
14800            self,
14801        ) -> impl google_cloud_lro::Poller<(), crate::model::DeleteTargetSiteMetadata> {
14802            type Operation = google_cloud_lro::internal::Operation<
14803                wkt::Empty,
14804                crate::model::DeleteTargetSiteMetadata,
14805            >;
14806            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
14807            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
14808
14809            let stub = self.0.stub.clone();
14810            let mut options = self.0.options.clone();
14811            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
14812            let query = move |name| {
14813                let stub = stub.clone();
14814                let options = options.clone();
14815                async {
14816                    let op = GetOperation::new(stub)
14817                        .set_name(name)
14818                        .with_options(options)
14819                        .send()
14820                        .await?;
14821                    Ok(Operation::new(op))
14822                }
14823            };
14824
14825            let start = move || async {
14826                let op = self.send().await?;
14827                Ok(Operation::new(op))
14828            };
14829
14830            google_cloud_lro::internal::new_unit_response_poller(
14831                polling_error_policy,
14832                polling_backoff_policy,
14833                start,
14834                query,
14835            )
14836        }
14837
14838        /// Sets the value of [name][crate::model::DeleteTargetSiteRequest::name].
14839        ///
14840        /// This is a **required** field for requests.
14841        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
14842            self.0.request.name = v.into();
14843            self
14844        }
14845    }
14846
14847    #[doc(hidden)]
14848    impl crate::RequestBuilder for DeleteTargetSite {
14849        fn request_options(&mut self) -> &mut crate::RequestOptions {
14850            &mut self.0.options
14851        }
14852    }
14853
14854    /// The request builder for [SiteSearchEngineService::list_target_sites][crate::client::SiteSearchEngineService::list_target_sites] calls.
14855    ///
14856    /// # Example
14857    /// ```
14858    /// # use google_cloud_discoveryengine_v1::builder::site_search_engine_service::ListTargetSites;
14859    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
14860    /// use google_cloud_gax::paginator::ItemPaginator;
14861    ///
14862    /// let builder = prepare_request_builder();
14863    /// let mut items = builder.by_item();
14864    /// while let Some(result) = items.next().await {
14865    ///   let item = result?;
14866    /// }
14867    /// # Ok(()) }
14868    ///
14869    /// fn prepare_request_builder() -> ListTargetSites {
14870    ///   # panic!();
14871    ///   // ... details omitted ...
14872    /// }
14873    /// ```
14874    #[derive(Clone, Debug)]
14875    pub struct ListTargetSites(RequestBuilder<crate::model::ListTargetSitesRequest>);
14876
14877    impl ListTargetSites {
14878        pub(crate) fn new(
14879            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14880        ) -> Self {
14881            Self(RequestBuilder::new(stub))
14882        }
14883
14884        /// Sets the full request, replacing any prior values.
14885        pub fn with_request<V: Into<crate::model::ListTargetSitesRequest>>(mut self, v: V) -> Self {
14886            self.0.request = v.into();
14887            self
14888        }
14889
14890        /// Sets all the options, replacing any prior values.
14891        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
14892            self.0.options = v.into();
14893            self
14894        }
14895
14896        /// Sends the request.
14897        pub async fn send(self) -> Result<crate::model::ListTargetSitesResponse> {
14898            (*self.0.stub)
14899                .list_target_sites(self.0.request, self.0.options)
14900                .await
14901                .map(crate::Response::into_body)
14902        }
14903
14904        /// Streams each page in the collection.
14905        pub fn by_page(
14906            self,
14907        ) -> impl google_cloud_gax::paginator::Paginator<
14908            crate::model::ListTargetSitesResponse,
14909            crate::Error,
14910        > {
14911            use std::clone::Clone;
14912            let token = self.0.request.page_token.clone();
14913            let execute = move |token: String| {
14914                let mut builder = self.clone();
14915                builder.0.request = builder.0.request.set_page_token(token);
14916                builder.send()
14917            };
14918            google_cloud_gax::paginator::internal::new_paginator(token, execute)
14919        }
14920
14921        /// Streams each item in the collection.
14922        pub fn by_item(
14923            self,
14924        ) -> impl google_cloud_gax::paginator::ItemPaginator<
14925            crate::model::ListTargetSitesResponse,
14926            crate::Error,
14927        > {
14928            use google_cloud_gax::paginator::Paginator;
14929            self.by_page().items()
14930        }
14931
14932        /// Sets the value of [parent][crate::model::ListTargetSitesRequest::parent].
14933        ///
14934        /// This is a **required** field for requests.
14935        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
14936            self.0.request.parent = v.into();
14937            self
14938        }
14939
14940        /// Sets the value of [page_size][crate::model::ListTargetSitesRequest::page_size].
14941        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
14942            self.0.request.page_size = v.into();
14943            self
14944        }
14945
14946        /// Sets the value of [page_token][crate::model::ListTargetSitesRequest::page_token].
14947        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
14948            self.0.request.page_token = v.into();
14949            self
14950        }
14951    }
14952
14953    #[doc(hidden)]
14954    impl crate::RequestBuilder for ListTargetSites {
14955        fn request_options(&mut self) -> &mut crate::RequestOptions {
14956            &mut self.0.options
14957        }
14958    }
14959
14960    /// The request builder for [SiteSearchEngineService::create_sitemap][crate::client::SiteSearchEngineService::create_sitemap] calls.
14961    ///
14962    /// # Example
14963    /// ```
14964    /// # use google_cloud_discoveryengine_v1::builder::site_search_engine_service::CreateSitemap;
14965    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
14966    /// use google_cloud_lro::Poller;
14967    ///
14968    /// let builder = prepare_request_builder();
14969    /// let response = builder.poller().until_done().await?;
14970    /// # Ok(()) }
14971    ///
14972    /// fn prepare_request_builder() -> CreateSitemap {
14973    ///   # panic!();
14974    ///   // ... details omitted ...
14975    /// }
14976    /// ```
14977    #[derive(Clone, Debug)]
14978    pub struct CreateSitemap(RequestBuilder<crate::model::CreateSitemapRequest>);
14979
14980    impl CreateSitemap {
14981        pub(crate) fn new(
14982            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14983        ) -> Self {
14984            Self(RequestBuilder::new(stub))
14985        }
14986
14987        /// Sets the full request, replacing any prior values.
14988        pub fn with_request<V: Into<crate::model::CreateSitemapRequest>>(mut self, v: V) -> Self {
14989            self.0.request = v.into();
14990            self
14991        }
14992
14993        /// Sets all the options, replacing any prior values.
14994        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
14995            self.0.options = v.into();
14996            self
14997        }
14998
14999        /// Sends the request.
15000        ///
15001        /// # Long running operations
15002        ///
15003        /// This starts, but does not poll, a longrunning operation. More information
15004        /// on [create_sitemap][crate::client::SiteSearchEngineService::create_sitemap].
15005        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
15006            (*self.0.stub)
15007                .create_sitemap(self.0.request, self.0.options)
15008                .await
15009                .map(crate::Response::into_body)
15010        }
15011
15012        /// Creates a [Poller][google_cloud_lro::Poller] to work with `create_sitemap`.
15013        pub fn poller(
15014            self,
15015        ) -> impl google_cloud_lro::Poller<crate::model::Sitemap, crate::model::CreateSitemapMetadata>
15016        {
15017            type Operation = google_cloud_lro::internal::Operation<
15018                crate::model::Sitemap,
15019                crate::model::CreateSitemapMetadata,
15020            >;
15021            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
15022            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
15023
15024            let stub = self.0.stub.clone();
15025            let mut options = self.0.options.clone();
15026            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
15027            let query = move |name| {
15028                let stub = stub.clone();
15029                let options = options.clone();
15030                async {
15031                    let op = GetOperation::new(stub)
15032                        .set_name(name)
15033                        .with_options(options)
15034                        .send()
15035                        .await?;
15036                    Ok(Operation::new(op))
15037                }
15038            };
15039
15040            let start = move || async {
15041                let op = self.send().await?;
15042                Ok(Operation::new(op))
15043            };
15044
15045            google_cloud_lro::internal::new_poller(
15046                polling_error_policy,
15047                polling_backoff_policy,
15048                start,
15049                query,
15050            )
15051        }
15052
15053        /// Sets the value of [parent][crate::model::CreateSitemapRequest::parent].
15054        ///
15055        /// This is a **required** field for requests.
15056        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
15057            self.0.request.parent = v.into();
15058            self
15059        }
15060
15061        /// Sets the value of [sitemap][crate::model::CreateSitemapRequest::sitemap].
15062        ///
15063        /// This is a **required** field for requests.
15064        pub fn set_sitemap<T>(mut self, v: T) -> Self
15065        where
15066            T: std::convert::Into<crate::model::Sitemap>,
15067        {
15068            self.0.request.sitemap = std::option::Option::Some(v.into());
15069            self
15070        }
15071
15072        /// Sets or clears the value of [sitemap][crate::model::CreateSitemapRequest::sitemap].
15073        ///
15074        /// This is a **required** field for requests.
15075        pub fn set_or_clear_sitemap<T>(mut self, v: std::option::Option<T>) -> Self
15076        where
15077            T: std::convert::Into<crate::model::Sitemap>,
15078        {
15079            self.0.request.sitemap = v.map(|x| x.into());
15080            self
15081        }
15082    }
15083
15084    #[doc(hidden)]
15085    impl crate::RequestBuilder for CreateSitemap {
15086        fn request_options(&mut self) -> &mut crate::RequestOptions {
15087            &mut self.0.options
15088        }
15089    }
15090
15091    /// The request builder for [SiteSearchEngineService::delete_sitemap][crate::client::SiteSearchEngineService::delete_sitemap] calls.
15092    ///
15093    /// # Example
15094    /// ```
15095    /// # use google_cloud_discoveryengine_v1::builder::site_search_engine_service::DeleteSitemap;
15096    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
15097    /// use google_cloud_lro::Poller;
15098    ///
15099    /// let builder = prepare_request_builder();
15100    /// let response = builder.poller().until_done().await?;
15101    /// # Ok(()) }
15102    ///
15103    /// fn prepare_request_builder() -> DeleteSitemap {
15104    ///   # panic!();
15105    ///   // ... details omitted ...
15106    /// }
15107    /// ```
15108    #[derive(Clone, Debug)]
15109    pub struct DeleteSitemap(RequestBuilder<crate::model::DeleteSitemapRequest>);
15110
15111    impl DeleteSitemap {
15112        pub(crate) fn new(
15113            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
15114        ) -> Self {
15115            Self(RequestBuilder::new(stub))
15116        }
15117
15118        /// Sets the full request, replacing any prior values.
15119        pub fn with_request<V: Into<crate::model::DeleteSitemapRequest>>(mut self, v: V) -> Self {
15120            self.0.request = v.into();
15121            self
15122        }
15123
15124        /// Sets all the options, replacing any prior values.
15125        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
15126            self.0.options = v.into();
15127            self
15128        }
15129
15130        /// Sends the request.
15131        ///
15132        /// # Long running operations
15133        ///
15134        /// This starts, but does not poll, a longrunning operation. More information
15135        /// on [delete_sitemap][crate::client::SiteSearchEngineService::delete_sitemap].
15136        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
15137            (*self.0.stub)
15138                .delete_sitemap(self.0.request, self.0.options)
15139                .await
15140                .map(crate::Response::into_body)
15141        }
15142
15143        /// Creates a [Poller][google_cloud_lro::Poller] to work with `delete_sitemap`.
15144        pub fn poller(
15145            self,
15146        ) -> impl google_cloud_lro::Poller<(), crate::model::DeleteSitemapMetadata> {
15147            type Operation = google_cloud_lro::internal::Operation<
15148                wkt::Empty,
15149                crate::model::DeleteSitemapMetadata,
15150            >;
15151            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
15152            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
15153
15154            let stub = self.0.stub.clone();
15155            let mut options = self.0.options.clone();
15156            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
15157            let query = move |name| {
15158                let stub = stub.clone();
15159                let options = options.clone();
15160                async {
15161                    let op = GetOperation::new(stub)
15162                        .set_name(name)
15163                        .with_options(options)
15164                        .send()
15165                        .await?;
15166                    Ok(Operation::new(op))
15167                }
15168            };
15169
15170            let start = move || async {
15171                let op = self.send().await?;
15172                Ok(Operation::new(op))
15173            };
15174
15175            google_cloud_lro::internal::new_unit_response_poller(
15176                polling_error_policy,
15177                polling_backoff_policy,
15178                start,
15179                query,
15180            )
15181        }
15182
15183        /// Sets the value of [name][crate::model::DeleteSitemapRequest::name].
15184        ///
15185        /// This is a **required** field for requests.
15186        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
15187            self.0.request.name = v.into();
15188            self
15189        }
15190    }
15191
15192    #[doc(hidden)]
15193    impl crate::RequestBuilder for DeleteSitemap {
15194        fn request_options(&mut self) -> &mut crate::RequestOptions {
15195            &mut self.0.options
15196        }
15197    }
15198
15199    /// The request builder for [SiteSearchEngineService::fetch_sitemaps][crate::client::SiteSearchEngineService::fetch_sitemaps] calls.
15200    ///
15201    /// # Example
15202    /// ```
15203    /// # use google_cloud_discoveryengine_v1::builder::site_search_engine_service::FetchSitemaps;
15204    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
15205    ///
15206    /// let builder = prepare_request_builder();
15207    /// let response = builder.send().await?;
15208    /// # Ok(()) }
15209    ///
15210    /// fn prepare_request_builder() -> FetchSitemaps {
15211    ///   # panic!();
15212    ///   // ... details omitted ...
15213    /// }
15214    /// ```
15215    #[derive(Clone, Debug)]
15216    pub struct FetchSitemaps(RequestBuilder<crate::model::FetchSitemapsRequest>);
15217
15218    impl FetchSitemaps {
15219        pub(crate) fn new(
15220            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
15221        ) -> Self {
15222            Self(RequestBuilder::new(stub))
15223        }
15224
15225        /// Sets the full request, replacing any prior values.
15226        pub fn with_request<V: Into<crate::model::FetchSitemapsRequest>>(mut self, v: V) -> Self {
15227            self.0.request = v.into();
15228            self
15229        }
15230
15231        /// Sets all the options, replacing any prior values.
15232        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
15233            self.0.options = v.into();
15234            self
15235        }
15236
15237        /// Sends the request.
15238        pub async fn send(self) -> Result<crate::model::FetchSitemapsResponse> {
15239            (*self.0.stub)
15240                .fetch_sitemaps(self.0.request, self.0.options)
15241                .await
15242                .map(crate::Response::into_body)
15243        }
15244
15245        /// Sets the value of [parent][crate::model::FetchSitemapsRequest::parent].
15246        ///
15247        /// This is a **required** field for requests.
15248        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
15249            self.0.request.parent = v.into();
15250            self
15251        }
15252
15253        /// Sets the value of [matcher][crate::model::FetchSitemapsRequest::matcher].
15254        pub fn set_matcher<T>(mut self, v: T) -> Self
15255        where
15256            T: std::convert::Into<crate::model::fetch_sitemaps_request::Matcher>,
15257        {
15258            self.0.request.matcher = std::option::Option::Some(v.into());
15259            self
15260        }
15261
15262        /// Sets or clears the value of [matcher][crate::model::FetchSitemapsRequest::matcher].
15263        pub fn set_or_clear_matcher<T>(mut self, v: std::option::Option<T>) -> Self
15264        where
15265            T: std::convert::Into<crate::model::fetch_sitemaps_request::Matcher>,
15266        {
15267            self.0.request.matcher = v.map(|x| x.into());
15268            self
15269        }
15270    }
15271
15272    #[doc(hidden)]
15273    impl crate::RequestBuilder for FetchSitemaps {
15274        fn request_options(&mut self) -> &mut crate::RequestOptions {
15275            &mut self.0.options
15276        }
15277    }
15278
15279    /// The request builder for [SiteSearchEngineService::enable_advanced_site_search][crate::client::SiteSearchEngineService::enable_advanced_site_search] calls.
15280    ///
15281    /// # Example
15282    /// ```
15283    /// # use google_cloud_discoveryengine_v1::builder::site_search_engine_service::EnableAdvancedSiteSearch;
15284    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
15285    /// use google_cloud_lro::Poller;
15286    ///
15287    /// let builder = prepare_request_builder();
15288    /// let response = builder.poller().until_done().await?;
15289    /// # Ok(()) }
15290    ///
15291    /// fn prepare_request_builder() -> EnableAdvancedSiteSearch {
15292    ///   # panic!();
15293    ///   // ... details omitted ...
15294    /// }
15295    /// ```
15296    #[derive(Clone, Debug)]
15297    pub struct EnableAdvancedSiteSearch(
15298        RequestBuilder<crate::model::EnableAdvancedSiteSearchRequest>,
15299    );
15300
15301    impl EnableAdvancedSiteSearch {
15302        pub(crate) fn new(
15303            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
15304        ) -> Self {
15305            Self(RequestBuilder::new(stub))
15306        }
15307
15308        /// Sets the full request, replacing any prior values.
15309        pub fn with_request<V: Into<crate::model::EnableAdvancedSiteSearchRequest>>(
15310            mut self,
15311            v: V,
15312        ) -> Self {
15313            self.0.request = v.into();
15314            self
15315        }
15316
15317        /// Sets all the options, replacing any prior values.
15318        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
15319            self.0.options = v.into();
15320            self
15321        }
15322
15323        /// Sends the request.
15324        ///
15325        /// # Long running operations
15326        ///
15327        /// This starts, but does not poll, a longrunning operation. More information
15328        /// on [enable_advanced_site_search][crate::client::SiteSearchEngineService::enable_advanced_site_search].
15329        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
15330            (*self.0.stub)
15331                .enable_advanced_site_search(self.0.request, self.0.options)
15332                .await
15333                .map(crate::Response::into_body)
15334        }
15335
15336        /// Creates a [Poller][google_cloud_lro::Poller] to work with `enable_advanced_site_search`.
15337        pub fn poller(
15338            self,
15339        ) -> impl google_cloud_lro::Poller<
15340            crate::model::EnableAdvancedSiteSearchResponse,
15341            crate::model::EnableAdvancedSiteSearchMetadata,
15342        > {
15343            type Operation = google_cloud_lro::internal::Operation<
15344                crate::model::EnableAdvancedSiteSearchResponse,
15345                crate::model::EnableAdvancedSiteSearchMetadata,
15346            >;
15347            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
15348            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
15349
15350            let stub = self.0.stub.clone();
15351            let mut options = self.0.options.clone();
15352            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
15353            let query = move |name| {
15354                let stub = stub.clone();
15355                let options = options.clone();
15356                async {
15357                    let op = GetOperation::new(stub)
15358                        .set_name(name)
15359                        .with_options(options)
15360                        .send()
15361                        .await?;
15362                    Ok(Operation::new(op))
15363                }
15364            };
15365
15366            let start = move || async {
15367                let op = self.send().await?;
15368                Ok(Operation::new(op))
15369            };
15370
15371            google_cloud_lro::internal::new_poller(
15372                polling_error_policy,
15373                polling_backoff_policy,
15374                start,
15375                query,
15376            )
15377        }
15378
15379        /// Sets the value of [site_search_engine][crate::model::EnableAdvancedSiteSearchRequest::site_search_engine].
15380        ///
15381        /// This is a **required** field for requests.
15382        pub fn set_site_search_engine<T: Into<std::string::String>>(mut self, v: T) -> Self {
15383            self.0.request.site_search_engine = v.into();
15384            self
15385        }
15386    }
15387
15388    #[doc(hidden)]
15389    impl crate::RequestBuilder for EnableAdvancedSiteSearch {
15390        fn request_options(&mut self) -> &mut crate::RequestOptions {
15391            &mut self.0.options
15392        }
15393    }
15394
15395    /// The request builder for [SiteSearchEngineService::disable_advanced_site_search][crate::client::SiteSearchEngineService::disable_advanced_site_search] calls.
15396    ///
15397    /// # Example
15398    /// ```
15399    /// # use google_cloud_discoveryengine_v1::builder::site_search_engine_service::DisableAdvancedSiteSearch;
15400    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
15401    /// use google_cloud_lro::Poller;
15402    ///
15403    /// let builder = prepare_request_builder();
15404    /// let response = builder.poller().until_done().await?;
15405    /// # Ok(()) }
15406    ///
15407    /// fn prepare_request_builder() -> DisableAdvancedSiteSearch {
15408    ///   # panic!();
15409    ///   // ... details omitted ...
15410    /// }
15411    /// ```
15412    #[derive(Clone, Debug)]
15413    pub struct DisableAdvancedSiteSearch(
15414        RequestBuilder<crate::model::DisableAdvancedSiteSearchRequest>,
15415    );
15416
15417    impl DisableAdvancedSiteSearch {
15418        pub(crate) fn new(
15419            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
15420        ) -> Self {
15421            Self(RequestBuilder::new(stub))
15422        }
15423
15424        /// Sets the full request, replacing any prior values.
15425        pub fn with_request<V: Into<crate::model::DisableAdvancedSiteSearchRequest>>(
15426            mut self,
15427            v: V,
15428        ) -> Self {
15429            self.0.request = v.into();
15430            self
15431        }
15432
15433        /// Sets all the options, replacing any prior values.
15434        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
15435            self.0.options = v.into();
15436            self
15437        }
15438
15439        /// Sends the request.
15440        ///
15441        /// # Long running operations
15442        ///
15443        /// This starts, but does not poll, a longrunning operation. More information
15444        /// on [disable_advanced_site_search][crate::client::SiteSearchEngineService::disable_advanced_site_search].
15445        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
15446            (*self.0.stub)
15447                .disable_advanced_site_search(self.0.request, self.0.options)
15448                .await
15449                .map(crate::Response::into_body)
15450        }
15451
15452        /// Creates a [Poller][google_cloud_lro::Poller] to work with `disable_advanced_site_search`.
15453        pub fn poller(
15454            self,
15455        ) -> impl google_cloud_lro::Poller<
15456            crate::model::DisableAdvancedSiteSearchResponse,
15457            crate::model::DisableAdvancedSiteSearchMetadata,
15458        > {
15459            type Operation = google_cloud_lro::internal::Operation<
15460                crate::model::DisableAdvancedSiteSearchResponse,
15461                crate::model::DisableAdvancedSiteSearchMetadata,
15462            >;
15463            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
15464            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
15465
15466            let stub = self.0.stub.clone();
15467            let mut options = self.0.options.clone();
15468            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
15469            let query = move |name| {
15470                let stub = stub.clone();
15471                let options = options.clone();
15472                async {
15473                    let op = GetOperation::new(stub)
15474                        .set_name(name)
15475                        .with_options(options)
15476                        .send()
15477                        .await?;
15478                    Ok(Operation::new(op))
15479                }
15480            };
15481
15482            let start = move || async {
15483                let op = self.send().await?;
15484                Ok(Operation::new(op))
15485            };
15486
15487            google_cloud_lro::internal::new_poller(
15488                polling_error_policy,
15489                polling_backoff_policy,
15490                start,
15491                query,
15492            )
15493        }
15494
15495        /// Sets the value of [site_search_engine][crate::model::DisableAdvancedSiteSearchRequest::site_search_engine].
15496        ///
15497        /// This is a **required** field for requests.
15498        pub fn set_site_search_engine<T: Into<std::string::String>>(mut self, v: T) -> Self {
15499            self.0.request.site_search_engine = v.into();
15500            self
15501        }
15502    }
15503
15504    #[doc(hidden)]
15505    impl crate::RequestBuilder for DisableAdvancedSiteSearch {
15506        fn request_options(&mut self) -> &mut crate::RequestOptions {
15507            &mut self.0.options
15508        }
15509    }
15510
15511    /// The request builder for [SiteSearchEngineService::recrawl_uris][crate::client::SiteSearchEngineService::recrawl_uris] calls.
15512    ///
15513    /// # Example
15514    /// ```
15515    /// # use google_cloud_discoveryengine_v1::builder::site_search_engine_service::RecrawlUris;
15516    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
15517    /// use google_cloud_lro::Poller;
15518    ///
15519    /// let builder = prepare_request_builder();
15520    /// let response = builder.poller().until_done().await?;
15521    /// # Ok(()) }
15522    ///
15523    /// fn prepare_request_builder() -> RecrawlUris {
15524    ///   # panic!();
15525    ///   // ... details omitted ...
15526    /// }
15527    /// ```
15528    #[derive(Clone, Debug)]
15529    pub struct RecrawlUris(RequestBuilder<crate::model::RecrawlUrisRequest>);
15530
15531    impl RecrawlUris {
15532        pub(crate) fn new(
15533            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
15534        ) -> Self {
15535            Self(RequestBuilder::new(stub))
15536        }
15537
15538        /// Sets the full request, replacing any prior values.
15539        pub fn with_request<V: Into<crate::model::RecrawlUrisRequest>>(mut self, v: V) -> Self {
15540            self.0.request = v.into();
15541            self
15542        }
15543
15544        /// Sets all the options, replacing any prior values.
15545        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
15546            self.0.options = v.into();
15547            self
15548        }
15549
15550        /// Sends the request.
15551        ///
15552        /// # Long running operations
15553        ///
15554        /// This starts, but does not poll, a longrunning operation. More information
15555        /// on [recrawl_uris][crate::client::SiteSearchEngineService::recrawl_uris].
15556        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
15557            (*self.0.stub)
15558                .recrawl_uris(self.0.request, self.0.options)
15559                .await
15560                .map(crate::Response::into_body)
15561        }
15562
15563        /// Creates a [Poller][google_cloud_lro::Poller] to work with `recrawl_uris`.
15564        pub fn poller(
15565            self,
15566        ) -> impl google_cloud_lro::Poller<
15567            crate::model::RecrawlUrisResponse,
15568            crate::model::RecrawlUrisMetadata,
15569        > {
15570            type Operation = google_cloud_lro::internal::Operation<
15571                crate::model::RecrawlUrisResponse,
15572                crate::model::RecrawlUrisMetadata,
15573            >;
15574            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
15575            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
15576
15577            let stub = self.0.stub.clone();
15578            let mut options = self.0.options.clone();
15579            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
15580            let query = move |name| {
15581                let stub = stub.clone();
15582                let options = options.clone();
15583                async {
15584                    let op = GetOperation::new(stub)
15585                        .set_name(name)
15586                        .with_options(options)
15587                        .send()
15588                        .await?;
15589                    Ok(Operation::new(op))
15590                }
15591            };
15592
15593            let start = move || async {
15594                let op = self.send().await?;
15595                Ok(Operation::new(op))
15596            };
15597
15598            google_cloud_lro::internal::new_poller(
15599                polling_error_policy,
15600                polling_backoff_policy,
15601                start,
15602                query,
15603            )
15604        }
15605
15606        /// Sets the value of [site_search_engine][crate::model::RecrawlUrisRequest::site_search_engine].
15607        ///
15608        /// This is a **required** field for requests.
15609        pub fn set_site_search_engine<T: Into<std::string::String>>(mut self, v: T) -> Self {
15610            self.0.request.site_search_engine = v.into();
15611            self
15612        }
15613
15614        /// Sets the value of [uris][crate::model::RecrawlUrisRequest::uris].
15615        ///
15616        /// This is a **required** field for requests.
15617        pub fn set_uris<T, V>(mut self, v: T) -> Self
15618        where
15619            T: std::iter::IntoIterator<Item = V>,
15620            V: std::convert::Into<std::string::String>,
15621        {
15622            use std::iter::Iterator;
15623            self.0.request.uris = v.into_iter().map(|i| i.into()).collect();
15624            self
15625        }
15626
15627        /// Sets the value of [site_credential][crate::model::RecrawlUrisRequest::site_credential].
15628        pub fn set_site_credential<T: Into<std::string::String>>(mut self, v: T) -> Self {
15629            self.0.request.site_credential = v.into();
15630            self
15631        }
15632    }
15633
15634    #[doc(hidden)]
15635    impl crate::RequestBuilder for RecrawlUris {
15636        fn request_options(&mut self) -> &mut crate::RequestOptions {
15637            &mut self.0.options
15638        }
15639    }
15640
15641    /// The request builder for [SiteSearchEngineService::batch_verify_target_sites][crate::client::SiteSearchEngineService::batch_verify_target_sites] calls.
15642    ///
15643    /// # Example
15644    /// ```
15645    /// # use google_cloud_discoveryengine_v1::builder::site_search_engine_service::BatchVerifyTargetSites;
15646    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
15647    /// use google_cloud_lro::Poller;
15648    ///
15649    /// let builder = prepare_request_builder();
15650    /// let response = builder.poller().until_done().await?;
15651    /// # Ok(()) }
15652    ///
15653    /// fn prepare_request_builder() -> BatchVerifyTargetSites {
15654    ///   # panic!();
15655    ///   // ... details omitted ...
15656    /// }
15657    /// ```
15658    #[derive(Clone, Debug)]
15659    pub struct BatchVerifyTargetSites(RequestBuilder<crate::model::BatchVerifyTargetSitesRequest>);
15660
15661    impl BatchVerifyTargetSites {
15662        pub(crate) fn new(
15663            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
15664        ) -> Self {
15665            Self(RequestBuilder::new(stub))
15666        }
15667
15668        /// Sets the full request, replacing any prior values.
15669        pub fn with_request<V: Into<crate::model::BatchVerifyTargetSitesRequest>>(
15670            mut self,
15671            v: V,
15672        ) -> Self {
15673            self.0.request = v.into();
15674            self
15675        }
15676
15677        /// Sets all the options, replacing any prior values.
15678        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
15679            self.0.options = v.into();
15680            self
15681        }
15682
15683        /// Sends the request.
15684        ///
15685        /// # Long running operations
15686        ///
15687        /// This starts, but does not poll, a longrunning operation. More information
15688        /// on [batch_verify_target_sites][crate::client::SiteSearchEngineService::batch_verify_target_sites].
15689        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
15690            (*self.0.stub)
15691                .batch_verify_target_sites(self.0.request, self.0.options)
15692                .await
15693                .map(crate::Response::into_body)
15694        }
15695
15696        /// Creates a [Poller][google_cloud_lro::Poller] to work with `batch_verify_target_sites`.
15697        pub fn poller(
15698            self,
15699        ) -> impl google_cloud_lro::Poller<
15700            crate::model::BatchVerifyTargetSitesResponse,
15701            crate::model::BatchVerifyTargetSitesMetadata,
15702        > {
15703            type Operation = google_cloud_lro::internal::Operation<
15704                crate::model::BatchVerifyTargetSitesResponse,
15705                crate::model::BatchVerifyTargetSitesMetadata,
15706            >;
15707            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
15708            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
15709
15710            let stub = self.0.stub.clone();
15711            let mut options = self.0.options.clone();
15712            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
15713            let query = move |name| {
15714                let stub = stub.clone();
15715                let options = options.clone();
15716                async {
15717                    let op = GetOperation::new(stub)
15718                        .set_name(name)
15719                        .with_options(options)
15720                        .send()
15721                        .await?;
15722                    Ok(Operation::new(op))
15723                }
15724            };
15725
15726            let start = move || async {
15727                let op = self.send().await?;
15728                Ok(Operation::new(op))
15729            };
15730
15731            google_cloud_lro::internal::new_poller(
15732                polling_error_policy,
15733                polling_backoff_policy,
15734                start,
15735                query,
15736            )
15737        }
15738
15739        /// Sets the value of [parent][crate::model::BatchVerifyTargetSitesRequest::parent].
15740        ///
15741        /// This is a **required** field for requests.
15742        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
15743            self.0.request.parent = v.into();
15744            self
15745        }
15746    }
15747
15748    #[doc(hidden)]
15749    impl crate::RequestBuilder for BatchVerifyTargetSites {
15750        fn request_options(&mut self) -> &mut crate::RequestOptions {
15751            &mut self.0.options
15752        }
15753    }
15754
15755    /// The request builder for [SiteSearchEngineService::fetch_domain_verification_status][crate::client::SiteSearchEngineService::fetch_domain_verification_status] calls.
15756    ///
15757    /// # Example
15758    /// ```
15759    /// # use google_cloud_discoveryengine_v1::builder::site_search_engine_service::FetchDomainVerificationStatus;
15760    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
15761    /// use google_cloud_gax::paginator::ItemPaginator;
15762    ///
15763    /// let builder = prepare_request_builder();
15764    /// let mut items = builder.by_item();
15765    /// while let Some(result) = items.next().await {
15766    ///   let item = result?;
15767    /// }
15768    /// # Ok(()) }
15769    ///
15770    /// fn prepare_request_builder() -> FetchDomainVerificationStatus {
15771    ///   # panic!();
15772    ///   // ... details omitted ...
15773    /// }
15774    /// ```
15775    #[derive(Clone, Debug)]
15776    pub struct FetchDomainVerificationStatus(
15777        RequestBuilder<crate::model::FetchDomainVerificationStatusRequest>,
15778    );
15779
15780    impl FetchDomainVerificationStatus {
15781        pub(crate) fn new(
15782            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
15783        ) -> Self {
15784            Self(RequestBuilder::new(stub))
15785        }
15786
15787        /// Sets the full request, replacing any prior values.
15788        pub fn with_request<V: Into<crate::model::FetchDomainVerificationStatusRequest>>(
15789            mut self,
15790            v: V,
15791        ) -> Self {
15792            self.0.request = v.into();
15793            self
15794        }
15795
15796        /// Sets all the options, replacing any prior values.
15797        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
15798            self.0.options = v.into();
15799            self
15800        }
15801
15802        /// Sends the request.
15803        pub async fn send(self) -> Result<crate::model::FetchDomainVerificationStatusResponse> {
15804            (*self.0.stub)
15805                .fetch_domain_verification_status(self.0.request, self.0.options)
15806                .await
15807                .map(crate::Response::into_body)
15808        }
15809
15810        /// Streams each page in the collection.
15811        pub fn by_page(
15812            self,
15813        ) -> impl google_cloud_gax::paginator::Paginator<
15814            crate::model::FetchDomainVerificationStatusResponse,
15815            crate::Error,
15816        > {
15817            use std::clone::Clone;
15818            let token = self.0.request.page_token.clone();
15819            let execute = move |token: String| {
15820                let mut builder = self.clone();
15821                builder.0.request = builder.0.request.set_page_token(token);
15822                builder.send()
15823            };
15824            google_cloud_gax::paginator::internal::new_paginator(token, execute)
15825        }
15826
15827        /// Streams each item in the collection.
15828        pub fn by_item(
15829            self,
15830        ) -> impl google_cloud_gax::paginator::ItemPaginator<
15831            crate::model::FetchDomainVerificationStatusResponse,
15832            crate::Error,
15833        > {
15834            use google_cloud_gax::paginator::Paginator;
15835            self.by_page().items()
15836        }
15837
15838        /// Sets the value of [site_search_engine][crate::model::FetchDomainVerificationStatusRequest::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 [page_size][crate::model::FetchDomainVerificationStatusRequest::page_size].
15847        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
15848            self.0.request.page_size = v.into();
15849            self
15850        }
15851
15852        /// Sets the value of [page_token][crate::model::FetchDomainVerificationStatusRequest::page_token].
15853        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
15854            self.0.request.page_token = v.into();
15855            self
15856        }
15857    }
15858
15859    #[doc(hidden)]
15860    impl crate::RequestBuilder for FetchDomainVerificationStatus {
15861        fn request_options(&mut self) -> &mut crate::RequestOptions {
15862            &mut self.0.options
15863        }
15864    }
15865
15866    /// The request builder for [SiteSearchEngineService::list_operations][crate::client::SiteSearchEngineService::list_operations] calls.
15867    ///
15868    /// # Example
15869    /// ```
15870    /// # use google_cloud_discoveryengine_v1::builder::site_search_engine_service::ListOperations;
15871    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
15872    /// use google_cloud_gax::paginator::ItemPaginator;
15873    ///
15874    /// let builder = prepare_request_builder();
15875    /// let mut items = builder.by_item();
15876    /// while let Some(result) = items.next().await {
15877    ///   let item = result?;
15878    /// }
15879    /// # Ok(()) }
15880    ///
15881    /// fn prepare_request_builder() -> ListOperations {
15882    ///   # panic!();
15883    ///   // ... details omitted ...
15884    /// }
15885    /// ```
15886    #[derive(Clone, Debug)]
15887    pub struct ListOperations(
15888        RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
15889    );
15890
15891    impl ListOperations {
15892        pub(crate) fn new(
15893            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
15894        ) -> Self {
15895            Self(RequestBuilder::new(stub))
15896        }
15897
15898        /// Sets the full request, replacing any prior values.
15899        pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
15900            mut self,
15901            v: V,
15902        ) -> Self {
15903            self.0.request = v.into();
15904            self
15905        }
15906
15907        /// Sets all the options, replacing any prior values.
15908        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
15909            self.0.options = v.into();
15910            self
15911        }
15912
15913        /// Sends the request.
15914        pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
15915            (*self.0.stub)
15916                .list_operations(self.0.request, self.0.options)
15917                .await
15918                .map(crate::Response::into_body)
15919        }
15920
15921        /// Streams each page in the collection.
15922        pub fn by_page(
15923            self,
15924        ) -> impl google_cloud_gax::paginator::Paginator<
15925            google_cloud_longrunning::model::ListOperationsResponse,
15926            crate::Error,
15927        > {
15928            use std::clone::Clone;
15929            let token = self.0.request.page_token.clone();
15930            let execute = move |token: String| {
15931                let mut builder = self.clone();
15932                builder.0.request = builder.0.request.set_page_token(token);
15933                builder.send()
15934            };
15935            google_cloud_gax::paginator::internal::new_paginator(token, execute)
15936        }
15937
15938        /// Streams each item in the collection.
15939        pub fn by_item(
15940            self,
15941        ) -> impl google_cloud_gax::paginator::ItemPaginator<
15942            google_cloud_longrunning::model::ListOperationsResponse,
15943            crate::Error,
15944        > {
15945            use google_cloud_gax::paginator::Paginator;
15946            self.by_page().items()
15947        }
15948
15949        /// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
15950        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
15951            self.0.request.name = v.into();
15952            self
15953        }
15954
15955        /// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::filter].
15956        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
15957            self.0.request.filter = v.into();
15958            self
15959        }
15960
15961        /// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
15962        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
15963            self.0.request.page_size = v.into();
15964            self
15965        }
15966
15967        /// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
15968        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
15969            self.0.request.page_token = v.into();
15970            self
15971        }
15972
15973        /// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
15974        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
15975            self.0.request.return_partial_success = v.into();
15976            self
15977        }
15978    }
15979
15980    #[doc(hidden)]
15981    impl crate::RequestBuilder for ListOperations {
15982        fn request_options(&mut self) -> &mut crate::RequestOptions {
15983            &mut self.0.options
15984        }
15985    }
15986
15987    /// The request builder for [SiteSearchEngineService::get_operation][crate::client::SiteSearchEngineService::get_operation] calls.
15988    ///
15989    /// # Example
15990    /// ```
15991    /// # use google_cloud_discoveryengine_v1::builder::site_search_engine_service::GetOperation;
15992    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
15993    ///
15994    /// let builder = prepare_request_builder();
15995    /// let response = builder.send().await?;
15996    /// # Ok(()) }
15997    ///
15998    /// fn prepare_request_builder() -> GetOperation {
15999    ///   # panic!();
16000    ///   // ... details omitted ...
16001    /// }
16002    /// ```
16003    #[derive(Clone, Debug)]
16004    pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
16005
16006    impl GetOperation {
16007        pub(crate) fn new(
16008            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
16009        ) -> Self {
16010            Self(RequestBuilder::new(stub))
16011        }
16012
16013        /// Sets the full request, replacing any prior values.
16014        pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
16015            mut self,
16016            v: V,
16017        ) -> Self {
16018            self.0.request = v.into();
16019            self
16020        }
16021
16022        /// Sets all the options, replacing any prior values.
16023        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
16024            self.0.options = v.into();
16025            self
16026        }
16027
16028        /// Sends the request.
16029        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
16030            (*self.0.stub)
16031                .get_operation(self.0.request, self.0.options)
16032                .await
16033                .map(crate::Response::into_body)
16034        }
16035
16036        /// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
16037        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
16038            self.0.request.name = v.into();
16039            self
16040        }
16041    }
16042
16043    #[doc(hidden)]
16044    impl crate::RequestBuilder for GetOperation {
16045        fn request_options(&mut self) -> &mut crate::RequestOptions {
16046            &mut self.0.options
16047        }
16048    }
16049
16050    /// The request builder for [SiteSearchEngineService::cancel_operation][crate::client::SiteSearchEngineService::cancel_operation] calls.
16051    ///
16052    /// # Example
16053    /// ```
16054    /// # use google_cloud_discoveryengine_v1::builder::site_search_engine_service::CancelOperation;
16055    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
16056    ///
16057    /// let builder = prepare_request_builder();
16058    /// let response = builder.send().await?;
16059    /// # Ok(()) }
16060    ///
16061    /// fn prepare_request_builder() -> CancelOperation {
16062    ///   # panic!();
16063    ///   // ... details omitted ...
16064    /// }
16065    /// ```
16066    #[derive(Clone, Debug)]
16067    pub struct CancelOperation(
16068        RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
16069    );
16070
16071    impl CancelOperation {
16072        pub(crate) fn new(
16073            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
16074        ) -> Self {
16075            Self(RequestBuilder::new(stub))
16076        }
16077
16078        /// Sets the full request, replacing any prior values.
16079        pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
16080            mut self,
16081            v: V,
16082        ) -> Self {
16083            self.0.request = v.into();
16084            self
16085        }
16086
16087        /// Sets all the options, replacing any prior values.
16088        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
16089            self.0.options = v.into();
16090            self
16091        }
16092
16093        /// Sends the request.
16094        pub async fn send(self) -> Result<()> {
16095            (*self.0.stub)
16096                .cancel_operation(self.0.request, self.0.options)
16097                .await
16098                .map(crate::Response::into_body)
16099        }
16100
16101        /// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::name].
16102        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
16103            self.0.request.name = v.into();
16104            self
16105        }
16106    }
16107
16108    #[doc(hidden)]
16109    impl crate::RequestBuilder for CancelOperation {
16110        fn request_options(&mut self) -> &mut crate::RequestOptions {
16111            &mut self.0.options
16112        }
16113    }
16114}
16115
16116/// Request and client builders for [UserEventService][crate::client::UserEventService].
16117#[cfg(feature = "user-event-service")]
16118#[cfg_attr(docsrs, doc(cfg(feature = "user-event-service")))]
16119pub mod user_event_service {
16120    use crate::Result;
16121
16122    /// A builder for [UserEventService][crate::client::UserEventService].
16123    ///
16124    /// ```
16125    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
16126    /// # use google_cloud_discoveryengine_v1::*;
16127    /// # use builder::user_event_service::ClientBuilder;
16128    /// # use client::UserEventService;
16129    /// let builder : ClientBuilder = UserEventService::builder();
16130    /// let client = builder
16131    ///     .with_endpoint("https://discoveryengine.googleapis.com")
16132    ///     .build().await?;
16133    /// # Ok(()) }
16134    /// ```
16135    pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
16136
16137    pub(crate) mod client {
16138        use super::super::super::client::UserEventService;
16139        pub struct Factory;
16140        impl crate::ClientFactory for Factory {
16141            type Client = UserEventService;
16142            type Credentials = gaxi::options::Credentials;
16143            async fn build(
16144                self,
16145                config: gaxi::options::ClientConfig,
16146            ) -> crate::ClientBuilderResult<Self::Client> {
16147                Self::Client::new(config).await
16148            }
16149        }
16150    }
16151
16152    /// Common implementation for [crate::client::UserEventService] request builders.
16153    #[derive(Clone, Debug)]
16154    pub(crate) struct RequestBuilder<R: std::default::Default> {
16155        stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
16156        request: R,
16157        options: crate::RequestOptions,
16158    }
16159
16160    impl<R> RequestBuilder<R>
16161    where
16162        R: std::default::Default,
16163    {
16164        pub(crate) fn new(
16165            stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
16166        ) -> Self {
16167            Self {
16168                stub,
16169                request: R::default(),
16170                options: crate::RequestOptions::default(),
16171            }
16172        }
16173    }
16174
16175    /// The request builder for [UserEventService::write_user_event][crate::client::UserEventService::write_user_event] calls.
16176    ///
16177    /// # Example
16178    /// ```
16179    /// # use google_cloud_discoveryengine_v1::builder::user_event_service::WriteUserEvent;
16180    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
16181    ///
16182    /// let builder = prepare_request_builder();
16183    /// let response = builder.send().await?;
16184    /// # Ok(()) }
16185    ///
16186    /// fn prepare_request_builder() -> WriteUserEvent {
16187    ///   # panic!();
16188    ///   // ... details omitted ...
16189    /// }
16190    /// ```
16191    #[derive(Clone, Debug)]
16192    pub struct WriteUserEvent(RequestBuilder<crate::model::WriteUserEventRequest>);
16193
16194    impl WriteUserEvent {
16195        pub(crate) fn new(
16196            stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
16197        ) -> Self {
16198            Self(RequestBuilder::new(stub))
16199        }
16200
16201        /// Sets the full request, replacing any prior values.
16202        pub fn with_request<V: Into<crate::model::WriteUserEventRequest>>(mut self, v: V) -> Self {
16203            self.0.request = v.into();
16204            self
16205        }
16206
16207        /// Sets all the options, replacing any prior values.
16208        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
16209            self.0.options = v.into();
16210            self
16211        }
16212
16213        /// Sends the request.
16214        pub async fn send(self) -> Result<crate::model::UserEvent> {
16215            (*self.0.stub)
16216                .write_user_event(self.0.request, self.0.options)
16217                .await
16218                .map(crate::Response::into_body)
16219        }
16220
16221        /// Sets the value of [parent][crate::model::WriteUserEventRequest::parent].
16222        ///
16223        /// This is a **required** field for requests.
16224        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
16225            self.0.request.parent = v.into();
16226            self
16227        }
16228
16229        /// Sets the value of [user_event][crate::model::WriteUserEventRequest::user_event].
16230        ///
16231        /// This is a **required** field for requests.
16232        pub fn set_user_event<T>(mut self, v: T) -> Self
16233        where
16234            T: std::convert::Into<crate::model::UserEvent>,
16235        {
16236            self.0.request.user_event = std::option::Option::Some(v.into());
16237            self
16238        }
16239
16240        /// Sets or clears the value of [user_event][crate::model::WriteUserEventRequest::user_event].
16241        ///
16242        /// This is a **required** field for requests.
16243        pub fn set_or_clear_user_event<T>(mut self, v: std::option::Option<T>) -> Self
16244        where
16245            T: std::convert::Into<crate::model::UserEvent>,
16246        {
16247            self.0.request.user_event = v.map(|x| x.into());
16248            self
16249        }
16250
16251        /// Sets the value of [write_async][crate::model::WriteUserEventRequest::write_async].
16252        pub fn set_write_async<T: Into<bool>>(mut self, v: T) -> Self {
16253            self.0.request.write_async = v.into();
16254            self
16255        }
16256    }
16257
16258    #[doc(hidden)]
16259    impl crate::RequestBuilder for WriteUserEvent {
16260        fn request_options(&mut self) -> &mut crate::RequestOptions {
16261            &mut self.0.options
16262        }
16263    }
16264
16265    /// The request builder for [UserEventService::collect_user_event][crate::client::UserEventService::collect_user_event] calls.
16266    ///
16267    /// # Example
16268    /// ```
16269    /// # use google_cloud_discoveryengine_v1::builder::user_event_service::CollectUserEvent;
16270    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
16271    ///
16272    /// let builder = prepare_request_builder();
16273    /// let response = builder.send().await?;
16274    /// # Ok(()) }
16275    ///
16276    /// fn prepare_request_builder() -> CollectUserEvent {
16277    ///   # panic!();
16278    ///   // ... details omitted ...
16279    /// }
16280    /// ```
16281    #[derive(Clone, Debug)]
16282    pub struct CollectUserEvent(RequestBuilder<crate::model::CollectUserEventRequest>);
16283
16284    impl CollectUserEvent {
16285        pub(crate) fn new(
16286            stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
16287        ) -> Self {
16288            Self(RequestBuilder::new(stub))
16289        }
16290
16291        /// Sets the full request, replacing any prior values.
16292        pub fn with_request<V: Into<crate::model::CollectUserEventRequest>>(
16293            mut self,
16294            v: V,
16295        ) -> Self {
16296            self.0.request = v.into();
16297            self
16298        }
16299
16300        /// Sets all the options, replacing any prior values.
16301        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
16302            self.0.options = v.into();
16303            self
16304        }
16305
16306        /// Sends the request.
16307        pub async fn send(self) -> Result<google_cloud_api::model::HttpBody> {
16308            (*self.0.stub)
16309                .collect_user_event(self.0.request, self.0.options)
16310                .await
16311                .map(crate::Response::into_body)
16312        }
16313
16314        /// Sets the value of [parent][crate::model::CollectUserEventRequest::parent].
16315        ///
16316        /// This is a **required** field for requests.
16317        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
16318            self.0.request.parent = v.into();
16319            self
16320        }
16321
16322        /// Sets the value of [user_event][crate::model::CollectUserEventRequest::user_event].
16323        ///
16324        /// This is a **required** field for requests.
16325        pub fn set_user_event<T: Into<std::string::String>>(mut self, v: T) -> Self {
16326            self.0.request.user_event = v.into();
16327            self
16328        }
16329
16330        /// Sets the value of [uri][crate::model::CollectUserEventRequest::uri].
16331        pub fn set_uri<T>(mut self, v: T) -> Self
16332        where
16333            T: std::convert::Into<std::string::String>,
16334        {
16335            self.0.request.uri = std::option::Option::Some(v.into());
16336            self
16337        }
16338
16339        /// Sets or clears the value of [uri][crate::model::CollectUserEventRequest::uri].
16340        pub fn set_or_clear_uri<T>(mut self, v: std::option::Option<T>) -> Self
16341        where
16342            T: std::convert::Into<std::string::String>,
16343        {
16344            self.0.request.uri = v.map(|x| x.into());
16345            self
16346        }
16347
16348        /// Sets the value of [ets][crate::model::CollectUserEventRequest::ets].
16349        pub fn set_ets<T>(mut self, v: T) -> Self
16350        where
16351            T: std::convert::Into<i64>,
16352        {
16353            self.0.request.ets = std::option::Option::Some(v.into());
16354            self
16355        }
16356
16357        /// Sets or clears the value of [ets][crate::model::CollectUserEventRequest::ets].
16358        pub fn set_or_clear_ets<T>(mut self, v: std::option::Option<T>) -> Self
16359        where
16360            T: std::convert::Into<i64>,
16361        {
16362            self.0.request.ets = v.map(|x| x.into());
16363            self
16364        }
16365    }
16366
16367    #[doc(hidden)]
16368    impl crate::RequestBuilder for CollectUserEvent {
16369        fn request_options(&mut self) -> &mut crate::RequestOptions {
16370            &mut self.0.options
16371        }
16372    }
16373
16374    /// The request builder for [UserEventService::purge_user_events][crate::client::UserEventService::purge_user_events] calls.
16375    ///
16376    /// # Example
16377    /// ```
16378    /// # use google_cloud_discoveryengine_v1::builder::user_event_service::PurgeUserEvents;
16379    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
16380    /// use google_cloud_lro::Poller;
16381    ///
16382    /// let builder = prepare_request_builder();
16383    /// let response = builder.poller().until_done().await?;
16384    /// # Ok(()) }
16385    ///
16386    /// fn prepare_request_builder() -> PurgeUserEvents {
16387    ///   # panic!();
16388    ///   // ... details omitted ...
16389    /// }
16390    /// ```
16391    #[derive(Clone, Debug)]
16392    pub struct PurgeUserEvents(RequestBuilder<crate::model::PurgeUserEventsRequest>);
16393
16394    impl PurgeUserEvents {
16395        pub(crate) fn new(
16396            stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
16397        ) -> Self {
16398            Self(RequestBuilder::new(stub))
16399        }
16400
16401        /// Sets the full request, replacing any prior values.
16402        pub fn with_request<V: Into<crate::model::PurgeUserEventsRequest>>(mut self, v: V) -> Self {
16403            self.0.request = v.into();
16404            self
16405        }
16406
16407        /// Sets all the options, replacing any prior values.
16408        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
16409            self.0.options = v.into();
16410            self
16411        }
16412
16413        /// Sends the request.
16414        ///
16415        /// # Long running operations
16416        ///
16417        /// This starts, but does not poll, a longrunning operation. More information
16418        /// on [purge_user_events][crate::client::UserEventService::purge_user_events].
16419        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
16420            (*self.0.stub)
16421                .purge_user_events(self.0.request, self.0.options)
16422                .await
16423                .map(crate::Response::into_body)
16424        }
16425
16426        /// Creates a [Poller][google_cloud_lro::Poller] to work with `purge_user_events`.
16427        pub fn poller(
16428            self,
16429        ) -> impl google_cloud_lro::Poller<
16430            crate::model::PurgeUserEventsResponse,
16431            crate::model::PurgeUserEventsMetadata,
16432        > {
16433            type Operation = google_cloud_lro::internal::Operation<
16434                crate::model::PurgeUserEventsResponse,
16435                crate::model::PurgeUserEventsMetadata,
16436            >;
16437            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
16438            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
16439
16440            let stub = self.0.stub.clone();
16441            let mut options = self.0.options.clone();
16442            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
16443            let query = move |name| {
16444                let stub = stub.clone();
16445                let options = options.clone();
16446                async {
16447                    let op = GetOperation::new(stub)
16448                        .set_name(name)
16449                        .with_options(options)
16450                        .send()
16451                        .await?;
16452                    Ok(Operation::new(op))
16453                }
16454            };
16455
16456            let start = move || async {
16457                let op = self.send().await?;
16458                Ok(Operation::new(op))
16459            };
16460
16461            google_cloud_lro::internal::new_poller(
16462                polling_error_policy,
16463                polling_backoff_policy,
16464                start,
16465                query,
16466            )
16467        }
16468
16469        /// Sets the value of [parent][crate::model::PurgeUserEventsRequest::parent].
16470        ///
16471        /// This is a **required** field for requests.
16472        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
16473            self.0.request.parent = v.into();
16474            self
16475        }
16476
16477        /// Sets the value of [filter][crate::model::PurgeUserEventsRequest::filter].
16478        ///
16479        /// This is a **required** field for requests.
16480        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
16481            self.0.request.filter = v.into();
16482            self
16483        }
16484
16485        /// Sets the value of [force][crate::model::PurgeUserEventsRequest::force].
16486        pub fn set_force<T: Into<bool>>(mut self, v: T) -> Self {
16487            self.0.request.force = v.into();
16488            self
16489        }
16490    }
16491
16492    #[doc(hidden)]
16493    impl crate::RequestBuilder for PurgeUserEvents {
16494        fn request_options(&mut self) -> &mut crate::RequestOptions {
16495            &mut self.0.options
16496        }
16497    }
16498
16499    /// The request builder for [UserEventService::import_user_events][crate::client::UserEventService::import_user_events] calls.
16500    ///
16501    /// # Example
16502    /// ```
16503    /// # use google_cloud_discoveryengine_v1::builder::user_event_service::ImportUserEvents;
16504    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
16505    /// use google_cloud_lro::Poller;
16506    ///
16507    /// let builder = prepare_request_builder();
16508    /// let response = builder.poller().until_done().await?;
16509    /// # Ok(()) }
16510    ///
16511    /// fn prepare_request_builder() -> ImportUserEvents {
16512    ///   # panic!();
16513    ///   // ... details omitted ...
16514    /// }
16515    /// ```
16516    #[derive(Clone, Debug)]
16517    pub struct ImportUserEvents(RequestBuilder<crate::model::ImportUserEventsRequest>);
16518
16519    impl ImportUserEvents {
16520        pub(crate) fn new(
16521            stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
16522        ) -> Self {
16523            Self(RequestBuilder::new(stub))
16524        }
16525
16526        /// Sets the full request, replacing any prior values.
16527        pub fn with_request<V: Into<crate::model::ImportUserEventsRequest>>(
16528            mut self,
16529            v: V,
16530        ) -> Self {
16531            self.0.request = v.into();
16532            self
16533        }
16534
16535        /// Sets all the options, replacing any prior values.
16536        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
16537            self.0.options = v.into();
16538            self
16539        }
16540
16541        /// Sends the request.
16542        ///
16543        /// # Long running operations
16544        ///
16545        /// This starts, but does not poll, a longrunning operation. More information
16546        /// on [import_user_events][crate::client::UserEventService::import_user_events].
16547        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
16548            (*self.0.stub)
16549                .import_user_events(self.0.request, self.0.options)
16550                .await
16551                .map(crate::Response::into_body)
16552        }
16553
16554        /// Creates a [Poller][google_cloud_lro::Poller] to work with `import_user_events`.
16555        pub fn poller(
16556            self,
16557        ) -> impl google_cloud_lro::Poller<
16558            crate::model::ImportUserEventsResponse,
16559            crate::model::ImportUserEventsMetadata,
16560        > {
16561            type Operation = google_cloud_lro::internal::Operation<
16562                crate::model::ImportUserEventsResponse,
16563                crate::model::ImportUserEventsMetadata,
16564            >;
16565            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
16566            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
16567
16568            let stub = self.0.stub.clone();
16569            let mut options = self.0.options.clone();
16570            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
16571            let query = move |name| {
16572                let stub = stub.clone();
16573                let options = options.clone();
16574                async {
16575                    let op = GetOperation::new(stub)
16576                        .set_name(name)
16577                        .with_options(options)
16578                        .send()
16579                        .await?;
16580                    Ok(Operation::new(op))
16581                }
16582            };
16583
16584            let start = move || async {
16585                let op = self.send().await?;
16586                Ok(Operation::new(op))
16587            };
16588
16589            google_cloud_lro::internal::new_poller(
16590                polling_error_policy,
16591                polling_backoff_policy,
16592                start,
16593                query,
16594            )
16595        }
16596
16597        /// Sets the value of [parent][crate::model::ImportUserEventsRequest::parent].
16598        ///
16599        /// This is a **required** field for requests.
16600        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
16601            self.0.request.parent = v.into();
16602            self
16603        }
16604
16605        /// Sets the value of [error_config][crate::model::ImportUserEventsRequest::error_config].
16606        pub fn set_error_config<T>(mut self, v: T) -> Self
16607        where
16608            T: std::convert::Into<crate::model::ImportErrorConfig>,
16609        {
16610            self.0.request.error_config = std::option::Option::Some(v.into());
16611            self
16612        }
16613
16614        /// Sets or clears the value of [error_config][crate::model::ImportUserEventsRequest::error_config].
16615        pub fn set_or_clear_error_config<T>(mut self, v: std::option::Option<T>) -> Self
16616        where
16617            T: std::convert::Into<crate::model::ImportErrorConfig>,
16618        {
16619            self.0.request.error_config = v.map(|x| x.into());
16620            self
16621        }
16622
16623        /// Sets the value of [source][crate::model::ImportUserEventsRequest::source].
16624        ///
16625        /// Note that all the setters affecting `source` are
16626        /// mutually exclusive.
16627        pub fn set_source<T: Into<Option<crate::model::import_user_events_request::Source>>>(
16628            mut self,
16629            v: T,
16630        ) -> Self {
16631            self.0.request.source = v.into();
16632            self
16633        }
16634
16635        /// Sets the value of [source][crate::model::ImportUserEventsRequest::source]
16636        /// to hold a `InlineSource`.
16637        ///
16638        /// Note that all the setters affecting `source` are
16639        /// mutually exclusive.
16640        pub fn set_inline_source<
16641            T: std::convert::Into<
16642                    std::boxed::Box<crate::model::import_user_events_request::InlineSource>,
16643                >,
16644        >(
16645            mut self,
16646            v: T,
16647        ) -> Self {
16648            self.0.request = self.0.request.set_inline_source(v);
16649            self
16650        }
16651
16652        /// Sets the value of [source][crate::model::ImportUserEventsRequest::source]
16653        /// to hold a `GcsSource`.
16654        ///
16655        /// Note that all the setters affecting `source` are
16656        /// mutually exclusive.
16657        pub fn set_gcs_source<T: std::convert::Into<std::boxed::Box<crate::model::GcsSource>>>(
16658            mut self,
16659            v: T,
16660        ) -> Self {
16661            self.0.request = self.0.request.set_gcs_source(v);
16662            self
16663        }
16664
16665        /// Sets the value of [source][crate::model::ImportUserEventsRequest::source]
16666        /// to hold a `BigquerySource`.
16667        ///
16668        /// Note that all the setters affecting `source` are
16669        /// mutually exclusive.
16670        pub fn set_bigquery_source<
16671            T: std::convert::Into<std::boxed::Box<crate::model::BigQuerySource>>,
16672        >(
16673            mut self,
16674            v: T,
16675        ) -> Self {
16676            self.0.request = self.0.request.set_bigquery_source(v);
16677            self
16678        }
16679    }
16680
16681    #[doc(hidden)]
16682    impl crate::RequestBuilder for ImportUserEvents {
16683        fn request_options(&mut self) -> &mut crate::RequestOptions {
16684            &mut self.0.options
16685        }
16686    }
16687
16688    /// The request builder for [UserEventService::list_operations][crate::client::UserEventService::list_operations] calls.
16689    ///
16690    /// # Example
16691    /// ```
16692    /// # use google_cloud_discoveryengine_v1::builder::user_event_service::ListOperations;
16693    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
16694    /// use google_cloud_gax::paginator::ItemPaginator;
16695    ///
16696    /// let builder = prepare_request_builder();
16697    /// let mut items = builder.by_item();
16698    /// while let Some(result) = items.next().await {
16699    ///   let item = result?;
16700    /// }
16701    /// # Ok(()) }
16702    ///
16703    /// fn prepare_request_builder() -> ListOperations {
16704    ///   # panic!();
16705    ///   // ... details omitted ...
16706    /// }
16707    /// ```
16708    #[derive(Clone, Debug)]
16709    pub struct ListOperations(
16710        RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
16711    );
16712
16713    impl ListOperations {
16714        pub(crate) fn new(
16715            stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
16716        ) -> Self {
16717            Self(RequestBuilder::new(stub))
16718        }
16719
16720        /// Sets the full request, replacing any prior values.
16721        pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
16722            mut self,
16723            v: V,
16724        ) -> Self {
16725            self.0.request = v.into();
16726            self
16727        }
16728
16729        /// Sets all the options, replacing any prior values.
16730        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
16731            self.0.options = v.into();
16732            self
16733        }
16734
16735        /// Sends the request.
16736        pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
16737            (*self.0.stub)
16738                .list_operations(self.0.request, self.0.options)
16739                .await
16740                .map(crate::Response::into_body)
16741        }
16742
16743        /// Streams each page in the collection.
16744        pub fn by_page(
16745            self,
16746        ) -> impl google_cloud_gax::paginator::Paginator<
16747            google_cloud_longrunning::model::ListOperationsResponse,
16748            crate::Error,
16749        > {
16750            use std::clone::Clone;
16751            let token = self.0.request.page_token.clone();
16752            let execute = move |token: String| {
16753                let mut builder = self.clone();
16754                builder.0.request = builder.0.request.set_page_token(token);
16755                builder.send()
16756            };
16757            google_cloud_gax::paginator::internal::new_paginator(token, execute)
16758        }
16759
16760        /// Streams each item in the collection.
16761        pub fn by_item(
16762            self,
16763        ) -> impl google_cloud_gax::paginator::ItemPaginator<
16764            google_cloud_longrunning::model::ListOperationsResponse,
16765            crate::Error,
16766        > {
16767            use google_cloud_gax::paginator::Paginator;
16768            self.by_page().items()
16769        }
16770
16771        /// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
16772        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
16773            self.0.request.name = v.into();
16774            self
16775        }
16776
16777        /// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::filter].
16778        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
16779            self.0.request.filter = v.into();
16780            self
16781        }
16782
16783        /// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
16784        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
16785            self.0.request.page_size = v.into();
16786            self
16787        }
16788
16789        /// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
16790        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
16791            self.0.request.page_token = v.into();
16792            self
16793        }
16794
16795        /// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
16796        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
16797            self.0.request.return_partial_success = v.into();
16798            self
16799        }
16800    }
16801
16802    #[doc(hidden)]
16803    impl crate::RequestBuilder for ListOperations {
16804        fn request_options(&mut self) -> &mut crate::RequestOptions {
16805            &mut self.0.options
16806        }
16807    }
16808
16809    /// The request builder for [UserEventService::get_operation][crate::client::UserEventService::get_operation] calls.
16810    ///
16811    /// # Example
16812    /// ```
16813    /// # use google_cloud_discoveryengine_v1::builder::user_event_service::GetOperation;
16814    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
16815    ///
16816    /// let builder = prepare_request_builder();
16817    /// let response = builder.send().await?;
16818    /// # Ok(()) }
16819    ///
16820    /// fn prepare_request_builder() -> GetOperation {
16821    ///   # panic!();
16822    ///   // ... details omitted ...
16823    /// }
16824    /// ```
16825    #[derive(Clone, Debug)]
16826    pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
16827
16828    impl GetOperation {
16829        pub(crate) fn new(
16830            stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
16831        ) -> Self {
16832            Self(RequestBuilder::new(stub))
16833        }
16834
16835        /// Sets the full request, replacing any prior values.
16836        pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
16837            mut self,
16838            v: V,
16839        ) -> Self {
16840            self.0.request = v.into();
16841            self
16842        }
16843
16844        /// Sets all the options, replacing any prior values.
16845        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
16846            self.0.options = v.into();
16847            self
16848        }
16849
16850        /// Sends the request.
16851        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
16852            (*self.0.stub)
16853                .get_operation(self.0.request, self.0.options)
16854                .await
16855                .map(crate::Response::into_body)
16856        }
16857
16858        /// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
16859        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
16860            self.0.request.name = v.into();
16861            self
16862        }
16863    }
16864
16865    #[doc(hidden)]
16866    impl crate::RequestBuilder for GetOperation {
16867        fn request_options(&mut self) -> &mut crate::RequestOptions {
16868            &mut self.0.options
16869        }
16870    }
16871
16872    /// The request builder for [UserEventService::cancel_operation][crate::client::UserEventService::cancel_operation] calls.
16873    ///
16874    /// # Example
16875    /// ```
16876    /// # use google_cloud_discoveryengine_v1::builder::user_event_service::CancelOperation;
16877    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
16878    ///
16879    /// let builder = prepare_request_builder();
16880    /// let response = builder.send().await?;
16881    /// # Ok(()) }
16882    ///
16883    /// fn prepare_request_builder() -> CancelOperation {
16884    ///   # panic!();
16885    ///   // ... details omitted ...
16886    /// }
16887    /// ```
16888    #[derive(Clone, Debug)]
16889    pub struct CancelOperation(
16890        RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
16891    );
16892
16893    impl CancelOperation {
16894        pub(crate) fn new(
16895            stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
16896        ) -> Self {
16897            Self(RequestBuilder::new(stub))
16898        }
16899
16900        /// Sets the full request, replacing any prior values.
16901        pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
16902            mut self,
16903            v: V,
16904        ) -> Self {
16905            self.0.request = v.into();
16906            self
16907        }
16908
16909        /// Sets all the options, replacing any prior values.
16910        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
16911            self.0.options = v.into();
16912            self
16913        }
16914
16915        /// Sends the request.
16916        pub async fn send(self) -> Result<()> {
16917            (*self.0.stub)
16918                .cancel_operation(self.0.request, self.0.options)
16919                .await
16920                .map(crate::Response::into_body)
16921        }
16922
16923        /// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::name].
16924        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
16925            self.0.request.name = v.into();
16926            self
16927        }
16928    }
16929
16930    #[doc(hidden)]
16931    impl crate::RequestBuilder for CancelOperation {
16932        fn request_options(&mut self) -> &mut crate::RequestOptions {
16933            &mut self.0.options
16934        }
16935    }
16936}
16937
16938/// Request and client builders for [UserLicenseService][crate::client::UserLicenseService].
16939#[cfg(feature = "user-license-service")]
16940#[cfg_attr(docsrs, doc(cfg(feature = "user-license-service")))]
16941pub mod user_license_service {
16942    use crate::Result;
16943
16944    /// A builder for [UserLicenseService][crate::client::UserLicenseService].
16945    ///
16946    /// ```
16947    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
16948    /// # use google_cloud_discoveryengine_v1::*;
16949    /// # use builder::user_license_service::ClientBuilder;
16950    /// # use client::UserLicenseService;
16951    /// let builder : ClientBuilder = UserLicenseService::builder();
16952    /// let client = builder
16953    ///     .with_endpoint("https://discoveryengine.googleapis.com")
16954    ///     .build().await?;
16955    /// # Ok(()) }
16956    /// ```
16957    pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
16958
16959    pub(crate) mod client {
16960        use super::super::super::client::UserLicenseService;
16961        pub struct Factory;
16962        impl crate::ClientFactory for Factory {
16963            type Client = UserLicenseService;
16964            type Credentials = gaxi::options::Credentials;
16965            async fn build(
16966                self,
16967                config: gaxi::options::ClientConfig,
16968            ) -> crate::ClientBuilderResult<Self::Client> {
16969                Self::Client::new(config).await
16970            }
16971        }
16972    }
16973
16974    /// Common implementation for [crate::client::UserLicenseService] request builders.
16975    #[derive(Clone, Debug)]
16976    pub(crate) struct RequestBuilder<R: std::default::Default> {
16977        stub: std::sync::Arc<dyn super::super::stub::dynamic::UserLicenseService>,
16978        request: R,
16979        options: crate::RequestOptions,
16980    }
16981
16982    impl<R> RequestBuilder<R>
16983    where
16984        R: std::default::Default,
16985    {
16986        pub(crate) fn new(
16987            stub: std::sync::Arc<dyn super::super::stub::dynamic::UserLicenseService>,
16988        ) -> Self {
16989            Self {
16990                stub,
16991                request: R::default(),
16992                options: crate::RequestOptions::default(),
16993            }
16994        }
16995    }
16996
16997    /// The request builder for [UserLicenseService::list_user_licenses][crate::client::UserLicenseService::list_user_licenses] calls.
16998    ///
16999    /// # Example
17000    /// ```
17001    /// # use google_cloud_discoveryengine_v1::builder::user_license_service::ListUserLicenses;
17002    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
17003    /// use google_cloud_gax::paginator::ItemPaginator;
17004    ///
17005    /// let builder = prepare_request_builder();
17006    /// let mut items = builder.by_item();
17007    /// while let Some(result) = items.next().await {
17008    ///   let item = result?;
17009    /// }
17010    /// # Ok(()) }
17011    ///
17012    /// fn prepare_request_builder() -> ListUserLicenses {
17013    ///   # panic!();
17014    ///   // ... details omitted ...
17015    /// }
17016    /// ```
17017    #[derive(Clone, Debug)]
17018    pub struct ListUserLicenses(RequestBuilder<crate::model::ListUserLicensesRequest>);
17019
17020    impl ListUserLicenses {
17021        pub(crate) fn new(
17022            stub: std::sync::Arc<dyn super::super::stub::dynamic::UserLicenseService>,
17023        ) -> Self {
17024            Self(RequestBuilder::new(stub))
17025        }
17026
17027        /// Sets the full request, replacing any prior values.
17028        pub fn with_request<V: Into<crate::model::ListUserLicensesRequest>>(
17029            mut self,
17030            v: V,
17031        ) -> Self {
17032            self.0.request = v.into();
17033            self
17034        }
17035
17036        /// Sets all the options, replacing any prior values.
17037        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
17038            self.0.options = v.into();
17039            self
17040        }
17041
17042        /// Sends the request.
17043        pub async fn send(self) -> Result<crate::model::ListUserLicensesResponse> {
17044            (*self.0.stub)
17045                .list_user_licenses(self.0.request, self.0.options)
17046                .await
17047                .map(crate::Response::into_body)
17048        }
17049
17050        /// Streams each page in the collection.
17051        pub fn by_page(
17052            self,
17053        ) -> impl google_cloud_gax::paginator::Paginator<
17054            crate::model::ListUserLicensesResponse,
17055            crate::Error,
17056        > {
17057            use std::clone::Clone;
17058            let token = self.0.request.page_token.clone();
17059            let execute = move |token: String| {
17060                let mut builder = self.clone();
17061                builder.0.request = builder.0.request.set_page_token(token);
17062                builder.send()
17063            };
17064            google_cloud_gax::paginator::internal::new_paginator(token, execute)
17065        }
17066
17067        /// Streams each item in the collection.
17068        pub fn by_item(
17069            self,
17070        ) -> impl google_cloud_gax::paginator::ItemPaginator<
17071            crate::model::ListUserLicensesResponse,
17072            crate::Error,
17073        > {
17074            use google_cloud_gax::paginator::Paginator;
17075            self.by_page().items()
17076        }
17077
17078        /// Sets the value of [parent][crate::model::ListUserLicensesRequest::parent].
17079        ///
17080        /// This is a **required** field for requests.
17081        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
17082            self.0.request.parent = v.into();
17083            self
17084        }
17085
17086        /// Sets the value of [page_size][crate::model::ListUserLicensesRequest::page_size].
17087        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
17088            self.0.request.page_size = v.into();
17089            self
17090        }
17091
17092        /// Sets the value of [page_token][crate::model::ListUserLicensesRequest::page_token].
17093        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
17094            self.0.request.page_token = v.into();
17095            self
17096        }
17097
17098        /// Sets the value of [filter][crate::model::ListUserLicensesRequest::filter].
17099        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
17100            self.0.request.filter = v.into();
17101            self
17102        }
17103    }
17104
17105    #[doc(hidden)]
17106    impl crate::RequestBuilder for ListUserLicenses {
17107        fn request_options(&mut self) -> &mut crate::RequestOptions {
17108            &mut self.0.options
17109        }
17110    }
17111
17112    /// The request builder for [UserLicenseService::batch_update_user_licenses][crate::client::UserLicenseService::batch_update_user_licenses] calls.
17113    ///
17114    /// # Example
17115    /// ```
17116    /// # use google_cloud_discoveryengine_v1::builder::user_license_service::BatchUpdateUserLicenses;
17117    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
17118    /// use google_cloud_lro::Poller;
17119    ///
17120    /// let builder = prepare_request_builder();
17121    /// let response = builder.poller().until_done().await?;
17122    /// # Ok(()) }
17123    ///
17124    /// fn prepare_request_builder() -> BatchUpdateUserLicenses {
17125    ///   # panic!();
17126    ///   // ... details omitted ...
17127    /// }
17128    /// ```
17129    #[derive(Clone, Debug)]
17130    pub struct BatchUpdateUserLicenses(
17131        RequestBuilder<crate::model::BatchUpdateUserLicensesRequest>,
17132    );
17133
17134    impl BatchUpdateUserLicenses {
17135        pub(crate) fn new(
17136            stub: std::sync::Arc<dyn super::super::stub::dynamic::UserLicenseService>,
17137        ) -> Self {
17138            Self(RequestBuilder::new(stub))
17139        }
17140
17141        /// Sets the full request, replacing any prior values.
17142        pub fn with_request<V: Into<crate::model::BatchUpdateUserLicensesRequest>>(
17143            mut self,
17144            v: V,
17145        ) -> Self {
17146            self.0.request = v.into();
17147            self
17148        }
17149
17150        /// Sets all the options, replacing any prior values.
17151        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
17152            self.0.options = v.into();
17153            self
17154        }
17155
17156        /// Sends the request.
17157        ///
17158        /// # Long running operations
17159        ///
17160        /// This starts, but does not poll, a longrunning operation. More information
17161        /// on [batch_update_user_licenses][crate::client::UserLicenseService::batch_update_user_licenses].
17162        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
17163            (*self.0.stub)
17164                .batch_update_user_licenses(self.0.request, self.0.options)
17165                .await
17166                .map(crate::Response::into_body)
17167        }
17168
17169        /// Creates a [Poller][google_cloud_lro::Poller] to work with `batch_update_user_licenses`.
17170        pub fn poller(
17171            self,
17172        ) -> impl google_cloud_lro::Poller<
17173            crate::model::BatchUpdateUserLicensesResponse,
17174            crate::model::BatchUpdateUserLicensesMetadata,
17175        > {
17176            type Operation = google_cloud_lro::internal::Operation<
17177                crate::model::BatchUpdateUserLicensesResponse,
17178                crate::model::BatchUpdateUserLicensesMetadata,
17179            >;
17180            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
17181            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
17182
17183            let stub = self.0.stub.clone();
17184            let mut options = self.0.options.clone();
17185            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
17186            let query = move |name| {
17187                let stub = stub.clone();
17188                let options = options.clone();
17189                async {
17190                    let op = GetOperation::new(stub)
17191                        .set_name(name)
17192                        .with_options(options)
17193                        .send()
17194                        .await?;
17195                    Ok(Operation::new(op))
17196                }
17197            };
17198
17199            let start = move || async {
17200                let op = self.send().await?;
17201                Ok(Operation::new(op))
17202            };
17203
17204            google_cloud_lro::internal::new_poller(
17205                polling_error_policy,
17206                polling_backoff_policy,
17207                start,
17208                query,
17209            )
17210        }
17211
17212        /// Sets the value of [parent][crate::model::BatchUpdateUserLicensesRequest::parent].
17213        ///
17214        /// This is a **required** field for requests.
17215        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
17216            self.0.request.parent = v.into();
17217            self
17218        }
17219
17220        /// Sets the value of [delete_unassigned_user_licenses][crate::model::BatchUpdateUserLicensesRequest::delete_unassigned_user_licenses].
17221        pub fn set_delete_unassigned_user_licenses<T: Into<bool>>(mut self, v: T) -> Self {
17222            self.0.request.delete_unassigned_user_licenses = v.into();
17223            self
17224        }
17225
17226        /// Sets the value of [source][crate::model::BatchUpdateUserLicensesRequest::source].
17227        ///
17228        /// Note that all the setters affecting `source` are
17229        /// mutually exclusive.
17230        pub fn set_source<
17231            T: Into<Option<crate::model::batch_update_user_licenses_request::Source>>,
17232        >(
17233            mut self,
17234            v: T,
17235        ) -> Self {
17236            self.0.request.source = v.into();
17237            self
17238        }
17239
17240        /// Sets the value of [source][crate::model::BatchUpdateUserLicensesRequest::source]
17241        /// to hold a `InlineSource`.
17242        ///
17243        /// Note that all the setters affecting `source` are
17244        /// mutually exclusive.
17245        pub fn set_inline_source<
17246            T: std::convert::Into<
17247                    std::boxed::Box<crate::model::batch_update_user_licenses_request::InlineSource>,
17248                >,
17249        >(
17250            mut self,
17251            v: T,
17252        ) -> Self {
17253            self.0.request = self.0.request.set_inline_source(v);
17254            self
17255        }
17256    }
17257
17258    #[doc(hidden)]
17259    impl crate::RequestBuilder for BatchUpdateUserLicenses {
17260        fn request_options(&mut self) -> &mut crate::RequestOptions {
17261            &mut self.0.options
17262        }
17263    }
17264
17265    /// The request builder for [UserLicenseService::list_operations][crate::client::UserLicenseService::list_operations] calls.
17266    ///
17267    /// # Example
17268    /// ```
17269    /// # use google_cloud_discoveryengine_v1::builder::user_license_service::ListOperations;
17270    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
17271    /// use google_cloud_gax::paginator::ItemPaginator;
17272    ///
17273    /// let builder = prepare_request_builder();
17274    /// let mut items = builder.by_item();
17275    /// while let Some(result) = items.next().await {
17276    ///   let item = result?;
17277    /// }
17278    /// # Ok(()) }
17279    ///
17280    /// fn prepare_request_builder() -> ListOperations {
17281    ///   # panic!();
17282    ///   // ... details omitted ...
17283    /// }
17284    /// ```
17285    #[derive(Clone, Debug)]
17286    pub struct ListOperations(
17287        RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
17288    );
17289
17290    impl ListOperations {
17291        pub(crate) fn new(
17292            stub: std::sync::Arc<dyn super::super::stub::dynamic::UserLicenseService>,
17293        ) -> Self {
17294            Self(RequestBuilder::new(stub))
17295        }
17296
17297        /// Sets the full request, replacing any prior values.
17298        pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
17299            mut self,
17300            v: V,
17301        ) -> Self {
17302            self.0.request = v.into();
17303            self
17304        }
17305
17306        /// Sets all the options, replacing any prior values.
17307        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
17308            self.0.options = v.into();
17309            self
17310        }
17311
17312        /// Sends the request.
17313        pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
17314            (*self.0.stub)
17315                .list_operations(self.0.request, self.0.options)
17316                .await
17317                .map(crate::Response::into_body)
17318        }
17319
17320        /// Streams each page in the collection.
17321        pub fn by_page(
17322            self,
17323        ) -> impl google_cloud_gax::paginator::Paginator<
17324            google_cloud_longrunning::model::ListOperationsResponse,
17325            crate::Error,
17326        > {
17327            use std::clone::Clone;
17328            let token = self.0.request.page_token.clone();
17329            let execute = move |token: String| {
17330                let mut builder = self.clone();
17331                builder.0.request = builder.0.request.set_page_token(token);
17332                builder.send()
17333            };
17334            google_cloud_gax::paginator::internal::new_paginator(token, execute)
17335        }
17336
17337        /// Streams each item in the collection.
17338        pub fn by_item(
17339            self,
17340        ) -> impl google_cloud_gax::paginator::ItemPaginator<
17341            google_cloud_longrunning::model::ListOperationsResponse,
17342            crate::Error,
17343        > {
17344            use google_cloud_gax::paginator::Paginator;
17345            self.by_page().items()
17346        }
17347
17348        /// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
17349        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
17350            self.0.request.name = v.into();
17351            self
17352        }
17353
17354        /// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::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        /// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
17361        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
17362            self.0.request.page_size = v.into();
17363            self
17364        }
17365
17366        /// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
17367        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
17368            self.0.request.page_token = v.into();
17369            self
17370        }
17371
17372        /// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
17373        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
17374            self.0.request.return_partial_success = v.into();
17375            self
17376        }
17377    }
17378
17379    #[doc(hidden)]
17380    impl crate::RequestBuilder for ListOperations {
17381        fn request_options(&mut self) -> &mut crate::RequestOptions {
17382            &mut self.0.options
17383        }
17384    }
17385
17386    /// The request builder for [UserLicenseService::get_operation][crate::client::UserLicenseService::get_operation] calls.
17387    ///
17388    /// # Example
17389    /// ```
17390    /// # use google_cloud_discoveryengine_v1::builder::user_license_service::GetOperation;
17391    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
17392    ///
17393    /// let builder = prepare_request_builder();
17394    /// let response = builder.send().await?;
17395    /// # Ok(()) }
17396    ///
17397    /// fn prepare_request_builder() -> GetOperation {
17398    ///   # panic!();
17399    ///   // ... details omitted ...
17400    /// }
17401    /// ```
17402    #[derive(Clone, Debug)]
17403    pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
17404
17405    impl GetOperation {
17406        pub(crate) fn new(
17407            stub: std::sync::Arc<dyn super::super::stub::dynamic::UserLicenseService>,
17408        ) -> Self {
17409            Self(RequestBuilder::new(stub))
17410        }
17411
17412        /// Sets the full request, replacing any prior values.
17413        pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
17414            mut self,
17415            v: V,
17416        ) -> Self {
17417            self.0.request = v.into();
17418            self
17419        }
17420
17421        /// Sets all the options, replacing any prior values.
17422        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
17423            self.0.options = v.into();
17424            self
17425        }
17426
17427        /// Sends the request.
17428        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
17429            (*self.0.stub)
17430                .get_operation(self.0.request, self.0.options)
17431                .await
17432                .map(crate::Response::into_body)
17433        }
17434
17435        /// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
17436        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
17437            self.0.request.name = v.into();
17438            self
17439        }
17440    }
17441
17442    #[doc(hidden)]
17443    impl crate::RequestBuilder for GetOperation {
17444        fn request_options(&mut self) -> &mut crate::RequestOptions {
17445            &mut self.0.options
17446        }
17447    }
17448
17449    /// The request builder for [UserLicenseService::cancel_operation][crate::client::UserLicenseService::cancel_operation] calls.
17450    ///
17451    /// # Example
17452    /// ```
17453    /// # use google_cloud_discoveryengine_v1::builder::user_license_service::CancelOperation;
17454    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
17455    ///
17456    /// let builder = prepare_request_builder();
17457    /// let response = builder.send().await?;
17458    /// # Ok(()) }
17459    ///
17460    /// fn prepare_request_builder() -> CancelOperation {
17461    ///   # panic!();
17462    ///   // ... details omitted ...
17463    /// }
17464    /// ```
17465    #[derive(Clone, Debug)]
17466    pub struct CancelOperation(
17467        RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
17468    );
17469
17470    impl CancelOperation {
17471        pub(crate) fn new(
17472            stub: std::sync::Arc<dyn super::super::stub::dynamic::UserLicenseService>,
17473        ) -> Self {
17474            Self(RequestBuilder::new(stub))
17475        }
17476
17477        /// Sets the full request, replacing any prior values.
17478        pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
17479            mut self,
17480            v: V,
17481        ) -> Self {
17482            self.0.request = v.into();
17483            self
17484        }
17485
17486        /// Sets all the options, replacing any prior values.
17487        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
17488            self.0.options = v.into();
17489            self
17490        }
17491
17492        /// Sends the request.
17493        pub async fn send(self) -> Result<()> {
17494            (*self.0.stub)
17495                .cancel_operation(self.0.request, self.0.options)
17496                .await
17497                .map(crate::Response::into_body)
17498        }
17499
17500        /// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::name].
17501        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
17502            self.0.request.name = v.into();
17503            self
17504        }
17505    }
17506
17507    #[doc(hidden)]
17508    impl crate::RequestBuilder for CancelOperation {
17509        fn request_options(&mut self) -> &mut crate::RequestOptions {
17510            &mut self.0.options
17511        }
17512    }
17513}