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#[cfg(feature = "assistant-service")]
18#[cfg_attr(docsrs, doc(cfg(feature = "assistant-service")))]
19pub mod assistant_service {
20    use crate::Result;
21
22    /// A builder for [AssistantService][crate::client::AssistantService].
23    ///
24    /// ```
25    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
26    /// # use google_cloud_discoveryengine_v1::*;
27    /// # use builder::assistant_service::ClientBuilder;
28    /// # use client::AssistantService;
29    /// let builder : ClientBuilder = AssistantService::builder();
30    /// let client = builder
31    ///     .with_endpoint("https://discoveryengine.googleapis.com")
32    ///     .build().await?;
33    /// # Ok(()) }
34    /// ```
35    pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
36
37    pub(crate) mod client {
38        use super::super::super::client::AssistantService;
39        pub struct Factory;
40        impl crate::ClientFactory for Factory {
41            type Client = AssistantService;
42            type Credentials = gaxi::options::Credentials;
43            async fn build(
44                self,
45                config: gaxi::options::ClientConfig,
46            ) -> crate::ClientBuilderResult<Self::Client> {
47                Self::Client::new(config).await
48            }
49        }
50    }
51
52    /// Common implementation for [crate::client::AssistantService] request builders.
53    #[derive(Clone, Debug)]
54    pub(crate) struct RequestBuilder<R: std::default::Default> {
55        stub: std::sync::Arc<dyn super::super::stub::dynamic::AssistantService>,
56        request: R,
57        options: crate::RequestOptions,
58    }
59
60    impl<R> RequestBuilder<R>
61    where
62        R: std::default::Default,
63    {
64        pub(crate) fn new(
65            stub: std::sync::Arc<dyn super::super::stub::dynamic::AssistantService>,
66        ) -> Self {
67            Self {
68                stub,
69                request: R::default(),
70                options: crate::RequestOptions::default(),
71            }
72        }
73    }
74
75    /// The request builder for [AssistantService::list_operations][crate::client::AssistantService::list_operations] calls.
76    ///
77    /// # Example
78    /// ```
79    /// # use google_cloud_discoveryengine_v1::builder::assistant_service::ListOperations;
80    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
81    /// use google_cloud_gax::paginator::ItemPaginator;
82    ///
83    /// let builder = prepare_request_builder();
84    /// let mut items = builder.by_item();
85    /// while let Some(result) = items.next().await {
86    ///   let item = result?;
87    /// }
88    /// # Ok(()) }
89    ///
90    /// fn prepare_request_builder() -> ListOperations {
91    ///   # panic!();
92    ///   // ... details omitted ...
93    /// }
94    /// ```
95    #[derive(Clone, Debug)]
96    pub struct ListOperations(
97        RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
98    );
99
100    impl ListOperations {
101        pub(crate) fn new(
102            stub: std::sync::Arc<dyn super::super::stub::dynamic::AssistantService>,
103        ) -> Self {
104            Self(RequestBuilder::new(stub))
105        }
106
107        /// Sets the full request, replacing any prior values.
108        pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
109            mut self,
110            v: V,
111        ) -> Self {
112            self.0.request = v.into();
113            self
114        }
115
116        /// Sets all the options, replacing any prior values.
117        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
118            self.0.options = v.into();
119            self
120        }
121
122        /// Sends the request.
123        pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
124            (*self.0.stub)
125                .list_operations(self.0.request, self.0.options)
126                .await
127                .map(crate::Response::into_body)
128        }
129
130        /// Streams each page in the collection.
131        pub fn by_page(
132            self,
133        ) -> impl google_cloud_gax::paginator::Paginator<
134            google_cloud_longrunning::model::ListOperationsResponse,
135            crate::Error,
136        > {
137            use std::clone::Clone;
138            let token = self.0.request.page_token.clone();
139            let execute = move |token: String| {
140                let mut builder = self.clone();
141                builder.0.request = builder.0.request.set_page_token(token);
142                builder.send()
143            };
144            google_cloud_gax::paginator::internal::new_paginator(token, execute)
145        }
146
147        /// Streams each item in the collection.
148        pub fn by_item(
149            self,
150        ) -> impl google_cloud_gax::paginator::ItemPaginator<
151            google_cloud_longrunning::model::ListOperationsResponse,
152            crate::Error,
153        > {
154            use google_cloud_gax::paginator::Paginator;
155            self.by_page().items()
156        }
157
158        /// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
159        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
160            self.0.request.name = v.into();
161            self
162        }
163
164        /// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::filter].
165        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
166            self.0.request.filter = v.into();
167            self
168        }
169
170        /// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
171        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
172            self.0.request.page_size = v.into();
173            self
174        }
175
176        /// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
177        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
178            self.0.request.page_token = v.into();
179            self
180        }
181
182        /// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
183        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
184            self.0.request.return_partial_success = v.into();
185            self
186        }
187    }
188
189    #[doc(hidden)]
190    impl crate::RequestBuilder for ListOperations {
191        fn request_options(&mut self) -> &mut crate::RequestOptions {
192            &mut self.0.options
193        }
194    }
195
196    /// The request builder for [AssistantService::get_operation][crate::client::AssistantService::get_operation] calls.
197    ///
198    /// # Example
199    /// ```
200    /// # use google_cloud_discoveryengine_v1::builder::assistant_service::GetOperation;
201    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
202    ///
203    /// let builder = prepare_request_builder();
204    /// let response = builder.send().await?;
205    /// # Ok(()) }
206    ///
207    /// fn prepare_request_builder() -> GetOperation {
208    ///   # panic!();
209    ///   // ... details omitted ...
210    /// }
211    /// ```
212    #[derive(Clone, Debug)]
213    pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
214
215    impl GetOperation {
216        pub(crate) fn new(
217            stub: std::sync::Arc<dyn super::super::stub::dynamic::AssistantService>,
218        ) -> Self {
219            Self(RequestBuilder::new(stub))
220        }
221
222        /// Sets the full request, replacing any prior values.
223        pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
224            mut self,
225            v: V,
226        ) -> Self {
227            self.0.request = v.into();
228            self
229        }
230
231        /// Sets all the options, replacing any prior values.
232        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
233            self.0.options = v.into();
234            self
235        }
236
237        /// Sends the request.
238        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
239            (*self.0.stub)
240                .get_operation(self.0.request, self.0.options)
241                .await
242                .map(crate::Response::into_body)
243        }
244
245        /// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
246        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
247            self.0.request.name = v.into();
248            self
249        }
250    }
251
252    #[doc(hidden)]
253    impl crate::RequestBuilder for GetOperation {
254        fn request_options(&mut self) -> &mut crate::RequestOptions {
255            &mut self.0.options
256        }
257    }
258
259    /// The request builder for [AssistantService::cancel_operation][crate::client::AssistantService::cancel_operation] calls.
260    ///
261    /// # Example
262    /// ```
263    /// # use google_cloud_discoveryengine_v1::builder::assistant_service::CancelOperation;
264    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
265    ///
266    /// let builder = prepare_request_builder();
267    /// let response = builder.send().await?;
268    /// # Ok(()) }
269    ///
270    /// fn prepare_request_builder() -> CancelOperation {
271    ///   # panic!();
272    ///   // ... details omitted ...
273    /// }
274    /// ```
275    #[derive(Clone, Debug)]
276    pub struct CancelOperation(
277        RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
278    );
279
280    impl CancelOperation {
281        pub(crate) fn new(
282            stub: std::sync::Arc<dyn super::super::stub::dynamic::AssistantService>,
283        ) -> Self {
284            Self(RequestBuilder::new(stub))
285        }
286
287        /// Sets the full request, replacing any prior values.
288        pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
289            mut self,
290            v: V,
291        ) -> Self {
292            self.0.request = v.into();
293            self
294        }
295
296        /// Sets all the options, replacing any prior values.
297        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
298            self.0.options = v.into();
299            self
300        }
301
302        /// Sends the request.
303        pub async fn send(self) -> Result<()> {
304            (*self.0.stub)
305                .cancel_operation(self.0.request, self.0.options)
306                .await
307                .map(crate::Response::into_body)
308        }
309
310        /// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::name].
311        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
312            self.0.request.name = v.into();
313            self
314        }
315    }
316
317    #[doc(hidden)]
318    impl crate::RequestBuilder for CancelOperation {
319        fn request_options(&mut self) -> &mut crate::RequestOptions {
320            &mut self.0.options
321        }
322    }
323}
324
325#[cfg(feature = "cmek-config-service")]
326#[cfg_attr(docsrs, doc(cfg(feature = "cmek-config-service")))]
327pub mod cmek_config_service {
328    use crate::Result;
329
330    /// A builder for [CmekConfigService][crate::client::CmekConfigService].
331    ///
332    /// ```
333    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
334    /// # use google_cloud_discoveryengine_v1::*;
335    /// # use builder::cmek_config_service::ClientBuilder;
336    /// # use client::CmekConfigService;
337    /// let builder : ClientBuilder = CmekConfigService::builder();
338    /// let client = builder
339    ///     .with_endpoint("https://discoveryengine.googleapis.com")
340    ///     .build().await?;
341    /// # Ok(()) }
342    /// ```
343    pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
344
345    pub(crate) mod client {
346        use super::super::super::client::CmekConfigService;
347        pub struct Factory;
348        impl crate::ClientFactory for Factory {
349            type Client = CmekConfigService;
350            type Credentials = gaxi::options::Credentials;
351            async fn build(
352                self,
353                config: gaxi::options::ClientConfig,
354            ) -> crate::ClientBuilderResult<Self::Client> {
355                Self::Client::new(config).await
356            }
357        }
358    }
359
360    /// Common implementation for [crate::client::CmekConfigService] request builders.
361    #[derive(Clone, Debug)]
362    pub(crate) struct RequestBuilder<R: std::default::Default> {
363        stub: std::sync::Arc<dyn super::super::stub::dynamic::CmekConfigService>,
364        request: R,
365        options: crate::RequestOptions,
366    }
367
368    impl<R> RequestBuilder<R>
369    where
370        R: std::default::Default,
371    {
372        pub(crate) fn new(
373            stub: std::sync::Arc<dyn super::super::stub::dynamic::CmekConfigService>,
374        ) -> Self {
375            Self {
376                stub,
377                request: R::default(),
378                options: crate::RequestOptions::default(),
379            }
380        }
381    }
382
383    /// The request builder for [CmekConfigService::update_cmek_config][crate::client::CmekConfigService::update_cmek_config] calls.
384    ///
385    /// # Example
386    /// ```
387    /// # use google_cloud_discoveryengine_v1::builder::cmek_config_service::UpdateCmekConfig;
388    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
389    /// use google_cloud_lro::Poller;
390    ///
391    /// let builder = prepare_request_builder();
392    /// let response = builder.poller().until_done().await?;
393    /// # Ok(()) }
394    ///
395    /// fn prepare_request_builder() -> UpdateCmekConfig {
396    ///   # panic!();
397    ///   // ... details omitted ...
398    /// }
399    /// ```
400    #[derive(Clone, Debug)]
401    pub struct UpdateCmekConfig(RequestBuilder<crate::model::UpdateCmekConfigRequest>);
402
403    impl UpdateCmekConfig {
404        pub(crate) fn new(
405            stub: std::sync::Arc<dyn super::super::stub::dynamic::CmekConfigService>,
406        ) -> Self {
407            Self(RequestBuilder::new(stub))
408        }
409
410        /// Sets the full request, replacing any prior values.
411        pub fn with_request<V: Into<crate::model::UpdateCmekConfigRequest>>(
412            mut self,
413            v: V,
414        ) -> Self {
415            self.0.request = v.into();
416            self
417        }
418
419        /// Sets all the options, replacing any prior values.
420        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
421            self.0.options = v.into();
422            self
423        }
424
425        /// Sends the request.
426        ///
427        /// # Long running operations
428        ///
429        /// This starts, but does not poll, a longrunning operation. More information
430        /// on [update_cmek_config][crate::client::CmekConfigService::update_cmek_config].
431        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
432            (*self.0.stub)
433                .update_cmek_config(self.0.request, self.0.options)
434                .await
435                .map(crate::Response::into_body)
436        }
437
438        /// Creates a [Poller][google_cloud_lro::Poller] to work with `update_cmek_config`.
439        pub fn poller(
440            self,
441        ) -> impl google_cloud_lro::Poller<
442            crate::model::CmekConfig,
443            crate::model::UpdateCmekConfigMetadata,
444        > {
445            type Operation = google_cloud_lro::internal::Operation<
446                crate::model::CmekConfig,
447                crate::model::UpdateCmekConfigMetadata,
448            >;
449            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
450            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
451
452            let stub = self.0.stub.clone();
453            let mut options = self.0.options.clone();
454            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
455            let query = move |name| {
456                let stub = stub.clone();
457                let options = options.clone();
458                async {
459                    let op = GetOperation::new(stub)
460                        .set_name(name)
461                        .with_options(options)
462                        .send()
463                        .await?;
464                    Ok(Operation::new(op))
465                }
466            };
467
468            let start = move || async {
469                let op = self.send().await?;
470                Ok(Operation::new(op))
471            };
472
473            google_cloud_lro::internal::new_poller(
474                polling_error_policy,
475                polling_backoff_policy,
476                start,
477                query,
478            )
479        }
480
481        /// Sets the value of [config][crate::model::UpdateCmekConfigRequest::config].
482        ///
483        /// This is a **required** field for requests.
484        pub fn set_config<T>(mut self, v: T) -> Self
485        where
486            T: std::convert::Into<crate::model::CmekConfig>,
487        {
488            self.0.request.config = std::option::Option::Some(v.into());
489            self
490        }
491
492        /// Sets or clears the value of [config][crate::model::UpdateCmekConfigRequest::config].
493        ///
494        /// This is a **required** field for requests.
495        pub fn set_or_clear_config<T>(mut self, v: std::option::Option<T>) -> Self
496        where
497            T: std::convert::Into<crate::model::CmekConfig>,
498        {
499            self.0.request.config = v.map(|x| x.into());
500            self
501        }
502
503        /// Sets the value of [set_default][crate::model::UpdateCmekConfigRequest::set_default].
504        pub fn set_set_default<T: Into<bool>>(mut self, v: T) -> Self {
505            self.0.request.set_default = v.into();
506            self
507        }
508    }
509
510    #[doc(hidden)]
511    impl crate::RequestBuilder for UpdateCmekConfig {
512        fn request_options(&mut self) -> &mut crate::RequestOptions {
513            &mut self.0.options
514        }
515    }
516
517    /// The request builder for [CmekConfigService::get_cmek_config][crate::client::CmekConfigService::get_cmek_config] calls.
518    ///
519    /// # Example
520    /// ```
521    /// # use google_cloud_discoveryengine_v1::builder::cmek_config_service::GetCmekConfig;
522    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
523    ///
524    /// let builder = prepare_request_builder();
525    /// let response = builder.send().await?;
526    /// # Ok(()) }
527    ///
528    /// fn prepare_request_builder() -> GetCmekConfig {
529    ///   # panic!();
530    ///   // ... details omitted ...
531    /// }
532    /// ```
533    #[derive(Clone, Debug)]
534    pub struct GetCmekConfig(RequestBuilder<crate::model::GetCmekConfigRequest>);
535
536    impl GetCmekConfig {
537        pub(crate) fn new(
538            stub: std::sync::Arc<dyn super::super::stub::dynamic::CmekConfigService>,
539        ) -> Self {
540            Self(RequestBuilder::new(stub))
541        }
542
543        /// Sets the full request, replacing any prior values.
544        pub fn with_request<V: Into<crate::model::GetCmekConfigRequest>>(mut self, v: V) -> Self {
545            self.0.request = v.into();
546            self
547        }
548
549        /// Sets all the options, replacing any prior values.
550        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
551            self.0.options = v.into();
552            self
553        }
554
555        /// Sends the request.
556        pub async fn send(self) -> Result<crate::model::CmekConfig> {
557            (*self.0.stub)
558                .get_cmek_config(self.0.request, self.0.options)
559                .await
560                .map(crate::Response::into_body)
561        }
562
563        /// Sets the value of [name][crate::model::GetCmekConfigRequest::name].
564        ///
565        /// This is a **required** field for requests.
566        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
567            self.0.request.name = v.into();
568            self
569        }
570    }
571
572    #[doc(hidden)]
573    impl crate::RequestBuilder for GetCmekConfig {
574        fn request_options(&mut self) -> &mut crate::RequestOptions {
575            &mut self.0.options
576        }
577    }
578
579    /// The request builder for [CmekConfigService::list_cmek_configs][crate::client::CmekConfigService::list_cmek_configs] calls.
580    ///
581    /// # Example
582    /// ```
583    /// # use google_cloud_discoveryengine_v1::builder::cmek_config_service::ListCmekConfigs;
584    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
585    ///
586    /// let builder = prepare_request_builder();
587    /// let response = builder.send().await?;
588    /// # Ok(()) }
589    ///
590    /// fn prepare_request_builder() -> ListCmekConfigs {
591    ///   # panic!();
592    ///   // ... details omitted ...
593    /// }
594    /// ```
595    #[derive(Clone, Debug)]
596    pub struct ListCmekConfigs(RequestBuilder<crate::model::ListCmekConfigsRequest>);
597
598    impl ListCmekConfigs {
599        pub(crate) fn new(
600            stub: std::sync::Arc<dyn super::super::stub::dynamic::CmekConfigService>,
601        ) -> Self {
602            Self(RequestBuilder::new(stub))
603        }
604
605        /// Sets the full request, replacing any prior values.
606        pub fn with_request<V: Into<crate::model::ListCmekConfigsRequest>>(mut self, v: V) -> Self {
607            self.0.request = v.into();
608            self
609        }
610
611        /// Sets all the options, replacing any prior values.
612        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
613            self.0.options = v.into();
614            self
615        }
616
617        /// Sends the request.
618        pub async fn send(self) -> Result<crate::model::ListCmekConfigsResponse> {
619            (*self.0.stub)
620                .list_cmek_configs(self.0.request, self.0.options)
621                .await
622                .map(crate::Response::into_body)
623        }
624
625        /// Sets the value of [parent][crate::model::ListCmekConfigsRequest::parent].
626        ///
627        /// This is a **required** field for requests.
628        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
629            self.0.request.parent = v.into();
630            self
631        }
632    }
633
634    #[doc(hidden)]
635    impl crate::RequestBuilder for ListCmekConfigs {
636        fn request_options(&mut self) -> &mut crate::RequestOptions {
637            &mut self.0.options
638        }
639    }
640
641    /// The request builder for [CmekConfigService::delete_cmek_config][crate::client::CmekConfigService::delete_cmek_config] calls.
642    ///
643    /// # Example
644    /// ```
645    /// # use google_cloud_discoveryengine_v1::builder::cmek_config_service::DeleteCmekConfig;
646    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
647    /// use google_cloud_lro::Poller;
648    ///
649    /// let builder = prepare_request_builder();
650    /// let response = builder.poller().until_done().await?;
651    /// # Ok(()) }
652    ///
653    /// fn prepare_request_builder() -> DeleteCmekConfig {
654    ///   # panic!();
655    ///   // ... details omitted ...
656    /// }
657    /// ```
658    #[derive(Clone, Debug)]
659    pub struct DeleteCmekConfig(RequestBuilder<crate::model::DeleteCmekConfigRequest>);
660
661    impl DeleteCmekConfig {
662        pub(crate) fn new(
663            stub: std::sync::Arc<dyn super::super::stub::dynamic::CmekConfigService>,
664        ) -> Self {
665            Self(RequestBuilder::new(stub))
666        }
667
668        /// Sets the full request, replacing any prior values.
669        pub fn with_request<V: Into<crate::model::DeleteCmekConfigRequest>>(
670            mut self,
671            v: V,
672        ) -> Self {
673            self.0.request = v.into();
674            self
675        }
676
677        /// Sets all the options, replacing any prior values.
678        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
679            self.0.options = v.into();
680            self
681        }
682
683        /// Sends the request.
684        ///
685        /// # Long running operations
686        ///
687        /// This starts, but does not poll, a longrunning operation. More information
688        /// on [delete_cmek_config][crate::client::CmekConfigService::delete_cmek_config].
689        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
690            (*self.0.stub)
691                .delete_cmek_config(self.0.request, self.0.options)
692                .await
693                .map(crate::Response::into_body)
694        }
695
696        /// Creates a [Poller][google_cloud_lro::Poller] to work with `delete_cmek_config`.
697        pub fn poller(
698            self,
699        ) -> impl google_cloud_lro::Poller<(), crate::model::DeleteCmekConfigMetadata> {
700            type Operation = google_cloud_lro::internal::Operation<
701                wkt::Empty,
702                crate::model::DeleteCmekConfigMetadata,
703            >;
704            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
705            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
706
707            let stub = self.0.stub.clone();
708            let mut options = self.0.options.clone();
709            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
710            let query = move |name| {
711                let stub = stub.clone();
712                let options = options.clone();
713                async {
714                    let op = GetOperation::new(stub)
715                        .set_name(name)
716                        .with_options(options)
717                        .send()
718                        .await?;
719                    Ok(Operation::new(op))
720                }
721            };
722
723            let start = move || async {
724                let op = self.send().await?;
725                Ok(Operation::new(op))
726            };
727
728            google_cloud_lro::internal::new_unit_response_poller(
729                polling_error_policy,
730                polling_backoff_policy,
731                start,
732                query,
733            )
734        }
735
736        /// Sets the value of [name][crate::model::DeleteCmekConfigRequest::name].
737        ///
738        /// This is a **required** field for requests.
739        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
740            self.0.request.name = v.into();
741            self
742        }
743    }
744
745    #[doc(hidden)]
746    impl crate::RequestBuilder for DeleteCmekConfig {
747        fn request_options(&mut self) -> &mut crate::RequestOptions {
748            &mut self.0.options
749        }
750    }
751
752    /// The request builder for [CmekConfigService::list_operations][crate::client::CmekConfigService::list_operations] calls.
753    ///
754    /// # Example
755    /// ```
756    /// # use google_cloud_discoveryengine_v1::builder::cmek_config_service::ListOperations;
757    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
758    /// use google_cloud_gax::paginator::ItemPaginator;
759    ///
760    /// let builder = prepare_request_builder();
761    /// let mut items = builder.by_item();
762    /// while let Some(result) = items.next().await {
763    ///   let item = result?;
764    /// }
765    /// # Ok(()) }
766    ///
767    /// fn prepare_request_builder() -> ListOperations {
768    ///   # panic!();
769    ///   // ... details omitted ...
770    /// }
771    /// ```
772    #[derive(Clone, Debug)]
773    pub struct ListOperations(
774        RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
775    );
776
777    impl ListOperations {
778        pub(crate) fn new(
779            stub: std::sync::Arc<dyn super::super::stub::dynamic::CmekConfigService>,
780        ) -> Self {
781            Self(RequestBuilder::new(stub))
782        }
783
784        /// Sets the full request, replacing any prior values.
785        pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
786            mut self,
787            v: V,
788        ) -> Self {
789            self.0.request = v.into();
790            self
791        }
792
793        /// Sets all the options, replacing any prior values.
794        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
795            self.0.options = v.into();
796            self
797        }
798
799        /// Sends the request.
800        pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
801            (*self.0.stub)
802                .list_operations(self.0.request, self.0.options)
803                .await
804                .map(crate::Response::into_body)
805        }
806
807        /// Streams each page in the collection.
808        pub fn by_page(
809            self,
810        ) -> impl google_cloud_gax::paginator::Paginator<
811            google_cloud_longrunning::model::ListOperationsResponse,
812            crate::Error,
813        > {
814            use std::clone::Clone;
815            let token = self.0.request.page_token.clone();
816            let execute = move |token: String| {
817                let mut builder = self.clone();
818                builder.0.request = builder.0.request.set_page_token(token);
819                builder.send()
820            };
821            google_cloud_gax::paginator::internal::new_paginator(token, execute)
822        }
823
824        /// Streams each item in the collection.
825        pub fn by_item(
826            self,
827        ) -> impl google_cloud_gax::paginator::ItemPaginator<
828            google_cloud_longrunning::model::ListOperationsResponse,
829            crate::Error,
830        > {
831            use google_cloud_gax::paginator::Paginator;
832            self.by_page().items()
833        }
834
835        /// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
836        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
837            self.0.request.name = v.into();
838            self
839        }
840
841        /// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::filter].
842        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
843            self.0.request.filter = v.into();
844            self
845        }
846
847        /// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
848        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
849            self.0.request.page_size = v.into();
850            self
851        }
852
853        /// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
854        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
855            self.0.request.page_token = v.into();
856            self
857        }
858
859        /// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
860        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
861            self.0.request.return_partial_success = v.into();
862            self
863        }
864    }
865
866    #[doc(hidden)]
867    impl crate::RequestBuilder for ListOperations {
868        fn request_options(&mut self) -> &mut crate::RequestOptions {
869            &mut self.0.options
870        }
871    }
872
873    /// The request builder for [CmekConfigService::get_operation][crate::client::CmekConfigService::get_operation] calls.
874    ///
875    /// # Example
876    /// ```
877    /// # use google_cloud_discoveryengine_v1::builder::cmek_config_service::GetOperation;
878    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
879    ///
880    /// let builder = prepare_request_builder();
881    /// let response = builder.send().await?;
882    /// # Ok(()) }
883    ///
884    /// fn prepare_request_builder() -> GetOperation {
885    ///   # panic!();
886    ///   // ... details omitted ...
887    /// }
888    /// ```
889    #[derive(Clone, Debug)]
890    pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
891
892    impl GetOperation {
893        pub(crate) fn new(
894            stub: std::sync::Arc<dyn super::super::stub::dynamic::CmekConfigService>,
895        ) -> Self {
896            Self(RequestBuilder::new(stub))
897        }
898
899        /// Sets the full request, replacing any prior values.
900        pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
901            mut self,
902            v: V,
903        ) -> Self {
904            self.0.request = v.into();
905            self
906        }
907
908        /// Sets all the options, replacing any prior values.
909        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
910            self.0.options = v.into();
911            self
912        }
913
914        /// Sends the request.
915        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
916            (*self.0.stub)
917                .get_operation(self.0.request, self.0.options)
918                .await
919                .map(crate::Response::into_body)
920        }
921
922        /// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
923        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
924            self.0.request.name = v.into();
925            self
926        }
927    }
928
929    #[doc(hidden)]
930    impl crate::RequestBuilder for GetOperation {
931        fn request_options(&mut self) -> &mut crate::RequestOptions {
932            &mut self.0.options
933        }
934    }
935
936    /// The request builder for [CmekConfigService::cancel_operation][crate::client::CmekConfigService::cancel_operation] calls.
937    ///
938    /// # Example
939    /// ```
940    /// # use google_cloud_discoveryengine_v1::builder::cmek_config_service::CancelOperation;
941    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
942    ///
943    /// let builder = prepare_request_builder();
944    /// let response = builder.send().await?;
945    /// # Ok(()) }
946    ///
947    /// fn prepare_request_builder() -> CancelOperation {
948    ///   # panic!();
949    ///   // ... details omitted ...
950    /// }
951    /// ```
952    #[derive(Clone, Debug)]
953    pub struct CancelOperation(
954        RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
955    );
956
957    impl CancelOperation {
958        pub(crate) fn new(
959            stub: std::sync::Arc<dyn super::super::stub::dynamic::CmekConfigService>,
960        ) -> Self {
961            Self(RequestBuilder::new(stub))
962        }
963
964        /// Sets the full request, replacing any prior values.
965        pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
966            mut self,
967            v: V,
968        ) -> Self {
969            self.0.request = v.into();
970            self
971        }
972
973        /// Sets all the options, replacing any prior values.
974        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
975            self.0.options = v.into();
976            self
977        }
978
979        /// Sends the request.
980        pub async fn send(self) -> Result<()> {
981            (*self.0.stub)
982                .cancel_operation(self.0.request, self.0.options)
983                .await
984                .map(crate::Response::into_body)
985        }
986
987        /// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::name].
988        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
989            self.0.request.name = v.into();
990            self
991        }
992    }
993
994    #[doc(hidden)]
995    impl crate::RequestBuilder for CancelOperation {
996        fn request_options(&mut self) -> &mut crate::RequestOptions {
997            &mut self.0.options
998        }
999    }
1000}
1001
1002#[cfg(feature = "completion-service")]
1003#[cfg_attr(docsrs, doc(cfg(feature = "completion-service")))]
1004pub mod completion_service {
1005    use crate::Result;
1006
1007    /// A builder for [CompletionService][crate::client::CompletionService].
1008    ///
1009    /// ```
1010    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
1011    /// # use google_cloud_discoveryengine_v1::*;
1012    /// # use builder::completion_service::ClientBuilder;
1013    /// # use client::CompletionService;
1014    /// let builder : ClientBuilder = CompletionService::builder();
1015    /// let client = builder
1016    ///     .with_endpoint("https://discoveryengine.googleapis.com")
1017    ///     .build().await?;
1018    /// # Ok(()) }
1019    /// ```
1020    pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
1021
1022    pub(crate) mod client {
1023        use super::super::super::client::CompletionService;
1024        pub struct Factory;
1025        impl crate::ClientFactory for Factory {
1026            type Client = CompletionService;
1027            type Credentials = gaxi::options::Credentials;
1028            async fn build(
1029                self,
1030                config: gaxi::options::ClientConfig,
1031            ) -> crate::ClientBuilderResult<Self::Client> {
1032                Self::Client::new(config).await
1033            }
1034        }
1035    }
1036
1037    /// Common implementation for [crate::client::CompletionService] request builders.
1038    #[derive(Clone, Debug)]
1039    pub(crate) struct RequestBuilder<R: std::default::Default> {
1040        stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1041        request: R,
1042        options: crate::RequestOptions,
1043    }
1044
1045    impl<R> RequestBuilder<R>
1046    where
1047        R: std::default::Default,
1048    {
1049        pub(crate) fn new(
1050            stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1051        ) -> Self {
1052            Self {
1053                stub,
1054                request: R::default(),
1055                options: crate::RequestOptions::default(),
1056            }
1057        }
1058    }
1059
1060    /// The request builder for [CompletionService::complete_query][crate::client::CompletionService::complete_query] calls.
1061    ///
1062    /// # Example
1063    /// ```
1064    /// # use google_cloud_discoveryengine_v1::builder::completion_service::CompleteQuery;
1065    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
1066    ///
1067    /// let builder = prepare_request_builder();
1068    /// let response = builder.send().await?;
1069    /// # Ok(()) }
1070    ///
1071    /// fn prepare_request_builder() -> CompleteQuery {
1072    ///   # panic!();
1073    ///   // ... details omitted ...
1074    /// }
1075    /// ```
1076    #[derive(Clone, Debug)]
1077    pub struct CompleteQuery(RequestBuilder<crate::model::CompleteQueryRequest>);
1078
1079    impl CompleteQuery {
1080        pub(crate) fn new(
1081            stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1082        ) -> Self {
1083            Self(RequestBuilder::new(stub))
1084        }
1085
1086        /// Sets the full request, replacing any prior values.
1087        pub fn with_request<V: Into<crate::model::CompleteQueryRequest>>(mut self, v: V) -> Self {
1088            self.0.request = v.into();
1089            self
1090        }
1091
1092        /// Sets all the options, replacing any prior values.
1093        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1094            self.0.options = v.into();
1095            self
1096        }
1097
1098        /// Sends the request.
1099        pub async fn send(self) -> Result<crate::model::CompleteQueryResponse> {
1100            (*self.0.stub)
1101                .complete_query(self.0.request, self.0.options)
1102                .await
1103                .map(crate::Response::into_body)
1104        }
1105
1106        /// Sets the value of [data_store][crate::model::CompleteQueryRequest::data_store].
1107        ///
1108        /// This is a **required** field for requests.
1109        pub fn set_data_store<T: Into<std::string::String>>(mut self, v: T) -> Self {
1110            self.0.request.data_store = v.into();
1111            self
1112        }
1113
1114        /// Sets the value of [query][crate::model::CompleteQueryRequest::query].
1115        ///
1116        /// This is a **required** field for requests.
1117        pub fn set_query<T: Into<std::string::String>>(mut self, v: T) -> Self {
1118            self.0.request.query = v.into();
1119            self
1120        }
1121
1122        /// Sets the value of [query_model][crate::model::CompleteQueryRequest::query_model].
1123        pub fn set_query_model<T: Into<std::string::String>>(mut self, v: T) -> Self {
1124            self.0.request.query_model = v.into();
1125            self
1126        }
1127
1128        /// Sets the value of [user_pseudo_id][crate::model::CompleteQueryRequest::user_pseudo_id].
1129        pub fn set_user_pseudo_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1130            self.0.request.user_pseudo_id = v.into();
1131            self
1132        }
1133
1134        /// Sets the value of [include_tail_suggestions][crate::model::CompleteQueryRequest::include_tail_suggestions].
1135        pub fn set_include_tail_suggestions<T: Into<bool>>(mut self, v: T) -> Self {
1136            self.0.request.include_tail_suggestions = v.into();
1137            self
1138        }
1139    }
1140
1141    #[doc(hidden)]
1142    impl crate::RequestBuilder for CompleteQuery {
1143        fn request_options(&mut self) -> &mut crate::RequestOptions {
1144            &mut self.0.options
1145        }
1146    }
1147
1148    /// The request builder for [CompletionService::import_suggestion_deny_list_entries][crate::client::CompletionService::import_suggestion_deny_list_entries] calls.
1149    ///
1150    /// # Example
1151    /// ```
1152    /// # use google_cloud_discoveryengine_v1::builder::completion_service::ImportSuggestionDenyListEntries;
1153    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
1154    /// use google_cloud_lro::Poller;
1155    ///
1156    /// let builder = prepare_request_builder();
1157    /// let response = builder.poller().until_done().await?;
1158    /// # Ok(()) }
1159    ///
1160    /// fn prepare_request_builder() -> ImportSuggestionDenyListEntries {
1161    ///   # panic!();
1162    ///   // ... details omitted ...
1163    /// }
1164    /// ```
1165    #[derive(Clone, Debug)]
1166    pub struct ImportSuggestionDenyListEntries(
1167        RequestBuilder<crate::model::ImportSuggestionDenyListEntriesRequest>,
1168    );
1169
1170    impl ImportSuggestionDenyListEntries {
1171        pub(crate) fn new(
1172            stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1173        ) -> Self {
1174            Self(RequestBuilder::new(stub))
1175        }
1176
1177        /// Sets the full request, replacing any prior values.
1178        pub fn with_request<V: Into<crate::model::ImportSuggestionDenyListEntriesRequest>>(
1179            mut self,
1180            v: V,
1181        ) -> Self {
1182            self.0.request = v.into();
1183            self
1184        }
1185
1186        /// Sets all the options, replacing any prior values.
1187        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1188            self.0.options = v.into();
1189            self
1190        }
1191
1192        /// Sends the request.
1193        ///
1194        /// # Long running operations
1195        ///
1196        /// This starts, but does not poll, a longrunning operation. More information
1197        /// on [import_suggestion_deny_list_entries][crate::client::CompletionService::import_suggestion_deny_list_entries].
1198        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1199            (*self.0.stub)
1200                .import_suggestion_deny_list_entries(self.0.request, self.0.options)
1201                .await
1202                .map(crate::Response::into_body)
1203        }
1204
1205        /// Creates a [Poller][google_cloud_lro::Poller] to work with `import_suggestion_deny_list_entries`.
1206        pub fn poller(
1207            self,
1208        ) -> impl google_cloud_lro::Poller<
1209            crate::model::ImportSuggestionDenyListEntriesResponse,
1210            crate::model::ImportSuggestionDenyListEntriesMetadata,
1211        > {
1212            type Operation = google_cloud_lro::internal::Operation<
1213                crate::model::ImportSuggestionDenyListEntriesResponse,
1214                crate::model::ImportSuggestionDenyListEntriesMetadata,
1215            >;
1216            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1217            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1218
1219            let stub = self.0.stub.clone();
1220            let mut options = self.0.options.clone();
1221            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
1222            let query = move |name| {
1223                let stub = stub.clone();
1224                let options = options.clone();
1225                async {
1226                    let op = GetOperation::new(stub)
1227                        .set_name(name)
1228                        .with_options(options)
1229                        .send()
1230                        .await?;
1231                    Ok(Operation::new(op))
1232                }
1233            };
1234
1235            let start = move || async {
1236                let op = self.send().await?;
1237                Ok(Operation::new(op))
1238            };
1239
1240            google_cloud_lro::internal::new_poller(
1241                polling_error_policy,
1242                polling_backoff_policy,
1243                start,
1244                query,
1245            )
1246        }
1247
1248        /// Sets the value of [parent][crate::model::ImportSuggestionDenyListEntriesRequest::parent].
1249        ///
1250        /// This is a **required** field for requests.
1251        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1252            self.0.request.parent = v.into();
1253            self
1254        }
1255
1256        /// Sets the value of [source][crate::model::ImportSuggestionDenyListEntriesRequest::source].
1257        ///
1258        /// Note that all the setters affecting `source` are
1259        /// mutually exclusive.
1260        pub fn set_source<
1261            T: Into<Option<crate::model::import_suggestion_deny_list_entries_request::Source>>,
1262        >(
1263            mut self,
1264            v: T,
1265        ) -> Self {
1266            self.0.request.source = v.into();
1267            self
1268        }
1269
1270        /// Sets the value of [source][crate::model::ImportSuggestionDenyListEntriesRequest::source]
1271        /// to hold a `InlineSource`.
1272        ///
1273        /// Note that all the setters affecting `source` are
1274        /// mutually exclusive.
1275        pub fn set_inline_source<
1276            T: std::convert::Into<
1277                    std::boxed::Box<
1278                        crate::model::import_suggestion_deny_list_entries_request::InlineSource,
1279                    >,
1280                >,
1281        >(
1282            mut self,
1283            v: T,
1284        ) -> Self {
1285            self.0.request = self.0.request.set_inline_source(v);
1286            self
1287        }
1288
1289        /// Sets the value of [source][crate::model::ImportSuggestionDenyListEntriesRequest::source]
1290        /// to hold a `GcsSource`.
1291        ///
1292        /// Note that all the setters affecting `source` are
1293        /// mutually exclusive.
1294        pub fn set_gcs_source<T: std::convert::Into<std::boxed::Box<crate::model::GcsSource>>>(
1295            mut self,
1296            v: T,
1297        ) -> Self {
1298            self.0.request = self.0.request.set_gcs_source(v);
1299            self
1300        }
1301    }
1302
1303    #[doc(hidden)]
1304    impl crate::RequestBuilder for ImportSuggestionDenyListEntries {
1305        fn request_options(&mut self) -> &mut crate::RequestOptions {
1306            &mut self.0.options
1307        }
1308    }
1309
1310    /// The request builder for [CompletionService::purge_suggestion_deny_list_entries][crate::client::CompletionService::purge_suggestion_deny_list_entries] calls.
1311    ///
1312    /// # Example
1313    /// ```
1314    /// # use google_cloud_discoveryengine_v1::builder::completion_service::PurgeSuggestionDenyListEntries;
1315    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
1316    /// use google_cloud_lro::Poller;
1317    ///
1318    /// let builder = prepare_request_builder();
1319    /// let response = builder.poller().until_done().await?;
1320    /// # Ok(()) }
1321    ///
1322    /// fn prepare_request_builder() -> PurgeSuggestionDenyListEntries {
1323    ///   # panic!();
1324    ///   // ... details omitted ...
1325    /// }
1326    /// ```
1327    #[derive(Clone, Debug)]
1328    pub struct PurgeSuggestionDenyListEntries(
1329        RequestBuilder<crate::model::PurgeSuggestionDenyListEntriesRequest>,
1330    );
1331
1332    impl PurgeSuggestionDenyListEntries {
1333        pub(crate) fn new(
1334            stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1335        ) -> Self {
1336            Self(RequestBuilder::new(stub))
1337        }
1338
1339        /// Sets the full request, replacing any prior values.
1340        pub fn with_request<V: Into<crate::model::PurgeSuggestionDenyListEntriesRequest>>(
1341            mut self,
1342            v: V,
1343        ) -> Self {
1344            self.0.request = v.into();
1345            self
1346        }
1347
1348        /// Sets all the options, replacing any prior values.
1349        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1350            self.0.options = v.into();
1351            self
1352        }
1353
1354        /// Sends the request.
1355        ///
1356        /// # Long running operations
1357        ///
1358        /// This starts, but does not poll, a longrunning operation. More information
1359        /// on [purge_suggestion_deny_list_entries][crate::client::CompletionService::purge_suggestion_deny_list_entries].
1360        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1361            (*self.0.stub)
1362                .purge_suggestion_deny_list_entries(self.0.request, self.0.options)
1363                .await
1364                .map(crate::Response::into_body)
1365        }
1366
1367        /// Creates a [Poller][google_cloud_lro::Poller] to work with `purge_suggestion_deny_list_entries`.
1368        pub fn poller(
1369            self,
1370        ) -> impl google_cloud_lro::Poller<
1371            crate::model::PurgeSuggestionDenyListEntriesResponse,
1372            crate::model::PurgeSuggestionDenyListEntriesMetadata,
1373        > {
1374            type Operation = google_cloud_lro::internal::Operation<
1375                crate::model::PurgeSuggestionDenyListEntriesResponse,
1376                crate::model::PurgeSuggestionDenyListEntriesMetadata,
1377            >;
1378            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1379            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1380
1381            let stub = self.0.stub.clone();
1382            let mut options = self.0.options.clone();
1383            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
1384            let query = move |name| {
1385                let stub = stub.clone();
1386                let options = options.clone();
1387                async {
1388                    let op = GetOperation::new(stub)
1389                        .set_name(name)
1390                        .with_options(options)
1391                        .send()
1392                        .await?;
1393                    Ok(Operation::new(op))
1394                }
1395            };
1396
1397            let start = move || async {
1398                let op = self.send().await?;
1399                Ok(Operation::new(op))
1400            };
1401
1402            google_cloud_lro::internal::new_poller(
1403                polling_error_policy,
1404                polling_backoff_policy,
1405                start,
1406                query,
1407            )
1408        }
1409
1410        /// Sets the value of [parent][crate::model::PurgeSuggestionDenyListEntriesRequest::parent].
1411        ///
1412        /// This is a **required** field for requests.
1413        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1414            self.0.request.parent = v.into();
1415            self
1416        }
1417    }
1418
1419    #[doc(hidden)]
1420    impl crate::RequestBuilder for PurgeSuggestionDenyListEntries {
1421        fn request_options(&mut self) -> &mut crate::RequestOptions {
1422            &mut self.0.options
1423        }
1424    }
1425
1426    /// The request builder for [CompletionService::import_completion_suggestions][crate::client::CompletionService::import_completion_suggestions] calls.
1427    ///
1428    /// # Example
1429    /// ```
1430    /// # use google_cloud_discoveryengine_v1::builder::completion_service::ImportCompletionSuggestions;
1431    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
1432    /// use google_cloud_lro::Poller;
1433    ///
1434    /// let builder = prepare_request_builder();
1435    /// let response = builder.poller().until_done().await?;
1436    /// # Ok(()) }
1437    ///
1438    /// fn prepare_request_builder() -> ImportCompletionSuggestions {
1439    ///   # panic!();
1440    ///   // ... details omitted ...
1441    /// }
1442    /// ```
1443    #[derive(Clone, Debug)]
1444    pub struct ImportCompletionSuggestions(
1445        RequestBuilder<crate::model::ImportCompletionSuggestionsRequest>,
1446    );
1447
1448    impl ImportCompletionSuggestions {
1449        pub(crate) fn new(
1450            stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1451        ) -> Self {
1452            Self(RequestBuilder::new(stub))
1453        }
1454
1455        /// Sets the full request, replacing any prior values.
1456        pub fn with_request<V: Into<crate::model::ImportCompletionSuggestionsRequest>>(
1457            mut self,
1458            v: V,
1459        ) -> Self {
1460            self.0.request = v.into();
1461            self
1462        }
1463
1464        /// Sets all the options, replacing any prior values.
1465        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1466            self.0.options = v.into();
1467            self
1468        }
1469
1470        /// Sends the request.
1471        ///
1472        /// # Long running operations
1473        ///
1474        /// This starts, but does not poll, a longrunning operation. More information
1475        /// on [import_completion_suggestions][crate::client::CompletionService::import_completion_suggestions].
1476        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1477            (*self.0.stub)
1478                .import_completion_suggestions(self.0.request, self.0.options)
1479                .await
1480                .map(crate::Response::into_body)
1481        }
1482
1483        /// Creates a [Poller][google_cloud_lro::Poller] to work with `import_completion_suggestions`.
1484        pub fn poller(
1485            self,
1486        ) -> impl google_cloud_lro::Poller<
1487            crate::model::ImportCompletionSuggestionsResponse,
1488            crate::model::ImportCompletionSuggestionsMetadata,
1489        > {
1490            type Operation = google_cloud_lro::internal::Operation<
1491                crate::model::ImportCompletionSuggestionsResponse,
1492                crate::model::ImportCompletionSuggestionsMetadata,
1493            >;
1494            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1495            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1496
1497            let stub = self.0.stub.clone();
1498            let mut options = self.0.options.clone();
1499            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
1500            let query = move |name| {
1501                let stub = stub.clone();
1502                let options = options.clone();
1503                async {
1504                    let op = GetOperation::new(stub)
1505                        .set_name(name)
1506                        .with_options(options)
1507                        .send()
1508                        .await?;
1509                    Ok(Operation::new(op))
1510                }
1511            };
1512
1513            let start = move || async {
1514                let op = self.send().await?;
1515                Ok(Operation::new(op))
1516            };
1517
1518            google_cloud_lro::internal::new_poller(
1519                polling_error_policy,
1520                polling_backoff_policy,
1521                start,
1522                query,
1523            )
1524        }
1525
1526        /// Sets the value of [parent][crate::model::ImportCompletionSuggestionsRequest::parent].
1527        ///
1528        /// This is a **required** field for requests.
1529        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1530            self.0.request.parent = v.into();
1531            self
1532        }
1533
1534        /// Sets the value of [error_config][crate::model::ImportCompletionSuggestionsRequest::error_config].
1535        pub fn set_error_config<T>(mut self, v: T) -> Self
1536        where
1537            T: std::convert::Into<crate::model::ImportErrorConfig>,
1538        {
1539            self.0.request.error_config = std::option::Option::Some(v.into());
1540            self
1541        }
1542
1543        /// Sets or clears the value of [error_config][crate::model::ImportCompletionSuggestionsRequest::error_config].
1544        pub fn set_or_clear_error_config<T>(mut self, v: std::option::Option<T>) -> Self
1545        where
1546            T: std::convert::Into<crate::model::ImportErrorConfig>,
1547        {
1548            self.0.request.error_config = v.map(|x| x.into());
1549            self
1550        }
1551
1552        /// Sets the value of [source][crate::model::ImportCompletionSuggestionsRequest::source].
1553        ///
1554        /// Note that all the setters affecting `source` are
1555        /// mutually exclusive.
1556        pub fn set_source<
1557            T: Into<Option<crate::model::import_completion_suggestions_request::Source>>,
1558        >(
1559            mut self,
1560            v: T,
1561        ) -> Self {
1562            self.0.request.source = v.into();
1563            self
1564        }
1565
1566        /// Sets the value of [source][crate::model::ImportCompletionSuggestionsRequest::source]
1567        /// to hold a `InlineSource`.
1568        ///
1569        /// Note that all the setters affecting `source` are
1570        /// mutually exclusive.
1571        pub fn set_inline_source<
1572            T: std::convert::Into<
1573                    std::boxed::Box<
1574                        crate::model::import_completion_suggestions_request::InlineSource,
1575                    >,
1576                >,
1577        >(
1578            mut self,
1579            v: T,
1580        ) -> Self {
1581            self.0.request = self.0.request.set_inline_source(v);
1582            self
1583        }
1584
1585        /// Sets the value of [source][crate::model::ImportCompletionSuggestionsRequest::source]
1586        /// to hold a `GcsSource`.
1587        ///
1588        /// Note that all the setters affecting `source` are
1589        /// mutually exclusive.
1590        pub fn set_gcs_source<T: std::convert::Into<std::boxed::Box<crate::model::GcsSource>>>(
1591            mut self,
1592            v: T,
1593        ) -> Self {
1594            self.0.request = self.0.request.set_gcs_source(v);
1595            self
1596        }
1597
1598        /// Sets the value of [source][crate::model::ImportCompletionSuggestionsRequest::source]
1599        /// to hold a `BigquerySource`.
1600        ///
1601        /// Note that all the setters affecting `source` are
1602        /// mutually exclusive.
1603        pub fn set_bigquery_source<
1604            T: std::convert::Into<std::boxed::Box<crate::model::BigQuerySource>>,
1605        >(
1606            mut self,
1607            v: T,
1608        ) -> Self {
1609            self.0.request = self.0.request.set_bigquery_source(v);
1610            self
1611        }
1612    }
1613
1614    #[doc(hidden)]
1615    impl crate::RequestBuilder for ImportCompletionSuggestions {
1616        fn request_options(&mut self) -> &mut crate::RequestOptions {
1617            &mut self.0.options
1618        }
1619    }
1620
1621    /// The request builder for [CompletionService::purge_completion_suggestions][crate::client::CompletionService::purge_completion_suggestions] calls.
1622    ///
1623    /// # Example
1624    /// ```
1625    /// # use google_cloud_discoveryengine_v1::builder::completion_service::PurgeCompletionSuggestions;
1626    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
1627    /// use google_cloud_lro::Poller;
1628    ///
1629    /// let builder = prepare_request_builder();
1630    /// let response = builder.poller().until_done().await?;
1631    /// # Ok(()) }
1632    ///
1633    /// fn prepare_request_builder() -> PurgeCompletionSuggestions {
1634    ///   # panic!();
1635    ///   // ... details omitted ...
1636    /// }
1637    /// ```
1638    #[derive(Clone, Debug)]
1639    pub struct PurgeCompletionSuggestions(
1640        RequestBuilder<crate::model::PurgeCompletionSuggestionsRequest>,
1641    );
1642
1643    impl PurgeCompletionSuggestions {
1644        pub(crate) fn new(
1645            stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1646        ) -> Self {
1647            Self(RequestBuilder::new(stub))
1648        }
1649
1650        /// Sets the full request, replacing any prior values.
1651        pub fn with_request<V: Into<crate::model::PurgeCompletionSuggestionsRequest>>(
1652            mut self,
1653            v: V,
1654        ) -> Self {
1655            self.0.request = v.into();
1656            self
1657        }
1658
1659        /// Sets all the options, replacing any prior values.
1660        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1661            self.0.options = v.into();
1662            self
1663        }
1664
1665        /// Sends the request.
1666        ///
1667        /// # Long running operations
1668        ///
1669        /// This starts, but does not poll, a longrunning operation. More information
1670        /// on [purge_completion_suggestions][crate::client::CompletionService::purge_completion_suggestions].
1671        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1672            (*self.0.stub)
1673                .purge_completion_suggestions(self.0.request, self.0.options)
1674                .await
1675                .map(crate::Response::into_body)
1676        }
1677
1678        /// Creates a [Poller][google_cloud_lro::Poller] to work with `purge_completion_suggestions`.
1679        pub fn poller(
1680            self,
1681        ) -> impl google_cloud_lro::Poller<
1682            crate::model::PurgeCompletionSuggestionsResponse,
1683            crate::model::PurgeCompletionSuggestionsMetadata,
1684        > {
1685            type Operation = google_cloud_lro::internal::Operation<
1686                crate::model::PurgeCompletionSuggestionsResponse,
1687                crate::model::PurgeCompletionSuggestionsMetadata,
1688            >;
1689            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1690            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1691
1692            let stub = self.0.stub.clone();
1693            let mut options = self.0.options.clone();
1694            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
1695            let query = move |name| {
1696                let stub = stub.clone();
1697                let options = options.clone();
1698                async {
1699                    let op = GetOperation::new(stub)
1700                        .set_name(name)
1701                        .with_options(options)
1702                        .send()
1703                        .await?;
1704                    Ok(Operation::new(op))
1705                }
1706            };
1707
1708            let start = move || async {
1709                let op = self.send().await?;
1710                Ok(Operation::new(op))
1711            };
1712
1713            google_cloud_lro::internal::new_poller(
1714                polling_error_policy,
1715                polling_backoff_policy,
1716                start,
1717                query,
1718            )
1719        }
1720
1721        /// Sets the value of [parent][crate::model::PurgeCompletionSuggestionsRequest::parent].
1722        ///
1723        /// This is a **required** field for requests.
1724        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1725            self.0.request.parent = v.into();
1726            self
1727        }
1728    }
1729
1730    #[doc(hidden)]
1731    impl crate::RequestBuilder for PurgeCompletionSuggestions {
1732        fn request_options(&mut self) -> &mut crate::RequestOptions {
1733            &mut self.0.options
1734        }
1735    }
1736
1737    /// The request builder for [CompletionService::list_operations][crate::client::CompletionService::list_operations] calls.
1738    ///
1739    /// # Example
1740    /// ```
1741    /// # use google_cloud_discoveryengine_v1::builder::completion_service::ListOperations;
1742    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
1743    /// use google_cloud_gax::paginator::ItemPaginator;
1744    ///
1745    /// let builder = prepare_request_builder();
1746    /// let mut items = builder.by_item();
1747    /// while let Some(result) = items.next().await {
1748    ///   let item = result?;
1749    /// }
1750    /// # Ok(()) }
1751    ///
1752    /// fn prepare_request_builder() -> ListOperations {
1753    ///   # panic!();
1754    ///   // ... details omitted ...
1755    /// }
1756    /// ```
1757    #[derive(Clone, Debug)]
1758    pub struct ListOperations(
1759        RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
1760    );
1761
1762    impl ListOperations {
1763        pub(crate) fn new(
1764            stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1765        ) -> Self {
1766            Self(RequestBuilder::new(stub))
1767        }
1768
1769        /// Sets the full request, replacing any prior values.
1770        pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
1771            mut self,
1772            v: V,
1773        ) -> Self {
1774            self.0.request = v.into();
1775            self
1776        }
1777
1778        /// Sets all the options, replacing any prior values.
1779        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1780            self.0.options = v.into();
1781            self
1782        }
1783
1784        /// Sends the request.
1785        pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
1786            (*self.0.stub)
1787                .list_operations(self.0.request, self.0.options)
1788                .await
1789                .map(crate::Response::into_body)
1790        }
1791
1792        /// Streams each page in the collection.
1793        pub fn by_page(
1794            self,
1795        ) -> impl google_cloud_gax::paginator::Paginator<
1796            google_cloud_longrunning::model::ListOperationsResponse,
1797            crate::Error,
1798        > {
1799            use std::clone::Clone;
1800            let token = self.0.request.page_token.clone();
1801            let execute = move |token: String| {
1802                let mut builder = self.clone();
1803                builder.0.request = builder.0.request.set_page_token(token);
1804                builder.send()
1805            };
1806            google_cloud_gax::paginator::internal::new_paginator(token, execute)
1807        }
1808
1809        /// Streams each item in the collection.
1810        pub fn by_item(
1811            self,
1812        ) -> impl google_cloud_gax::paginator::ItemPaginator<
1813            google_cloud_longrunning::model::ListOperationsResponse,
1814            crate::Error,
1815        > {
1816            use google_cloud_gax::paginator::Paginator;
1817            self.by_page().items()
1818        }
1819
1820        /// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
1821        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1822            self.0.request.name = v.into();
1823            self
1824        }
1825
1826        /// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::filter].
1827        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1828            self.0.request.filter = v.into();
1829            self
1830        }
1831
1832        /// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
1833        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1834            self.0.request.page_size = v.into();
1835            self
1836        }
1837
1838        /// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
1839        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1840            self.0.request.page_token = v.into();
1841            self
1842        }
1843
1844        /// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
1845        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
1846            self.0.request.return_partial_success = v.into();
1847            self
1848        }
1849    }
1850
1851    #[doc(hidden)]
1852    impl crate::RequestBuilder for ListOperations {
1853        fn request_options(&mut self) -> &mut crate::RequestOptions {
1854            &mut self.0.options
1855        }
1856    }
1857
1858    /// The request builder for [CompletionService::get_operation][crate::client::CompletionService::get_operation] calls.
1859    ///
1860    /// # Example
1861    /// ```
1862    /// # use google_cloud_discoveryengine_v1::builder::completion_service::GetOperation;
1863    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
1864    ///
1865    /// let builder = prepare_request_builder();
1866    /// let response = builder.send().await?;
1867    /// # Ok(()) }
1868    ///
1869    /// fn prepare_request_builder() -> GetOperation {
1870    ///   # panic!();
1871    ///   // ... details omitted ...
1872    /// }
1873    /// ```
1874    #[derive(Clone, Debug)]
1875    pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
1876
1877    impl GetOperation {
1878        pub(crate) fn new(
1879            stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1880        ) -> Self {
1881            Self(RequestBuilder::new(stub))
1882        }
1883
1884        /// Sets the full request, replacing any prior values.
1885        pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
1886            mut self,
1887            v: V,
1888        ) -> Self {
1889            self.0.request = v.into();
1890            self
1891        }
1892
1893        /// Sets all the options, replacing any prior values.
1894        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1895            self.0.options = v.into();
1896            self
1897        }
1898
1899        /// Sends the request.
1900        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1901            (*self.0.stub)
1902                .get_operation(self.0.request, self.0.options)
1903                .await
1904                .map(crate::Response::into_body)
1905        }
1906
1907        /// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
1908        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1909            self.0.request.name = v.into();
1910            self
1911        }
1912    }
1913
1914    #[doc(hidden)]
1915    impl crate::RequestBuilder for GetOperation {
1916        fn request_options(&mut self) -> &mut crate::RequestOptions {
1917            &mut self.0.options
1918        }
1919    }
1920
1921    /// The request builder for [CompletionService::cancel_operation][crate::client::CompletionService::cancel_operation] calls.
1922    ///
1923    /// # Example
1924    /// ```
1925    /// # use google_cloud_discoveryengine_v1::builder::completion_service::CancelOperation;
1926    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
1927    ///
1928    /// let builder = prepare_request_builder();
1929    /// let response = builder.send().await?;
1930    /// # Ok(()) }
1931    ///
1932    /// fn prepare_request_builder() -> CancelOperation {
1933    ///   # panic!();
1934    ///   // ... details omitted ...
1935    /// }
1936    /// ```
1937    #[derive(Clone, Debug)]
1938    pub struct CancelOperation(
1939        RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
1940    );
1941
1942    impl CancelOperation {
1943        pub(crate) fn new(
1944            stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1945        ) -> Self {
1946            Self(RequestBuilder::new(stub))
1947        }
1948
1949        /// Sets the full request, replacing any prior values.
1950        pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
1951            mut self,
1952            v: V,
1953        ) -> Self {
1954            self.0.request = v.into();
1955            self
1956        }
1957
1958        /// Sets all the options, replacing any prior values.
1959        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1960            self.0.options = v.into();
1961            self
1962        }
1963
1964        /// Sends the request.
1965        pub async fn send(self) -> Result<()> {
1966            (*self.0.stub)
1967                .cancel_operation(self.0.request, self.0.options)
1968                .await
1969                .map(crate::Response::into_body)
1970        }
1971
1972        /// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::name].
1973        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1974            self.0.request.name = v.into();
1975            self
1976        }
1977    }
1978
1979    #[doc(hidden)]
1980    impl crate::RequestBuilder for CancelOperation {
1981        fn request_options(&mut self) -> &mut crate::RequestOptions {
1982            &mut self.0.options
1983        }
1984    }
1985}
1986
1987#[cfg(feature = "control-service")]
1988#[cfg_attr(docsrs, doc(cfg(feature = "control-service")))]
1989pub mod control_service {
1990    use crate::Result;
1991
1992    /// A builder for [ControlService][crate::client::ControlService].
1993    ///
1994    /// ```
1995    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
1996    /// # use google_cloud_discoveryengine_v1::*;
1997    /// # use builder::control_service::ClientBuilder;
1998    /// # use client::ControlService;
1999    /// let builder : ClientBuilder = ControlService::builder();
2000    /// let client = builder
2001    ///     .with_endpoint("https://discoveryengine.googleapis.com")
2002    ///     .build().await?;
2003    /// # Ok(()) }
2004    /// ```
2005    pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
2006
2007    pub(crate) mod client {
2008        use super::super::super::client::ControlService;
2009        pub struct Factory;
2010        impl crate::ClientFactory for Factory {
2011            type Client = ControlService;
2012            type Credentials = gaxi::options::Credentials;
2013            async fn build(
2014                self,
2015                config: gaxi::options::ClientConfig,
2016            ) -> crate::ClientBuilderResult<Self::Client> {
2017                Self::Client::new(config).await
2018            }
2019        }
2020    }
2021
2022    /// Common implementation for [crate::client::ControlService] request builders.
2023    #[derive(Clone, Debug)]
2024    pub(crate) struct RequestBuilder<R: std::default::Default> {
2025        stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2026        request: R,
2027        options: crate::RequestOptions,
2028    }
2029
2030    impl<R> RequestBuilder<R>
2031    where
2032        R: std::default::Default,
2033    {
2034        pub(crate) fn new(
2035            stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2036        ) -> Self {
2037            Self {
2038                stub,
2039                request: R::default(),
2040                options: crate::RequestOptions::default(),
2041            }
2042        }
2043    }
2044
2045    /// The request builder for [ControlService::create_control][crate::client::ControlService::create_control] calls.
2046    ///
2047    /// # Example
2048    /// ```
2049    /// # use google_cloud_discoveryengine_v1::builder::control_service::CreateControl;
2050    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
2051    ///
2052    /// let builder = prepare_request_builder();
2053    /// let response = builder.send().await?;
2054    /// # Ok(()) }
2055    ///
2056    /// fn prepare_request_builder() -> CreateControl {
2057    ///   # panic!();
2058    ///   // ... details omitted ...
2059    /// }
2060    /// ```
2061    #[derive(Clone, Debug)]
2062    pub struct CreateControl(RequestBuilder<crate::model::CreateControlRequest>);
2063
2064    impl CreateControl {
2065        pub(crate) fn new(
2066            stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2067        ) -> Self {
2068            Self(RequestBuilder::new(stub))
2069        }
2070
2071        /// Sets the full request, replacing any prior values.
2072        pub fn with_request<V: Into<crate::model::CreateControlRequest>>(mut self, v: V) -> Self {
2073            self.0.request = v.into();
2074            self
2075        }
2076
2077        /// Sets all the options, replacing any prior values.
2078        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2079            self.0.options = v.into();
2080            self
2081        }
2082
2083        /// Sends the request.
2084        pub async fn send(self) -> Result<crate::model::Control> {
2085            (*self.0.stub)
2086                .create_control(self.0.request, self.0.options)
2087                .await
2088                .map(crate::Response::into_body)
2089        }
2090
2091        /// Sets the value of [parent][crate::model::CreateControlRequest::parent].
2092        ///
2093        /// This is a **required** field for requests.
2094        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2095            self.0.request.parent = v.into();
2096            self
2097        }
2098
2099        /// Sets the value of [control][crate::model::CreateControlRequest::control].
2100        ///
2101        /// This is a **required** field for requests.
2102        pub fn set_control<T>(mut self, v: T) -> Self
2103        where
2104            T: std::convert::Into<crate::model::Control>,
2105        {
2106            self.0.request.control = std::option::Option::Some(v.into());
2107            self
2108        }
2109
2110        /// Sets or clears the value of [control][crate::model::CreateControlRequest::control].
2111        ///
2112        /// This is a **required** field for requests.
2113        pub fn set_or_clear_control<T>(mut self, v: std::option::Option<T>) -> Self
2114        where
2115            T: std::convert::Into<crate::model::Control>,
2116        {
2117            self.0.request.control = v.map(|x| x.into());
2118            self
2119        }
2120
2121        /// Sets the value of [control_id][crate::model::CreateControlRequest::control_id].
2122        ///
2123        /// This is a **required** field for requests.
2124        pub fn set_control_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2125            self.0.request.control_id = v.into();
2126            self
2127        }
2128    }
2129
2130    #[doc(hidden)]
2131    impl crate::RequestBuilder for CreateControl {
2132        fn request_options(&mut self) -> &mut crate::RequestOptions {
2133            &mut self.0.options
2134        }
2135    }
2136
2137    /// The request builder for [ControlService::delete_control][crate::client::ControlService::delete_control] calls.
2138    ///
2139    /// # Example
2140    /// ```
2141    /// # use google_cloud_discoveryengine_v1::builder::control_service::DeleteControl;
2142    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
2143    ///
2144    /// let builder = prepare_request_builder();
2145    /// let response = builder.send().await?;
2146    /// # Ok(()) }
2147    ///
2148    /// fn prepare_request_builder() -> DeleteControl {
2149    ///   # panic!();
2150    ///   // ... details omitted ...
2151    /// }
2152    /// ```
2153    #[derive(Clone, Debug)]
2154    pub struct DeleteControl(RequestBuilder<crate::model::DeleteControlRequest>);
2155
2156    impl DeleteControl {
2157        pub(crate) fn new(
2158            stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2159        ) -> Self {
2160            Self(RequestBuilder::new(stub))
2161        }
2162
2163        /// Sets the full request, replacing any prior values.
2164        pub fn with_request<V: Into<crate::model::DeleteControlRequest>>(mut self, v: V) -> Self {
2165            self.0.request = v.into();
2166            self
2167        }
2168
2169        /// Sets all the options, replacing any prior values.
2170        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2171            self.0.options = v.into();
2172            self
2173        }
2174
2175        /// Sends the request.
2176        pub async fn send(self) -> Result<()> {
2177            (*self.0.stub)
2178                .delete_control(self.0.request, self.0.options)
2179                .await
2180                .map(crate::Response::into_body)
2181        }
2182
2183        /// Sets the value of [name][crate::model::DeleteControlRequest::name].
2184        ///
2185        /// This is a **required** field for requests.
2186        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2187            self.0.request.name = v.into();
2188            self
2189        }
2190    }
2191
2192    #[doc(hidden)]
2193    impl crate::RequestBuilder for DeleteControl {
2194        fn request_options(&mut self) -> &mut crate::RequestOptions {
2195            &mut self.0.options
2196        }
2197    }
2198
2199    /// The request builder for [ControlService::update_control][crate::client::ControlService::update_control] calls.
2200    ///
2201    /// # Example
2202    /// ```
2203    /// # use google_cloud_discoveryengine_v1::builder::control_service::UpdateControl;
2204    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
2205    ///
2206    /// let builder = prepare_request_builder();
2207    /// let response = builder.send().await?;
2208    /// # Ok(()) }
2209    ///
2210    /// fn prepare_request_builder() -> UpdateControl {
2211    ///   # panic!();
2212    ///   // ... details omitted ...
2213    /// }
2214    /// ```
2215    #[derive(Clone, Debug)]
2216    pub struct UpdateControl(RequestBuilder<crate::model::UpdateControlRequest>);
2217
2218    impl UpdateControl {
2219        pub(crate) fn new(
2220            stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2221        ) -> Self {
2222            Self(RequestBuilder::new(stub))
2223        }
2224
2225        /// Sets the full request, replacing any prior values.
2226        pub fn with_request<V: Into<crate::model::UpdateControlRequest>>(mut self, v: V) -> Self {
2227            self.0.request = v.into();
2228            self
2229        }
2230
2231        /// Sets all the options, replacing any prior values.
2232        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2233            self.0.options = v.into();
2234            self
2235        }
2236
2237        /// Sends the request.
2238        pub async fn send(self) -> Result<crate::model::Control> {
2239            (*self.0.stub)
2240                .update_control(self.0.request, self.0.options)
2241                .await
2242                .map(crate::Response::into_body)
2243        }
2244
2245        /// Sets the value of [control][crate::model::UpdateControlRequest::control].
2246        ///
2247        /// This is a **required** field for requests.
2248        pub fn set_control<T>(mut self, v: T) -> Self
2249        where
2250            T: std::convert::Into<crate::model::Control>,
2251        {
2252            self.0.request.control = std::option::Option::Some(v.into());
2253            self
2254        }
2255
2256        /// Sets or clears the value of [control][crate::model::UpdateControlRequest::control].
2257        ///
2258        /// This is a **required** field for requests.
2259        pub fn set_or_clear_control<T>(mut self, v: std::option::Option<T>) -> Self
2260        where
2261            T: std::convert::Into<crate::model::Control>,
2262        {
2263            self.0.request.control = v.map(|x| x.into());
2264            self
2265        }
2266
2267        /// Sets the value of [update_mask][crate::model::UpdateControlRequest::update_mask].
2268        pub fn set_update_mask<T>(mut self, v: T) -> Self
2269        where
2270            T: std::convert::Into<wkt::FieldMask>,
2271        {
2272            self.0.request.update_mask = std::option::Option::Some(v.into());
2273            self
2274        }
2275
2276        /// Sets or clears the value of [update_mask][crate::model::UpdateControlRequest::update_mask].
2277        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
2278        where
2279            T: std::convert::Into<wkt::FieldMask>,
2280        {
2281            self.0.request.update_mask = v.map(|x| x.into());
2282            self
2283        }
2284    }
2285
2286    #[doc(hidden)]
2287    impl crate::RequestBuilder for UpdateControl {
2288        fn request_options(&mut self) -> &mut crate::RequestOptions {
2289            &mut self.0.options
2290        }
2291    }
2292
2293    /// The request builder for [ControlService::get_control][crate::client::ControlService::get_control] calls.
2294    ///
2295    /// # Example
2296    /// ```
2297    /// # use google_cloud_discoveryengine_v1::builder::control_service::GetControl;
2298    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
2299    ///
2300    /// let builder = prepare_request_builder();
2301    /// let response = builder.send().await?;
2302    /// # Ok(()) }
2303    ///
2304    /// fn prepare_request_builder() -> GetControl {
2305    ///   # panic!();
2306    ///   // ... details omitted ...
2307    /// }
2308    /// ```
2309    #[derive(Clone, Debug)]
2310    pub struct GetControl(RequestBuilder<crate::model::GetControlRequest>);
2311
2312    impl GetControl {
2313        pub(crate) fn new(
2314            stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2315        ) -> Self {
2316            Self(RequestBuilder::new(stub))
2317        }
2318
2319        /// Sets the full request, replacing any prior values.
2320        pub fn with_request<V: Into<crate::model::GetControlRequest>>(mut self, v: V) -> Self {
2321            self.0.request = v.into();
2322            self
2323        }
2324
2325        /// Sets all the options, replacing any prior values.
2326        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2327            self.0.options = v.into();
2328            self
2329        }
2330
2331        /// Sends the request.
2332        pub async fn send(self) -> Result<crate::model::Control> {
2333            (*self.0.stub)
2334                .get_control(self.0.request, self.0.options)
2335                .await
2336                .map(crate::Response::into_body)
2337        }
2338
2339        /// Sets the value of [name][crate::model::GetControlRequest::name].
2340        ///
2341        /// This is a **required** field for requests.
2342        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2343            self.0.request.name = v.into();
2344            self
2345        }
2346    }
2347
2348    #[doc(hidden)]
2349    impl crate::RequestBuilder for GetControl {
2350        fn request_options(&mut self) -> &mut crate::RequestOptions {
2351            &mut self.0.options
2352        }
2353    }
2354
2355    /// The request builder for [ControlService::list_controls][crate::client::ControlService::list_controls] calls.
2356    ///
2357    /// # Example
2358    /// ```
2359    /// # use google_cloud_discoveryengine_v1::builder::control_service::ListControls;
2360    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
2361    /// use google_cloud_gax::paginator::ItemPaginator;
2362    ///
2363    /// let builder = prepare_request_builder();
2364    /// let mut items = builder.by_item();
2365    /// while let Some(result) = items.next().await {
2366    ///   let item = result?;
2367    /// }
2368    /// # Ok(()) }
2369    ///
2370    /// fn prepare_request_builder() -> ListControls {
2371    ///   # panic!();
2372    ///   // ... details omitted ...
2373    /// }
2374    /// ```
2375    #[derive(Clone, Debug)]
2376    pub struct ListControls(RequestBuilder<crate::model::ListControlsRequest>);
2377
2378    impl ListControls {
2379        pub(crate) fn new(
2380            stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2381        ) -> Self {
2382            Self(RequestBuilder::new(stub))
2383        }
2384
2385        /// Sets the full request, replacing any prior values.
2386        pub fn with_request<V: Into<crate::model::ListControlsRequest>>(mut self, v: V) -> Self {
2387            self.0.request = v.into();
2388            self
2389        }
2390
2391        /// Sets all the options, replacing any prior values.
2392        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2393            self.0.options = v.into();
2394            self
2395        }
2396
2397        /// Sends the request.
2398        pub async fn send(self) -> Result<crate::model::ListControlsResponse> {
2399            (*self.0.stub)
2400                .list_controls(self.0.request, self.0.options)
2401                .await
2402                .map(crate::Response::into_body)
2403        }
2404
2405        /// Streams each page in the collection.
2406        pub fn by_page(
2407            self,
2408        ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListControlsResponse, crate::Error>
2409        {
2410            use std::clone::Clone;
2411            let token = self.0.request.page_token.clone();
2412            let execute = move |token: String| {
2413                let mut builder = self.clone();
2414                builder.0.request = builder.0.request.set_page_token(token);
2415                builder.send()
2416            };
2417            google_cloud_gax::paginator::internal::new_paginator(token, execute)
2418        }
2419
2420        /// Streams each item in the collection.
2421        pub fn by_item(
2422            self,
2423        ) -> impl google_cloud_gax::paginator::ItemPaginator<
2424            crate::model::ListControlsResponse,
2425            crate::Error,
2426        > {
2427            use google_cloud_gax::paginator::Paginator;
2428            self.by_page().items()
2429        }
2430
2431        /// Sets the value of [parent][crate::model::ListControlsRequest::parent].
2432        ///
2433        /// This is a **required** field for requests.
2434        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2435            self.0.request.parent = v.into();
2436            self
2437        }
2438
2439        /// Sets the value of [page_size][crate::model::ListControlsRequest::page_size].
2440        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2441            self.0.request.page_size = v.into();
2442            self
2443        }
2444
2445        /// Sets the value of [page_token][crate::model::ListControlsRequest::page_token].
2446        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2447            self.0.request.page_token = v.into();
2448            self
2449        }
2450
2451        /// Sets the value of [filter][crate::model::ListControlsRequest::filter].
2452        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
2453            self.0.request.filter = v.into();
2454            self
2455        }
2456    }
2457
2458    #[doc(hidden)]
2459    impl crate::RequestBuilder for ListControls {
2460        fn request_options(&mut self) -> &mut crate::RequestOptions {
2461            &mut self.0.options
2462        }
2463    }
2464
2465    /// The request builder for [ControlService::list_operations][crate::client::ControlService::list_operations] calls.
2466    ///
2467    /// # Example
2468    /// ```
2469    /// # use google_cloud_discoveryengine_v1::builder::control_service::ListOperations;
2470    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
2471    /// use google_cloud_gax::paginator::ItemPaginator;
2472    ///
2473    /// let builder = prepare_request_builder();
2474    /// let mut items = builder.by_item();
2475    /// while let Some(result) = items.next().await {
2476    ///   let item = result?;
2477    /// }
2478    /// # Ok(()) }
2479    ///
2480    /// fn prepare_request_builder() -> ListOperations {
2481    ///   # panic!();
2482    ///   // ... details omitted ...
2483    /// }
2484    /// ```
2485    #[derive(Clone, Debug)]
2486    pub struct ListOperations(
2487        RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
2488    );
2489
2490    impl ListOperations {
2491        pub(crate) fn new(
2492            stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2493        ) -> Self {
2494            Self(RequestBuilder::new(stub))
2495        }
2496
2497        /// Sets the full request, replacing any prior values.
2498        pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
2499            mut self,
2500            v: V,
2501        ) -> Self {
2502            self.0.request = v.into();
2503            self
2504        }
2505
2506        /// Sets all the options, replacing any prior values.
2507        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2508            self.0.options = v.into();
2509            self
2510        }
2511
2512        /// Sends the request.
2513        pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
2514            (*self.0.stub)
2515                .list_operations(self.0.request, self.0.options)
2516                .await
2517                .map(crate::Response::into_body)
2518        }
2519
2520        /// Streams each page in the collection.
2521        pub fn by_page(
2522            self,
2523        ) -> impl google_cloud_gax::paginator::Paginator<
2524            google_cloud_longrunning::model::ListOperationsResponse,
2525            crate::Error,
2526        > {
2527            use std::clone::Clone;
2528            let token = self.0.request.page_token.clone();
2529            let execute = move |token: String| {
2530                let mut builder = self.clone();
2531                builder.0.request = builder.0.request.set_page_token(token);
2532                builder.send()
2533            };
2534            google_cloud_gax::paginator::internal::new_paginator(token, execute)
2535        }
2536
2537        /// Streams each item in the collection.
2538        pub fn by_item(
2539            self,
2540        ) -> impl google_cloud_gax::paginator::ItemPaginator<
2541            google_cloud_longrunning::model::ListOperationsResponse,
2542            crate::Error,
2543        > {
2544            use google_cloud_gax::paginator::Paginator;
2545            self.by_page().items()
2546        }
2547
2548        /// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
2549        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2550            self.0.request.name = v.into();
2551            self
2552        }
2553
2554        /// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::filter].
2555        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
2556            self.0.request.filter = v.into();
2557            self
2558        }
2559
2560        /// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
2561        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2562            self.0.request.page_size = v.into();
2563            self
2564        }
2565
2566        /// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
2567        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2568            self.0.request.page_token = v.into();
2569            self
2570        }
2571
2572        /// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
2573        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
2574            self.0.request.return_partial_success = v.into();
2575            self
2576        }
2577    }
2578
2579    #[doc(hidden)]
2580    impl crate::RequestBuilder for ListOperations {
2581        fn request_options(&mut self) -> &mut crate::RequestOptions {
2582            &mut self.0.options
2583        }
2584    }
2585
2586    /// The request builder for [ControlService::get_operation][crate::client::ControlService::get_operation] calls.
2587    ///
2588    /// # Example
2589    /// ```
2590    /// # use google_cloud_discoveryengine_v1::builder::control_service::GetOperation;
2591    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
2592    ///
2593    /// let builder = prepare_request_builder();
2594    /// let response = builder.send().await?;
2595    /// # Ok(()) }
2596    ///
2597    /// fn prepare_request_builder() -> GetOperation {
2598    ///   # panic!();
2599    ///   // ... details omitted ...
2600    /// }
2601    /// ```
2602    #[derive(Clone, Debug)]
2603    pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
2604
2605    impl GetOperation {
2606        pub(crate) fn new(
2607            stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2608        ) -> Self {
2609            Self(RequestBuilder::new(stub))
2610        }
2611
2612        /// Sets the full request, replacing any prior values.
2613        pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
2614            mut self,
2615            v: V,
2616        ) -> Self {
2617            self.0.request = v.into();
2618            self
2619        }
2620
2621        /// Sets all the options, replacing any prior values.
2622        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2623            self.0.options = v.into();
2624            self
2625        }
2626
2627        /// Sends the request.
2628        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
2629            (*self.0.stub)
2630                .get_operation(self.0.request, self.0.options)
2631                .await
2632                .map(crate::Response::into_body)
2633        }
2634
2635        /// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
2636        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2637            self.0.request.name = v.into();
2638            self
2639        }
2640    }
2641
2642    #[doc(hidden)]
2643    impl crate::RequestBuilder for GetOperation {
2644        fn request_options(&mut self) -> &mut crate::RequestOptions {
2645            &mut self.0.options
2646        }
2647    }
2648
2649    /// The request builder for [ControlService::cancel_operation][crate::client::ControlService::cancel_operation] calls.
2650    ///
2651    /// # Example
2652    /// ```
2653    /// # use google_cloud_discoveryengine_v1::builder::control_service::CancelOperation;
2654    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
2655    ///
2656    /// let builder = prepare_request_builder();
2657    /// let response = builder.send().await?;
2658    /// # Ok(()) }
2659    ///
2660    /// fn prepare_request_builder() -> CancelOperation {
2661    ///   # panic!();
2662    ///   // ... details omitted ...
2663    /// }
2664    /// ```
2665    #[derive(Clone, Debug)]
2666    pub struct CancelOperation(
2667        RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
2668    );
2669
2670    impl CancelOperation {
2671        pub(crate) fn new(
2672            stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2673        ) -> Self {
2674            Self(RequestBuilder::new(stub))
2675        }
2676
2677        /// Sets the full request, replacing any prior values.
2678        pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
2679            mut self,
2680            v: V,
2681        ) -> Self {
2682            self.0.request = v.into();
2683            self
2684        }
2685
2686        /// Sets all the options, replacing any prior values.
2687        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2688            self.0.options = v.into();
2689            self
2690        }
2691
2692        /// Sends the request.
2693        pub async fn send(self) -> Result<()> {
2694            (*self.0.stub)
2695                .cancel_operation(self.0.request, self.0.options)
2696                .await
2697                .map(crate::Response::into_body)
2698        }
2699
2700        /// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::name].
2701        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2702            self.0.request.name = v.into();
2703            self
2704        }
2705    }
2706
2707    #[doc(hidden)]
2708    impl crate::RequestBuilder for CancelOperation {
2709        fn request_options(&mut self) -> &mut crate::RequestOptions {
2710            &mut self.0.options
2711        }
2712    }
2713}
2714
2715#[cfg(feature = "conversational-search-service")]
2716#[cfg_attr(docsrs, doc(cfg(feature = "conversational-search-service")))]
2717pub mod conversational_search_service {
2718    use crate::Result;
2719
2720    /// A builder for [ConversationalSearchService][crate::client::ConversationalSearchService].
2721    ///
2722    /// ```
2723    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
2724    /// # use google_cloud_discoveryengine_v1::*;
2725    /// # use builder::conversational_search_service::ClientBuilder;
2726    /// # use client::ConversationalSearchService;
2727    /// let builder : ClientBuilder = ConversationalSearchService::builder();
2728    /// let client = builder
2729    ///     .with_endpoint("https://discoveryengine.googleapis.com")
2730    ///     .build().await?;
2731    /// # Ok(()) }
2732    /// ```
2733    pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
2734
2735    pub(crate) mod client {
2736        use super::super::super::client::ConversationalSearchService;
2737        pub struct Factory;
2738        impl crate::ClientFactory for Factory {
2739            type Client = ConversationalSearchService;
2740            type Credentials = gaxi::options::Credentials;
2741            async fn build(
2742                self,
2743                config: gaxi::options::ClientConfig,
2744            ) -> crate::ClientBuilderResult<Self::Client> {
2745                Self::Client::new(config).await
2746            }
2747        }
2748    }
2749
2750    /// Common implementation for [crate::client::ConversationalSearchService] request builders.
2751    #[derive(Clone, Debug)]
2752    pub(crate) struct RequestBuilder<R: std::default::Default> {
2753        stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
2754        request: R,
2755        options: crate::RequestOptions,
2756    }
2757
2758    impl<R> RequestBuilder<R>
2759    where
2760        R: std::default::Default,
2761    {
2762        pub(crate) fn new(
2763            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
2764        ) -> Self {
2765            Self {
2766                stub,
2767                request: R::default(),
2768                options: crate::RequestOptions::default(),
2769            }
2770        }
2771    }
2772
2773    /// The request builder for [ConversationalSearchService::converse_conversation][crate::client::ConversationalSearchService::converse_conversation] calls.
2774    ///
2775    /// # Example
2776    /// ```
2777    /// # use google_cloud_discoveryengine_v1::builder::conversational_search_service::ConverseConversation;
2778    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
2779    ///
2780    /// let builder = prepare_request_builder();
2781    /// let response = builder.send().await?;
2782    /// # Ok(()) }
2783    ///
2784    /// fn prepare_request_builder() -> ConverseConversation {
2785    ///   # panic!();
2786    ///   // ... details omitted ...
2787    /// }
2788    /// ```
2789    #[derive(Clone, Debug)]
2790    pub struct ConverseConversation(RequestBuilder<crate::model::ConverseConversationRequest>);
2791
2792    impl ConverseConversation {
2793        pub(crate) fn new(
2794            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
2795        ) -> Self {
2796            Self(RequestBuilder::new(stub))
2797        }
2798
2799        /// Sets the full request, replacing any prior values.
2800        pub fn with_request<V: Into<crate::model::ConverseConversationRequest>>(
2801            mut self,
2802            v: V,
2803        ) -> Self {
2804            self.0.request = v.into();
2805            self
2806        }
2807
2808        /// Sets all the options, replacing any prior values.
2809        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2810            self.0.options = v.into();
2811            self
2812        }
2813
2814        /// Sends the request.
2815        pub async fn send(self) -> Result<crate::model::ConverseConversationResponse> {
2816            (*self.0.stub)
2817                .converse_conversation(self.0.request, self.0.options)
2818                .await
2819                .map(crate::Response::into_body)
2820        }
2821
2822        /// Sets the value of [name][crate::model::ConverseConversationRequest::name].
2823        ///
2824        /// This is a **required** field for requests.
2825        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2826            self.0.request.name = v.into();
2827            self
2828        }
2829
2830        /// Sets the value of [query][crate::model::ConverseConversationRequest::query].
2831        ///
2832        /// This is a **required** field for requests.
2833        pub fn set_query<T>(mut self, v: T) -> Self
2834        where
2835            T: std::convert::Into<crate::model::TextInput>,
2836        {
2837            self.0.request.query = std::option::Option::Some(v.into());
2838            self
2839        }
2840
2841        /// Sets or clears the value of [query][crate::model::ConverseConversationRequest::query].
2842        ///
2843        /// This is a **required** field for requests.
2844        pub fn set_or_clear_query<T>(mut self, v: std::option::Option<T>) -> Self
2845        where
2846            T: std::convert::Into<crate::model::TextInput>,
2847        {
2848            self.0.request.query = v.map(|x| x.into());
2849            self
2850        }
2851
2852        /// Sets the value of [serving_config][crate::model::ConverseConversationRequest::serving_config].
2853        pub fn set_serving_config<T: Into<std::string::String>>(mut self, v: T) -> Self {
2854            self.0.request.serving_config = v.into();
2855            self
2856        }
2857
2858        /// Sets the value of [conversation][crate::model::ConverseConversationRequest::conversation].
2859        pub fn set_conversation<T>(mut self, v: T) -> Self
2860        where
2861            T: std::convert::Into<crate::model::Conversation>,
2862        {
2863            self.0.request.conversation = std::option::Option::Some(v.into());
2864            self
2865        }
2866
2867        /// Sets or clears the value of [conversation][crate::model::ConverseConversationRequest::conversation].
2868        pub fn set_or_clear_conversation<T>(mut self, v: std::option::Option<T>) -> Self
2869        where
2870            T: std::convert::Into<crate::model::Conversation>,
2871        {
2872            self.0.request.conversation = v.map(|x| x.into());
2873            self
2874        }
2875
2876        /// Sets the value of [safe_search][crate::model::ConverseConversationRequest::safe_search].
2877        pub fn set_safe_search<T: Into<bool>>(mut self, v: T) -> Self {
2878            self.0.request.safe_search = v.into();
2879            self
2880        }
2881
2882        /// Sets the value of [user_labels][crate::model::ConverseConversationRequest::user_labels].
2883        pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
2884        where
2885            T: std::iter::IntoIterator<Item = (K, V)>,
2886            K: std::convert::Into<std::string::String>,
2887            V: std::convert::Into<std::string::String>,
2888        {
2889            self.0.request.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
2890            self
2891        }
2892
2893        /// Sets the value of [summary_spec][crate::model::ConverseConversationRequest::summary_spec].
2894        pub fn set_summary_spec<T>(mut self, v: T) -> Self
2895        where
2896            T: std::convert::Into<crate::model::search_request::content_search_spec::SummarySpec>,
2897        {
2898            self.0.request.summary_spec = std::option::Option::Some(v.into());
2899            self
2900        }
2901
2902        /// Sets or clears the value of [summary_spec][crate::model::ConverseConversationRequest::summary_spec].
2903        pub fn set_or_clear_summary_spec<T>(mut self, v: std::option::Option<T>) -> Self
2904        where
2905            T: std::convert::Into<crate::model::search_request::content_search_spec::SummarySpec>,
2906        {
2907            self.0.request.summary_spec = v.map(|x| x.into());
2908            self
2909        }
2910
2911        /// Sets the value of [filter][crate::model::ConverseConversationRequest::filter].
2912        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
2913            self.0.request.filter = v.into();
2914            self
2915        }
2916
2917        /// Sets the value of [boost_spec][crate::model::ConverseConversationRequest::boost_spec].
2918        pub fn set_boost_spec<T>(mut self, v: T) -> Self
2919        where
2920            T: std::convert::Into<crate::model::search_request::BoostSpec>,
2921        {
2922            self.0.request.boost_spec = std::option::Option::Some(v.into());
2923            self
2924        }
2925
2926        /// Sets or clears the value of [boost_spec][crate::model::ConverseConversationRequest::boost_spec].
2927        pub fn set_or_clear_boost_spec<T>(mut self, v: std::option::Option<T>) -> Self
2928        where
2929            T: std::convert::Into<crate::model::search_request::BoostSpec>,
2930        {
2931            self.0.request.boost_spec = v.map(|x| x.into());
2932            self
2933        }
2934    }
2935
2936    #[doc(hidden)]
2937    impl crate::RequestBuilder for ConverseConversation {
2938        fn request_options(&mut self) -> &mut crate::RequestOptions {
2939            &mut self.0.options
2940        }
2941    }
2942
2943    /// The request builder for [ConversationalSearchService::create_conversation][crate::client::ConversationalSearchService::create_conversation] calls.
2944    ///
2945    /// # Example
2946    /// ```
2947    /// # use google_cloud_discoveryengine_v1::builder::conversational_search_service::CreateConversation;
2948    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
2949    ///
2950    /// let builder = prepare_request_builder();
2951    /// let response = builder.send().await?;
2952    /// # Ok(()) }
2953    ///
2954    /// fn prepare_request_builder() -> CreateConversation {
2955    ///   # panic!();
2956    ///   // ... details omitted ...
2957    /// }
2958    /// ```
2959    #[derive(Clone, Debug)]
2960    pub struct CreateConversation(RequestBuilder<crate::model::CreateConversationRequest>);
2961
2962    impl CreateConversation {
2963        pub(crate) fn new(
2964            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
2965        ) -> Self {
2966            Self(RequestBuilder::new(stub))
2967        }
2968
2969        /// Sets the full request, replacing any prior values.
2970        pub fn with_request<V: Into<crate::model::CreateConversationRequest>>(
2971            mut self,
2972            v: V,
2973        ) -> Self {
2974            self.0.request = v.into();
2975            self
2976        }
2977
2978        /// Sets all the options, replacing any prior values.
2979        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2980            self.0.options = v.into();
2981            self
2982        }
2983
2984        /// Sends the request.
2985        pub async fn send(self) -> Result<crate::model::Conversation> {
2986            (*self.0.stub)
2987                .create_conversation(self.0.request, self.0.options)
2988                .await
2989                .map(crate::Response::into_body)
2990        }
2991
2992        /// Sets the value of [parent][crate::model::CreateConversationRequest::parent].
2993        ///
2994        /// This is a **required** field for requests.
2995        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2996            self.0.request.parent = v.into();
2997            self
2998        }
2999
3000        /// Sets the value of [conversation][crate::model::CreateConversationRequest::conversation].
3001        ///
3002        /// This is a **required** field for requests.
3003        pub fn set_conversation<T>(mut self, v: T) -> Self
3004        where
3005            T: std::convert::Into<crate::model::Conversation>,
3006        {
3007            self.0.request.conversation = std::option::Option::Some(v.into());
3008            self
3009        }
3010
3011        /// Sets or clears the value of [conversation][crate::model::CreateConversationRequest::conversation].
3012        ///
3013        /// This is a **required** field for requests.
3014        pub fn set_or_clear_conversation<T>(mut self, v: std::option::Option<T>) -> Self
3015        where
3016            T: std::convert::Into<crate::model::Conversation>,
3017        {
3018            self.0.request.conversation = v.map(|x| x.into());
3019            self
3020        }
3021    }
3022
3023    #[doc(hidden)]
3024    impl crate::RequestBuilder for CreateConversation {
3025        fn request_options(&mut self) -> &mut crate::RequestOptions {
3026            &mut self.0.options
3027        }
3028    }
3029
3030    /// The request builder for [ConversationalSearchService::delete_conversation][crate::client::ConversationalSearchService::delete_conversation] calls.
3031    ///
3032    /// # Example
3033    /// ```
3034    /// # use google_cloud_discoveryengine_v1::builder::conversational_search_service::DeleteConversation;
3035    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
3036    ///
3037    /// let builder = prepare_request_builder();
3038    /// let response = builder.send().await?;
3039    /// # Ok(()) }
3040    ///
3041    /// fn prepare_request_builder() -> DeleteConversation {
3042    ///   # panic!();
3043    ///   // ... details omitted ...
3044    /// }
3045    /// ```
3046    #[derive(Clone, Debug)]
3047    pub struct DeleteConversation(RequestBuilder<crate::model::DeleteConversationRequest>);
3048
3049    impl DeleteConversation {
3050        pub(crate) fn new(
3051            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3052        ) -> Self {
3053            Self(RequestBuilder::new(stub))
3054        }
3055
3056        /// Sets the full request, replacing any prior values.
3057        pub fn with_request<V: Into<crate::model::DeleteConversationRequest>>(
3058            mut self,
3059            v: V,
3060        ) -> Self {
3061            self.0.request = v.into();
3062            self
3063        }
3064
3065        /// Sets all the options, replacing any prior values.
3066        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3067            self.0.options = v.into();
3068            self
3069        }
3070
3071        /// Sends the request.
3072        pub async fn send(self) -> Result<()> {
3073            (*self.0.stub)
3074                .delete_conversation(self.0.request, self.0.options)
3075                .await
3076                .map(crate::Response::into_body)
3077        }
3078
3079        /// Sets the value of [name][crate::model::DeleteConversationRequest::name].
3080        ///
3081        /// This is a **required** field for requests.
3082        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3083            self.0.request.name = v.into();
3084            self
3085        }
3086    }
3087
3088    #[doc(hidden)]
3089    impl crate::RequestBuilder for DeleteConversation {
3090        fn request_options(&mut self) -> &mut crate::RequestOptions {
3091            &mut self.0.options
3092        }
3093    }
3094
3095    /// The request builder for [ConversationalSearchService::update_conversation][crate::client::ConversationalSearchService::update_conversation] calls.
3096    ///
3097    /// # Example
3098    /// ```
3099    /// # use google_cloud_discoveryengine_v1::builder::conversational_search_service::UpdateConversation;
3100    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
3101    ///
3102    /// let builder = prepare_request_builder();
3103    /// let response = builder.send().await?;
3104    /// # Ok(()) }
3105    ///
3106    /// fn prepare_request_builder() -> UpdateConversation {
3107    ///   # panic!();
3108    ///   // ... details omitted ...
3109    /// }
3110    /// ```
3111    #[derive(Clone, Debug)]
3112    pub struct UpdateConversation(RequestBuilder<crate::model::UpdateConversationRequest>);
3113
3114    impl UpdateConversation {
3115        pub(crate) fn new(
3116            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3117        ) -> Self {
3118            Self(RequestBuilder::new(stub))
3119        }
3120
3121        /// Sets the full request, replacing any prior values.
3122        pub fn with_request<V: Into<crate::model::UpdateConversationRequest>>(
3123            mut self,
3124            v: V,
3125        ) -> Self {
3126            self.0.request = v.into();
3127            self
3128        }
3129
3130        /// Sets all the options, replacing any prior values.
3131        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3132            self.0.options = v.into();
3133            self
3134        }
3135
3136        /// Sends the request.
3137        pub async fn send(self) -> Result<crate::model::Conversation> {
3138            (*self.0.stub)
3139                .update_conversation(self.0.request, self.0.options)
3140                .await
3141                .map(crate::Response::into_body)
3142        }
3143
3144        /// Sets the value of [conversation][crate::model::UpdateConversationRequest::conversation].
3145        ///
3146        /// This is a **required** field for requests.
3147        pub fn set_conversation<T>(mut self, v: T) -> Self
3148        where
3149            T: std::convert::Into<crate::model::Conversation>,
3150        {
3151            self.0.request.conversation = std::option::Option::Some(v.into());
3152            self
3153        }
3154
3155        /// Sets or clears the value of [conversation][crate::model::UpdateConversationRequest::conversation].
3156        ///
3157        /// This is a **required** field for requests.
3158        pub fn set_or_clear_conversation<T>(mut self, v: std::option::Option<T>) -> Self
3159        where
3160            T: std::convert::Into<crate::model::Conversation>,
3161        {
3162            self.0.request.conversation = v.map(|x| x.into());
3163            self
3164        }
3165
3166        /// Sets the value of [update_mask][crate::model::UpdateConversationRequest::update_mask].
3167        pub fn set_update_mask<T>(mut self, v: T) -> Self
3168        where
3169            T: std::convert::Into<wkt::FieldMask>,
3170        {
3171            self.0.request.update_mask = std::option::Option::Some(v.into());
3172            self
3173        }
3174
3175        /// Sets or clears the value of [update_mask][crate::model::UpdateConversationRequest::update_mask].
3176        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
3177        where
3178            T: std::convert::Into<wkt::FieldMask>,
3179        {
3180            self.0.request.update_mask = v.map(|x| x.into());
3181            self
3182        }
3183    }
3184
3185    #[doc(hidden)]
3186    impl crate::RequestBuilder for UpdateConversation {
3187        fn request_options(&mut self) -> &mut crate::RequestOptions {
3188            &mut self.0.options
3189        }
3190    }
3191
3192    /// The request builder for [ConversationalSearchService::get_conversation][crate::client::ConversationalSearchService::get_conversation] calls.
3193    ///
3194    /// # Example
3195    /// ```
3196    /// # use google_cloud_discoveryengine_v1::builder::conversational_search_service::GetConversation;
3197    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
3198    ///
3199    /// let builder = prepare_request_builder();
3200    /// let response = builder.send().await?;
3201    /// # Ok(()) }
3202    ///
3203    /// fn prepare_request_builder() -> GetConversation {
3204    ///   # panic!();
3205    ///   // ... details omitted ...
3206    /// }
3207    /// ```
3208    #[derive(Clone, Debug)]
3209    pub struct GetConversation(RequestBuilder<crate::model::GetConversationRequest>);
3210
3211    impl GetConversation {
3212        pub(crate) fn new(
3213            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3214        ) -> Self {
3215            Self(RequestBuilder::new(stub))
3216        }
3217
3218        /// Sets the full request, replacing any prior values.
3219        pub fn with_request<V: Into<crate::model::GetConversationRequest>>(mut self, v: V) -> Self {
3220            self.0.request = v.into();
3221            self
3222        }
3223
3224        /// Sets all the options, replacing any prior values.
3225        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3226            self.0.options = v.into();
3227            self
3228        }
3229
3230        /// Sends the request.
3231        pub async fn send(self) -> Result<crate::model::Conversation> {
3232            (*self.0.stub)
3233                .get_conversation(self.0.request, self.0.options)
3234                .await
3235                .map(crate::Response::into_body)
3236        }
3237
3238        /// Sets the value of [name][crate::model::GetConversationRequest::name].
3239        ///
3240        /// This is a **required** field for requests.
3241        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3242            self.0.request.name = v.into();
3243            self
3244        }
3245    }
3246
3247    #[doc(hidden)]
3248    impl crate::RequestBuilder for GetConversation {
3249        fn request_options(&mut self) -> &mut crate::RequestOptions {
3250            &mut self.0.options
3251        }
3252    }
3253
3254    /// The request builder for [ConversationalSearchService::list_conversations][crate::client::ConversationalSearchService::list_conversations] calls.
3255    ///
3256    /// # Example
3257    /// ```
3258    /// # use google_cloud_discoveryengine_v1::builder::conversational_search_service::ListConversations;
3259    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
3260    /// use google_cloud_gax::paginator::ItemPaginator;
3261    ///
3262    /// let builder = prepare_request_builder();
3263    /// let mut items = builder.by_item();
3264    /// while let Some(result) = items.next().await {
3265    ///   let item = result?;
3266    /// }
3267    /// # Ok(()) }
3268    ///
3269    /// fn prepare_request_builder() -> ListConversations {
3270    ///   # panic!();
3271    ///   // ... details omitted ...
3272    /// }
3273    /// ```
3274    #[derive(Clone, Debug)]
3275    pub struct ListConversations(RequestBuilder<crate::model::ListConversationsRequest>);
3276
3277    impl ListConversations {
3278        pub(crate) fn new(
3279            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3280        ) -> Self {
3281            Self(RequestBuilder::new(stub))
3282        }
3283
3284        /// Sets the full request, replacing any prior values.
3285        pub fn with_request<V: Into<crate::model::ListConversationsRequest>>(
3286            mut self,
3287            v: V,
3288        ) -> Self {
3289            self.0.request = v.into();
3290            self
3291        }
3292
3293        /// Sets all the options, replacing any prior values.
3294        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3295            self.0.options = v.into();
3296            self
3297        }
3298
3299        /// Sends the request.
3300        pub async fn send(self) -> Result<crate::model::ListConversationsResponse> {
3301            (*self.0.stub)
3302                .list_conversations(self.0.request, self.0.options)
3303                .await
3304                .map(crate::Response::into_body)
3305        }
3306
3307        /// Streams each page in the collection.
3308        pub fn by_page(
3309            self,
3310        ) -> impl google_cloud_gax::paginator::Paginator<
3311            crate::model::ListConversationsResponse,
3312            crate::Error,
3313        > {
3314            use std::clone::Clone;
3315            let token = self.0.request.page_token.clone();
3316            let execute = move |token: String| {
3317                let mut builder = self.clone();
3318                builder.0.request = builder.0.request.set_page_token(token);
3319                builder.send()
3320            };
3321            google_cloud_gax::paginator::internal::new_paginator(token, execute)
3322        }
3323
3324        /// Streams each item in the collection.
3325        pub fn by_item(
3326            self,
3327        ) -> impl google_cloud_gax::paginator::ItemPaginator<
3328            crate::model::ListConversationsResponse,
3329            crate::Error,
3330        > {
3331            use google_cloud_gax::paginator::Paginator;
3332            self.by_page().items()
3333        }
3334
3335        /// Sets the value of [parent][crate::model::ListConversationsRequest::parent].
3336        ///
3337        /// This is a **required** field for requests.
3338        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
3339            self.0.request.parent = v.into();
3340            self
3341        }
3342
3343        /// Sets the value of [page_size][crate::model::ListConversationsRequest::page_size].
3344        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
3345            self.0.request.page_size = v.into();
3346            self
3347        }
3348
3349        /// Sets the value of [page_token][crate::model::ListConversationsRequest::page_token].
3350        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
3351            self.0.request.page_token = v.into();
3352            self
3353        }
3354
3355        /// Sets the value of [filter][crate::model::ListConversationsRequest::filter].
3356        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
3357            self.0.request.filter = v.into();
3358            self
3359        }
3360
3361        /// Sets the value of [order_by][crate::model::ListConversationsRequest::order_by].
3362        pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
3363            self.0.request.order_by = v.into();
3364            self
3365        }
3366    }
3367
3368    #[doc(hidden)]
3369    impl crate::RequestBuilder for ListConversations {
3370        fn request_options(&mut self) -> &mut crate::RequestOptions {
3371            &mut self.0.options
3372        }
3373    }
3374
3375    /// The request builder for [ConversationalSearchService::answer_query][crate::client::ConversationalSearchService::answer_query] calls.
3376    ///
3377    /// # Example
3378    /// ```
3379    /// # use google_cloud_discoveryengine_v1::builder::conversational_search_service::AnswerQuery;
3380    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
3381    ///
3382    /// let builder = prepare_request_builder();
3383    /// let response = builder.send().await?;
3384    /// # Ok(()) }
3385    ///
3386    /// fn prepare_request_builder() -> AnswerQuery {
3387    ///   # panic!();
3388    ///   // ... details omitted ...
3389    /// }
3390    /// ```
3391    #[derive(Clone, Debug)]
3392    pub struct AnswerQuery(RequestBuilder<crate::model::AnswerQueryRequest>);
3393
3394    impl AnswerQuery {
3395        pub(crate) fn new(
3396            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3397        ) -> Self {
3398            Self(RequestBuilder::new(stub))
3399        }
3400
3401        /// Sets the full request, replacing any prior values.
3402        pub fn with_request<V: Into<crate::model::AnswerQueryRequest>>(mut self, v: V) -> Self {
3403            self.0.request = v.into();
3404            self
3405        }
3406
3407        /// Sets all the options, replacing any prior values.
3408        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3409            self.0.options = v.into();
3410            self
3411        }
3412
3413        /// Sends the request.
3414        pub async fn send(self) -> Result<crate::model::AnswerQueryResponse> {
3415            (*self.0.stub)
3416                .answer_query(self.0.request, self.0.options)
3417                .await
3418                .map(crate::Response::into_body)
3419        }
3420
3421        /// Sets the value of [serving_config][crate::model::AnswerQueryRequest::serving_config].
3422        ///
3423        /// This is a **required** field for requests.
3424        pub fn set_serving_config<T: Into<std::string::String>>(mut self, v: T) -> Self {
3425            self.0.request.serving_config = v.into();
3426            self
3427        }
3428
3429        /// Sets the value of [query][crate::model::AnswerQueryRequest::query].
3430        ///
3431        /// This is a **required** field for requests.
3432        pub fn set_query<T>(mut self, v: T) -> Self
3433        where
3434            T: std::convert::Into<crate::model::Query>,
3435        {
3436            self.0.request.query = std::option::Option::Some(v.into());
3437            self
3438        }
3439
3440        /// Sets or clears the value of [query][crate::model::AnswerQueryRequest::query].
3441        ///
3442        /// This is a **required** field for requests.
3443        pub fn set_or_clear_query<T>(mut self, v: std::option::Option<T>) -> Self
3444        where
3445            T: std::convert::Into<crate::model::Query>,
3446        {
3447            self.0.request.query = v.map(|x| x.into());
3448            self
3449        }
3450
3451        /// Sets the value of [session][crate::model::AnswerQueryRequest::session].
3452        pub fn set_session<T: Into<std::string::String>>(mut self, v: T) -> Self {
3453            self.0.request.session = v.into();
3454            self
3455        }
3456
3457        /// Sets the value of [safety_spec][crate::model::AnswerQueryRequest::safety_spec].
3458        pub fn set_safety_spec<T>(mut self, v: T) -> Self
3459        where
3460            T: std::convert::Into<crate::model::answer_query_request::SafetySpec>,
3461        {
3462            self.0.request.safety_spec = std::option::Option::Some(v.into());
3463            self
3464        }
3465
3466        /// Sets or clears the value of [safety_spec][crate::model::AnswerQueryRequest::safety_spec].
3467        pub fn set_or_clear_safety_spec<T>(mut self, v: std::option::Option<T>) -> Self
3468        where
3469            T: std::convert::Into<crate::model::answer_query_request::SafetySpec>,
3470        {
3471            self.0.request.safety_spec = v.map(|x| x.into());
3472            self
3473        }
3474
3475        /// Sets the value of [related_questions_spec][crate::model::AnswerQueryRequest::related_questions_spec].
3476        pub fn set_related_questions_spec<T>(mut self, v: T) -> Self
3477        where
3478            T: std::convert::Into<crate::model::answer_query_request::RelatedQuestionsSpec>,
3479        {
3480            self.0.request.related_questions_spec = std::option::Option::Some(v.into());
3481            self
3482        }
3483
3484        /// Sets or clears the value of [related_questions_spec][crate::model::AnswerQueryRequest::related_questions_spec].
3485        pub fn set_or_clear_related_questions_spec<T>(mut self, v: std::option::Option<T>) -> Self
3486        where
3487            T: std::convert::Into<crate::model::answer_query_request::RelatedQuestionsSpec>,
3488        {
3489            self.0.request.related_questions_spec = v.map(|x| x.into());
3490            self
3491        }
3492
3493        /// Sets the value of [grounding_spec][crate::model::AnswerQueryRequest::grounding_spec].
3494        pub fn set_grounding_spec<T>(mut self, v: T) -> Self
3495        where
3496            T: std::convert::Into<crate::model::answer_query_request::GroundingSpec>,
3497        {
3498            self.0.request.grounding_spec = std::option::Option::Some(v.into());
3499            self
3500        }
3501
3502        /// Sets or clears the value of [grounding_spec][crate::model::AnswerQueryRequest::grounding_spec].
3503        pub fn set_or_clear_grounding_spec<T>(mut self, v: std::option::Option<T>) -> Self
3504        where
3505            T: std::convert::Into<crate::model::answer_query_request::GroundingSpec>,
3506        {
3507            self.0.request.grounding_spec = v.map(|x| x.into());
3508            self
3509        }
3510
3511        /// Sets the value of [answer_generation_spec][crate::model::AnswerQueryRequest::answer_generation_spec].
3512        pub fn set_answer_generation_spec<T>(mut self, v: T) -> Self
3513        where
3514            T: std::convert::Into<crate::model::answer_query_request::AnswerGenerationSpec>,
3515        {
3516            self.0.request.answer_generation_spec = std::option::Option::Some(v.into());
3517            self
3518        }
3519
3520        /// Sets or clears the value of [answer_generation_spec][crate::model::AnswerQueryRequest::answer_generation_spec].
3521        pub fn set_or_clear_answer_generation_spec<T>(mut self, v: std::option::Option<T>) -> Self
3522        where
3523            T: std::convert::Into<crate::model::answer_query_request::AnswerGenerationSpec>,
3524        {
3525            self.0.request.answer_generation_spec = v.map(|x| x.into());
3526            self
3527        }
3528
3529        /// Sets the value of [search_spec][crate::model::AnswerQueryRequest::search_spec].
3530        pub fn set_search_spec<T>(mut self, v: T) -> Self
3531        where
3532            T: std::convert::Into<crate::model::answer_query_request::SearchSpec>,
3533        {
3534            self.0.request.search_spec = std::option::Option::Some(v.into());
3535            self
3536        }
3537
3538        /// Sets or clears the value of [search_spec][crate::model::AnswerQueryRequest::search_spec].
3539        pub fn set_or_clear_search_spec<T>(mut self, v: std::option::Option<T>) -> Self
3540        where
3541            T: std::convert::Into<crate::model::answer_query_request::SearchSpec>,
3542        {
3543            self.0.request.search_spec = v.map(|x| x.into());
3544            self
3545        }
3546
3547        /// Sets the value of [query_understanding_spec][crate::model::AnswerQueryRequest::query_understanding_spec].
3548        pub fn set_query_understanding_spec<T>(mut self, v: T) -> Self
3549        where
3550            T: std::convert::Into<crate::model::answer_query_request::QueryUnderstandingSpec>,
3551        {
3552            self.0.request.query_understanding_spec = std::option::Option::Some(v.into());
3553            self
3554        }
3555
3556        /// Sets or clears the value of [query_understanding_spec][crate::model::AnswerQueryRequest::query_understanding_spec].
3557        pub fn set_or_clear_query_understanding_spec<T>(mut self, v: std::option::Option<T>) -> Self
3558        where
3559            T: std::convert::Into<crate::model::answer_query_request::QueryUnderstandingSpec>,
3560        {
3561            self.0.request.query_understanding_spec = v.map(|x| x.into());
3562            self
3563        }
3564
3565        /// Sets the value of [asynchronous_mode][crate::model::AnswerQueryRequest::asynchronous_mode].
3566        #[deprecated]
3567        pub fn set_asynchronous_mode<T: Into<bool>>(mut self, v: T) -> Self {
3568            self.0.request.asynchronous_mode = v.into();
3569            self
3570        }
3571
3572        /// Sets the value of [user_pseudo_id][crate::model::AnswerQueryRequest::user_pseudo_id].
3573        pub fn set_user_pseudo_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
3574            self.0.request.user_pseudo_id = v.into();
3575            self
3576        }
3577
3578        /// Sets the value of [user_labels][crate::model::AnswerQueryRequest::user_labels].
3579        pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
3580        where
3581            T: std::iter::IntoIterator<Item = (K, V)>,
3582            K: std::convert::Into<std::string::String>,
3583            V: std::convert::Into<std::string::String>,
3584        {
3585            self.0.request.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
3586            self
3587        }
3588
3589        /// Sets the value of [end_user_spec][crate::model::AnswerQueryRequest::end_user_spec].
3590        pub fn set_end_user_spec<T>(mut self, v: T) -> Self
3591        where
3592            T: std::convert::Into<crate::model::answer_query_request::EndUserSpec>,
3593        {
3594            self.0.request.end_user_spec = std::option::Option::Some(v.into());
3595            self
3596        }
3597
3598        /// Sets or clears the value of [end_user_spec][crate::model::AnswerQueryRequest::end_user_spec].
3599        pub fn set_or_clear_end_user_spec<T>(mut self, v: std::option::Option<T>) -> Self
3600        where
3601            T: std::convert::Into<crate::model::answer_query_request::EndUserSpec>,
3602        {
3603            self.0.request.end_user_spec = v.map(|x| x.into());
3604            self
3605        }
3606    }
3607
3608    #[doc(hidden)]
3609    impl crate::RequestBuilder for AnswerQuery {
3610        fn request_options(&mut self) -> &mut crate::RequestOptions {
3611            &mut self.0.options
3612        }
3613    }
3614
3615    /// The request builder for [ConversationalSearchService::get_answer][crate::client::ConversationalSearchService::get_answer] calls.
3616    ///
3617    /// # Example
3618    /// ```
3619    /// # use google_cloud_discoveryengine_v1::builder::conversational_search_service::GetAnswer;
3620    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
3621    ///
3622    /// let builder = prepare_request_builder();
3623    /// let response = builder.send().await?;
3624    /// # Ok(()) }
3625    ///
3626    /// fn prepare_request_builder() -> GetAnswer {
3627    ///   # panic!();
3628    ///   // ... details omitted ...
3629    /// }
3630    /// ```
3631    #[derive(Clone, Debug)]
3632    pub struct GetAnswer(RequestBuilder<crate::model::GetAnswerRequest>);
3633
3634    impl GetAnswer {
3635        pub(crate) fn new(
3636            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3637        ) -> Self {
3638            Self(RequestBuilder::new(stub))
3639        }
3640
3641        /// Sets the full request, replacing any prior values.
3642        pub fn with_request<V: Into<crate::model::GetAnswerRequest>>(mut self, v: V) -> Self {
3643            self.0.request = v.into();
3644            self
3645        }
3646
3647        /// Sets all the options, replacing any prior values.
3648        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3649            self.0.options = v.into();
3650            self
3651        }
3652
3653        /// Sends the request.
3654        pub async fn send(self) -> Result<crate::model::Answer> {
3655            (*self.0.stub)
3656                .get_answer(self.0.request, self.0.options)
3657                .await
3658                .map(crate::Response::into_body)
3659        }
3660
3661        /// Sets the value of [name][crate::model::GetAnswerRequest::name].
3662        ///
3663        /// This is a **required** field for requests.
3664        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3665            self.0.request.name = v.into();
3666            self
3667        }
3668    }
3669
3670    #[doc(hidden)]
3671    impl crate::RequestBuilder for GetAnswer {
3672        fn request_options(&mut self) -> &mut crate::RequestOptions {
3673            &mut self.0.options
3674        }
3675    }
3676
3677    /// The request builder for [ConversationalSearchService::create_session][crate::client::ConversationalSearchService::create_session] calls.
3678    ///
3679    /// # Example
3680    /// ```
3681    /// # use google_cloud_discoveryengine_v1::builder::conversational_search_service::CreateSession;
3682    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
3683    ///
3684    /// let builder = prepare_request_builder();
3685    /// let response = builder.send().await?;
3686    /// # Ok(()) }
3687    ///
3688    /// fn prepare_request_builder() -> CreateSession {
3689    ///   # panic!();
3690    ///   // ... details omitted ...
3691    /// }
3692    /// ```
3693    #[derive(Clone, Debug)]
3694    pub struct CreateSession(RequestBuilder<crate::model::CreateSessionRequest>);
3695
3696    impl CreateSession {
3697        pub(crate) fn new(
3698            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3699        ) -> Self {
3700            Self(RequestBuilder::new(stub))
3701        }
3702
3703        /// Sets the full request, replacing any prior values.
3704        pub fn with_request<V: Into<crate::model::CreateSessionRequest>>(mut self, v: V) -> Self {
3705            self.0.request = v.into();
3706            self
3707        }
3708
3709        /// Sets all the options, replacing any prior values.
3710        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3711            self.0.options = v.into();
3712            self
3713        }
3714
3715        /// Sends the request.
3716        pub async fn send(self) -> Result<crate::model::Session> {
3717            (*self.0.stub)
3718                .create_session(self.0.request, self.0.options)
3719                .await
3720                .map(crate::Response::into_body)
3721        }
3722
3723        /// Sets the value of [parent][crate::model::CreateSessionRequest::parent].
3724        ///
3725        /// This is a **required** field for requests.
3726        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
3727            self.0.request.parent = v.into();
3728            self
3729        }
3730
3731        /// Sets the value of [session][crate::model::CreateSessionRequest::session].
3732        ///
3733        /// This is a **required** field for requests.
3734        pub fn set_session<T>(mut self, v: T) -> Self
3735        where
3736            T: std::convert::Into<crate::model::Session>,
3737        {
3738            self.0.request.session = std::option::Option::Some(v.into());
3739            self
3740        }
3741
3742        /// Sets or clears the value of [session][crate::model::CreateSessionRequest::session].
3743        ///
3744        /// This is a **required** field for requests.
3745        pub fn set_or_clear_session<T>(mut self, v: std::option::Option<T>) -> Self
3746        where
3747            T: std::convert::Into<crate::model::Session>,
3748        {
3749            self.0.request.session = v.map(|x| x.into());
3750            self
3751        }
3752    }
3753
3754    #[doc(hidden)]
3755    impl crate::RequestBuilder for CreateSession {
3756        fn request_options(&mut self) -> &mut crate::RequestOptions {
3757            &mut self.0.options
3758        }
3759    }
3760
3761    /// The request builder for [ConversationalSearchService::delete_session][crate::client::ConversationalSearchService::delete_session] calls.
3762    ///
3763    /// # Example
3764    /// ```
3765    /// # use google_cloud_discoveryengine_v1::builder::conversational_search_service::DeleteSession;
3766    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
3767    ///
3768    /// let builder = prepare_request_builder();
3769    /// let response = builder.send().await?;
3770    /// # Ok(()) }
3771    ///
3772    /// fn prepare_request_builder() -> DeleteSession {
3773    ///   # panic!();
3774    ///   // ... details omitted ...
3775    /// }
3776    /// ```
3777    #[derive(Clone, Debug)]
3778    pub struct DeleteSession(RequestBuilder<crate::model::DeleteSessionRequest>);
3779
3780    impl DeleteSession {
3781        pub(crate) fn new(
3782            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3783        ) -> Self {
3784            Self(RequestBuilder::new(stub))
3785        }
3786
3787        /// Sets the full request, replacing any prior values.
3788        pub fn with_request<V: Into<crate::model::DeleteSessionRequest>>(mut self, v: V) -> Self {
3789            self.0.request = v.into();
3790            self
3791        }
3792
3793        /// Sets all the options, replacing any prior values.
3794        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3795            self.0.options = v.into();
3796            self
3797        }
3798
3799        /// Sends the request.
3800        pub async fn send(self) -> Result<()> {
3801            (*self.0.stub)
3802                .delete_session(self.0.request, self.0.options)
3803                .await
3804                .map(crate::Response::into_body)
3805        }
3806
3807        /// Sets the value of [name][crate::model::DeleteSessionRequest::name].
3808        ///
3809        /// This is a **required** field for requests.
3810        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3811            self.0.request.name = v.into();
3812            self
3813        }
3814    }
3815
3816    #[doc(hidden)]
3817    impl crate::RequestBuilder for DeleteSession {
3818        fn request_options(&mut self) -> &mut crate::RequestOptions {
3819            &mut self.0.options
3820        }
3821    }
3822
3823    /// The request builder for [ConversationalSearchService::update_session][crate::client::ConversationalSearchService::update_session] calls.
3824    ///
3825    /// # Example
3826    /// ```
3827    /// # use google_cloud_discoveryengine_v1::builder::conversational_search_service::UpdateSession;
3828    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
3829    ///
3830    /// let builder = prepare_request_builder();
3831    /// let response = builder.send().await?;
3832    /// # Ok(()) }
3833    ///
3834    /// fn prepare_request_builder() -> UpdateSession {
3835    ///   # panic!();
3836    ///   // ... details omitted ...
3837    /// }
3838    /// ```
3839    #[derive(Clone, Debug)]
3840    pub struct UpdateSession(RequestBuilder<crate::model::UpdateSessionRequest>);
3841
3842    impl UpdateSession {
3843        pub(crate) fn new(
3844            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3845        ) -> Self {
3846            Self(RequestBuilder::new(stub))
3847        }
3848
3849        /// Sets the full request, replacing any prior values.
3850        pub fn with_request<V: Into<crate::model::UpdateSessionRequest>>(mut self, v: V) -> Self {
3851            self.0.request = v.into();
3852            self
3853        }
3854
3855        /// Sets all the options, replacing any prior values.
3856        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3857            self.0.options = v.into();
3858            self
3859        }
3860
3861        /// Sends the request.
3862        pub async fn send(self) -> Result<crate::model::Session> {
3863            (*self.0.stub)
3864                .update_session(self.0.request, self.0.options)
3865                .await
3866                .map(crate::Response::into_body)
3867        }
3868
3869        /// Sets the value of [session][crate::model::UpdateSessionRequest::session].
3870        ///
3871        /// This is a **required** field for requests.
3872        pub fn set_session<T>(mut self, v: T) -> Self
3873        where
3874            T: std::convert::Into<crate::model::Session>,
3875        {
3876            self.0.request.session = std::option::Option::Some(v.into());
3877            self
3878        }
3879
3880        /// Sets or clears the value of [session][crate::model::UpdateSessionRequest::session].
3881        ///
3882        /// This is a **required** field for requests.
3883        pub fn set_or_clear_session<T>(mut self, v: std::option::Option<T>) -> Self
3884        where
3885            T: std::convert::Into<crate::model::Session>,
3886        {
3887            self.0.request.session = v.map(|x| x.into());
3888            self
3889        }
3890
3891        /// Sets the value of [update_mask][crate::model::UpdateSessionRequest::update_mask].
3892        pub fn set_update_mask<T>(mut self, v: T) -> Self
3893        where
3894            T: std::convert::Into<wkt::FieldMask>,
3895        {
3896            self.0.request.update_mask = std::option::Option::Some(v.into());
3897            self
3898        }
3899
3900        /// Sets or clears the value of [update_mask][crate::model::UpdateSessionRequest::update_mask].
3901        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
3902        where
3903            T: std::convert::Into<wkt::FieldMask>,
3904        {
3905            self.0.request.update_mask = v.map(|x| x.into());
3906            self
3907        }
3908    }
3909
3910    #[doc(hidden)]
3911    impl crate::RequestBuilder for UpdateSession {
3912        fn request_options(&mut self) -> &mut crate::RequestOptions {
3913            &mut self.0.options
3914        }
3915    }
3916
3917    /// The request builder for [ConversationalSearchService::get_session][crate::client::ConversationalSearchService::get_session] calls.
3918    ///
3919    /// # Example
3920    /// ```
3921    /// # use google_cloud_discoveryengine_v1::builder::conversational_search_service::GetSession;
3922    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
3923    ///
3924    /// let builder = prepare_request_builder();
3925    /// let response = builder.send().await?;
3926    /// # Ok(()) }
3927    ///
3928    /// fn prepare_request_builder() -> GetSession {
3929    ///   # panic!();
3930    ///   // ... details omitted ...
3931    /// }
3932    /// ```
3933    #[derive(Clone, Debug)]
3934    pub struct GetSession(RequestBuilder<crate::model::GetSessionRequest>);
3935
3936    impl GetSession {
3937        pub(crate) fn new(
3938            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3939        ) -> Self {
3940            Self(RequestBuilder::new(stub))
3941        }
3942
3943        /// Sets the full request, replacing any prior values.
3944        pub fn with_request<V: Into<crate::model::GetSessionRequest>>(mut self, v: V) -> Self {
3945            self.0.request = v.into();
3946            self
3947        }
3948
3949        /// Sets all the options, replacing any prior values.
3950        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3951            self.0.options = v.into();
3952            self
3953        }
3954
3955        /// Sends the request.
3956        pub async fn send(self) -> Result<crate::model::Session> {
3957            (*self.0.stub)
3958                .get_session(self.0.request, self.0.options)
3959                .await
3960                .map(crate::Response::into_body)
3961        }
3962
3963        /// Sets the value of [name][crate::model::GetSessionRequest::name].
3964        ///
3965        /// This is a **required** field for requests.
3966        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3967            self.0.request.name = v.into();
3968            self
3969        }
3970
3971        /// Sets the value of [include_answer_details][crate::model::GetSessionRequest::include_answer_details].
3972        pub fn set_include_answer_details<T: Into<bool>>(mut self, v: T) -> Self {
3973            self.0.request.include_answer_details = v.into();
3974            self
3975        }
3976    }
3977
3978    #[doc(hidden)]
3979    impl crate::RequestBuilder for GetSession {
3980        fn request_options(&mut self) -> &mut crate::RequestOptions {
3981            &mut self.0.options
3982        }
3983    }
3984
3985    /// The request builder for [ConversationalSearchService::list_sessions][crate::client::ConversationalSearchService::list_sessions] calls.
3986    ///
3987    /// # Example
3988    /// ```
3989    /// # use google_cloud_discoveryengine_v1::builder::conversational_search_service::ListSessions;
3990    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
3991    /// use google_cloud_gax::paginator::ItemPaginator;
3992    ///
3993    /// let builder = prepare_request_builder();
3994    /// let mut items = builder.by_item();
3995    /// while let Some(result) = items.next().await {
3996    ///   let item = result?;
3997    /// }
3998    /// # Ok(()) }
3999    ///
4000    /// fn prepare_request_builder() -> ListSessions {
4001    ///   # panic!();
4002    ///   // ... details omitted ...
4003    /// }
4004    /// ```
4005    #[derive(Clone, Debug)]
4006    pub struct ListSessions(RequestBuilder<crate::model::ListSessionsRequest>);
4007
4008    impl ListSessions {
4009        pub(crate) fn new(
4010            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
4011        ) -> Self {
4012            Self(RequestBuilder::new(stub))
4013        }
4014
4015        /// Sets the full request, replacing any prior values.
4016        pub fn with_request<V: Into<crate::model::ListSessionsRequest>>(mut self, v: V) -> Self {
4017            self.0.request = v.into();
4018            self
4019        }
4020
4021        /// Sets all the options, replacing any prior values.
4022        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4023            self.0.options = v.into();
4024            self
4025        }
4026
4027        /// Sends the request.
4028        pub async fn send(self) -> Result<crate::model::ListSessionsResponse> {
4029            (*self.0.stub)
4030                .list_sessions(self.0.request, self.0.options)
4031                .await
4032                .map(crate::Response::into_body)
4033        }
4034
4035        /// Streams each page in the collection.
4036        pub fn by_page(
4037            self,
4038        ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListSessionsResponse, crate::Error>
4039        {
4040            use std::clone::Clone;
4041            let token = self.0.request.page_token.clone();
4042            let execute = move |token: String| {
4043                let mut builder = self.clone();
4044                builder.0.request = builder.0.request.set_page_token(token);
4045                builder.send()
4046            };
4047            google_cloud_gax::paginator::internal::new_paginator(token, execute)
4048        }
4049
4050        /// Streams each item in the collection.
4051        pub fn by_item(
4052            self,
4053        ) -> impl google_cloud_gax::paginator::ItemPaginator<
4054            crate::model::ListSessionsResponse,
4055            crate::Error,
4056        > {
4057            use google_cloud_gax::paginator::Paginator;
4058            self.by_page().items()
4059        }
4060
4061        /// Sets the value of [parent][crate::model::ListSessionsRequest::parent].
4062        ///
4063        /// This is a **required** field for requests.
4064        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
4065            self.0.request.parent = v.into();
4066            self
4067        }
4068
4069        /// Sets the value of [page_size][crate::model::ListSessionsRequest::page_size].
4070        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
4071            self.0.request.page_size = v.into();
4072            self
4073        }
4074
4075        /// Sets the value of [page_token][crate::model::ListSessionsRequest::page_token].
4076        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
4077            self.0.request.page_token = v.into();
4078            self
4079        }
4080
4081        /// Sets the value of [filter][crate::model::ListSessionsRequest::filter].
4082        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
4083            self.0.request.filter = v.into();
4084            self
4085        }
4086
4087        /// Sets the value of [order_by][crate::model::ListSessionsRequest::order_by].
4088        pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
4089            self.0.request.order_by = v.into();
4090            self
4091        }
4092    }
4093
4094    #[doc(hidden)]
4095    impl crate::RequestBuilder for ListSessions {
4096        fn request_options(&mut self) -> &mut crate::RequestOptions {
4097            &mut self.0.options
4098        }
4099    }
4100
4101    /// The request builder for [ConversationalSearchService::list_operations][crate::client::ConversationalSearchService::list_operations] calls.
4102    ///
4103    /// # Example
4104    /// ```
4105    /// # use google_cloud_discoveryengine_v1::builder::conversational_search_service::ListOperations;
4106    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
4107    /// use google_cloud_gax::paginator::ItemPaginator;
4108    ///
4109    /// let builder = prepare_request_builder();
4110    /// let mut items = builder.by_item();
4111    /// while let Some(result) = items.next().await {
4112    ///   let item = result?;
4113    /// }
4114    /// # Ok(()) }
4115    ///
4116    /// fn prepare_request_builder() -> ListOperations {
4117    ///   # panic!();
4118    ///   // ... details omitted ...
4119    /// }
4120    /// ```
4121    #[derive(Clone, Debug)]
4122    pub struct ListOperations(
4123        RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
4124    );
4125
4126    impl ListOperations {
4127        pub(crate) fn new(
4128            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
4129        ) -> Self {
4130            Self(RequestBuilder::new(stub))
4131        }
4132
4133        /// Sets the full request, replacing any prior values.
4134        pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
4135            mut self,
4136            v: V,
4137        ) -> Self {
4138            self.0.request = v.into();
4139            self
4140        }
4141
4142        /// Sets all the options, replacing any prior values.
4143        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4144            self.0.options = v.into();
4145            self
4146        }
4147
4148        /// Sends the request.
4149        pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
4150            (*self.0.stub)
4151                .list_operations(self.0.request, self.0.options)
4152                .await
4153                .map(crate::Response::into_body)
4154        }
4155
4156        /// Streams each page in the collection.
4157        pub fn by_page(
4158            self,
4159        ) -> impl google_cloud_gax::paginator::Paginator<
4160            google_cloud_longrunning::model::ListOperationsResponse,
4161            crate::Error,
4162        > {
4163            use std::clone::Clone;
4164            let token = self.0.request.page_token.clone();
4165            let execute = move |token: String| {
4166                let mut builder = self.clone();
4167                builder.0.request = builder.0.request.set_page_token(token);
4168                builder.send()
4169            };
4170            google_cloud_gax::paginator::internal::new_paginator(token, execute)
4171        }
4172
4173        /// Streams each item in the collection.
4174        pub fn by_item(
4175            self,
4176        ) -> impl google_cloud_gax::paginator::ItemPaginator<
4177            google_cloud_longrunning::model::ListOperationsResponse,
4178            crate::Error,
4179        > {
4180            use google_cloud_gax::paginator::Paginator;
4181            self.by_page().items()
4182        }
4183
4184        /// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
4185        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4186            self.0.request.name = v.into();
4187            self
4188        }
4189
4190        /// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::filter].
4191        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
4192            self.0.request.filter = v.into();
4193            self
4194        }
4195
4196        /// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
4197        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
4198            self.0.request.page_size = v.into();
4199            self
4200        }
4201
4202        /// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
4203        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
4204            self.0.request.page_token = v.into();
4205            self
4206        }
4207
4208        /// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
4209        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
4210            self.0.request.return_partial_success = v.into();
4211            self
4212        }
4213    }
4214
4215    #[doc(hidden)]
4216    impl crate::RequestBuilder for ListOperations {
4217        fn request_options(&mut self) -> &mut crate::RequestOptions {
4218            &mut self.0.options
4219        }
4220    }
4221
4222    /// The request builder for [ConversationalSearchService::get_operation][crate::client::ConversationalSearchService::get_operation] calls.
4223    ///
4224    /// # Example
4225    /// ```
4226    /// # use google_cloud_discoveryengine_v1::builder::conversational_search_service::GetOperation;
4227    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
4228    ///
4229    /// let builder = prepare_request_builder();
4230    /// let response = builder.send().await?;
4231    /// # Ok(()) }
4232    ///
4233    /// fn prepare_request_builder() -> GetOperation {
4234    ///   # panic!();
4235    ///   // ... details omitted ...
4236    /// }
4237    /// ```
4238    #[derive(Clone, Debug)]
4239    pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
4240
4241    impl GetOperation {
4242        pub(crate) fn new(
4243            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
4244        ) -> Self {
4245            Self(RequestBuilder::new(stub))
4246        }
4247
4248        /// Sets the full request, replacing any prior values.
4249        pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
4250            mut self,
4251            v: V,
4252        ) -> Self {
4253            self.0.request = v.into();
4254            self
4255        }
4256
4257        /// Sets all the options, replacing any prior values.
4258        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4259            self.0.options = v.into();
4260            self
4261        }
4262
4263        /// Sends the request.
4264        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
4265            (*self.0.stub)
4266                .get_operation(self.0.request, self.0.options)
4267                .await
4268                .map(crate::Response::into_body)
4269        }
4270
4271        /// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
4272        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4273            self.0.request.name = v.into();
4274            self
4275        }
4276    }
4277
4278    #[doc(hidden)]
4279    impl crate::RequestBuilder for GetOperation {
4280        fn request_options(&mut self) -> &mut crate::RequestOptions {
4281            &mut self.0.options
4282        }
4283    }
4284
4285    /// The request builder for [ConversationalSearchService::cancel_operation][crate::client::ConversationalSearchService::cancel_operation] calls.
4286    ///
4287    /// # Example
4288    /// ```
4289    /// # use google_cloud_discoveryengine_v1::builder::conversational_search_service::CancelOperation;
4290    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
4291    ///
4292    /// let builder = prepare_request_builder();
4293    /// let response = builder.send().await?;
4294    /// # Ok(()) }
4295    ///
4296    /// fn prepare_request_builder() -> CancelOperation {
4297    ///   # panic!();
4298    ///   // ... details omitted ...
4299    /// }
4300    /// ```
4301    #[derive(Clone, Debug)]
4302    pub struct CancelOperation(
4303        RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
4304    );
4305
4306    impl CancelOperation {
4307        pub(crate) fn new(
4308            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
4309        ) -> Self {
4310            Self(RequestBuilder::new(stub))
4311        }
4312
4313        /// Sets the full request, replacing any prior values.
4314        pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
4315            mut self,
4316            v: V,
4317        ) -> Self {
4318            self.0.request = v.into();
4319            self
4320        }
4321
4322        /// Sets all the options, replacing any prior values.
4323        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4324            self.0.options = v.into();
4325            self
4326        }
4327
4328        /// Sends the request.
4329        pub async fn send(self) -> Result<()> {
4330            (*self.0.stub)
4331                .cancel_operation(self.0.request, self.0.options)
4332                .await
4333                .map(crate::Response::into_body)
4334        }
4335
4336        /// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::name].
4337        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4338            self.0.request.name = v.into();
4339            self
4340        }
4341    }
4342
4343    #[doc(hidden)]
4344    impl crate::RequestBuilder for CancelOperation {
4345        fn request_options(&mut self) -> &mut crate::RequestOptions {
4346            &mut self.0.options
4347        }
4348    }
4349}
4350
4351#[cfg(feature = "data-store-service")]
4352#[cfg_attr(docsrs, doc(cfg(feature = "data-store-service")))]
4353pub mod data_store_service {
4354    use crate::Result;
4355
4356    /// A builder for [DataStoreService][crate::client::DataStoreService].
4357    ///
4358    /// ```
4359    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
4360    /// # use google_cloud_discoveryengine_v1::*;
4361    /// # use builder::data_store_service::ClientBuilder;
4362    /// # use client::DataStoreService;
4363    /// let builder : ClientBuilder = DataStoreService::builder();
4364    /// let client = builder
4365    ///     .with_endpoint("https://discoveryengine.googleapis.com")
4366    ///     .build().await?;
4367    /// # Ok(()) }
4368    /// ```
4369    pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
4370
4371    pub(crate) mod client {
4372        use super::super::super::client::DataStoreService;
4373        pub struct Factory;
4374        impl crate::ClientFactory for Factory {
4375            type Client = DataStoreService;
4376            type Credentials = gaxi::options::Credentials;
4377            async fn build(
4378                self,
4379                config: gaxi::options::ClientConfig,
4380            ) -> crate::ClientBuilderResult<Self::Client> {
4381                Self::Client::new(config).await
4382            }
4383        }
4384    }
4385
4386    /// Common implementation for [crate::client::DataStoreService] request builders.
4387    #[derive(Clone, Debug)]
4388    pub(crate) struct RequestBuilder<R: std::default::Default> {
4389        stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
4390        request: R,
4391        options: crate::RequestOptions,
4392    }
4393
4394    impl<R> RequestBuilder<R>
4395    where
4396        R: std::default::Default,
4397    {
4398        pub(crate) fn new(
4399            stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
4400        ) -> Self {
4401            Self {
4402                stub,
4403                request: R::default(),
4404                options: crate::RequestOptions::default(),
4405            }
4406        }
4407    }
4408
4409    /// The request builder for [DataStoreService::create_data_store][crate::client::DataStoreService::create_data_store] calls.
4410    ///
4411    /// # Example
4412    /// ```
4413    /// # use google_cloud_discoveryengine_v1::builder::data_store_service::CreateDataStore;
4414    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
4415    /// use google_cloud_lro::Poller;
4416    ///
4417    /// let builder = prepare_request_builder();
4418    /// let response = builder.poller().until_done().await?;
4419    /// # Ok(()) }
4420    ///
4421    /// fn prepare_request_builder() -> CreateDataStore {
4422    ///   # panic!();
4423    ///   // ... details omitted ...
4424    /// }
4425    /// ```
4426    #[derive(Clone, Debug)]
4427    pub struct CreateDataStore(RequestBuilder<crate::model::CreateDataStoreRequest>);
4428
4429    impl CreateDataStore {
4430        pub(crate) fn new(
4431            stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
4432        ) -> Self {
4433            Self(RequestBuilder::new(stub))
4434        }
4435
4436        /// Sets the full request, replacing any prior values.
4437        pub fn with_request<V: Into<crate::model::CreateDataStoreRequest>>(mut self, v: V) -> Self {
4438            self.0.request = v.into();
4439            self
4440        }
4441
4442        /// Sets all the options, replacing any prior values.
4443        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4444            self.0.options = v.into();
4445            self
4446        }
4447
4448        /// Sends the request.
4449        ///
4450        /// # Long running operations
4451        ///
4452        /// This starts, but does not poll, a longrunning operation. More information
4453        /// on [create_data_store][crate::client::DataStoreService::create_data_store].
4454        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
4455            (*self.0.stub)
4456                .create_data_store(self.0.request, self.0.options)
4457                .await
4458                .map(crate::Response::into_body)
4459        }
4460
4461        /// Creates a [Poller][google_cloud_lro::Poller] to work with `create_data_store`.
4462        pub fn poller(
4463            self,
4464        ) -> impl google_cloud_lro::Poller<crate::model::DataStore, crate::model::CreateDataStoreMetadata>
4465        {
4466            type Operation = google_cloud_lro::internal::Operation<
4467                crate::model::DataStore,
4468                crate::model::CreateDataStoreMetadata,
4469            >;
4470            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
4471            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
4472
4473            let stub = self.0.stub.clone();
4474            let mut options = self.0.options.clone();
4475            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
4476            let query = move |name| {
4477                let stub = stub.clone();
4478                let options = options.clone();
4479                async {
4480                    let op = GetOperation::new(stub)
4481                        .set_name(name)
4482                        .with_options(options)
4483                        .send()
4484                        .await?;
4485                    Ok(Operation::new(op))
4486                }
4487            };
4488
4489            let start = move || async {
4490                let op = self.send().await?;
4491                Ok(Operation::new(op))
4492            };
4493
4494            google_cloud_lro::internal::new_poller(
4495                polling_error_policy,
4496                polling_backoff_policy,
4497                start,
4498                query,
4499            )
4500        }
4501
4502        /// Sets the value of [parent][crate::model::CreateDataStoreRequest::parent].
4503        ///
4504        /// This is a **required** field for requests.
4505        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
4506            self.0.request.parent = v.into();
4507            self
4508        }
4509
4510        /// Sets the value of [data_store][crate::model::CreateDataStoreRequest::data_store].
4511        ///
4512        /// This is a **required** field for requests.
4513        pub fn set_data_store<T>(mut self, v: T) -> Self
4514        where
4515            T: std::convert::Into<crate::model::DataStore>,
4516        {
4517            self.0.request.data_store = std::option::Option::Some(v.into());
4518            self
4519        }
4520
4521        /// Sets or clears the value of [data_store][crate::model::CreateDataStoreRequest::data_store].
4522        ///
4523        /// This is a **required** field for requests.
4524        pub fn set_or_clear_data_store<T>(mut self, v: std::option::Option<T>) -> Self
4525        where
4526            T: std::convert::Into<crate::model::DataStore>,
4527        {
4528            self.0.request.data_store = v.map(|x| x.into());
4529            self
4530        }
4531
4532        /// Sets the value of [data_store_id][crate::model::CreateDataStoreRequest::data_store_id].
4533        ///
4534        /// This is a **required** field for requests.
4535        pub fn set_data_store_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
4536            self.0.request.data_store_id = v.into();
4537            self
4538        }
4539
4540        /// Sets the value of [create_advanced_site_search][crate::model::CreateDataStoreRequest::create_advanced_site_search].
4541        pub fn set_create_advanced_site_search<T: Into<bool>>(mut self, v: T) -> Self {
4542            self.0.request.create_advanced_site_search = v.into();
4543            self
4544        }
4545
4546        /// Sets the value of [skip_default_schema_creation][crate::model::CreateDataStoreRequest::skip_default_schema_creation].
4547        pub fn set_skip_default_schema_creation<T: Into<bool>>(mut self, v: T) -> Self {
4548            self.0.request.skip_default_schema_creation = v.into();
4549            self
4550        }
4551
4552        /// Sets the value of [cmek_options][crate::model::CreateDataStoreRequest::cmek_options].
4553        ///
4554        /// Note that all the setters affecting `cmek_options` are
4555        /// mutually exclusive.
4556        pub fn set_cmek_options<
4557            T: Into<Option<crate::model::create_data_store_request::CmekOptions>>,
4558        >(
4559            mut self,
4560            v: T,
4561        ) -> Self {
4562            self.0.request.cmek_options = v.into();
4563            self
4564        }
4565
4566        /// Sets the value of [cmek_options][crate::model::CreateDataStoreRequest::cmek_options]
4567        /// to hold a `CmekConfigName`.
4568        ///
4569        /// Note that all the setters affecting `cmek_options` are
4570        /// mutually exclusive.
4571        pub fn set_cmek_config_name<T: std::convert::Into<std::string::String>>(
4572            mut self,
4573            v: T,
4574        ) -> Self {
4575            self.0.request = self.0.request.set_cmek_config_name(v);
4576            self
4577        }
4578
4579        /// Sets the value of [cmek_options][crate::model::CreateDataStoreRequest::cmek_options]
4580        /// to hold a `DisableCmek`.
4581        ///
4582        /// Note that all the setters affecting `cmek_options` are
4583        /// mutually exclusive.
4584        pub fn set_disable_cmek<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4585            self.0.request = self.0.request.set_disable_cmek(v);
4586            self
4587        }
4588    }
4589
4590    #[doc(hidden)]
4591    impl crate::RequestBuilder for CreateDataStore {
4592        fn request_options(&mut self) -> &mut crate::RequestOptions {
4593            &mut self.0.options
4594        }
4595    }
4596
4597    /// The request builder for [DataStoreService::get_data_store][crate::client::DataStoreService::get_data_store] calls.
4598    ///
4599    /// # Example
4600    /// ```
4601    /// # use google_cloud_discoveryengine_v1::builder::data_store_service::GetDataStore;
4602    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
4603    ///
4604    /// let builder = prepare_request_builder();
4605    /// let response = builder.send().await?;
4606    /// # Ok(()) }
4607    ///
4608    /// fn prepare_request_builder() -> GetDataStore {
4609    ///   # panic!();
4610    ///   // ... details omitted ...
4611    /// }
4612    /// ```
4613    #[derive(Clone, Debug)]
4614    pub struct GetDataStore(RequestBuilder<crate::model::GetDataStoreRequest>);
4615
4616    impl GetDataStore {
4617        pub(crate) fn new(
4618            stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
4619        ) -> Self {
4620            Self(RequestBuilder::new(stub))
4621        }
4622
4623        /// Sets the full request, replacing any prior values.
4624        pub fn with_request<V: Into<crate::model::GetDataStoreRequest>>(mut self, v: V) -> Self {
4625            self.0.request = v.into();
4626            self
4627        }
4628
4629        /// Sets all the options, replacing any prior values.
4630        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4631            self.0.options = v.into();
4632            self
4633        }
4634
4635        /// Sends the request.
4636        pub async fn send(self) -> Result<crate::model::DataStore> {
4637            (*self.0.stub)
4638                .get_data_store(self.0.request, self.0.options)
4639                .await
4640                .map(crate::Response::into_body)
4641        }
4642
4643        /// Sets the value of [name][crate::model::GetDataStoreRequest::name].
4644        ///
4645        /// This is a **required** field for requests.
4646        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4647            self.0.request.name = v.into();
4648            self
4649        }
4650    }
4651
4652    #[doc(hidden)]
4653    impl crate::RequestBuilder for GetDataStore {
4654        fn request_options(&mut self) -> &mut crate::RequestOptions {
4655            &mut self.0.options
4656        }
4657    }
4658
4659    /// The request builder for [DataStoreService::list_data_stores][crate::client::DataStoreService::list_data_stores] calls.
4660    ///
4661    /// # Example
4662    /// ```
4663    /// # use google_cloud_discoveryengine_v1::builder::data_store_service::ListDataStores;
4664    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
4665    /// use google_cloud_gax::paginator::ItemPaginator;
4666    ///
4667    /// let builder = prepare_request_builder();
4668    /// let mut items = builder.by_item();
4669    /// while let Some(result) = items.next().await {
4670    ///   let item = result?;
4671    /// }
4672    /// # Ok(()) }
4673    ///
4674    /// fn prepare_request_builder() -> ListDataStores {
4675    ///   # panic!();
4676    ///   // ... details omitted ...
4677    /// }
4678    /// ```
4679    #[derive(Clone, Debug)]
4680    pub struct ListDataStores(RequestBuilder<crate::model::ListDataStoresRequest>);
4681
4682    impl ListDataStores {
4683        pub(crate) fn new(
4684            stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
4685        ) -> Self {
4686            Self(RequestBuilder::new(stub))
4687        }
4688
4689        /// Sets the full request, replacing any prior values.
4690        pub fn with_request<V: Into<crate::model::ListDataStoresRequest>>(mut self, v: V) -> Self {
4691            self.0.request = v.into();
4692            self
4693        }
4694
4695        /// Sets all the options, replacing any prior values.
4696        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4697            self.0.options = v.into();
4698            self
4699        }
4700
4701        /// Sends the request.
4702        pub async fn send(self) -> Result<crate::model::ListDataStoresResponse> {
4703            (*self.0.stub)
4704                .list_data_stores(self.0.request, self.0.options)
4705                .await
4706                .map(crate::Response::into_body)
4707        }
4708
4709        /// Streams each page in the collection.
4710        pub fn by_page(
4711            self,
4712        ) -> impl google_cloud_gax::paginator::Paginator<
4713            crate::model::ListDataStoresResponse,
4714            crate::Error,
4715        > {
4716            use std::clone::Clone;
4717            let token = self.0.request.page_token.clone();
4718            let execute = move |token: String| {
4719                let mut builder = self.clone();
4720                builder.0.request = builder.0.request.set_page_token(token);
4721                builder.send()
4722            };
4723            google_cloud_gax::paginator::internal::new_paginator(token, execute)
4724        }
4725
4726        /// Streams each item in the collection.
4727        pub fn by_item(
4728            self,
4729        ) -> impl google_cloud_gax::paginator::ItemPaginator<
4730            crate::model::ListDataStoresResponse,
4731            crate::Error,
4732        > {
4733            use google_cloud_gax::paginator::Paginator;
4734            self.by_page().items()
4735        }
4736
4737        /// Sets the value of [parent][crate::model::ListDataStoresRequest::parent].
4738        ///
4739        /// This is a **required** field for requests.
4740        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
4741            self.0.request.parent = v.into();
4742            self
4743        }
4744
4745        /// Sets the value of [page_size][crate::model::ListDataStoresRequest::page_size].
4746        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
4747            self.0.request.page_size = v.into();
4748            self
4749        }
4750
4751        /// Sets the value of [page_token][crate::model::ListDataStoresRequest::page_token].
4752        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
4753            self.0.request.page_token = v.into();
4754            self
4755        }
4756
4757        /// Sets the value of [filter][crate::model::ListDataStoresRequest::filter].
4758        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
4759            self.0.request.filter = v.into();
4760            self
4761        }
4762    }
4763
4764    #[doc(hidden)]
4765    impl crate::RequestBuilder for ListDataStores {
4766        fn request_options(&mut self) -> &mut crate::RequestOptions {
4767            &mut self.0.options
4768        }
4769    }
4770
4771    /// The request builder for [DataStoreService::delete_data_store][crate::client::DataStoreService::delete_data_store] calls.
4772    ///
4773    /// # Example
4774    /// ```
4775    /// # use google_cloud_discoveryengine_v1::builder::data_store_service::DeleteDataStore;
4776    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
4777    /// use google_cloud_lro::Poller;
4778    ///
4779    /// let builder = prepare_request_builder();
4780    /// let response = builder.poller().until_done().await?;
4781    /// # Ok(()) }
4782    ///
4783    /// fn prepare_request_builder() -> DeleteDataStore {
4784    ///   # panic!();
4785    ///   // ... details omitted ...
4786    /// }
4787    /// ```
4788    #[derive(Clone, Debug)]
4789    pub struct DeleteDataStore(RequestBuilder<crate::model::DeleteDataStoreRequest>);
4790
4791    impl DeleteDataStore {
4792        pub(crate) fn new(
4793            stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
4794        ) -> Self {
4795            Self(RequestBuilder::new(stub))
4796        }
4797
4798        /// Sets the full request, replacing any prior values.
4799        pub fn with_request<V: Into<crate::model::DeleteDataStoreRequest>>(mut self, v: V) -> Self {
4800            self.0.request = v.into();
4801            self
4802        }
4803
4804        /// Sets all the options, replacing any prior values.
4805        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4806            self.0.options = v.into();
4807            self
4808        }
4809
4810        /// Sends the request.
4811        ///
4812        /// # Long running operations
4813        ///
4814        /// This starts, but does not poll, a longrunning operation. More information
4815        /// on [delete_data_store][crate::client::DataStoreService::delete_data_store].
4816        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
4817            (*self.0.stub)
4818                .delete_data_store(self.0.request, self.0.options)
4819                .await
4820                .map(crate::Response::into_body)
4821        }
4822
4823        /// Creates a [Poller][google_cloud_lro::Poller] to work with `delete_data_store`.
4824        pub fn poller(
4825            self,
4826        ) -> impl google_cloud_lro::Poller<(), crate::model::DeleteDataStoreMetadata> {
4827            type Operation = google_cloud_lro::internal::Operation<
4828                wkt::Empty,
4829                crate::model::DeleteDataStoreMetadata,
4830            >;
4831            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
4832            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
4833
4834            let stub = self.0.stub.clone();
4835            let mut options = self.0.options.clone();
4836            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
4837            let query = move |name| {
4838                let stub = stub.clone();
4839                let options = options.clone();
4840                async {
4841                    let op = GetOperation::new(stub)
4842                        .set_name(name)
4843                        .with_options(options)
4844                        .send()
4845                        .await?;
4846                    Ok(Operation::new(op))
4847                }
4848            };
4849
4850            let start = move || async {
4851                let op = self.send().await?;
4852                Ok(Operation::new(op))
4853            };
4854
4855            google_cloud_lro::internal::new_unit_response_poller(
4856                polling_error_policy,
4857                polling_backoff_policy,
4858                start,
4859                query,
4860            )
4861        }
4862
4863        /// Sets the value of [name][crate::model::DeleteDataStoreRequest::name].
4864        ///
4865        /// This is a **required** field for requests.
4866        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4867            self.0.request.name = v.into();
4868            self
4869        }
4870    }
4871
4872    #[doc(hidden)]
4873    impl crate::RequestBuilder for DeleteDataStore {
4874        fn request_options(&mut self) -> &mut crate::RequestOptions {
4875            &mut self.0.options
4876        }
4877    }
4878
4879    /// The request builder for [DataStoreService::update_data_store][crate::client::DataStoreService::update_data_store] calls.
4880    ///
4881    /// # Example
4882    /// ```
4883    /// # use google_cloud_discoveryengine_v1::builder::data_store_service::UpdateDataStore;
4884    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
4885    ///
4886    /// let builder = prepare_request_builder();
4887    /// let response = builder.send().await?;
4888    /// # Ok(()) }
4889    ///
4890    /// fn prepare_request_builder() -> UpdateDataStore {
4891    ///   # panic!();
4892    ///   // ... details omitted ...
4893    /// }
4894    /// ```
4895    #[derive(Clone, Debug)]
4896    pub struct UpdateDataStore(RequestBuilder<crate::model::UpdateDataStoreRequest>);
4897
4898    impl UpdateDataStore {
4899        pub(crate) fn new(
4900            stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
4901        ) -> Self {
4902            Self(RequestBuilder::new(stub))
4903        }
4904
4905        /// Sets the full request, replacing any prior values.
4906        pub fn with_request<V: Into<crate::model::UpdateDataStoreRequest>>(mut self, v: V) -> Self {
4907            self.0.request = v.into();
4908            self
4909        }
4910
4911        /// Sets all the options, replacing any prior values.
4912        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4913            self.0.options = v.into();
4914            self
4915        }
4916
4917        /// Sends the request.
4918        pub async fn send(self) -> Result<crate::model::DataStore> {
4919            (*self.0.stub)
4920                .update_data_store(self.0.request, self.0.options)
4921                .await
4922                .map(crate::Response::into_body)
4923        }
4924
4925        /// Sets the value of [data_store][crate::model::UpdateDataStoreRequest::data_store].
4926        ///
4927        /// This is a **required** field for requests.
4928        pub fn set_data_store<T>(mut self, v: T) -> Self
4929        where
4930            T: std::convert::Into<crate::model::DataStore>,
4931        {
4932            self.0.request.data_store = std::option::Option::Some(v.into());
4933            self
4934        }
4935
4936        /// Sets or clears the value of [data_store][crate::model::UpdateDataStoreRequest::data_store].
4937        ///
4938        /// This is a **required** field for requests.
4939        pub fn set_or_clear_data_store<T>(mut self, v: std::option::Option<T>) -> Self
4940        where
4941            T: std::convert::Into<crate::model::DataStore>,
4942        {
4943            self.0.request.data_store = v.map(|x| x.into());
4944            self
4945        }
4946
4947        /// Sets the value of [update_mask][crate::model::UpdateDataStoreRequest::update_mask].
4948        pub fn set_update_mask<T>(mut self, v: T) -> Self
4949        where
4950            T: std::convert::Into<wkt::FieldMask>,
4951        {
4952            self.0.request.update_mask = std::option::Option::Some(v.into());
4953            self
4954        }
4955
4956        /// Sets or clears the value of [update_mask][crate::model::UpdateDataStoreRequest::update_mask].
4957        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
4958        where
4959            T: std::convert::Into<wkt::FieldMask>,
4960        {
4961            self.0.request.update_mask = v.map(|x| x.into());
4962            self
4963        }
4964    }
4965
4966    #[doc(hidden)]
4967    impl crate::RequestBuilder for UpdateDataStore {
4968        fn request_options(&mut self) -> &mut crate::RequestOptions {
4969            &mut self.0.options
4970        }
4971    }
4972
4973    /// The request builder for [DataStoreService::list_operations][crate::client::DataStoreService::list_operations] calls.
4974    ///
4975    /// # Example
4976    /// ```
4977    /// # use google_cloud_discoveryengine_v1::builder::data_store_service::ListOperations;
4978    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
4979    /// use google_cloud_gax::paginator::ItemPaginator;
4980    ///
4981    /// let builder = prepare_request_builder();
4982    /// let mut items = builder.by_item();
4983    /// while let Some(result) = items.next().await {
4984    ///   let item = result?;
4985    /// }
4986    /// # Ok(()) }
4987    ///
4988    /// fn prepare_request_builder() -> ListOperations {
4989    ///   # panic!();
4990    ///   // ... details omitted ...
4991    /// }
4992    /// ```
4993    #[derive(Clone, Debug)]
4994    pub struct ListOperations(
4995        RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
4996    );
4997
4998    impl ListOperations {
4999        pub(crate) fn new(
5000            stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
5001        ) -> Self {
5002            Self(RequestBuilder::new(stub))
5003        }
5004
5005        /// Sets the full request, replacing any prior values.
5006        pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
5007            mut self,
5008            v: V,
5009        ) -> Self {
5010            self.0.request = v.into();
5011            self
5012        }
5013
5014        /// Sets all the options, replacing any prior values.
5015        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5016            self.0.options = v.into();
5017            self
5018        }
5019
5020        /// Sends the request.
5021        pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
5022            (*self.0.stub)
5023                .list_operations(self.0.request, self.0.options)
5024                .await
5025                .map(crate::Response::into_body)
5026        }
5027
5028        /// Streams each page in the collection.
5029        pub fn by_page(
5030            self,
5031        ) -> impl google_cloud_gax::paginator::Paginator<
5032            google_cloud_longrunning::model::ListOperationsResponse,
5033            crate::Error,
5034        > {
5035            use std::clone::Clone;
5036            let token = self.0.request.page_token.clone();
5037            let execute = move |token: String| {
5038                let mut builder = self.clone();
5039                builder.0.request = builder.0.request.set_page_token(token);
5040                builder.send()
5041            };
5042            google_cloud_gax::paginator::internal::new_paginator(token, execute)
5043        }
5044
5045        /// Streams each item in the collection.
5046        pub fn by_item(
5047            self,
5048        ) -> impl google_cloud_gax::paginator::ItemPaginator<
5049            google_cloud_longrunning::model::ListOperationsResponse,
5050            crate::Error,
5051        > {
5052            use google_cloud_gax::paginator::Paginator;
5053            self.by_page().items()
5054        }
5055
5056        /// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
5057        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5058            self.0.request.name = v.into();
5059            self
5060        }
5061
5062        /// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::filter].
5063        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
5064            self.0.request.filter = v.into();
5065            self
5066        }
5067
5068        /// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
5069        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
5070            self.0.request.page_size = v.into();
5071            self
5072        }
5073
5074        /// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
5075        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
5076            self.0.request.page_token = v.into();
5077            self
5078        }
5079
5080        /// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
5081        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
5082            self.0.request.return_partial_success = v.into();
5083            self
5084        }
5085    }
5086
5087    #[doc(hidden)]
5088    impl crate::RequestBuilder for ListOperations {
5089        fn request_options(&mut self) -> &mut crate::RequestOptions {
5090            &mut self.0.options
5091        }
5092    }
5093
5094    /// The request builder for [DataStoreService::get_operation][crate::client::DataStoreService::get_operation] calls.
5095    ///
5096    /// # Example
5097    /// ```
5098    /// # use google_cloud_discoveryengine_v1::builder::data_store_service::GetOperation;
5099    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
5100    ///
5101    /// let builder = prepare_request_builder();
5102    /// let response = builder.send().await?;
5103    /// # Ok(()) }
5104    ///
5105    /// fn prepare_request_builder() -> GetOperation {
5106    ///   # panic!();
5107    ///   // ... details omitted ...
5108    /// }
5109    /// ```
5110    #[derive(Clone, Debug)]
5111    pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
5112
5113    impl GetOperation {
5114        pub(crate) fn new(
5115            stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
5116        ) -> Self {
5117            Self(RequestBuilder::new(stub))
5118        }
5119
5120        /// Sets the full request, replacing any prior values.
5121        pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
5122            mut self,
5123            v: V,
5124        ) -> Self {
5125            self.0.request = v.into();
5126            self
5127        }
5128
5129        /// Sets all the options, replacing any prior values.
5130        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5131            self.0.options = v.into();
5132            self
5133        }
5134
5135        /// Sends the request.
5136        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
5137            (*self.0.stub)
5138                .get_operation(self.0.request, self.0.options)
5139                .await
5140                .map(crate::Response::into_body)
5141        }
5142
5143        /// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
5144        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5145            self.0.request.name = v.into();
5146            self
5147        }
5148    }
5149
5150    #[doc(hidden)]
5151    impl crate::RequestBuilder for GetOperation {
5152        fn request_options(&mut self) -> &mut crate::RequestOptions {
5153            &mut self.0.options
5154        }
5155    }
5156
5157    /// The request builder for [DataStoreService::cancel_operation][crate::client::DataStoreService::cancel_operation] calls.
5158    ///
5159    /// # Example
5160    /// ```
5161    /// # use google_cloud_discoveryengine_v1::builder::data_store_service::CancelOperation;
5162    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
5163    ///
5164    /// let builder = prepare_request_builder();
5165    /// let response = builder.send().await?;
5166    /// # Ok(()) }
5167    ///
5168    /// fn prepare_request_builder() -> CancelOperation {
5169    ///   # panic!();
5170    ///   // ... details omitted ...
5171    /// }
5172    /// ```
5173    #[derive(Clone, Debug)]
5174    pub struct CancelOperation(
5175        RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
5176    );
5177
5178    impl CancelOperation {
5179        pub(crate) fn new(
5180            stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
5181        ) -> Self {
5182            Self(RequestBuilder::new(stub))
5183        }
5184
5185        /// Sets the full request, replacing any prior values.
5186        pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
5187            mut self,
5188            v: V,
5189        ) -> Self {
5190            self.0.request = v.into();
5191            self
5192        }
5193
5194        /// Sets all the options, replacing any prior values.
5195        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5196            self.0.options = v.into();
5197            self
5198        }
5199
5200        /// Sends the request.
5201        pub async fn send(self) -> Result<()> {
5202            (*self.0.stub)
5203                .cancel_operation(self.0.request, self.0.options)
5204                .await
5205                .map(crate::Response::into_body)
5206        }
5207
5208        /// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::name].
5209        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5210            self.0.request.name = v.into();
5211            self
5212        }
5213    }
5214
5215    #[doc(hidden)]
5216    impl crate::RequestBuilder for CancelOperation {
5217        fn request_options(&mut self) -> &mut crate::RequestOptions {
5218            &mut self.0.options
5219        }
5220    }
5221}
5222
5223#[cfg(feature = "document-service")]
5224#[cfg_attr(docsrs, doc(cfg(feature = "document-service")))]
5225pub mod document_service {
5226    use crate::Result;
5227
5228    /// A builder for [DocumentService][crate::client::DocumentService].
5229    ///
5230    /// ```
5231    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
5232    /// # use google_cloud_discoveryengine_v1::*;
5233    /// # use builder::document_service::ClientBuilder;
5234    /// # use client::DocumentService;
5235    /// let builder : ClientBuilder = DocumentService::builder();
5236    /// let client = builder
5237    ///     .with_endpoint("https://discoveryengine.googleapis.com")
5238    ///     .build().await?;
5239    /// # Ok(()) }
5240    /// ```
5241    pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
5242
5243    pub(crate) mod client {
5244        use super::super::super::client::DocumentService;
5245        pub struct Factory;
5246        impl crate::ClientFactory for Factory {
5247            type Client = DocumentService;
5248            type Credentials = gaxi::options::Credentials;
5249            async fn build(
5250                self,
5251                config: gaxi::options::ClientConfig,
5252            ) -> crate::ClientBuilderResult<Self::Client> {
5253                Self::Client::new(config).await
5254            }
5255        }
5256    }
5257
5258    /// Common implementation for [crate::client::DocumentService] request builders.
5259    #[derive(Clone, Debug)]
5260    pub(crate) struct RequestBuilder<R: std::default::Default> {
5261        stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
5262        request: R,
5263        options: crate::RequestOptions,
5264    }
5265
5266    impl<R> RequestBuilder<R>
5267    where
5268        R: std::default::Default,
5269    {
5270        pub(crate) fn new(
5271            stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
5272        ) -> Self {
5273            Self {
5274                stub,
5275                request: R::default(),
5276                options: crate::RequestOptions::default(),
5277            }
5278        }
5279    }
5280
5281    /// The request builder for [DocumentService::get_document][crate::client::DocumentService::get_document] calls.
5282    ///
5283    /// # Example
5284    /// ```
5285    /// # use google_cloud_discoveryengine_v1::builder::document_service::GetDocument;
5286    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
5287    ///
5288    /// let builder = prepare_request_builder();
5289    /// let response = builder.send().await?;
5290    /// # Ok(()) }
5291    ///
5292    /// fn prepare_request_builder() -> GetDocument {
5293    ///   # panic!();
5294    ///   // ... details omitted ...
5295    /// }
5296    /// ```
5297    #[derive(Clone, Debug)]
5298    pub struct GetDocument(RequestBuilder<crate::model::GetDocumentRequest>);
5299
5300    impl GetDocument {
5301        pub(crate) fn new(
5302            stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
5303        ) -> Self {
5304            Self(RequestBuilder::new(stub))
5305        }
5306
5307        /// Sets the full request, replacing any prior values.
5308        pub fn with_request<V: Into<crate::model::GetDocumentRequest>>(mut self, v: V) -> Self {
5309            self.0.request = v.into();
5310            self
5311        }
5312
5313        /// Sets all the options, replacing any prior values.
5314        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5315            self.0.options = v.into();
5316            self
5317        }
5318
5319        /// Sends the request.
5320        pub async fn send(self) -> Result<crate::model::Document> {
5321            (*self.0.stub)
5322                .get_document(self.0.request, self.0.options)
5323                .await
5324                .map(crate::Response::into_body)
5325        }
5326
5327        /// Sets the value of [name][crate::model::GetDocumentRequest::name].
5328        ///
5329        /// This is a **required** field for requests.
5330        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5331            self.0.request.name = v.into();
5332            self
5333        }
5334    }
5335
5336    #[doc(hidden)]
5337    impl crate::RequestBuilder for GetDocument {
5338        fn request_options(&mut self) -> &mut crate::RequestOptions {
5339            &mut self.0.options
5340        }
5341    }
5342
5343    /// The request builder for [DocumentService::list_documents][crate::client::DocumentService::list_documents] calls.
5344    ///
5345    /// # Example
5346    /// ```
5347    /// # use google_cloud_discoveryengine_v1::builder::document_service::ListDocuments;
5348    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
5349    /// use google_cloud_gax::paginator::ItemPaginator;
5350    ///
5351    /// let builder = prepare_request_builder();
5352    /// let mut items = builder.by_item();
5353    /// while let Some(result) = items.next().await {
5354    ///   let item = result?;
5355    /// }
5356    /// # Ok(()) }
5357    ///
5358    /// fn prepare_request_builder() -> ListDocuments {
5359    ///   # panic!();
5360    ///   // ... details omitted ...
5361    /// }
5362    /// ```
5363    #[derive(Clone, Debug)]
5364    pub struct ListDocuments(RequestBuilder<crate::model::ListDocumentsRequest>);
5365
5366    impl ListDocuments {
5367        pub(crate) fn new(
5368            stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
5369        ) -> Self {
5370            Self(RequestBuilder::new(stub))
5371        }
5372
5373        /// Sets the full request, replacing any prior values.
5374        pub fn with_request<V: Into<crate::model::ListDocumentsRequest>>(mut self, v: V) -> Self {
5375            self.0.request = v.into();
5376            self
5377        }
5378
5379        /// Sets all the options, replacing any prior values.
5380        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5381            self.0.options = v.into();
5382            self
5383        }
5384
5385        /// Sends the request.
5386        pub async fn send(self) -> Result<crate::model::ListDocumentsResponse> {
5387            (*self.0.stub)
5388                .list_documents(self.0.request, self.0.options)
5389                .await
5390                .map(crate::Response::into_body)
5391        }
5392
5393        /// Streams each page in the collection.
5394        pub fn by_page(
5395            self,
5396        ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListDocumentsResponse, crate::Error>
5397        {
5398            use std::clone::Clone;
5399            let token = self.0.request.page_token.clone();
5400            let execute = move |token: String| {
5401                let mut builder = self.clone();
5402                builder.0.request = builder.0.request.set_page_token(token);
5403                builder.send()
5404            };
5405            google_cloud_gax::paginator::internal::new_paginator(token, execute)
5406        }
5407
5408        /// Streams each item in the collection.
5409        pub fn by_item(
5410            self,
5411        ) -> impl google_cloud_gax::paginator::ItemPaginator<
5412            crate::model::ListDocumentsResponse,
5413            crate::Error,
5414        > {
5415            use google_cloud_gax::paginator::Paginator;
5416            self.by_page().items()
5417        }
5418
5419        /// Sets the value of [parent][crate::model::ListDocumentsRequest::parent].
5420        ///
5421        /// This is a **required** field for requests.
5422        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
5423            self.0.request.parent = v.into();
5424            self
5425        }
5426
5427        /// Sets the value of [page_size][crate::model::ListDocumentsRequest::page_size].
5428        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
5429            self.0.request.page_size = v.into();
5430            self
5431        }
5432
5433        /// Sets the value of [page_token][crate::model::ListDocumentsRequest::page_token].
5434        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
5435            self.0.request.page_token = v.into();
5436            self
5437        }
5438    }
5439
5440    #[doc(hidden)]
5441    impl crate::RequestBuilder for ListDocuments {
5442        fn request_options(&mut self) -> &mut crate::RequestOptions {
5443            &mut self.0.options
5444        }
5445    }
5446
5447    /// The request builder for [DocumentService::create_document][crate::client::DocumentService::create_document] calls.
5448    ///
5449    /// # Example
5450    /// ```
5451    /// # use google_cloud_discoveryengine_v1::builder::document_service::CreateDocument;
5452    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
5453    ///
5454    /// let builder = prepare_request_builder();
5455    /// let response = builder.send().await?;
5456    /// # Ok(()) }
5457    ///
5458    /// fn prepare_request_builder() -> CreateDocument {
5459    ///   # panic!();
5460    ///   // ... details omitted ...
5461    /// }
5462    /// ```
5463    #[derive(Clone, Debug)]
5464    pub struct CreateDocument(RequestBuilder<crate::model::CreateDocumentRequest>);
5465
5466    impl CreateDocument {
5467        pub(crate) fn new(
5468            stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
5469        ) -> Self {
5470            Self(RequestBuilder::new(stub))
5471        }
5472
5473        /// Sets the full request, replacing any prior values.
5474        pub fn with_request<V: Into<crate::model::CreateDocumentRequest>>(mut self, v: V) -> Self {
5475            self.0.request = v.into();
5476            self
5477        }
5478
5479        /// Sets all the options, replacing any prior values.
5480        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5481            self.0.options = v.into();
5482            self
5483        }
5484
5485        /// Sends the request.
5486        pub async fn send(self) -> Result<crate::model::Document> {
5487            (*self.0.stub)
5488                .create_document(self.0.request, self.0.options)
5489                .await
5490                .map(crate::Response::into_body)
5491        }
5492
5493        /// Sets the value of [parent][crate::model::CreateDocumentRequest::parent].
5494        ///
5495        /// This is a **required** field for requests.
5496        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
5497            self.0.request.parent = v.into();
5498            self
5499        }
5500
5501        /// Sets the value of [document][crate::model::CreateDocumentRequest::document].
5502        ///
5503        /// This is a **required** field for requests.
5504        pub fn set_document<T>(mut self, v: T) -> Self
5505        where
5506            T: std::convert::Into<crate::model::Document>,
5507        {
5508            self.0.request.document = std::option::Option::Some(v.into());
5509            self
5510        }
5511
5512        /// Sets or clears the value of [document][crate::model::CreateDocumentRequest::document].
5513        ///
5514        /// This is a **required** field for requests.
5515        pub fn set_or_clear_document<T>(mut self, v: std::option::Option<T>) -> Self
5516        where
5517            T: std::convert::Into<crate::model::Document>,
5518        {
5519            self.0.request.document = v.map(|x| x.into());
5520            self
5521        }
5522
5523        /// Sets the value of [document_id][crate::model::CreateDocumentRequest::document_id].
5524        ///
5525        /// This is a **required** field for requests.
5526        pub fn set_document_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
5527            self.0.request.document_id = v.into();
5528            self
5529        }
5530    }
5531
5532    #[doc(hidden)]
5533    impl crate::RequestBuilder for CreateDocument {
5534        fn request_options(&mut self) -> &mut crate::RequestOptions {
5535            &mut self.0.options
5536        }
5537    }
5538
5539    /// The request builder for [DocumentService::update_document][crate::client::DocumentService::update_document] calls.
5540    ///
5541    /// # Example
5542    /// ```
5543    /// # use google_cloud_discoveryengine_v1::builder::document_service::UpdateDocument;
5544    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
5545    ///
5546    /// let builder = prepare_request_builder();
5547    /// let response = builder.send().await?;
5548    /// # Ok(()) }
5549    ///
5550    /// fn prepare_request_builder() -> UpdateDocument {
5551    ///   # panic!();
5552    ///   // ... details omitted ...
5553    /// }
5554    /// ```
5555    #[derive(Clone, Debug)]
5556    pub struct UpdateDocument(RequestBuilder<crate::model::UpdateDocumentRequest>);
5557
5558    impl UpdateDocument {
5559        pub(crate) fn new(
5560            stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
5561        ) -> Self {
5562            Self(RequestBuilder::new(stub))
5563        }
5564
5565        /// Sets the full request, replacing any prior values.
5566        pub fn with_request<V: Into<crate::model::UpdateDocumentRequest>>(mut self, v: V) -> Self {
5567            self.0.request = v.into();
5568            self
5569        }
5570
5571        /// Sets all the options, replacing any prior values.
5572        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5573            self.0.options = v.into();
5574            self
5575        }
5576
5577        /// Sends the request.
5578        pub async fn send(self) -> Result<crate::model::Document> {
5579            (*self.0.stub)
5580                .update_document(self.0.request, self.0.options)
5581                .await
5582                .map(crate::Response::into_body)
5583        }
5584
5585        /// Sets the value of [document][crate::model::UpdateDocumentRequest::document].
5586        ///
5587        /// This is a **required** field for requests.
5588        pub fn set_document<T>(mut self, v: T) -> Self
5589        where
5590            T: std::convert::Into<crate::model::Document>,
5591        {
5592            self.0.request.document = std::option::Option::Some(v.into());
5593            self
5594        }
5595
5596        /// Sets or clears the value of [document][crate::model::UpdateDocumentRequest::document].
5597        ///
5598        /// This is a **required** field for requests.
5599        pub fn set_or_clear_document<T>(mut self, v: std::option::Option<T>) -> Self
5600        where
5601            T: std::convert::Into<crate::model::Document>,
5602        {
5603            self.0.request.document = v.map(|x| x.into());
5604            self
5605        }
5606
5607        /// Sets the value of [allow_missing][crate::model::UpdateDocumentRequest::allow_missing].
5608        pub fn set_allow_missing<T: Into<bool>>(mut self, v: T) -> Self {
5609            self.0.request.allow_missing = v.into();
5610            self
5611        }
5612
5613        /// Sets the value of [update_mask][crate::model::UpdateDocumentRequest::update_mask].
5614        pub fn set_update_mask<T>(mut self, v: T) -> Self
5615        where
5616            T: std::convert::Into<wkt::FieldMask>,
5617        {
5618            self.0.request.update_mask = std::option::Option::Some(v.into());
5619            self
5620        }
5621
5622        /// Sets or clears the value of [update_mask][crate::model::UpdateDocumentRequest::update_mask].
5623        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
5624        where
5625            T: std::convert::Into<wkt::FieldMask>,
5626        {
5627            self.0.request.update_mask = v.map(|x| x.into());
5628            self
5629        }
5630    }
5631
5632    #[doc(hidden)]
5633    impl crate::RequestBuilder for UpdateDocument {
5634        fn request_options(&mut self) -> &mut crate::RequestOptions {
5635            &mut self.0.options
5636        }
5637    }
5638
5639    /// The request builder for [DocumentService::delete_document][crate::client::DocumentService::delete_document] calls.
5640    ///
5641    /// # Example
5642    /// ```
5643    /// # use google_cloud_discoveryengine_v1::builder::document_service::DeleteDocument;
5644    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
5645    ///
5646    /// let builder = prepare_request_builder();
5647    /// let response = builder.send().await?;
5648    /// # Ok(()) }
5649    ///
5650    /// fn prepare_request_builder() -> DeleteDocument {
5651    ///   # panic!();
5652    ///   // ... details omitted ...
5653    /// }
5654    /// ```
5655    #[derive(Clone, Debug)]
5656    pub struct DeleteDocument(RequestBuilder<crate::model::DeleteDocumentRequest>);
5657
5658    impl DeleteDocument {
5659        pub(crate) fn new(
5660            stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
5661        ) -> Self {
5662            Self(RequestBuilder::new(stub))
5663        }
5664
5665        /// Sets the full request, replacing any prior values.
5666        pub fn with_request<V: Into<crate::model::DeleteDocumentRequest>>(mut self, v: V) -> Self {
5667            self.0.request = v.into();
5668            self
5669        }
5670
5671        /// Sets all the options, replacing any prior values.
5672        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5673            self.0.options = v.into();
5674            self
5675        }
5676
5677        /// Sends the request.
5678        pub async fn send(self) -> Result<()> {
5679            (*self.0.stub)
5680                .delete_document(self.0.request, self.0.options)
5681                .await
5682                .map(crate::Response::into_body)
5683        }
5684
5685        /// Sets the value of [name][crate::model::DeleteDocumentRequest::name].
5686        ///
5687        /// This is a **required** field for requests.
5688        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5689            self.0.request.name = v.into();
5690            self
5691        }
5692    }
5693
5694    #[doc(hidden)]
5695    impl crate::RequestBuilder for DeleteDocument {
5696        fn request_options(&mut self) -> &mut crate::RequestOptions {
5697            &mut self.0.options
5698        }
5699    }
5700
5701    /// The request builder for [DocumentService::import_documents][crate::client::DocumentService::import_documents] calls.
5702    ///
5703    /// # Example
5704    /// ```
5705    /// # use google_cloud_discoveryengine_v1::builder::document_service::ImportDocuments;
5706    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
5707    /// use google_cloud_lro::Poller;
5708    ///
5709    /// let builder = prepare_request_builder();
5710    /// let response = builder.poller().until_done().await?;
5711    /// # Ok(()) }
5712    ///
5713    /// fn prepare_request_builder() -> ImportDocuments {
5714    ///   # panic!();
5715    ///   // ... details omitted ...
5716    /// }
5717    /// ```
5718    #[derive(Clone, Debug)]
5719    pub struct ImportDocuments(RequestBuilder<crate::model::ImportDocumentsRequest>);
5720
5721    impl ImportDocuments {
5722        pub(crate) fn new(
5723            stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
5724        ) -> Self {
5725            Self(RequestBuilder::new(stub))
5726        }
5727
5728        /// Sets the full request, replacing any prior values.
5729        pub fn with_request<V: Into<crate::model::ImportDocumentsRequest>>(mut self, v: V) -> Self {
5730            self.0.request = v.into();
5731            self
5732        }
5733
5734        /// Sets all the options, replacing any prior values.
5735        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5736            self.0.options = v.into();
5737            self
5738        }
5739
5740        /// Sends the request.
5741        ///
5742        /// # Long running operations
5743        ///
5744        /// This starts, but does not poll, a longrunning operation. More information
5745        /// on [import_documents][crate::client::DocumentService::import_documents].
5746        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
5747            (*self.0.stub)
5748                .import_documents(self.0.request, self.0.options)
5749                .await
5750                .map(crate::Response::into_body)
5751        }
5752
5753        /// Creates a [Poller][google_cloud_lro::Poller] to work with `import_documents`.
5754        pub fn poller(
5755            self,
5756        ) -> impl google_cloud_lro::Poller<
5757            crate::model::ImportDocumentsResponse,
5758            crate::model::ImportDocumentsMetadata,
5759        > {
5760            type Operation = google_cloud_lro::internal::Operation<
5761                crate::model::ImportDocumentsResponse,
5762                crate::model::ImportDocumentsMetadata,
5763            >;
5764            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
5765            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
5766
5767            let stub = self.0.stub.clone();
5768            let mut options = self.0.options.clone();
5769            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
5770            let query = move |name| {
5771                let stub = stub.clone();
5772                let options = options.clone();
5773                async {
5774                    let op = GetOperation::new(stub)
5775                        .set_name(name)
5776                        .with_options(options)
5777                        .send()
5778                        .await?;
5779                    Ok(Operation::new(op))
5780                }
5781            };
5782
5783            let start = move || async {
5784                let op = self.send().await?;
5785                Ok(Operation::new(op))
5786            };
5787
5788            google_cloud_lro::internal::new_poller(
5789                polling_error_policy,
5790                polling_backoff_policy,
5791                start,
5792                query,
5793            )
5794        }
5795
5796        /// Sets the value of [parent][crate::model::ImportDocumentsRequest::parent].
5797        ///
5798        /// This is a **required** field for requests.
5799        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
5800            self.0.request.parent = v.into();
5801            self
5802        }
5803
5804        /// Sets the value of [error_config][crate::model::ImportDocumentsRequest::error_config].
5805        pub fn set_error_config<T>(mut self, v: T) -> Self
5806        where
5807            T: std::convert::Into<crate::model::ImportErrorConfig>,
5808        {
5809            self.0.request.error_config = std::option::Option::Some(v.into());
5810            self
5811        }
5812
5813        /// Sets or clears the value of [error_config][crate::model::ImportDocumentsRequest::error_config].
5814        pub fn set_or_clear_error_config<T>(mut self, v: std::option::Option<T>) -> Self
5815        where
5816            T: std::convert::Into<crate::model::ImportErrorConfig>,
5817        {
5818            self.0.request.error_config = v.map(|x| x.into());
5819            self
5820        }
5821
5822        /// Sets the value of [reconciliation_mode][crate::model::ImportDocumentsRequest::reconciliation_mode].
5823        pub fn set_reconciliation_mode<
5824            T: Into<crate::model::import_documents_request::ReconciliationMode>,
5825        >(
5826            mut self,
5827            v: T,
5828        ) -> Self {
5829            self.0.request.reconciliation_mode = v.into();
5830            self
5831        }
5832
5833        /// Sets the value of [update_mask][crate::model::ImportDocumentsRequest::update_mask].
5834        pub fn set_update_mask<T>(mut self, v: T) -> Self
5835        where
5836            T: std::convert::Into<wkt::FieldMask>,
5837        {
5838            self.0.request.update_mask = std::option::Option::Some(v.into());
5839            self
5840        }
5841
5842        /// Sets or clears the value of [update_mask][crate::model::ImportDocumentsRequest::update_mask].
5843        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
5844        where
5845            T: std::convert::Into<wkt::FieldMask>,
5846        {
5847            self.0.request.update_mask = v.map(|x| x.into());
5848            self
5849        }
5850
5851        /// Sets the value of [auto_generate_ids][crate::model::ImportDocumentsRequest::auto_generate_ids].
5852        pub fn set_auto_generate_ids<T: Into<bool>>(mut self, v: T) -> Self {
5853            self.0.request.auto_generate_ids = v.into();
5854            self
5855        }
5856
5857        /// Sets the value of [id_field][crate::model::ImportDocumentsRequest::id_field].
5858        pub fn set_id_field<T: Into<std::string::String>>(mut self, v: T) -> Self {
5859            self.0.request.id_field = v.into();
5860            self
5861        }
5862
5863        /// Sets the value of [force_refresh_content][crate::model::ImportDocumentsRequest::force_refresh_content].
5864        pub fn set_force_refresh_content<T: Into<bool>>(mut self, v: T) -> Self {
5865            self.0.request.force_refresh_content = v.into();
5866            self
5867        }
5868
5869        /// Sets the value of [source][crate::model::ImportDocumentsRequest::source].
5870        ///
5871        /// Note that all the setters affecting `source` are
5872        /// mutually exclusive.
5873        pub fn set_source<T: Into<Option<crate::model::import_documents_request::Source>>>(
5874            mut self,
5875            v: T,
5876        ) -> Self {
5877            self.0.request.source = v.into();
5878            self
5879        }
5880
5881        /// Sets the value of [source][crate::model::ImportDocumentsRequest::source]
5882        /// to hold a `InlineSource`.
5883        ///
5884        /// Note that all the setters affecting `source` are
5885        /// mutually exclusive.
5886        pub fn set_inline_source<
5887            T: std::convert::Into<
5888                    std::boxed::Box<crate::model::import_documents_request::InlineSource>,
5889                >,
5890        >(
5891            mut self,
5892            v: T,
5893        ) -> Self {
5894            self.0.request = self.0.request.set_inline_source(v);
5895            self
5896        }
5897
5898        /// Sets the value of [source][crate::model::ImportDocumentsRequest::source]
5899        /// to hold a `GcsSource`.
5900        ///
5901        /// Note that all the setters affecting `source` are
5902        /// mutually exclusive.
5903        pub fn set_gcs_source<T: std::convert::Into<std::boxed::Box<crate::model::GcsSource>>>(
5904            mut self,
5905            v: T,
5906        ) -> Self {
5907            self.0.request = self.0.request.set_gcs_source(v);
5908            self
5909        }
5910
5911        /// Sets the value of [source][crate::model::ImportDocumentsRequest::source]
5912        /// to hold a `BigquerySource`.
5913        ///
5914        /// Note that all the setters affecting `source` are
5915        /// mutually exclusive.
5916        pub fn set_bigquery_source<
5917            T: std::convert::Into<std::boxed::Box<crate::model::BigQuerySource>>,
5918        >(
5919            mut self,
5920            v: T,
5921        ) -> Self {
5922            self.0.request = self.0.request.set_bigquery_source(v);
5923            self
5924        }
5925
5926        /// Sets the value of [source][crate::model::ImportDocumentsRequest::source]
5927        /// to hold a `FhirStoreSource`.
5928        ///
5929        /// Note that all the setters affecting `source` are
5930        /// mutually exclusive.
5931        pub fn set_fhir_store_source<
5932            T: std::convert::Into<std::boxed::Box<crate::model::FhirStoreSource>>,
5933        >(
5934            mut self,
5935            v: T,
5936        ) -> Self {
5937            self.0.request = self.0.request.set_fhir_store_source(v);
5938            self
5939        }
5940
5941        /// Sets the value of [source][crate::model::ImportDocumentsRequest::source]
5942        /// to hold a `SpannerSource`.
5943        ///
5944        /// Note that all the setters affecting `source` are
5945        /// mutually exclusive.
5946        pub fn set_spanner_source<
5947            T: std::convert::Into<std::boxed::Box<crate::model::SpannerSource>>,
5948        >(
5949            mut self,
5950            v: T,
5951        ) -> Self {
5952            self.0.request = self.0.request.set_spanner_source(v);
5953            self
5954        }
5955
5956        /// Sets the value of [source][crate::model::ImportDocumentsRequest::source]
5957        /// to hold a `CloudSqlSource`.
5958        ///
5959        /// Note that all the setters affecting `source` are
5960        /// mutually exclusive.
5961        pub fn set_cloud_sql_source<
5962            T: std::convert::Into<std::boxed::Box<crate::model::CloudSqlSource>>,
5963        >(
5964            mut self,
5965            v: T,
5966        ) -> Self {
5967            self.0.request = self.0.request.set_cloud_sql_source(v);
5968            self
5969        }
5970
5971        /// Sets the value of [source][crate::model::ImportDocumentsRequest::source]
5972        /// to hold a `FirestoreSource`.
5973        ///
5974        /// Note that all the setters affecting `source` are
5975        /// mutually exclusive.
5976        pub fn set_firestore_source<
5977            T: std::convert::Into<std::boxed::Box<crate::model::FirestoreSource>>,
5978        >(
5979            mut self,
5980            v: T,
5981        ) -> Self {
5982            self.0.request = self.0.request.set_firestore_source(v);
5983            self
5984        }
5985
5986        /// Sets the value of [source][crate::model::ImportDocumentsRequest::source]
5987        /// to hold a `AlloyDbSource`.
5988        ///
5989        /// Note that all the setters affecting `source` are
5990        /// mutually exclusive.
5991        pub fn set_alloy_db_source<
5992            T: std::convert::Into<std::boxed::Box<crate::model::AlloyDbSource>>,
5993        >(
5994            mut self,
5995            v: T,
5996        ) -> Self {
5997            self.0.request = self.0.request.set_alloy_db_source(v);
5998            self
5999        }
6000
6001        /// Sets the value of [source][crate::model::ImportDocumentsRequest::source]
6002        /// to hold a `BigtableSource`.
6003        ///
6004        /// Note that all the setters affecting `source` are
6005        /// mutually exclusive.
6006        pub fn set_bigtable_source<
6007            T: std::convert::Into<std::boxed::Box<crate::model::BigtableSource>>,
6008        >(
6009            mut self,
6010            v: T,
6011        ) -> Self {
6012            self.0.request = self.0.request.set_bigtable_source(v);
6013            self
6014        }
6015    }
6016
6017    #[doc(hidden)]
6018    impl crate::RequestBuilder for ImportDocuments {
6019        fn request_options(&mut self) -> &mut crate::RequestOptions {
6020            &mut self.0.options
6021        }
6022    }
6023
6024    /// The request builder for [DocumentService::purge_documents][crate::client::DocumentService::purge_documents] calls.
6025    ///
6026    /// # Example
6027    /// ```
6028    /// # use google_cloud_discoveryengine_v1::builder::document_service::PurgeDocuments;
6029    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
6030    /// use google_cloud_lro::Poller;
6031    ///
6032    /// let builder = prepare_request_builder();
6033    /// let response = builder.poller().until_done().await?;
6034    /// # Ok(()) }
6035    ///
6036    /// fn prepare_request_builder() -> PurgeDocuments {
6037    ///   # panic!();
6038    ///   // ... details omitted ...
6039    /// }
6040    /// ```
6041    #[derive(Clone, Debug)]
6042    pub struct PurgeDocuments(RequestBuilder<crate::model::PurgeDocumentsRequest>);
6043
6044    impl PurgeDocuments {
6045        pub(crate) fn new(
6046            stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
6047        ) -> Self {
6048            Self(RequestBuilder::new(stub))
6049        }
6050
6051        /// Sets the full request, replacing any prior values.
6052        pub fn with_request<V: Into<crate::model::PurgeDocumentsRequest>>(mut self, v: V) -> Self {
6053            self.0.request = v.into();
6054            self
6055        }
6056
6057        /// Sets all the options, replacing any prior values.
6058        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6059            self.0.options = v.into();
6060            self
6061        }
6062
6063        /// Sends the request.
6064        ///
6065        /// # Long running operations
6066        ///
6067        /// This starts, but does not poll, a longrunning operation. More information
6068        /// on [purge_documents][crate::client::DocumentService::purge_documents].
6069        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
6070            (*self.0.stub)
6071                .purge_documents(self.0.request, self.0.options)
6072                .await
6073                .map(crate::Response::into_body)
6074        }
6075
6076        /// Creates a [Poller][google_cloud_lro::Poller] to work with `purge_documents`.
6077        pub fn poller(
6078            self,
6079        ) -> impl google_cloud_lro::Poller<
6080            crate::model::PurgeDocumentsResponse,
6081            crate::model::PurgeDocumentsMetadata,
6082        > {
6083            type Operation = google_cloud_lro::internal::Operation<
6084                crate::model::PurgeDocumentsResponse,
6085                crate::model::PurgeDocumentsMetadata,
6086            >;
6087            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
6088            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
6089
6090            let stub = self.0.stub.clone();
6091            let mut options = self.0.options.clone();
6092            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
6093            let query = move |name| {
6094                let stub = stub.clone();
6095                let options = options.clone();
6096                async {
6097                    let op = GetOperation::new(stub)
6098                        .set_name(name)
6099                        .with_options(options)
6100                        .send()
6101                        .await?;
6102                    Ok(Operation::new(op))
6103                }
6104            };
6105
6106            let start = move || async {
6107                let op = self.send().await?;
6108                Ok(Operation::new(op))
6109            };
6110
6111            google_cloud_lro::internal::new_poller(
6112                polling_error_policy,
6113                polling_backoff_policy,
6114                start,
6115                query,
6116            )
6117        }
6118
6119        /// Sets the value of [parent][crate::model::PurgeDocumentsRequest::parent].
6120        ///
6121        /// This is a **required** field for requests.
6122        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
6123            self.0.request.parent = v.into();
6124            self
6125        }
6126
6127        /// Sets the value of [filter][crate::model::PurgeDocumentsRequest::filter].
6128        ///
6129        /// This is a **required** field for requests.
6130        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
6131            self.0.request.filter = v.into();
6132            self
6133        }
6134
6135        /// Sets the value of [error_config][crate::model::PurgeDocumentsRequest::error_config].
6136        pub fn set_error_config<T>(mut self, v: T) -> Self
6137        where
6138            T: std::convert::Into<crate::model::PurgeErrorConfig>,
6139        {
6140            self.0.request.error_config = std::option::Option::Some(v.into());
6141            self
6142        }
6143
6144        /// Sets or clears the value of [error_config][crate::model::PurgeDocumentsRequest::error_config].
6145        pub fn set_or_clear_error_config<T>(mut self, v: std::option::Option<T>) -> Self
6146        where
6147            T: std::convert::Into<crate::model::PurgeErrorConfig>,
6148        {
6149            self.0.request.error_config = v.map(|x| x.into());
6150            self
6151        }
6152
6153        /// Sets the value of [force][crate::model::PurgeDocumentsRequest::force].
6154        pub fn set_force<T: Into<bool>>(mut self, v: T) -> Self {
6155            self.0.request.force = v.into();
6156            self
6157        }
6158
6159        /// Sets the value of [source][crate::model::PurgeDocumentsRequest::source].
6160        ///
6161        /// Note that all the setters affecting `source` are
6162        /// mutually exclusive.
6163        pub fn set_source<T: Into<Option<crate::model::purge_documents_request::Source>>>(
6164            mut self,
6165            v: T,
6166        ) -> Self {
6167            self.0.request.source = v.into();
6168            self
6169        }
6170
6171        /// Sets the value of [source][crate::model::PurgeDocumentsRequest::source]
6172        /// to hold a `GcsSource`.
6173        ///
6174        /// Note that all the setters affecting `source` are
6175        /// mutually exclusive.
6176        pub fn set_gcs_source<T: std::convert::Into<std::boxed::Box<crate::model::GcsSource>>>(
6177            mut self,
6178            v: T,
6179        ) -> Self {
6180            self.0.request = self.0.request.set_gcs_source(v);
6181            self
6182        }
6183
6184        /// Sets the value of [source][crate::model::PurgeDocumentsRequest::source]
6185        /// to hold a `InlineSource`.
6186        ///
6187        /// Note that all the setters affecting `source` are
6188        /// mutually exclusive.
6189        pub fn set_inline_source<
6190            T: std::convert::Into<
6191                    std::boxed::Box<crate::model::purge_documents_request::InlineSource>,
6192                >,
6193        >(
6194            mut self,
6195            v: T,
6196        ) -> Self {
6197            self.0.request = self.0.request.set_inline_source(v);
6198            self
6199        }
6200    }
6201
6202    #[doc(hidden)]
6203    impl crate::RequestBuilder for PurgeDocuments {
6204        fn request_options(&mut self) -> &mut crate::RequestOptions {
6205            &mut self.0.options
6206        }
6207    }
6208
6209    /// The request builder for [DocumentService::batch_get_documents_metadata][crate::client::DocumentService::batch_get_documents_metadata] calls.
6210    ///
6211    /// # Example
6212    /// ```
6213    /// # use google_cloud_discoveryengine_v1::builder::document_service::BatchGetDocumentsMetadata;
6214    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
6215    ///
6216    /// let builder = prepare_request_builder();
6217    /// let response = builder.send().await?;
6218    /// # Ok(()) }
6219    ///
6220    /// fn prepare_request_builder() -> BatchGetDocumentsMetadata {
6221    ///   # panic!();
6222    ///   // ... details omitted ...
6223    /// }
6224    /// ```
6225    #[derive(Clone, Debug)]
6226    pub struct BatchGetDocumentsMetadata(
6227        RequestBuilder<crate::model::BatchGetDocumentsMetadataRequest>,
6228    );
6229
6230    impl BatchGetDocumentsMetadata {
6231        pub(crate) fn new(
6232            stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
6233        ) -> Self {
6234            Self(RequestBuilder::new(stub))
6235        }
6236
6237        /// Sets the full request, replacing any prior values.
6238        pub fn with_request<V: Into<crate::model::BatchGetDocumentsMetadataRequest>>(
6239            mut self,
6240            v: V,
6241        ) -> Self {
6242            self.0.request = v.into();
6243            self
6244        }
6245
6246        /// Sets all the options, replacing any prior values.
6247        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6248            self.0.options = v.into();
6249            self
6250        }
6251
6252        /// Sends the request.
6253        pub async fn send(self) -> Result<crate::model::BatchGetDocumentsMetadataResponse> {
6254            (*self.0.stub)
6255                .batch_get_documents_metadata(self.0.request, self.0.options)
6256                .await
6257                .map(crate::Response::into_body)
6258        }
6259
6260        /// Sets the value of [parent][crate::model::BatchGetDocumentsMetadataRequest::parent].
6261        ///
6262        /// This is a **required** field for requests.
6263        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
6264            self.0.request.parent = v.into();
6265            self
6266        }
6267
6268        /// Sets the value of [matcher][crate::model::BatchGetDocumentsMetadataRequest::matcher].
6269        ///
6270        /// This is a **required** field for requests.
6271        pub fn set_matcher<T>(mut self, v: T) -> Self
6272        where
6273            T: std::convert::Into<crate::model::batch_get_documents_metadata_request::Matcher>,
6274        {
6275            self.0.request.matcher = std::option::Option::Some(v.into());
6276            self
6277        }
6278
6279        /// Sets or clears the value of [matcher][crate::model::BatchGetDocumentsMetadataRequest::matcher].
6280        ///
6281        /// This is a **required** field for requests.
6282        pub fn set_or_clear_matcher<T>(mut self, v: std::option::Option<T>) -> Self
6283        where
6284            T: std::convert::Into<crate::model::batch_get_documents_metadata_request::Matcher>,
6285        {
6286            self.0.request.matcher = v.map(|x| x.into());
6287            self
6288        }
6289    }
6290
6291    #[doc(hidden)]
6292    impl crate::RequestBuilder for BatchGetDocumentsMetadata {
6293        fn request_options(&mut self) -> &mut crate::RequestOptions {
6294            &mut self.0.options
6295        }
6296    }
6297
6298    /// The request builder for [DocumentService::list_operations][crate::client::DocumentService::list_operations] calls.
6299    ///
6300    /// # Example
6301    /// ```
6302    /// # use google_cloud_discoveryengine_v1::builder::document_service::ListOperations;
6303    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
6304    /// use google_cloud_gax::paginator::ItemPaginator;
6305    ///
6306    /// let builder = prepare_request_builder();
6307    /// let mut items = builder.by_item();
6308    /// while let Some(result) = items.next().await {
6309    ///   let item = result?;
6310    /// }
6311    /// # Ok(()) }
6312    ///
6313    /// fn prepare_request_builder() -> ListOperations {
6314    ///   # panic!();
6315    ///   // ... details omitted ...
6316    /// }
6317    /// ```
6318    #[derive(Clone, Debug)]
6319    pub struct ListOperations(
6320        RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
6321    );
6322
6323    impl ListOperations {
6324        pub(crate) fn new(
6325            stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
6326        ) -> Self {
6327            Self(RequestBuilder::new(stub))
6328        }
6329
6330        /// Sets the full request, replacing any prior values.
6331        pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
6332            mut self,
6333            v: V,
6334        ) -> Self {
6335            self.0.request = v.into();
6336            self
6337        }
6338
6339        /// Sets all the options, replacing any prior values.
6340        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6341            self.0.options = v.into();
6342            self
6343        }
6344
6345        /// Sends the request.
6346        pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
6347            (*self.0.stub)
6348                .list_operations(self.0.request, self.0.options)
6349                .await
6350                .map(crate::Response::into_body)
6351        }
6352
6353        /// Streams each page in the collection.
6354        pub fn by_page(
6355            self,
6356        ) -> impl google_cloud_gax::paginator::Paginator<
6357            google_cloud_longrunning::model::ListOperationsResponse,
6358            crate::Error,
6359        > {
6360            use std::clone::Clone;
6361            let token = self.0.request.page_token.clone();
6362            let execute = move |token: String| {
6363                let mut builder = self.clone();
6364                builder.0.request = builder.0.request.set_page_token(token);
6365                builder.send()
6366            };
6367            google_cloud_gax::paginator::internal::new_paginator(token, execute)
6368        }
6369
6370        /// Streams each item in the collection.
6371        pub fn by_item(
6372            self,
6373        ) -> impl google_cloud_gax::paginator::ItemPaginator<
6374            google_cloud_longrunning::model::ListOperationsResponse,
6375            crate::Error,
6376        > {
6377            use google_cloud_gax::paginator::Paginator;
6378            self.by_page().items()
6379        }
6380
6381        /// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
6382        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6383            self.0.request.name = v.into();
6384            self
6385        }
6386
6387        /// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::filter].
6388        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
6389            self.0.request.filter = v.into();
6390            self
6391        }
6392
6393        /// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
6394        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
6395            self.0.request.page_size = v.into();
6396            self
6397        }
6398
6399        /// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
6400        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
6401            self.0.request.page_token = v.into();
6402            self
6403        }
6404
6405        /// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
6406        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
6407            self.0.request.return_partial_success = v.into();
6408            self
6409        }
6410    }
6411
6412    #[doc(hidden)]
6413    impl crate::RequestBuilder for ListOperations {
6414        fn request_options(&mut self) -> &mut crate::RequestOptions {
6415            &mut self.0.options
6416        }
6417    }
6418
6419    /// The request builder for [DocumentService::get_operation][crate::client::DocumentService::get_operation] calls.
6420    ///
6421    /// # Example
6422    /// ```
6423    /// # use google_cloud_discoveryengine_v1::builder::document_service::GetOperation;
6424    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
6425    ///
6426    /// let builder = prepare_request_builder();
6427    /// let response = builder.send().await?;
6428    /// # Ok(()) }
6429    ///
6430    /// fn prepare_request_builder() -> GetOperation {
6431    ///   # panic!();
6432    ///   // ... details omitted ...
6433    /// }
6434    /// ```
6435    #[derive(Clone, Debug)]
6436    pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
6437
6438    impl GetOperation {
6439        pub(crate) fn new(
6440            stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
6441        ) -> Self {
6442            Self(RequestBuilder::new(stub))
6443        }
6444
6445        /// Sets the full request, replacing any prior values.
6446        pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
6447            mut self,
6448            v: V,
6449        ) -> Self {
6450            self.0.request = v.into();
6451            self
6452        }
6453
6454        /// Sets all the options, replacing any prior values.
6455        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6456            self.0.options = v.into();
6457            self
6458        }
6459
6460        /// Sends the request.
6461        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
6462            (*self.0.stub)
6463                .get_operation(self.0.request, self.0.options)
6464                .await
6465                .map(crate::Response::into_body)
6466        }
6467
6468        /// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
6469        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6470            self.0.request.name = v.into();
6471            self
6472        }
6473    }
6474
6475    #[doc(hidden)]
6476    impl crate::RequestBuilder for GetOperation {
6477        fn request_options(&mut self) -> &mut crate::RequestOptions {
6478            &mut self.0.options
6479        }
6480    }
6481
6482    /// The request builder for [DocumentService::cancel_operation][crate::client::DocumentService::cancel_operation] calls.
6483    ///
6484    /// # Example
6485    /// ```
6486    /// # use google_cloud_discoveryengine_v1::builder::document_service::CancelOperation;
6487    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
6488    ///
6489    /// let builder = prepare_request_builder();
6490    /// let response = builder.send().await?;
6491    /// # Ok(()) }
6492    ///
6493    /// fn prepare_request_builder() -> CancelOperation {
6494    ///   # panic!();
6495    ///   // ... details omitted ...
6496    /// }
6497    /// ```
6498    #[derive(Clone, Debug)]
6499    pub struct CancelOperation(
6500        RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
6501    );
6502
6503    impl CancelOperation {
6504        pub(crate) fn new(
6505            stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
6506        ) -> Self {
6507            Self(RequestBuilder::new(stub))
6508        }
6509
6510        /// Sets the full request, replacing any prior values.
6511        pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
6512            mut self,
6513            v: V,
6514        ) -> Self {
6515            self.0.request = v.into();
6516            self
6517        }
6518
6519        /// Sets all the options, replacing any prior values.
6520        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6521            self.0.options = v.into();
6522            self
6523        }
6524
6525        /// Sends the request.
6526        pub async fn send(self) -> Result<()> {
6527            (*self.0.stub)
6528                .cancel_operation(self.0.request, self.0.options)
6529                .await
6530                .map(crate::Response::into_body)
6531        }
6532
6533        /// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::name].
6534        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6535            self.0.request.name = v.into();
6536            self
6537        }
6538    }
6539
6540    #[doc(hidden)]
6541    impl crate::RequestBuilder for CancelOperation {
6542        fn request_options(&mut self) -> &mut crate::RequestOptions {
6543            &mut self.0.options
6544        }
6545    }
6546}
6547
6548#[cfg(feature = "engine-service")]
6549#[cfg_attr(docsrs, doc(cfg(feature = "engine-service")))]
6550pub mod engine_service {
6551    use crate::Result;
6552
6553    /// A builder for [EngineService][crate::client::EngineService].
6554    ///
6555    /// ```
6556    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
6557    /// # use google_cloud_discoveryengine_v1::*;
6558    /// # use builder::engine_service::ClientBuilder;
6559    /// # use client::EngineService;
6560    /// let builder : ClientBuilder = EngineService::builder();
6561    /// let client = builder
6562    ///     .with_endpoint("https://discoveryengine.googleapis.com")
6563    ///     .build().await?;
6564    /// # Ok(()) }
6565    /// ```
6566    pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
6567
6568    pub(crate) mod client {
6569        use super::super::super::client::EngineService;
6570        pub struct Factory;
6571        impl crate::ClientFactory for Factory {
6572            type Client = EngineService;
6573            type Credentials = gaxi::options::Credentials;
6574            async fn build(
6575                self,
6576                config: gaxi::options::ClientConfig,
6577            ) -> crate::ClientBuilderResult<Self::Client> {
6578                Self::Client::new(config).await
6579            }
6580        }
6581    }
6582
6583    /// Common implementation for [crate::client::EngineService] request builders.
6584    #[derive(Clone, Debug)]
6585    pub(crate) struct RequestBuilder<R: std::default::Default> {
6586        stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
6587        request: R,
6588        options: crate::RequestOptions,
6589    }
6590
6591    impl<R> RequestBuilder<R>
6592    where
6593        R: std::default::Default,
6594    {
6595        pub(crate) fn new(
6596            stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
6597        ) -> Self {
6598            Self {
6599                stub,
6600                request: R::default(),
6601                options: crate::RequestOptions::default(),
6602            }
6603        }
6604    }
6605
6606    /// The request builder for [EngineService::create_engine][crate::client::EngineService::create_engine] calls.
6607    ///
6608    /// # Example
6609    /// ```
6610    /// # use google_cloud_discoveryengine_v1::builder::engine_service::CreateEngine;
6611    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
6612    /// use google_cloud_lro::Poller;
6613    ///
6614    /// let builder = prepare_request_builder();
6615    /// let response = builder.poller().until_done().await?;
6616    /// # Ok(()) }
6617    ///
6618    /// fn prepare_request_builder() -> CreateEngine {
6619    ///   # panic!();
6620    ///   // ... details omitted ...
6621    /// }
6622    /// ```
6623    #[derive(Clone, Debug)]
6624    pub struct CreateEngine(RequestBuilder<crate::model::CreateEngineRequest>);
6625
6626    impl CreateEngine {
6627        pub(crate) fn new(
6628            stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
6629        ) -> Self {
6630            Self(RequestBuilder::new(stub))
6631        }
6632
6633        /// Sets the full request, replacing any prior values.
6634        pub fn with_request<V: Into<crate::model::CreateEngineRequest>>(mut self, v: V) -> Self {
6635            self.0.request = v.into();
6636            self
6637        }
6638
6639        /// Sets all the options, replacing any prior values.
6640        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6641            self.0.options = v.into();
6642            self
6643        }
6644
6645        /// Sends the request.
6646        ///
6647        /// # Long running operations
6648        ///
6649        /// This starts, but does not poll, a longrunning operation. More information
6650        /// on [create_engine][crate::client::EngineService::create_engine].
6651        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
6652            (*self.0.stub)
6653                .create_engine(self.0.request, self.0.options)
6654                .await
6655                .map(crate::Response::into_body)
6656        }
6657
6658        /// Creates a [Poller][google_cloud_lro::Poller] to work with `create_engine`.
6659        pub fn poller(
6660            self,
6661        ) -> impl google_cloud_lro::Poller<crate::model::Engine, crate::model::CreateEngineMetadata>
6662        {
6663            type Operation = google_cloud_lro::internal::Operation<
6664                crate::model::Engine,
6665                crate::model::CreateEngineMetadata,
6666            >;
6667            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
6668            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
6669
6670            let stub = self.0.stub.clone();
6671            let mut options = self.0.options.clone();
6672            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
6673            let query = move |name| {
6674                let stub = stub.clone();
6675                let options = options.clone();
6676                async {
6677                    let op = GetOperation::new(stub)
6678                        .set_name(name)
6679                        .with_options(options)
6680                        .send()
6681                        .await?;
6682                    Ok(Operation::new(op))
6683                }
6684            };
6685
6686            let start = move || async {
6687                let op = self.send().await?;
6688                Ok(Operation::new(op))
6689            };
6690
6691            google_cloud_lro::internal::new_poller(
6692                polling_error_policy,
6693                polling_backoff_policy,
6694                start,
6695                query,
6696            )
6697        }
6698
6699        /// Sets the value of [parent][crate::model::CreateEngineRequest::parent].
6700        ///
6701        /// This is a **required** field for requests.
6702        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
6703            self.0.request.parent = v.into();
6704            self
6705        }
6706
6707        /// Sets the value of [engine][crate::model::CreateEngineRequest::engine].
6708        ///
6709        /// This is a **required** field for requests.
6710        pub fn set_engine<T>(mut self, v: T) -> Self
6711        where
6712            T: std::convert::Into<crate::model::Engine>,
6713        {
6714            self.0.request.engine = std::option::Option::Some(v.into());
6715            self
6716        }
6717
6718        /// Sets or clears the value of [engine][crate::model::CreateEngineRequest::engine].
6719        ///
6720        /// This is a **required** field for requests.
6721        pub fn set_or_clear_engine<T>(mut self, v: std::option::Option<T>) -> Self
6722        where
6723            T: std::convert::Into<crate::model::Engine>,
6724        {
6725            self.0.request.engine = v.map(|x| x.into());
6726            self
6727        }
6728
6729        /// Sets the value of [engine_id][crate::model::CreateEngineRequest::engine_id].
6730        ///
6731        /// This is a **required** field for requests.
6732        pub fn set_engine_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
6733            self.0.request.engine_id = v.into();
6734            self
6735        }
6736    }
6737
6738    #[doc(hidden)]
6739    impl crate::RequestBuilder for CreateEngine {
6740        fn request_options(&mut self) -> &mut crate::RequestOptions {
6741            &mut self.0.options
6742        }
6743    }
6744
6745    /// The request builder for [EngineService::delete_engine][crate::client::EngineService::delete_engine] calls.
6746    ///
6747    /// # Example
6748    /// ```
6749    /// # use google_cloud_discoveryengine_v1::builder::engine_service::DeleteEngine;
6750    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
6751    /// use google_cloud_lro::Poller;
6752    ///
6753    /// let builder = prepare_request_builder();
6754    /// let response = builder.poller().until_done().await?;
6755    /// # Ok(()) }
6756    ///
6757    /// fn prepare_request_builder() -> DeleteEngine {
6758    ///   # panic!();
6759    ///   // ... details omitted ...
6760    /// }
6761    /// ```
6762    #[derive(Clone, Debug)]
6763    pub struct DeleteEngine(RequestBuilder<crate::model::DeleteEngineRequest>);
6764
6765    impl DeleteEngine {
6766        pub(crate) fn new(
6767            stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
6768        ) -> Self {
6769            Self(RequestBuilder::new(stub))
6770        }
6771
6772        /// Sets the full request, replacing any prior values.
6773        pub fn with_request<V: Into<crate::model::DeleteEngineRequest>>(mut self, v: V) -> Self {
6774            self.0.request = v.into();
6775            self
6776        }
6777
6778        /// Sets all the options, replacing any prior values.
6779        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6780            self.0.options = v.into();
6781            self
6782        }
6783
6784        /// Sends the request.
6785        ///
6786        /// # Long running operations
6787        ///
6788        /// This starts, but does not poll, a longrunning operation. More information
6789        /// on [delete_engine][crate::client::EngineService::delete_engine].
6790        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
6791            (*self.0.stub)
6792                .delete_engine(self.0.request, self.0.options)
6793                .await
6794                .map(crate::Response::into_body)
6795        }
6796
6797        /// Creates a [Poller][google_cloud_lro::Poller] to work with `delete_engine`.
6798        pub fn poller(
6799            self,
6800        ) -> impl google_cloud_lro::Poller<(), crate::model::DeleteEngineMetadata> {
6801            type Operation = google_cloud_lro::internal::Operation<
6802                wkt::Empty,
6803                crate::model::DeleteEngineMetadata,
6804            >;
6805            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
6806            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
6807
6808            let stub = self.0.stub.clone();
6809            let mut options = self.0.options.clone();
6810            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
6811            let query = move |name| {
6812                let stub = stub.clone();
6813                let options = options.clone();
6814                async {
6815                    let op = GetOperation::new(stub)
6816                        .set_name(name)
6817                        .with_options(options)
6818                        .send()
6819                        .await?;
6820                    Ok(Operation::new(op))
6821                }
6822            };
6823
6824            let start = move || async {
6825                let op = self.send().await?;
6826                Ok(Operation::new(op))
6827            };
6828
6829            google_cloud_lro::internal::new_unit_response_poller(
6830                polling_error_policy,
6831                polling_backoff_policy,
6832                start,
6833                query,
6834            )
6835        }
6836
6837        /// Sets the value of [name][crate::model::DeleteEngineRequest::name].
6838        ///
6839        /// This is a **required** field for requests.
6840        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6841            self.0.request.name = v.into();
6842            self
6843        }
6844    }
6845
6846    #[doc(hidden)]
6847    impl crate::RequestBuilder for DeleteEngine {
6848        fn request_options(&mut self) -> &mut crate::RequestOptions {
6849            &mut self.0.options
6850        }
6851    }
6852
6853    /// The request builder for [EngineService::update_engine][crate::client::EngineService::update_engine] calls.
6854    ///
6855    /// # Example
6856    /// ```
6857    /// # use google_cloud_discoveryengine_v1::builder::engine_service::UpdateEngine;
6858    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
6859    ///
6860    /// let builder = prepare_request_builder();
6861    /// let response = builder.send().await?;
6862    /// # Ok(()) }
6863    ///
6864    /// fn prepare_request_builder() -> UpdateEngine {
6865    ///   # panic!();
6866    ///   // ... details omitted ...
6867    /// }
6868    /// ```
6869    #[derive(Clone, Debug)]
6870    pub struct UpdateEngine(RequestBuilder<crate::model::UpdateEngineRequest>);
6871
6872    impl UpdateEngine {
6873        pub(crate) fn new(
6874            stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
6875        ) -> Self {
6876            Self(RequestBuilder::new(stub))
6877        }
6878
6879        /// Sets the full request, replacing any prior values.
6880        pub fn with_request<V: Into<crate::model::UpdateEngineRequest>>(mut self, v: V) -> Self {
6881            self.0.request = v.into();
6882            self
6883        }
6884
6885        /// Sets all the options, replacing any prior values.
6886        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6887            self.0.options = v.into();
6888            self
6889        }
6890
6891        /// Sends the request.
6892        pub async fn send(self) -> Result<crate::model::Engine> {
6893            (*self.0.stub)
6894                .update_engine(self.0.request, self.0.options)
6895                .await
6896                .map(crate::Response::into_body)
6897        }
6898
6899        /// Sets the value of [engine][crate::model::UpdateEngineRequest::engine].
6900        ///
6901        /// This is a **required** field for requests.
6902        pub fn set_engine<T>(mut self, v: T) -> Self
6903        where
6904            T: std::convert::Into<crate::model::Engine>,
6905        {
6906            self.0.request.engine = std::option::Option::Some(v.into());
6907            self
6908        }
6909
6910        /// Sets or clears the value of [engine][crate::model::UpdateEngineRequest::engine].
6911        ///
6912        /// This is a **required** field for requests.
6913        pub fn set_or_clear_engine<T>(mut self, v: std::option::Option<T>) -> Self
6914        where
6915            T: std::convert::Into<crate::model::Engine>,
6916        {
6917            self.0.request.engine = v.map(|x| x.into());
6918            self
6919        }
6920
6921        /// Sets the value of [update_mask][crate::model::UpdateEngineRequest::update_mask].
6922        pub fn set_update_mask<T>(mut self, v: T) -> Self
6923        where
6924            T: std::convert::Into<wkt::FieldMask>,
6925        {
6926            self.0.request.update_mask = std::option::Option::Some(v.into());
6927            self
6928        }
6929
6930        /// Sets or clears the value of [update_mask][crate::model::UpdateEngineRequest::update_mask].
6931        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
6932        where
6933            T: std::convert::Into<wkt::FieldMask>,
6934        {
6935            self.0.request.update_mask = v.map(|x| x.into());
6936            self
6937        }
6938    }
6939
6940    #[doc(hidden)]
6941    impl crate::RequestBuilder for UpdateEngine {
6942        fn request_options(&mut self) -> &mut crate::RequestOptions {
6943            &mut self.0.options
6944        }
6945    }
6946
6947    /// The request builder for [EngineService::get_engine][crate::client::EngineService::get_engine] calls.
6948    ///
6949    /// # Example
6950    /// ```
6951    /// # use google_cloud_discoveryengine_v1::builder::engine_service::GetEngine;
6952    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
6953    ///
6954    /// let builder = prepare_request_builder();
6955    /// let response = builder.send().await?;
6956    /// # Ok(()) }
6957    ///
6958    /// fn prepare_request_builder() -> GetEngine {
6959    ///   # panic!();
6960    ///   // ... details omitted ...
6961    /// }
6962    /// ```
6963    #[derive(Clone, Debug)]
6964    pub struct GetEngine(RequestBuilder<crate::model::GetEngineRequest>);
6965
6966    impl GetEngine {
6967        pub(crate) fn new(
6968            stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
6969        ) -> Self {
6970            Self(RequestBuilder::new(stub))
6971        }
6972
6973        /// Sets the full request, replacing any prior values.
6974        pub fn with_request<V: Into<crate::model::GetEngineRequest>>(mut self, v: V) -> Self {
6975            self.0.request = v.into();
6976            self
6977        }
6978
6979        /// Sets all the options, replacing any prior values.
6980        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6981            self.0.options = v.into();
6982            self
6983        }
6984
6985        /// Sends the request.
6986        pub async fn send(self) -> Result<crate::model::Engine> {
6987            (*self.0.stub)
6988                .get_engine(self.0.request, self.0.options)
6989                .await
6990                .map(crate::Response::into_body)
6991        }
6992
6993        /// Sets the value of [name][crate::model::GetEngineRequest::name].
6994        ///
6995        /// This is a **required** field for requests.
6996        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6997            self.0.request.name = v.into();
6998            self
6999        }
7000    }
7001
7002    #[doc(hidden)]
7003    impl crate::RequestBuilder for GetEngine {
7004        fn request_options(&mut self) -> &mut crate::RequestOptions {
7005            &mut self.0.options
7006        }
7007    }
7008
7009    /// The request builder for [EngineService::list_engines][crate::client::EngineService::list_engines] calls.
7010    ///
7011    /// # Example
7012    /// ```
7013    /// # use google_cloud_discoveryengine_v1::builder::engine_service::ListEngines;
7014    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
7015    /// use google_cloud_gax::paginator::ItemPaginator;
7016    ///
7017    /// let builder = prepare_request_builder();
7018    /// let mut items = builder.by_item();
7019    /// while let Some(result) = items.next().await {
7020    ///   let item = result?;
7021    /// }
7022    /// # Ok(()) }
7023    ///
7024    /// fn prepare_request_builder() -> ListEngines {
7025    ///   # panic!();
7026    ///   // ... details omitted ...
7027    /// }
7028    /// ```
7029    #[derive(Clone, Debug)]
7030    pub struct ListEngines(RequestBuilder<crate::model::ListEnginesRequest>);
7031
7032    impl ListEngines {
7033        pub(crate) fn new(
7034            stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
7035        ) -> Self {
7036            Self(RequestBuilder::new(stub))
7037        }
7038
7039        /// Sets the full request, replacing any prior values.
7040        pub fn with_request<V: Into<crate::model::ListEnginesRequest>>(mut self, v: V) -> Self {
7041            self.0.request = v.into();
7042            self
7043        }
7044
7045        /// Sets all the options, replacing any prior values.
7046        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7047            self.0.options = v.into();
7048            self
7049        }
7050
7051        /// Sends the request.
7052        pub async fn send(self) -> Result<crate::model::ListEnginesResponse> {
7053            (*self.0.stub)
7054                .list_engines(self.0.request, self.0.options)
7055                .await
7056                .map(crate::Response::into_body)
7057        }
7058
7059        /// Streams each page in the collection.
7060        pub fn by_page(
7061            self,
7062        ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListEnginesResponse, crate::Error>
7063        {
7064            use std::clone::Clone;
7065            let token = self.0.request.page_token.clone();
7066            let execute = move |token: String| {
7067                let mut builder = self.clone();
7068                builder.0.request = builder.0.request.set_page_token(token);
7069                builder.send()
7070            };
7071            google_cloud_gax::paginator::internal::new_paginator(token, execute)
7072        }
7073
7074        /// Streams each item in the collection.
7075        pub fn by_item(
7076            self,
7077        ) -> impl google_cloud_gax::paginator::ItemPaginator<
7078            crate::model::ListEnginesResponse,
7079            crate::Error,
7080        > {
7081            use google_cloud_gax::paginator::Paginator;
7082            self.by_page().items()
7083        }
7084
7085        /// Sets the value of [parent][crate::model::ListEnginesRequest::parent].
7086        ///
7087        /// This is a **required** field for requests.
7088        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
7089            self.0.request.parent = v.into();
7090            self
7091        }
7092
7093        /// Sets the value of [page_size][crate::model::ListEnginesRequest::page_size].
7094        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
7095            self.0.request.page_size = v.into();
7096            self
7097        }
7098
7099        /// Sets the value of [page_token][crate::model::ListEnginesRequest::page_token].
7100        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
7101            self.0.request.page_token = v.into();
7102            self
7103        }
7104
7105        /// Sets the value of [filter][crate::model::ListEnginesRequest::filter].
7106        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
7107            self.0.request.filter = v.into();
7108            self
7109        }
7110    }
7111
7112    #[doc(hidden)]
7113    impl crate::RequestBuilder for ListEngines {
7114        fn request_options(&mut self) -> &mut crate::RequestOptions {
7115            &mut self.0.options
7116        }
7117    }
7118
7119    /// The request builder for [EngineService::list_operations][crate::client::EngineService::list_operations] calls.
7120    ///
7121    /// # Example
7122    /// ```
7123    /// # use google_cloud_discoveryengine_v1::builder::engine_service::ListOperations;
7124    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
7125    /// use google_cloud_gax::paginator::ItemPaginator;
7126    ///
7127    /// let builder = prepare_request_builder();
7128    /// let mut items = builder.by_item();
7129    /// while let Some(result) = items.next().await {
7130    ///   let item = result?;
7131    /// }
7132    /// # Ok(()) }
7133    ///
7134    /// fn prepare_request_builder() -> ListOperations {
7135    ///   # panic!();
7136    ///   // ... details omitted ...
7137    /// }
7138    /// ```
7139    #[derive(Clone, Debug)]
7140    pub struct ListOperations(
7141        RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
7142    );
7143
7144    impl ListOperations {
7145        pub(crate) fn new(
7146            stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
7147        ) -> Self {
7148            Self(RequestBuilder::new(stub))
7149        }
7150
7151        /// Sets the full request, replacing any prior values.
7152        pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
7153            mut self,
7154            v: V,
7155        ) -> Self {
7156            self.0.request = v.into();
7157            self
7158        }
7159
7160        /// Sets all the options, replacing any prior values.
7161        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7162            self.0.options = v.into();
7163            self
7164        }
7165
7166        /// Sends the request.
7167        pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
7168            (*self.0.stub)
7169                .list_operations(self.0.request, self.0.options)
7170                .await
7171                .map(crate::Response::into_body)
7172        }
7173
7174        /// Streams each page in the collection.
7175        pub fn by_page(
7176            self,
7177        ) -> impl google_cloud_gax::paginator::Paginator<
7178            google_cloud_longrunning::model::ListOperationsResponse,
7179            crate::Error,
7180        > {
7181            use std::clone::Clone;
7182            let token = self.0.request.page_token.clone();
7183            let execute = move |token: String| {
7184                let mut builder = self.clone();
7185                builder.0.request = builder.0.request.set_page_token(token);
7186                builder.send()
7187            };
7188            google_cloud_gax::paginator::internal::new_paginator(token, execute)
7189        }
7190
7191        /// Streams each item in the collection.
7192        pub fn by_item(
7193            self,
7194        ) -> impl google_cloud_gax::paginator::ItemPaginator<
7195            google_cloud_longrunning::model::ListOperationsResponse,
7196            crate::Error,
7197        > {
7198            use google_cloud_gax::paginator::Paginator;
7199            self.by_page().items()
7200        }
7201
7202        /// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
7203        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7204            self.0.request.name = v.into();
7205            self
7206        }
7207
7208        /// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::filter].
7209        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
7210            self.0.request.filter = v.into();
7211            self
7212        }
7213
7214        /// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
7215        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
7216            self.0.request.page_size = v.into();
7217            self
7218        }
7219
7220        /// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
7221        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
7222            self.0.request.page_token = v.into();
7223            self
7224        }
7225
7226        /// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
7227        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
7228            self.0.request.return_partial_success = v.into();
7229            self
7230        }
7231    }
7232
7233    #[doc(hidden)]
7234    impl crate::RequestBuilder for ListOperations {
7235        fn request_options(&mut self) -> &mut crate::RequestOptions {
7236            &mut self.0.options
7237        }
7238    }
7239
7240    /// The request builder for [EngineService::get_operation][crate::client::EngineService::get_operation] calls.
7241    ///
7242    /// # Example
7243    /// ```
7244    /// # use google_cloud_discoveryengine_v1::builder::engine_service::GetOperation;
7245    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
7246    ///
7247    /// let builder = prepare_request_builder();
7248    /// let response = builder.send().await?;
7249    /// # Ok(()) }
7250    ///
7251    /// fn prepare_request_builder() -> GetOperation {
7252    ///   # panic!();
7253    ///   // ... details omitted ...
7254    /// }
7255    /// ```
7256    #[derive(Clone, Debug)]
7257    pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
7258
7259    impl GetOperation {
7260        pub(crate) fn new(
7261            stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
7262        ) -> Self {
7263            Self(RequestBuilder::new(stub))
7264        }
7265
7266        /// Sets the full request, replacing any prior values.
7267        pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
7268            mut self,
7269            v: V,
7270        ) -> Self {
7271            self.0.request = v.into();
7272            self
7273        }
7274
7275        /// Sets all the options, replacing any prior values.
7276        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7277            self.0.options = v.into();
7278            self
7279        }
7280
7281        /// Sends the request.
7282        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
7283            (*self.0.stub)
7284                .get_operation(self.0.request, self.0.options)
7285                .await
7286                .map(crate::Response::into_body)
7287        }
7288
7289        /// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
7290        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7291            self.0.request.name = v.into();
7292            self
7293        }
7294    }
7295
7296    #[doc(hidden)]
7297    impl crate::RequestBuilder for GetOperation {
7298        fn request_options(&mut self) -> &mut crate::RequestOptions {
7299            &mut self.0.options
7300        }
7301    }
7302
7303    /// The request builder for [EngineService::cancel_operation][crate::client::EngineService::cancel_operation] calls.
7304    ///
7305    /// # Example
7306    /// ```
7307    /// # use google_cloud_discoveryengine_v1::builder::engine_service::CancelOperation;
7308    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
7309    ///
7310    /// let builder = prepare_request_builder();
7311    /// let response = builder.send().await?;
7312    /// # Ok(()) }
7313    ///
7314    /// fn prepare_request_builder() -> CancelOperation {
7315    ///   # panic!();
7316    ///   // ... details omitted ...
7317    /// }
7318    /// ```
7319    #[derive(Clone, Debug)]
7320    pub struct CancelOperation(
7321        RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
7322    );
7323
7324    impl CancelOperation {
7325        pub(crate) fn new(
7326            stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
7327        ) -> Self {
7328            Self(RequestBuilder::new(stub))
7329        }
7330
7331        /// Sets the full request, replacing any prior values.
7332        pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
7333            mut self,
7334            v: V,
7335        ) -> Self {
7336            self.0.request = v.into();
7337            self
7338        }
7339
7340        /// Sets all the options, replacing any prior values.
7341        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7342            self.0.options = v.into();
7343            self
7344        }
7345
7346        /// Sends the request.
7347        pub async fn send(self) -> Result<()> {
7348            (*self.0.stub)
7349                .cancel_operation(self.0.request, self.0.options)
7350                .await
7351                .map(crate::Response::into_body)
7352        }
7353
7354        /// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::name].
7355        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7356            self.0.request.name = v.into();
7357            self
7358        }
7359    }
7360
7361    #[doc(hidden)]
7362    impl crate::RequestBuilder for CancelOperation {
7363        fn request_options(&mut self) -> &mut crate::RequestOptions {
7364            &mut self.0.options
7365        }
7366    }
7367}
7368
7369#[cfg(feature = "grounded-generation-service")]
7370#[cfg_attr(docsrs, doc(cfg(feature = "grounded-generation-service")))]
7371pub mod grounded_generation_service {
7372    use crate::Result;
7373
7374    /// A builder for [GroundedGenerationService][crate::client::GroundedGenerationService].
7375    ///
7376    /// ```
7377    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
7378    /// # use google_cloud_discoveryengine_v1::*;
7379    /// # use builder::grounded_generation_service::ClientBuilder;
7380    /// # use client::GroundedGenerationService;
7381    /// let builder : ClientBuilder = GroundedGenerationService::builder();
7382    /// let client = builder
7383    ///     .with_endpoint("https://discoveryengine.googleapis.com")
7384    ///     .build().await?;
7385    /// # Ok(()) }
7386    /// ```
7387    pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
7388
7389    pub(crate) mod client {
7390        use super::super::super::client::GroundedGenerationService;
7391        pub struct Factory;
7392        impl crate::ClientFactory for Factory {
7393            type Client = GroundedGenerationService;
7394            type Credentials = gaxi::options::Credentials;
7395            async fn build(
7396                self,
7397                config: gaxi::options::ClientConfig,
7398            ) -> crate::ClientBuilderResult<Self::Client> {
7399                Self::Client::new(config).await
7400            }
7401        }
7402    }
7403
7404    /// Common implementation for [crate::client::GroundedGenerationService] request builders.
7405    #[derive(Clone, Debug)]
7406    pub(crate) struct RequestBuilder<R: std::default::Default> {
7407        stub: std::sync::Arc<dyn super::super::stub::dynamic::GroundedGenerationService>,
7408        request: R,
7409        options: crate::RequestOptions,
7410    }
7411
7412    impl<R> RequestBuilder<R>
7413    where
7414        R: std::default::Default,
7415    {
7416        pub(crate) fn new(
7417            stub: std::sync::Arc<dyn super::super::stub::dynamic::GroundedGenerationService>,
7418        ) -> Self {
7419            Self {
7420                stub,
7421                request: R::default(),
7422                options: crate::RequestOptions::default(),
7423            }
7424        }
7425    }
7426
7427    /// The request builder for [GroundedGenerationService::generate_grounded_content][crate::client::GroundedGenerationService::generate_grounded_content] calls.
7428    ///
7429    /// # Example
7430    /// ```
7431    /// # use google_cloud_discoveryengine_v1::builder::grounded_generation_service::GenerateGroundedContent;
7432    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
7433    ///
7434    /// let builder = prepare_request_builder();
7435    /// let response = builder.send().await?;
7436    /// # Ok(()) }
7437    ///
7438    /// fn prepare_request_builder() -> GenerateGroundedContent {
7439    ///   # panic!();
7440    ///   // ... details omitted ...
7441    /// }
7442    /// ```
7443    #[derive(Clone, Debug)]
7444    pub struct GenerateGroundedContent(
7445        RequestBuilder<crate::model::GenerateGroundedContentRequest>,
7446    );
7447
7448    impl GenerateGroundedContent {
7449        pub(crate) fn new(
7450            stub: std::sync::Arc<dyn super::super::stub::dynamic::GroundedGenerationService>,
7451        ) -> Self {
7452            Self(RequestBuilder::new(stub))
7453        }
7454
7455        /// Sets the full request, replacing any prior values.
7456        pub fn with_request<V: Into<crate::model::GenerateGroundedContentRequest>>(
7457            mut self,
7458            v: V,
7459        ) -> Self {
7460            self.0.request = v.into();
7461            self
7462        }
7463
7464        /// Sets all the options, replacing any prior values.
7465        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7466            self.0.options = v.into();
7467            self
7468        }
7469
7470        /// Sends the request.
7471        pub async fn send(self) -> Result<crate::model::GenerateGroundedContentResponse> {
7472            (*self.0.stub)
7473                .generate_grounded_content(self.0.request, self.0.options)
7474                .await
7475                .map(crate::Response::into_body)
7476        }
7477
7478        /// Sets the value of [location][crate::model::GenerateGroundedContentRequest::location].
7479        ///
7480        /// This is a **required** field for requests.
7481        pub fn set_location<T: Into<std::string::String>>(mut self, v: T) -> Self {
7482            self.0.request.location = v.into();
7483            self
7484        }
7485
7486        /// Sets the value of [system_instruction][crate::model::GenerateGroundedContentRequest::system_instruction].
7487        pub fn set_system_instruction<T>(mut self, v: T) -> Self
7488        where
7489            T: std::convert::Into<crate::model::GroundedGenerationContent>,
7490        {
7491            self.0.request.system_instruction = std::option::Option::Some(v.into());
7492            self
7493        }
7494
7495        /// Sets or clears the value of [system_instruction][crate::model::GenerateGroundedContentRequest::system_instruction].
7496        pub fn set_or_clear_system_instruction<T>(mut self, v: std::option::Option<T>) -> Self
7497        where
7498            T: std::convert::Into<crate::model::GroundedGenerationContent>,
7499        {
7500            self.0.request.system_instruction = v.map(|x| x.into());
7501            self
7502        }
7503
7504        /// Sets the value of [contents][crate::model::GenerateGroundedContentRequest::contents].
7505        pub fn set_contents<T, V>(mut self, v: T) -> Self
7506        where
7507            T: std::iter::IntoIterator<Item = V>,
7508            V: std::convert::Into<crate::model::GroundedGenerationContent>,
7509        {
7510            use std::iter::Iterator;
7511            self.0.request.contents = v.into_iter().map(|i| i.into()).collect();
7512            self
7513        }
7514
7515        /// Sets the value of [generation_spec][crate::model::GenerateGroundedContentRequest::generation_spec].
7516        pub fn set_generation_spec<T>(mut self, v: T) -> Self
7517        where
7518            T: std::convert::Into<crate::model::generate_grounded_content_request::GenerationSpec>,
7519        {
7520            self.0.request.generation_spec = std::option::Option::Some(v.into());
7521            self
7522        }
7523
7524        /// Sets or clears the value of [generation_spec][crate::model::GenerateGroundedContentRequest::generation_spec].
7525        pub fn set_or_clear_generation_spec<T>(mut self, v: std::option::Option<T>) -> Self
7526        where
7527            T: std::convert::Into<crate::model::generate_grounded_content_request::GenerationSpec>,
7528        {
7529            self.0.request.generation_spec = v.map(|x| x.into());
7530            self
7531        }
7532
7533        /// Sets the value of [grounding_spec][crate::model::GenerateGroundedContentRequest::grounding_spec].
7534        pub fn set_grounding_spec<T>(mut self, v: T) -> Self
7535        where
7536            T: std::convert::Into<crate::model::generate_grounded_content_request::GroundingSpec>,
7537        {
7538            self.0.request.grounding_spec = std::option::Option::Some(v.into());
7539            self
7540        }
7541
7542        /// Sets or clears the value of [grounding_spec][crate::model::GenerateGroundedContentRequest::grounding_spec].
7543        pub fn set_or_clear_grounding_spec<T>(mut self, v: std::option::Option<T>) -> Self
7544        where
7545            T: std::convert::Into<crate::model::generate_grounded_content_request::GroundingSpec>,
7546        {
7547            self.0.request.grounding_spec = v.map(|x| x.into());
7548            self
7549        }
7550
7551        /// Sets the value of [user_labels][crate::model::GenerateGroundedContentRequest::user_labels].
7552        pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
7553        where
7554            T: std::iter::IntoIterator<Item = (K, V)>,
7555            K: std::convert::Into<std::string::String>,
7556            V: std::convert::Into<std::string::String>,
7557        {
7558            self.0.request.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
7559            self
7560        }
7561    }
7562
7563    #[doc(hidden)]
7564    impl crate::RequestBuilder for GenerateGroundedContent {
7565        fn request_options(&mut self) -> &mut crate::RequestOptions {
7566            &mut self.0.options
7567        }
7568    }
7569
7570    /// The request builder for [GroundedGenerationService::check_grounding][crate::client::GroundedGenerationService::check_grounding] calls.
7571    ///
7572    /// # Example
7573    /// ```
7574    /// # use google_cloud_discoveryengine_v1::builder::grounded_generation_service::CheckGrounding;
7575    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
7576    ///
7577    /// let builder = prepare_request_builder();
7578    /// let response = builder.send().await?;
7579    /// # Ok(()) }
7580    ///
7581    /// fn prepare_request_builder() -> CheckGrounding {
7582    ///   # panic!();
7583    ///   // ... details omitted ...
7584    /// }
7585    /// ```
7586    #[derive(Clone, Debug)]
7587    pub struct CheckGrounding(RequestBuilder<crate::model::CheckGroundingRequest>);
7588
7589    impl CheckGrounding {
7590        pub(crate) fn new(
7591            stub: std::sync::Arc<dyn super::super::stub::dynamic::GroundedGenerationService>,
7592        ) -> Self {
7593            Self(RequestBuilder::new(stub))
7594        }
7595
7596        /// Sets the full request, replacing any prior values.
7597        pub fn with_request<V: Into<crate::model::CheckGroundingRequest>>(mut self, v: V) -> Self {
7598            self.0.request = v.into();
7599            self
7600        }
7601
7602        /// Sets all the options, replacing any prior values.
7603        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7604            self.0.options = v.into();
7605            self
7606        }
7607
7608        /// Sends the request.
7609        pub async fn send(self) -> Result<crate::model::CheckGroundingResponse> {
7610            (*self.0.stub)
7611                .check_grounding(self.0.request, self.0.options)
7612                .await
7613                .map(crate::Response::into_body)
7614        }
7615
7616        /// Sets the value of [grounding_config][crate::model::CheckGroundingRequest::grounding_config].
7617        ///
7618        /// This is a **required** field for requests.
7619        pub fn set_grounding_config<T: Into<std::string::String>>(mut self, v: T) -> Self {
7620            self.0.request.grounding_config = v.into();
7621            self
7622        }
7623
7624        /// Sets the value of [answer_candidate][crate::model::CheckGroundingRequest::answer_candidate].
7625        pub fn set_answer_candidate<T: Into<std::string::String>>(mut self, v: T) -> Self {
7626            self.0.request.answer_candidate = v.into();
7627            self
7628        }
7629
7630        /// Sets the value of [facts][crate::model::CheckGroundingRequest::facts].
7631        pub fn set_facts<T, V>(mut self, v: T) -> Self
7632        where
7633            T: std::iter::IntoIterator<Item = V>,
7634            V: std::convert::Into<crate::model::GroundingFact>,
7635        {
7636            use std::iter::Iterator;
7637            self.0.request.facts = v.into_iter().map(|i| i.into()).collect();
7638            self
7639        }
7640
7641        /// Sets the value of [grounding_spec][crate::model::CheckGroundingRequest::grounding_spec].
7642        pub fn set_grounding_spec<T>(mut self, v: T) -> Self
7643        where
7644            T: std::convert::Into<crate::model::CheckGroundingSpec>,
7645        {
7646            self.0.request.grounding_spec = std::option::Option::Some(v.into());
7647            self
7648        }
7649
7650        /// Sets or clears the value of [grounding_spec][crate::model::CheckGroundingRequest::grounding_spec].
7651        pub fn set_or_clear_grounding_spec<T>(mut self, v: std::option::Option<T>) -> Self
7652        where
7653            T: std::convert::Into<crate::model::CheckGroundingSpec>,
7654        {
7655            self.0.request.grounding_spec = v.map(|x| x.into());
7656            self
7657        }
7658
7659        /// Sets the value of [user_labels][crate::model::CheckGroundingRequest::user_labels].
7660        pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
7661        where
7662            T: std::iter::IntoIterator<Item = (K, V)>,
7663            K: std::convert::Into<std::string::String>,
7664            V: std::convert::Into<std::string::String>,
7665        {
7666            self.0.request.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
7667            self
7668        }
7669    }
7670
7671    #[doc(hidden)]
7672    impl crate::RequestBuilder for CheckGrounding {
7673        fn request_options(&mut self) -> &mut crate::RequestOptions {
7674            &mut self.0.options
7675        }
7676    }
7677
7678    /// The request builder for [GroundedGenerationService::list_operations][crate::client::GroundedGenerationService::list_operations] calls.
7679    ///
7680    /// # Example
7681    /// ```
7682    /// # use google_cloud_discoveryengine_v1::builder::grounded_generation_service::ListOperations;
7683    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
7684    /// use google_cloud_gax::paginator::ItemPaginator;
7685    ///
7686    /// let builder = prepare_request_builder();
7687    /// let mut items = builder.by_item();
7688    /// while let Some(result) = items.next().await {
7689    ///   let item = result?;
7690    /// }
7691    /// # Ok(()) }
7692    ///
7693    /// fn prepare_request_builder() -> ListOperations {
7694    ///   # panic!();
7695    ///   // ... details omitted ...
7696    /// }
7697    /// ```
7698    #[derive(Clone, Debug)]
7699    pub struct ListOperations(
7700        RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
7701    );
7702
7703    impl ListOperations {
7704        pub(crate) fn new(
7705            stub: std::sync::Arc<dyn super::super::stub::dynamic::GroundedGenerationService>,
7706        ) -> Self {
7707            Self(RequestBuilder::new(stub))
7708        }
7709
7710        /// Sets the full request, replacing any prior values.
7711        pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
7712            mut self,
7713            v: V,
7714        ) -> Self {
7715            self.0.request = v.into();
7716            self
7717        }
7718
7719        /// Sets all the options, replacing any prior values.
7720        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7721            self.0.options = v.into();
7722            self
7723        }
7724
7725        /// Sends the request.
7726        pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
7727            (*self.0.stub)
7728                .list_operations(self.0.request, self.0.options)
7729                .await
7730                .map(crate::Response::into_body)
7731        }
7732
7733        /// Streams each page in the collection.
7734        pub fn by_page(
7735            self,
7736        ) -> impl google_cloud_gax::paginator::Paginator<
7737            google_cloud_longrunning::model::ListOperationsResponse,
7738            crate::Error,
7739        > {
7740            use std::clone::Clone;
7741            let token = self.0.request.page_token.clone();
7742            let execute = move |token: String| {
7743                let mut builder = self.clone();
7744                builder.0.request = builder.0.request.set_page_token(token);
7745                builder.send()
7746            };
7747            google_cloud_gax::paginator::internal::new_paginator(token, execute)
7748        }
7749
7750        /// Streams each item in the collection.
7751        pub fn by_item(
7752            self,
7753        ) -> impl google_cloud_gax::paginator::ItemPaginator<
7754            google_cloud_longrunning::model::ListOperationsResponse,
7755            crate::Error,
7756        > {
7757            use google_cloud_gax::paginator::Paginator;
7758            self.by_page().items()
7759        }
7760
7761        /// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
7762        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7763            self.0.request.name = v.into();
7764            self
7765        }
7766
7767        /// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::filter].
7768        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
7769            self.0.request.filter = v.into();
7770            self
7771        }
7772
7773        /// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
7774        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
7775            self.0.request.page_size = v.into();
7776            self
7777        }
7778
7779        /// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
7780        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
7781            self.0.request.page_token = v.into();
7782            self
7783        }
7784
7785        /// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
7786        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
7787            self.0.request.return_partial_success = v.into();
7788            self
7789        }
7790    }
7791
7792    #[doc(hidden)]
7793    impl crate::RequestBuilder for ListOperations {
7794        fn request_options(&mut self) -> &mut crate::RequestOptions {
7795            &mut self.0.options
7796        }
7797    }
7798
7799    /// The request builder for [GroundedGenerationService::get_operation][crate::client::GroundedGenerationService::get_operation] calls.
7800    ///
7801    /// # Example
7802    /// ```
7803    /// # use google_cloud_discoveryengine_v1::builder::grounded_generation_service::GetOperation;
7804    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
7805    ///
7806    /// let builder = prepare_request_builder();
7807    /// let response = builder.send().await?;
7808    /// # Ok(()) }
7809    ///
7810    /// fn prepare_request_builder() -> GetOperation {
7811    ///   # panic!();
7812    ///   // ... details omitted ...
7813    /// }
7814    /// ```
7815    #[derive(Clone, Debug)]
7816    pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
7817
7818    impl GetOperation {
7819        pub(crate) fn new(
7820            stub: std::sync::Arc<dyn super::super::stub::dynamic::GroundedGenerationService>,
7821        ) -> Self {
7822            Self(RequestBuilder::new(stub))
7823        }
7824
7825        /// Sets the full request, replacing any prior values.
7826        pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
7827            mut self,
7828            v: V,
7829        ) -> Self {
7830            self.0.request = v.into();
7831            self
7832        }
7833
7834        /// Sets all the options, replacing any prior values.
7835        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7836            self.0.options = v.into();
7837            self
7838        }
7839
7840        /// Sends the request.
7841        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
7842            (*self.0.stub)
7843                .get_operation(self.0.request, self.0.options)
7844                .await
7845                .map(crate::Response::into_body)
7846        }
7847
7848        /// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
7849        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7850            self.0.request.name = v.into();
7851            self
7852        }
7853    }
7854
7855    #[doc(hidden)]
7856    impl crate::RequestBuilder for GetOperation {
7857        fn request_options(&mut self) -> &mut crate::RequestOptions {
7858            &mut self.0.options
7859        }
7860    }
7861
7862    /// The request builder for [GroundedGenerationService::cancel_operation][crate::client::GroundedGenerationService::cancel_operation] calls.
7863    ///
7864    /// # Example
7865    /// ```
7866    /// # use google_cloud_discoveryengine_v1::builder::grounded_generation_service::CancelOperation;
7867    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
7868    ///
7869    /// let builder = prepare_request_builder();
7870    /// let response = builder.send().await?;
7871    /// # Ok(()) }
7872    ///
7873    /// fn prepare_request_builder() -> CancelOperation {
7874    ///   # panic!();
7875    ///   // ... details omitted ...
7876    /// }
7877    /// ```
7878    #[derive(Clone, Debug)]
7879    pub struct CancelOperation(
7880        RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
7881    );
7882
7883    impl CancelOperation {
7884        pub(crate) fn new(
7885            stub: std::sync::Arc<dyn super::super::stub::dynamic::GroundedGenerationService>,
7886        ) -> Self {
7887            Self(RequestBuilder::new(stub))
7888        }
7889
7890        /// Sets the full request, replacing any prior values.
7891        pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
7892            mut self,
7893            v: V,
7894        ) -> Self {
7895            self.0.request = v.into();
7896            self
7897        }
7898
7899        /// Sets all the options, replacing any prior values.
7900        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7901            self.0.options = v.into();
7902            self
7903        }
7904
7905        /// Sends the request.
7906        pub async fn send(self) -> Result<()> {
7907            (*self.0.stub)
7908                .cancel_operation(self.0.request, self.0.options)
7909                .await
7910                .map(crate::Response::into_body)
7911        }
7912
7913        /// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::name].
7914        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7915            self.0.request.name = v.into();
7916            self
7917        }
7918    }
7919
7920    #[doc(hidden)]
7921    impl crate::RequestBuilder for CancelOperation {
7922        fn request_options(&mut self) -> &mut crate::RequestOptions {
7923            &mut self.0.options
7924        }
7925    }
7926}
7927
7928#[cfg(feature = "identity-mapping-store-service")]
7929#[cfg_attr(docsrs, doc(cfg(feature = "identity-mapping-store-service")))]
7930pub mod identity_mapping_store_service {
7931    use crate::Result;
7932
7933    /// A builder for [IdentityMappingStoreService][crate::client::IdentityMappingStoreService].
7934    ///
7935    /// ```
7936    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
7937    /// # use google_cloud_discoveryengine_v1::*;
7938    /// # use builder::identity_mapping_store_service::ClientBuilder;
7939    /// # use client::IdentityMappingStoreService;
7940    /// let builder : ClientBuilder = IdentityMappingStoreService::builder();
7941    /// let client = builder
7942    ///     .with_endpoint("https://discoveryengine.googleapis.com")
7943    ///     .build().await?;
7944    /// # Ok(()) }
7945    /// ```
7946    pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
7947
7948    pub(crate) mod client {
7949        use super::super::super::client::IdentityMappingStoreService;
7950        pub struct Factory;
7951        impl crate::ClientFactory for Factory {
7952            type Client = IdentityMappingStoreService;
7953            type Credentials = gaxi::options::Credentials;
7954            async fn build(
7955                self,
7956                config: gaxi::options::ClientConfig,
7957            ) -> crate::ClientBuilderResult<Self::Client> {
7958                Self::Client::new(config).await
7959            }
7960        }
7961    }
7962
7963    /// Common implementation for [crate::client::IdentityMappingStoreService] request builders.
7964    #[derive(Clone, Debug)]
7965    pub(crate) struct RequestBuilder<R: std::default::Default> {
7966        stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
7967        request: R,
7968        options: crate::RequestOptions,
7969    }
7970
7971    impl<R> RequestBuilder<R>
7972    where
7973        R: std::default::Default,
7974    {
7975        pub(crate) fn new(
7976            stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
7977        ) -> Self {
7978            Self {
7979                stub,
7980                request: R::default(),
7981                options: crate::RequestOptions::default(),
7982            }
7983        }
7984    }
7985
7986    /// The request builder for [IdentityMappingStoreService::create_identity_mapping_store][crate::client::IdentityMappingStoreService::create_identity_mapping_store] calls.
7987    ///
7988    /// # Example
7989    /// ```
7990    /// # use google_cloud_discoveryengine_v1::builder::identity_mapping_store_service::CreateIdentityMappingStore;
7991    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
7992    ///
7993    /// let builder = prepare_request_builder();
7994    /// let response = builder.send().await?;
7995    /// # Ok(()) }
7996    ///
7997    /// fn prepare_request_builder() -> CreateIdentityMappingStore {
7998    ///   # panic!();
7999    ///   // ... details omitted ...
8000    /// }
8001    /// ```
8002    #[derive(Clone, Debug)]
8003    pub struct CreateIdentityMappingStore(
8004        RequestBuilder<crate::model::CreateIdentityMappingStoreRequest>,
8005    );
8006
8007    impl CreateIdentityMappingStore {
8008        pub(crate) fn new(
8009            stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
8010        ) -> Self {
8011            Self(RequestBuilder::new(stub))
8012        }
8013
8014        /// Sets the full request, replacing any prior values.
8015        pub fn with_request<V: Into<crate::model::CreateIdentityMappingStoreRequest>>(
8016            mut self,
8017            v: V,
8018        ) -> Self {
8019            self.0.request = v.into();
8020            self
8021        }
8022
8023        /// Sets all the options, replacing any prior values.
8024        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
8025            self.0.options = v.into();
8026            self
8027        }
8028
8029        /// Sends the request.
8030        pub async fn send(self) -> Result<crate::model::IdentityMappingStore> {
8031            (*self.0.stub)
8032                .create_identity_mapping_store(self.0.request, self.0.options)
8033                .await
8034                .map(crate::Response::into_body)
8035        }
8036
8037        /// Sets the value of [parent][crate::model::CreateIdentityMappingStoreRequest::parent].
8038        ///
8039        /// This is a **required** field for requests.
8040        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
8041            self.0.request.parent = v.into();
8042            self
8043        }
8044
8045        /// Sets the value of [identity_mapping_store_id][crate::model::CreateIdentityMappingStoreRequest::identity_mapping_store_id].
8046        ///
8047        /// This is a **required** field for requests.
8048        pub fn set_identity_mapping_store_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
8049            self.0.request.identity_mapping_store_id = v.into();
8050            self
8051        }
8052
8053        /// Sets the value of [identity_mapping_store][crate::model::CreateIdentityMappingStoreRequest::identity_mapping_store].
8054        ///
8055        /// This is a **required** field for requests.
8056        pub fn set_identity_mapping_store<T>(mut self, v: T) -> Self
8057        where
8058            T: std::convert::Into<crate::model::IdentityMappingStore>,
8059        {
8060            self.0.request.identity_mapping_store = std::option::Option::Some(v.into());
8061            self
8062        }
8063
8064        /// Sets or clears the value of [identity_mapping_store][crate::model::CreateIdentityMappingStoreRequest::identity_mapping_store].
8065        ///
8066        /// This is a **required** field for requests.
8067        pub fn set_or_clear_identity_mapping_store<T>(mut self, v: std::option::Option<T>) -> Self
8068        where
8069            T: std::convert::Into<crate::model::IdentityMappingStore>,
8070        {
8071            self.0.request.identity_mapping_store = v.map(|x| x.into());
8072            self
8073        }
8074
8075        /// Sets the value of [cmek_options][crate::model::CreateIdentityMappingStoreRequest::cmek_options].
8076        ///
8077        /// Note that all the setters affecting `cmek_options` are
8078        /// mutually exclusive.
8079        pub fn set_cmek_options<
8080            T: Into<Option<crate::model::create_identity_mapping_store_request::CmekOptions>>,
8081        >(
8082            mut self,
8083            v: T,
8084        ) -> Self {
8085            self.0.request.cmek_options = v.into();
8086            self
8087        }
8088
8089        /// Sets the value of [cmek_options][crate::model::CreateIdentityMappingStoreRequest::cmek_options]
8090        /// to hold a `CmekConfigName`.
8091        ///
8092        /// Note that all the setters affecting `cmek_options` are
8093        /// mutually exclusive.
8094        pub fn set_cmek_config_name<T: std::convert::Into<std::string::String>>(
8095            mut self,
8096            v: T,
8097        ) -> Self {
8098            self.0.request = self.0.request.set_cmek_config_name(v);
8099            self
8100        }
8101
8102        /// Sets the value of [cmek_options][crate::model::CreateIdentityMappingStoreRequest::cmek_options]
8103        /// to hold a `DisableCmek`.
8104        ///
8105        /// Note that all the setters affecting `cmek_options` are
8106        /// mutually exclusive.
8107        pub fn set_disable_cmek<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
8108            self.0.request = self.0.request.set_disable_cmek(v);
8109            self
8110        }
8111    }
8112
8113    #[doc(hidden)]
8114    impl crate::RequestBuilder for CreateIdentityMappingStore {
8115        fn request_options(&mut self) -> &mut crate::RequestOptions {
8116            &mut self.0.options
8117        }
8118    }
8119
8120    /// The request builder for [IdentityMappingStoreService::get_identity_mapping_store][crate::client::IdentityMappingStoreService::get_identity_mapping_store] calls.
8121    ///
8122    /// # Example
8123    /// ```
8124    /// # use google_cloud_discoveryengine_v1::builder::identity_mapping_store_service::GetIdentityMappingStore;
8125    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
8126    ///
8127    /// let builder = prepare_request_builder();
8128    /// let response = builder.send().await?;
8129    /// # Ok(()) }
8130    ///
8131    /// fn prepare_request_builder() -> GetIdentityMappingStore {
8132    ///   # panic!();
8133    ///   // ... details omitted ...
8134    /// }
8135    /// ```
8136    #[derive(Clone, Debug)]
8137    pub struct GetIdentityMappingStore(
8138        RequestBuilder<crate::model::GetIdentityMappingStoreRequest>,
8139    );
8140
8141    impl GetIdentityMappingStore {
8142        pub(crate) fn new(
8143            stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
8144        ) -> Self {
8145            Self(RequestBuilder::new(stub))
8146        }
8147
8148        /// Sets the full request, replacing any prior values.
8149        pub fn with_request<V: Into<crate::model::GetIdentityMappingStoreRequest>>(
8150            mut self,
8151            v: V,
8152        ) -> Self {
8153            self.0.request = v.into();
8154            self
8155        }
8156
8157        /// Sets all the options, replacing any prior values.
8158        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
8159            self.0.options = v.into();
8160            self
8161        }
8162
8163        /// Sends the request.
8164        pub async fn send(self) -> Result<crate::model::IdentityMappingStore> {
8165            (*self.0.stub)
8166                .get_identity_mapping_store(self.0.request, self.0.options)
8167                .await
8168                .map(crate::Response::into_body)
8169        }
8170
8171        /// Sets the value of [name][crate::model::GetIdentityMappingStoreRequest::name].
8172        ///
8173        /// This is a **required** field for requests.
8174        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
8175            self.0.request.name = v.into();
8176            self
8177        }
8178    }
8179
8180    #[doc(hidden)]
8181    impl crate::RequestBuilder for GetIdentityMappingStore {
8182        fn request_options(&mut self) -> &mut crate::RequestOptions {
8183            &mut self.0.options
8184        }
8185    }
8186
8187    /// The request builder for [IdentityMappingStoreService::delete_identity_mapping_store][crate::client::IdentityMappingStoreService::delete_identity_mapping_store] calls.
8188    ///
8189    /// # Example
8190    /// ```
8191    /// # use google_cloud_discoveryengine_v1::builder::identity_mapping_store_service::DeleteIdentityMappingStore;
8192    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
8193    /// use google_cloud_lro::Poller;
8194    ///
8195    /// let builder = prepare_request_builder();
8196    /// let response = builder.poller().until_done().await?;
8197    /// # Ok(()) }
8198    ///
8199    /// fn prepare_request_builder() -> DeleteIdentityMappingStore {
8200    ///   # panic!();
8201    ///   // ... details omitted ...
8202    /// }
8203    /// ```
8204    #[derive(Clone, Debug)]
8205    pub struct DeleteIdentityMappingStore(
8206        RequestBuilder<crate::model::DeleteIdentityMappingStoreRequest>,
8207    );
8208
8209    impl DeleteIdentityMappingStore {
8210        pub(crate) fn new(
8211            stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
8212        ) -> Self {
8213            Self(RequestBuilder::new(stub))
8214        }
8215
8216        /// Sets the full request, replacing any prior values.
8217        pub fn with_request<V: Into<crate::model::DeleteIdentityMappingStoreRequest>>(
8218            mut self,
8219            v: V,
8220        ) -> Self {
8221            self.0.request = v.into();
8222            self
8223        }
8224
8225        /// Sets all the options, replacing any prior values.
8226        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
8227            self.0.options = v.into();
8228            self
8229        }
8230
8231        /// Sends the request.
8232        ///
8233        /// # Long running operations
8234        ///
8235        /// This starts, but does not poll, a longrunning operation. More information
8236        /// on [delete_identity_mapping_store][crate::client::IdentityMappingStoreService::delete_identity_mapping_store].
8237        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
8238            (*self.0.stub)
8239                .delete_identity_mapping_store(self.0.request, self.0.options)
8240                .await
8241                .map(crate::Response::into_body)
8242        }
8243
8244        /// Creates a [Poller][google_cloud_lro::Poller] to work with `delete_identity_mapping_store`.
8245        pub fn poller(
8246            self,
8247        ) -> impl google_cloud_lro::Poller<(), crate::model::DeleteIdentityMappingStoreMetadata>
8248        {
8249            type Operation = google_cloud_lro::internal::Operation<
8250                wkt::Empty,
8251                crate::model::DeleteIdentityMappingStoreMetadata,
8252            >;
8253            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
8254            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
8255
8256            let stub = self.0.stub.clone();
8257            let mut options = self.0.options.clone();
8258            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
8259            let query = move |name| {
8260                let stub = stub.clone();
8261                let options = options.clone();
8262                async {
8263                    let op = GetOperation::new(stub)
8264                        .set_name(name)
8265                        .with_options(options)
8266                        .send()
8267                        .await?;
8268                    Ok(Operation::new(op))
8269                }
8270            };
8271
8272            let start = move || async {
8273                let op = self.send().await?;
8274                Ok(Operation::new(op))
8275            };
8276
8277            google_cloud_lro::internal::new_unit_response_poller(
8278                polling_error_policy,
8279                polling_backoff_policy,
8280                start,
8281                query,
8282            )
8283        }
8284
8285        /// Sets the value of [name][crate::model::DeleteIdentityMappingStoreRequest::name].
8286        ///
8287        /// This is a **required** field for requests.
8288        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
8289            self.0.request.name = v.into();
8290            self
8291        }
8292    }
8293
8294    #[doc(hidden)]
8295    impl crate::RequestBuilder for DeleteIdentityMappingStore {
8296        fn request_options(&mut self) -> &mut crate::RequestOptions {
8297            &mut self.0.options
8298        }
8299    }
8300
8301    /// The request builder for [IdentityMappingStoreService::import_identity_mappings][crate::client::IdentityMappingStoreService::import_identity_mappings] calls.
8302    ///
8303    /// # Example
8304    /// ```
8305    /// # use google_cloud_discoveryengine_v1::builder::identity_mapping_store_service::ImportIdentityMappings;
8306    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
8307    /// use google_cloud_lro::Poller;
8308    ///
8309    /// let builder = prepare_request_builder();
8310    /// let response = builder.poller().until_done().await?;
8311    /// # Ok(()) }
8312    ///
8313    /// fn prepare_request_builder() -> ImportIdentityMappings {
8314    ///   # panic!();
8315    ///   // ... details omitted ...
8316    /// }
8317    /// ```
8318    #[derive(Clone, Debug)]
8319    pub struct ImportIdentityMappings(RequestBuilder<crate::model::ImportIdentityMappingsRequest>);
8320
8321    impl ImportIdentityMappings {
8322        pub(crate) fn new(
8323            stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
8324        ) -> Self {
8325            Self(RequestBuilder::new(stub))
8326        }
8327
8328        /// Sets the full request, replacing any prior values.
8329        pub fn with_request<V: Into<crate::model::ImportIdentityMappingsRequest>>(
8330            mut self,
8331            v: V,
8332        ) -> Self {
8333            self.0.request = v.into();
8334            self
8335        }
8336
8337        /// Sets all the options, replacing any prior values.
8338        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
8339            self.0.options = v.into();
8340            self
8341        }
8342
8343        /// Sends the request.
8344        ///
8345        /// # Long running operations
8346        ///
8347        /// This starts, but does not poll, a longrunning operation. More information
8348        /// on [import_identity_mappings][crate::client::IdentityMappingStoreService::import_identity_mappings].
8349        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
8350            (*self.0.stub)
8351                .import_identity_mappings(self.0.request, self.0.options)
8352                .await
8353                .map(crate::Response::into_body)
8354        }
8355
8356        /// Creates a [Poller][google_cloud_lro::Poller] to work with `import_identity_mappings`.
8357        pub fn poller(
8358            self,
8359        ) -> impl google_cloud_lro::Poller<
8360            crate::model::ImportIdentityMappingsResponse,
8361            crate::model::IdentityMappingEntryOperationMetadata,
8362        > {
8363            type Operation = google_cloud_lro::internal::Operation<
8364                crate::model::ImportIdentityMappingsResponse,
8365                crate::model::IdentityMappingEntryOperationMetadata,
8366            >;
8367            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
8368            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
8369
8370            let stub = self.0.stub.clone();
8371            let mut options = self.0.options.clone();
8372            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
8373            let query = move |name| {
8374                let stub = stub.clone();
8375                let options = options.clone();
8376                async {
8377                    let op = GetOperation::new(stub)
8378                        .set_name(name)
8379                        .with_options(options)
8380                        .send()
8381                        .await?;
8382                    Ok(Operation::new(op))
8383                }
8384            };
8385
8386            let start = move || async {
8387                let op = self.send().await?;
8388                Ok(Operation::new(op))
8389            };
8390
8391            google_cloud_lro::internal::new_poller(
8392                polling_error_policy,
8393                polling_backoff_policy,
8394                start,
8395                query,
8396            )
8397        }
8398
8399        /// Sets the value of [identity_mapping_store][crate::model::ImportIdentityMappingsRequest::identity_mapping_store].
8400        ///
8401        /// This is a **required** field for requests.
8402        pub fn set_identity_mapping_store<T: Into<std::string::String>>(mut self, v: T) -> Self {
8403            self.0.request.identity_mapping_store = v.into();
8404            self
8405        }
8406
8407        /// Sets the value of [source][crate::model::ImportIdentityMappingsRequest::source].
8408        ///
8409        /// Note that all the setters affecting `source` are
8410        /// mutually exclusive.
8411        pub fn set_source<
8412            T: Into<Option<crate::model::import_identity_mappings_request::Source>>,
8413        >(
8414            mut self,
8415            v: T,
8416        ) -> Self {
8417            self.0.request.source = v.into();
8418            self
8419        }
8420
8421        /// Sets the value of [source][crate::model::ImportIdentityMappingsRequest::source]
8422        /// to hold a `InlineSource`.
8423        ///
8424        /// Note that all the setters affecting `source` are
8425        /// mutually exclusive.
8426        pub fn set_inline_source<
8427            T: std::convert::Into<
8428                    std::boxed::Box<crate::model::import_identity_mappings_request::InlineSource>,
8429                >,
8430        >(
8431            mut self,
8432            v: T,
8433        ) -> Self {
8434            self.0.request = self.0.request.set_inline_source(v);
8435            self
8436        }
8437    }
8438
8439    #[doc(hidden)]
8440    impl crate::RequestBuilder for ImportIdentityMappings {
8441        fn request_options(&mut self) -> &mut crate::RequestOptions {
8442            &mut self.0.options
8443        }
8444    }
8445
8446    /// The request builder for [IdentityMappingStoreService::purge_identity_mappings][crate::client::IdentityMappingStoreService::purge_identity_mappings] calls.
8447    ///
8448    /// # Example
8449    /// ```
8450    /// # use google_cloud_discoveryengine_v1::builder::identity_mapping_store_service::PurgeIdentityMappings;
8451    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
8452    /// use google_cloud_lro::Poller;
8453    ///
8454    /// let builder = prepare_request_builder();
8455    /// let response = builder.poller().until_done().await?;
8456    /// # Ok(()) }
8457    ///
8458    /// fn prepare_request_builder() -> PurgeIdentityMappings {
8459    ///   # panic!();
8460    ///   // ... details omitted ...
8461    /// }
8462    /// ```
8463    #[derive(Clone, Debug)]
8464    pub struct PurgeIdentityMappings(RequestBuilder<crate::model::PurgeIdentityMappingsRequest>);
8465
8466    impl PurgeIdentityMappings {
8467        pub(crate) fn new(
8468            stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
8469        ) -> Self {
8470            Self(RequestBuilder::new(stub))
8471        }
8472
8473        /// Sets the full request, replacing any prior values.
8474        pub fn with_request<V: Into<crate::model::PurgeIdentityMappingsRequest>>(
8475            mut self,
8476            v: V,
8477        ) -> Self {
8478            self.0.request = v.into();
8479            self
8480        }
8481
8482        /// Sets all the options, replacing any prior values.
8483        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
8484            self.0.options = v.into();
8485            self
8486        }
8487
8488        /// Sends the request.
8489        ///
8490        /// # Long running operations
8491        ///
8492        /// This starts, but does not poll, a longrunning operation. More information
8493        /// on [purge_identity_mappings][crate::client::IdentityMappingStoreService::purge_identity_mappings].
8494        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
8495            (*self.0.stub)
8496                .purge_identity_mappings(self.0.request, self.0.options)
8497                .await
8498                .map(crate::Response::into_body)
8499        }
8500
8501        /// Creates a [Poller][google_cloud_lro::Poller] to work with `purge_identity_mappings`.
8502        pub fn poller(
8503            self,
8504        ) -> impl google_cloud_lro::Poller<(), crate::model::IdentityMappingEntryOperationMetadata>
8505        {
8506            type Operation = google_cloud_lro::internal::Operation<
8507                wkt::Empty,
8508                crate::model::IdentityMappingEntryOperationMetadata,
8509            >;
8510            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
8511            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
8512
8513            let stub = self.0.stub.clone();
8514            let mut options = self.0.options.clone();
8515            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
8516            let query = move |name| {
8517                let stub = stub.clone();
8518                let options = options.clone();
8519                async {
8520                    let op = GetOperation::new(stub)
8521                        .set_name(name)
8522                        .with_options(options)
8523                        .send()
8524                        .await?;
8525                    Ok(Operation::new(op))
8526                }
8527            };
8528
8529            let start = move || async {
8530                let op = self.send().await?;
8531                Ok(Operation::new(op))
8532            };
8533
8534            google_cloud_lro::internal::new_unit_response_poller(
8535                polling_error_policy,
8536                polling_backoff_policy,
8537                start,
8538                query,
8539            )
8540        }
8541
8542        /// Sets the value of [identity_mapping_store][crate::model::PurgeIdentityMappingsRequest::identity_mapping_store].
8543        ///
8544        /// This is a **required** field for requests.
8545        pub fn set_identity_mapping_store<T: Into<std::string::String>>(mut self, v: T) -> Self {
8546            self.0.request.identity_mapping_store = v.into();
8547            self
8548        }
8549
8550        /// Sets the value of [filter][crate::model::PurgeIdentityMappingsRequest::filter].
8551        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
8552            self.0.request.filter = v.into();
8553            self
8554        }
8555
8556        /// Sets the value of [force][crate::model::PurgeIdentityMappingsRequest::force].
8557        pub fn set_force<T>(mut self, v: T) -> Self
8558        where
8559            T: std::convert::Into<bool>,
8560        {
8561            self.0.request.force = std::option::Option::Some(v.into());
8562            self
8563        }
8564
8565        /// Sets or clears the value of [force][crate::model::PurgeIdentityMappingsRequest::force].
8566        pub fn set_or_clear_force<T>(mut self, v: std::option::Option<T>) -> Self
8567        where
8568            T: std::convert::Into<bool>,
8569        {
8570            self.0.request.force = v.map(|x| x.into());
8571            self
8572        }
8573
8574        /// Sets the value of [source][crate::model::PurgeIdentityMappingsRequest::source].
8575        ///
8576        /// Note that all the setters affecting `source` are
8577        /// mutually exclusive.
8578        pub fn set_source<
8579            T: Into<Option<crate::model::purge_identity_mappings_request::Source>>,
8580        >(
8581            mut self,
8582            v: T,
8583        ) -> Self {
8584            self.0.request.source = v.into();
8585            self
8586        }
8587
8588        /// Sets the value of [source][crate::model::PurgeIdentityMappingsRequest::source]
8589        /// to hold a `InlineSource`.
8590        ///
8591        /// Note that all the setters affecting `source` are
8592        /// mutually exclusive.
8593        pub fn set_inline_source<
8594            T: std::convert::Into<
8595                    std::boxed::Box<crate::model::purge_identity_mappings_request::InlineSource>,
8596                >,
8597        >(
8598            mut self,
8599            v: T,
8600        ) -> Self {
8601            self.0.request = self.0.request.set_inline_source(v);
8602            self
8603        }
8604    }
8605
8606    #[doc(hidden)]
8607    impl crate::RequestBuilder for PurgeIdentityMappings {
8608        fn request_options(&mut self) -> &mut crate::RequestOptions {
8609            &mut self.0.options
8610        }
8611    }
8612
8613    /// The request builder for [IdentityMappingStoreService::list_identity_mappings][crate::client::IdentityMappingStoreService::list_identity_mappings] calls.
8614    ///
8615    /// # Example
8616    /// ```
8617    /// # use google_cloud_discoveryengine_v1::builder::identity_mapping_store_service::ListIdentityMappings;
8618    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
8619    /// use google_cloud_gax::paginator::ItemPaginator;
8620    ///
8621    /// let builder = prepare_request_builder();
8622    /// let mut items = builder.by_item();
8623    /// while let Some(result) = items.next().await {
8624    ///   let item = result?;
8625    /// }
8626    /// # Ok(()) }
8627    ///
8628    /// fn prepare_request_builder() -> ListIdentityMappings {
8629    ///   # panic!();
8630    ///   // ... details omitted ...
8631    /// }
8632    /// ```
8633    #[derive(Clone, Debug)]
8634    pub struct ListIdentityMappings(RequestBuilder<crate::model::ListIdentityMappingsRequest>);
8635
8636    impl ListIdentityMappings {
8637        pub(crate) fn new(
8638            stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
8639        ) -> Self {
8640            Self(RequestBuilder::new(stub))
8641        }
8642
8643        /// Sets the full request, replacing any prior values.
8644        pub fn with_request<V: Into<crate::model::ListIdentityMappingsRequest>>(
8645            mut self,
8646            v: V,
8647        ) -> Self {
8648            self.0.request = v.into();
8649            self
8650        }
8651
8652        /// Sets all the options, replacing any prior values.
8653        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
8654            self.0.options = v.into();
8655            self
8656        }
8657
8658        /// Sends the request.
8659        pub async fn send(self) -> Result<crate::model::ListIdentityMappingsResponse> {
8660            (*self.0.stub)
8661                .list_identity_mappings(self.0.request, self.0.options)
8662                .await
8663                .map(crate::Response::into_body)
8664        }
8665
8666        /// Streams each page in the collection.
8667        pub fn by_page(
8668            self,
8669        ) -> impl google_cloud_gax::paginator::Paginator<
8670            crate::model::ListIdentityMappingsResponse,
8671            crate::Error,
8672        > {
8673            use std::clone::Clone;
8674            let token = self.0.request.page_token.clone();
8675            let execute = move |token: String| {
8676                let mut builder = self.clone();
8677                builder.0.request = builder.0.request.set_page_token(token);
8678                builder.send()
8679            };
8680            google_cloud_gax::paginator::internal::new_paginator(token, execute)
8681        }
8682
8683        /// Streams each item in the collection.
8684        pub fn by_item(
8685            self,
8686        ) -> impl google_cloud_gax::paginator::ItemPaginator<
8687            crate::model::ListIdentityMappingsResponse,
8688            crate::Error,
8689        > {
8690            use google_cloud_gax::paginator::Paginator;
8691            self.by_page().items()
8692        }
8693
8694        /// Sets the value of [identity_mapping_store][crate::model::ListIdentityMappingsRequest::identity_mapping_store].
8695        ///
8696        /// This is a **required** field for requests.
8697        pub fn set_identity_mapping_store<T: Into<std::string::String>>(mut self, v: T) -> Self {
8698            self.0.request.identity_mapping_store = v.into();
8699            self
8700        }
8701
8702        /// Sets the value of [page_size][crate::model::ListIdentityMappingsRequest::page_size].
8703        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
8704            self.0.request.page_size = v.into();
8705            self
8706        }
8707
8708        /// Sets the value of [page_token][crate::model::ListIdentityMappingsRequest::page_token].
8709        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
8710            self.0.request.page_token = v.into();
8711            self
8712        }
8713    }
8714
8715    #[doc(hidden)]
8716    impl crate::RequestBuilder for ListIdentityMappings {
8717        fn request_options(&mut self) -> &mut crate::RequestOptions {
8718            &mut self.0.options
8719        }
8720    }
8721
8722    /// The request builder for [IdentityMappingStoreService::list_identity_mapping_stores][crate::client::IdentityMappingStoreService::list_identity_mapping_stores] calls.
8723    ///
8724    /// # Example
8725    /// ```
8726    /// # use google_cloud_discoveryengine_v1::builder::identity_mapping_store_service::ListIdentityMappingStores;
8727    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
8728    /// use google_cloud_gax::paginator::ItemPaginator;
8729    ///
8730    /// let builder = prepare_request_builder();
8731    /// let mut items = builder.by_item();
8732    /// while let Some(result) = items.next().await {
8733    ///   let item = result?;
8734    /// }
8735    /// # Ok(()) }
8736    ///
8737    /// fn prepare_request_builder() -> ListIdentityMappingStores {
8738    ///   # panic!();
8739    ///   // ... details omitted ...
8740    /// }
8741    /// ```
8742    #[derive(Clone, Debug)]
8743    pub struct ListIdentityMappingStores(
8744        RequestBuilder<crate::model::ListIdentityMappingStoresRequest>,
8745    );
8746
8747    impl ListIdentityMappingStores {
8748        pub(crate) fn new(
8749            stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
8750        ) -> Self {
8751            Self(RequestBuilder::new(stub))
8752        }
8753
8754        /// Sets the full request, replacing any prior values.
8755        pub fn with_request<V: Into<crate::model::ListIdentityMappingStoresRequest>>(
8756            mut self,
8757            v: V,
8758        ) -> Self {
8759            self.0.request = v.into();
8760            self
8761        }
8762
8763        /// Sets all the options, replacing any prior values.
8764        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
8765            self.0.options = v.into();
8766            self
8767        }
8768
8769        /// Sends the request.
8770        pub async fn send(self) -> Result<crate::model::ListIdentityMappingStoresResponse> {
8771            (*self.0.stub)
8772                .list_identity_mapping_stores(self.0.request, self.0.options)
8773                .await
8774                .map(crate::Response::into_body)
8775        }
8776
8777        /// Streams each page in the collection.
8778        pub fn by_page(
8779            self,
8780        ) -> impl google_cloud_gax::paginator::Paginator<
8781            crate::model::ListIdentityMappingStoresResponse,
8782            crate::Error,
8783        > {
8784            use std::clone::Clone;
8785            let token = self.0.request.page_token.clone();
8786            let execute = move |token: String| {
8787                let mut builder = self.clone();
8788                builder.0.request = builder.0.request.set_page_token(token);
8789                builder.send()
8790            };
8791            google_cloud_gax::paginator::internal::new_paginator(token, execute)
8792        }
8793
8794        /// Streams each item in the collection.
8795        pub fn by_item(
8796            self,
8797        ) -> impl google_cloud_gax::paginator::ItemPaginator<
8798            crate::model::ListIdentityMappingStoresResponse,
8799            crate::Error,
8800        > {
8801            use google_cloud_gax::paginator::Paginator;
8802            self.by_page().items()
8803        }
8804
8805        /// Sets the value of [parent][crate::model::ListIdentityMappingStoresRequest::parent].
8806        ///
8807        /// This is a **required** field for requests.
8808        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
8809            self.0.request.parent = v.into();
8810            self
8811        }
8812
8813        /// Sets the value of [page_size][crate::model::ListIdentityMappingStoresRequest::page_size].
8814        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
8815            self.0.request.page_size = v.into();
8816            self
8817        }
8818
8819        /// Sets the value of [page_token][crate::model::ListIdentityMappingStoresRequest::page_token].
8820        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
8821            self.0.request.page_token = v.into();
8822            self
8823        }
8824    }
8825
8826    #[doc(hidden)]
8827    impl crate::RequestBuilder for ListIdentityMappingStores {
8828        fn request_options(&mut self) -> &mut crate::RequestOptions {
8829            &mut self.0.options
8830        }
8831    }
8832
8833    /// The request builder for [IdentityMappingStoreService::list_operations][crate::client::IdentityMappingStoreService::list_operations] calls.
8834    ///
8835    /// # Example
8836    /// ```
8837    /// # use google_cloud_discoveryengine_v1::builder::identity_mapping_store_service::ListOperations;
8838    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
8839    /// use google_cloud_gax::paginator::ItemPaginator;
8840    ///
8841    /// let builder = prepare_request_builder();
8842    /// let mut items = builder.by_item();
8843    /// while let Some(result) = items.next().await {
8844    ///   let item = result?;
8845    /// }
8846    /// # Ok(()) }
8847    ///
8848    /// fn prepare_request_builder() -> ListOperations {
8849    ///   # panic!();
8850    ///   // ... details omitted ...
8851    /// }
8852    /// ```
8853    #[derive(Clone, Debug)]
8854    pub struct ListOperations(
8855        RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
8856    );
8857
8858    impl ListOperations {
8859        pub(crate) fn new(
8860            stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
8861        ) -> Self {
8862            Self(RequestBuilder::new(stub))
8863        }
8864
8865        /// Sets the full request, replacing any prior values.
8866        pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
8867            mut self,
8868            v: V,
8869        ) -> Self {
8870            self.0.request = v.into();
8871            self
8872        }
8873
8874        /// Sets all the options, replacing any prior values.
8875        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
8876            self.0.options = v.into();
8877            self
8878        }
8879
8880        /// Sends the request.
8881        pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
8882            (*self.0.stub)
8883                .list_operations(self.0.request, self.0.options)
8884                .await
8885                .map(crate::Response::into_body)
8886        }
8887
8888        /// Streams each page in the collection.
8889        pub fn by_page(
8890            self,
8891        ) -> impl google_cloud_gax::paginator::Paginator<
8892            google_cloud_longrunning::model::ListOperationsResponse,
8893            crate::Error,
8894        > {
8895            use std::clone::Clone;
8896            let token = self.0.request.page_token.clone();
8897            let execute = move |token: String| {
8898                let mut builder = self.clone();
8899                builder.0.request = builder.0.request.set_page_token(token);
8900                builder.send()
8901            };
8902            google_cloud_gax::paginator::internal::new_paginator(token, execute)
8903        }
8904
8905        /// Streams each item in the collection.
8906        pub fn by_item(
8907            self,
8908        ) -> impl google_cloud_gax::paginator::ItemPaginator<
8909            google_cloud_longrunning::model::ListOperationsResponse,
8910            crate::Error,
8911        > {
8912            use google_cloud_gax::paginator::Paginator;
8913            self.by_page().items()
8914        }
8915
8916        /// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
8917        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
8918            self.0.request.name = v.into();
8919            self
8920        }
8921
8922        /// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::filter].
8923        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
8924            self.0.request.filter = v.into();
8925            self
8926        }
8927
8928        /// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
8929        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
8930            self.0.request.page_size = v.into();
8931            self
8932        }
8933
8934        /// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
8935        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
8936            self.0.request.page_token = v.into();
8937            self
8938        }
8939
8940        /// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
8941        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
8942            self.0.request.return_partial_success = v.into();
8943            self
8944        }
8945    }
8946
8947    #[doc(hidden)]
8948    impl crate::RequestBuilder for ListOperations {
8949        fn request_options(&mut self) -> &mut crate::RequestOptions {
8950            &mut self.0.options
8951        }
8952    }
8953
8954    /// The request builder for [IdentityMappingStoreService::get_operation][crate::client::IdentityMappingStoreService::get_operation] calls.
8955    ///
8956    /// # Example
8957    /// ```
8958    /// # use google_cloud_discoveryengine_v1::builder::identity_mapping_store_service::GetOperation;
8959    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
8960    ///
8961    /// let builder = prepare_request_builder();
8962    /// let response = builder.send().await?;
8963    /// # Ok(()) }
8964    ///
8965    /// fn prepare_request_builder() -> GetOperation {
8966    ///   # panic!();
8967    ///   // ... details omitted ...
8968    /// }
8969    /// ```
8970    #[derive(Clone, Debug)]
8971    pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
8972
8973    impl GetOperation {
8974        pub(crate) fn new(
8975            stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
8976        ) -> Self {
8977            Self(RequestBuilder::new(stub))
8978        }
8979
8980        /// Sets the full request, replacing any prior values.
8981        pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
8982            mut self,
8983            v: V,
8984        ) -> Self {
8985            self.0.request = v.into();
8986            self
8987        }
8988
8989        /// Sets all the options, replacing any prior values.
8990        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
8991            self.0.options = v.into();
8992            self
8993        }
8994
8995        /// Sends the request.
8996        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
8997            (*self.0.stub)
8998                .get_operation(self.0.request, self.0.options)
8999                .await
9000                .map(crate::Response::into_body)
9001        }
9002
9003        /// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
9004        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9005            self.0.request.name = v.into();
9006            self
9007        }
9008    }
9009
9010    #[doc(hidden)]
9011    impl crate::RequestBuilder for GetOperation {
9012        fn request_options(&mut self) -> &mut crate::RequestOptions {
9013            &mut self.0.options
9014        }
9015    }
9016
9017    /// The request builder for [IdentityMappingStoreService::cancel_operation][crate::client::IdentityMappingStoreService::cancel_operation] calls.
9018    ///
9019    /// # Example
9020    /// ```
9021    /// # use google_cloud_discoveryengine_v1::builder::identity_mapping_store_service::CancelOperation;
9022    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
9023    ///
9024    /// let builder = prepare_request_builder();
9025    /// let response = builder.send().await?;
9026    /// # Ok(()) }
9027    ///
9028    /// fn prepare_request_builder() -> CancelOperation {
9029    ///   # panic!();
9030    ///   // ... details omitted ...
9031    /// }
9032    /// ```
9033    #[derive(Clone, Debug)]
9034    pub struct CancelOperation(
9035        RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
9036    );
9037
9038    impl CancelOperation {
9039        pub(crate) fn new(
9040            stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
9041        ) -> Self {
9042            Self(RequestBuilder::new(stub))
9043        }
9044
9045        /// Sets the full request, replacing any prior values.
9046        pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
9047            mut self,
9048            v: V,
9049        ) -> Self {
9050            self.0.request = v.into();
9051            self
9052        }
9053
9054        /// Sets all the options, replacing any prior values.
9055        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
9056            self.0.options = v.into();
9057            self
9058        }
9059
9060        /// Sends the request.
9061        pub async fn send(self) -> Result<()> {
9062            (*self.0.stub)
9063                .cancel_operation(self.0.request, self.0.options)
9064                .await
9065                .map(crate::Response::into_body)
9066        }
9067
9068        /// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::name].
9069        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9070            self.0.request.name = v.into();
9071            self
9072        }
9073    }
9074
9075    #[doc(hidden)]
9076    impl crate::RequestBuilder for CancelOperation {
9077        fn request_options(&mut self) -> &mut crate::RequestOptions {
9078            &mut self.0.options
9079        }
9080    }
9081}
9082
9083#[cfg(feature = "project-service")]
9084#[cfg_attr(docsrs, doc(cfg(feature = "project-service")))]
9085pub mod project_service {
9086    use crate::Result;
9087
9088    /// A builder for [ProjectService][crate::client::ProjectService].
9089    ///
9090    /// ```
9091    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
9092    /// # use google_cloud_discoveryengine_v1::*;
9093    /// # use builder::project_service::ClientBuilder;
9094    /// # use client::ProjectService;
9095    /// let builder : ClientBuilder = ProjectService::builder();
9096    /// let client = builder
9097    ///     .with_endpoint("https://discoveryengine.googleapis.com")
9098    ///     .build().await?;
9099    /// # Ok(()) }
9100    /// ```
9101    pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
9102
9103    pub(crate) mod client {
9104        use super::super::super::client::ProjectService;
9105        pub struct Factory;
9106        impl crate::ClientFactory for Factory {
9107            type Client = ProjectService;
9108            type Credentials = gaxi::options::Credentials;
9109            async fn build(
9110                self,
9111                config: gaxi::options::ClientConfig,
9112            ) -> crate::ClientBuilderResult<Self::Client> {
9113                Self::Client::new(config).await
9114            }
9115        }
9116    }
9117
9118    /// Common implementation for [crate::client::ProjectService] request builders.
9119    #[derive(Clone, Debug)]
9120    pub(crate) struct RequestBuilder<R: std::default::Default> {
9121        stub: std::sync::Arc<dyn super::super::stub::dynamic::ProjectService>,
9122        request: R,
9123        options: crate::RequestOptions,
9124    }
9125
9126    impl<R> RequestBuilder<R>
9127    where
9128        R: std::default::Default,
9129    {
9130        pub(crate) fn new(
9131            stub: std::sync::Arc<dyn super::super::stub::dynamic::ProjectService>,
9132        ) -> Self {
9133            Self {
9134                stub,
9135                request: R::default(),
9136                options: crate::RequestOptions::default(),
9137            }
9138        }
9139    }
9140
9141    /// The request builder for [ProjectService::provision_project][crate::client::ProjectService::provision_project] calls.
9142    ///
9143    /// # Example
9144    /// ```
9145    /// # use google_cloud_discoveryengine_v1::builder::project_service::ProvisionProject;
9146    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
9147    /// use google_cloud_lro::Poller;
9148    ///
9149    /// let builder = prepare_request_builder();
9150    /// let response = builder.poller().until_done().await?;
9151    /// # Ok(()) }
9152    ///
9153    /// fn prepare_request_builder() -> ProvisionProject {
9154    ///   # panic!();
9155    ///   // ... details omitted ...
9156    /// }
9157    /// ```
9158    #[derive(Clone, Debug)]
9159    pub struct ProvisionProject(RequestBuilder<crate::model::ProvisionProjectRequest>);
9160
9161    impl ProvisionProject {
9162        pub(crate) fn new(
9163            stub: std::sync::Arc<dyn super::super::stub::dynamic::ProjectService>,
9164        ) -> Self {
9165            Self(RequestBuilder::new(stub))
9166        }
9167
9168        /// Sets the full request, replacing any prior values.
9169        pub fn with_request<V: Into<crate::model::ProvisionProjectRequest>>(
9170            mut self,
9171            v: V,
9172        ) -> Self {
9173            self.0.request = v.into();
9174            self
9175        }
9176
9177        /// Sets all the options, replacing any prior values.
9178        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
9179            self.0.options = v.into();
9180            self
9181        }
9182
9183        /// Sends the request.
9184        ///
9185        /// # Long running operations
9186        ///
9187        /// This starts, but does not poll, a longrunning operation. More information
9188        /// on [provision_project][crate::client::ProjectService::provision_project].
9189        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
9190            (*self.0.stub)
9191                .provision_project(self.0.request, self.0.options)
9192                .await
9193                .map(crate::Response::into_body)
9194        }
9195
9196        /// Creates a [Poller][google_cloud_lro::Poller] to work with `provision_project`.
9197        pub fn poller(
9198            self,
9199        ) -> impl google_cloud_lro::Poller<crate::model::Project, crate::model::ProvisionProjectMetadata>
9200        {
9201            type Operation = google_cloud_lro::internal::Operation<
9202                crate::model::Project,
9203                crate::model::ProvisionProjectMetadata,
9204            >;
9205            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
9206            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
9207
9208            let stub = self.0.stub.clone();
9209            let mut options = self.0.options.clone();
9210            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
9211            let query = move |name| {
9212                let stub = stub.clone();
9213                let options = options.clone();
9214                async {
9215                    let op = GetOperation::new(stub)
9216                        .set_name(name)
9217                        .with_options(options)
9218                        .send()
9219                        .await?;
9220                    Ok(Operation::new(op))
9221                }
9222            };
9223
9224            let start = move || async {
9225                let op = self.send().await?;
9226                Ok(Operation::new(op))
9227            };
9228
9229            google_cloud_lro::internal::new_poller(
9230                polling_error_policy,
9231                polling_backoff_policy,
9232                start,
9233                query,
9234            )
9235        }
9236
9237        /// Sets the value of [name][crate::model::ProvisionProjectRequest::name].
9238        ///
9239        /// This is a **required** field for requests.
9240        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9241            self.0.request.name = v.into();
9242            self
9243        }
9244
9245        /// Sets the value of [accept_data_use_terms][crate::model::ProvisionProjectRequest::accept_data_use_terms].
9246        ///
9247        /// This is a **required** field for requests.
9248        pub fn set_accept_data_use_terms<T: Into<bool>>(mut self, v: T) -> Self {
9249            self.0.request.accept_data_use_terms = v.into();
9250            self
9251        }
9252
9253        /// Sets the value of [data_use_terms_version][crate::model::ProvisionProjectRequest::data_use_terms_version].
9254        ///
9255        /// This is a **required** field for requests.
9256        pub fn set_data_use_terms_version<T: Into<std::string::String>>(mut self, v: T) -> Self {
9257            self.0.request.data_use_terms_version = v.into();
9258            self
9259        }
9260    }
9261
9262    #[doc(hidden)]
9263    impl crate::RequestBuilder for ProvisionProject {
9264        fn request_options(&mut self) -> &mut crate::RequestOptions {
9265            &mut self.0.options
9266        }
9267    }
9268
9269    /// The request builder for [ProjectService::list_operations][crate::client::ProjectService::list_operations] calls.
9270    ///
9271    /// # Example
9272    /// ```
9273    /// # use google_cloud_discoveryengine_v1::builder::project_service::ListOperations;
9274    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
9275    /// use google_cloud_gax::paginator::ItemPaginator;
9276    ///
9277    /// let builder = prepare_request_builder();
9278    /// let mut items = builder.by_item();
9279    /// while let Some(result) = items.next().await {
9280    ///   let item = result?;
9281    /// }
9282    /// # Ok(()) }
9283    ///
9284    /// fn prepare_request_builder() -> ListOperations {
9285    ///   # panic!();
9286    ///   // ... details omitted ...
9287    /// }
9288    /// ```
9289    #[derive(Clone, Debug)]
9290    pub struct ListOperations(
9291        RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
9292    );
9293
9294    impl ListOperations {
9295        pub(crate) fn new(
9296            stub: std::sync::Arc<dyn super::super::stub::dynamic::ProjectService>,
9297        ) -> Self {
9298            Self(RequestBuilder::new(stub))
9299        }
9300
9301        /// Sets the full request, replacing any prior values.
9302        pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
9303            mut self,
9304            v: V,
9305        ) -> Self {
9306            self.0.request = v.into();
9307            self
9308        }
9309
9310        /// Sets all the options, replacing any prior values.
9311        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
9312            self.0.options = v.into();
9313            self
9314        }
9315
9316        /// Sends the request.
9317        pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
9318            (*self.0.stub)
9319                .list_operations(self.0.request, self.0.options)
9320                .await
9321                .map(crate::Response::into_body)
9322        }
9323
9324        /// Streams each page in the collection.
9325        pub fn by_page(
9326            self,
9327        ) -> impl google_cloud_gax::paginator::Paginator<
9328            google_cloud_longrunning::model::ListOperationsResponse,
9329            crate::Error,
9330        > {
9331            use std::clone::Clone;
9332            let token = self.0.request.page_token.clone();
9333            let execute = move |token: String| {
9334                let mut builder = self.clone();
9335                builder.0.request = builder.0.request.set_page_token(token);
9336                builder.send()
9337            };
9338            google_cloud_gax::paginator::internal::new_paginator(token, execute)
9339        }
9340
9341        /// Streams each item in the collection.
9342        pub fn by_item(
9343            self,
9344        ) -> impl google_cloud_gax::paginator::ItemPaginator<
9345            google_cloud_longrunning::model::ListOperationsResponse,
9346            crate::Error,
9347        > {
9348            use google_cloud_gax::paginator::Paginator;
9349            self.by_page().items()
9350        }
9351
9352        /// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
9353        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9354            self.0.request.name = v.into();
9355            self
9356        }
9357
9358        /// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::filter].
9359        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
9360            self.0.request.filter = v.into();
9361            self
9362        }
9363
9364        /// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
9365        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
9366            self.0.request.page_size = v.into();
9367            self
9368        }
9369
9370        /// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
9371        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
9372            self.0.request.page_token = v.into();
9373            self
9374        }
9375
9376        /// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
9377        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
9378            self.0.request.return_partial_success = v.into();
9379            self
9380        }
9381    }
9382
9383    #[doc(hidden)]
9384    impl crate::RequestBuilder for ListOperations {
9385        fn request_options(&mut self) -> &mut crate::RequestOptions {
9386            &mut self.0.options
9387        }
9388    }
9389
9390    /// The request builder for [ProjectService::get_operation][crate::client::ProjectService::get_operation] calls.
9391    ///
9392    /// # Example
9393    /// ```
9394    /// # use google_cloud_discoveryengine_v1::builder::project_service::GetOperation;
9395    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
9396    ///
9397    /// let builder = prepare_request_builder();
9398    /// let response = builder.send().await?;
9399    /// # Ok(()) }
9400    ///
9401    /// fn prepare_request_builder() -> GetOperation {
9402    ///   # panic!();
9403    ///   // ... details omitted ...
9404    /// }
9405    /// ```
9406    #[derive(Clone, Debug)]
9407    pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
9408
9409    impl GetOperation {
9410        pub(crate) fn new(
9411            stub: std::sync::Arc<dyn super::super::stub::dynamic::ProjectService>,
9412        ) -> Self {
9413            Self(RequestBuilder::new(stub))
9414        }
9415
9416        /// Sets the full request, replacing any prior values.
9417        pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
9418            mut self,
9419            v: V,
9420        ) -> Self {
9421            self.0.request = v.into();
9422            self
9423        }
9424
9425        /// Sets all the options, replacing any prior values.
9426        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
9427            self.0.options = v.into();
9428            self
9429        }
9430
9431        /// Sends the request.
9432        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
9433            (*self.0.stub)
9434                .get_operation(self.0.request, self.0.options)
9435                .await
9436                .map(crate::Response::into_body)
9437        }
9438
9439        /// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
9440        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9441            self.0.request.name = v.into();
9442            self
9443        }
9444    }
9445
9446    #[doc(hidden)]
9447    impl crate::RequestBuilder for GetOperation {
9448        fn request_options(&mut self) -> &mut crate::RequestOptions {
9449            &mut self.0.options
9450        }
9451    }
9452
9453    /// The request builder for [ProjectService::cancel_operation][crate::client::ProjectService::cancel_operation] calls.
9454    ///
9455    /// # Example
9456    /// ```
9457    /// # use google_cloud_discoveryengine_v1::builder::project_service::CancelOperation;
9458    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
9459    ///
9460    /// let builder = prepare_request_builder();
9461    /// let response = builder.send().await?;
9462    /// # Ok(()) }
9463    ///
9464    /// fn prepare_request_builder() -> CancelOperation {
9465    ///   # panic!();
9466    ///   // ... details omitted ...
9467    /// }
9468    /// ```
9469    #[derive(Clone, Debug)]
9470    pub struct CancelOperation(
9471        RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
9472    );
9473
9474    impl CancelOperation {
9475        pub(crate) fn new(
9476            stub: std::sync::Arc<dyn super::super::stub::dynamic::ProjectService>,
9477        ) -> Self {
9478            Self(RequestBuilder::new(stub))
9479        }
9480
9481        /// Sets the full request, replacing any prior values.
9482        pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
9483            mut self,
9484            v: V,
9485        ) -> Self {
9486            self.0.request = v.into();
9487            self
9488        }
9489
9490        /// Sets all the options, replacing any prior values.
9491        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
9492            self.0.options = v.into();
9493            self
9494        }
9495
9496        /// Sends the request.
9497        pub async fn send(self) -> Result<()> {
9498            (*self.0.stub)
9499                .cancel_operation(self.0.request, self.0.options)
9500                .await
9501                .map(crate::Response::into_body)
9502        }
9503
9504        /// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::name].
9505        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9506            self.0.request.name = v.into();
9507            self
9508        }
9509    }
9510
9511    #[doc(hidden)]
9512    impl crate::RequestBuilder for CancelOperation {
9513        fn request_options(&mut self) -> &mut crate::RequestOptions {
9514            &mut self.0.options
9515        }
9516    }
9517}
9518
9519#[cfg(feature = "rank-service")]
9520#[cfg_attr(docsrs, doc(cfg(feature = "rank-service")))]
9521pub mod rank_service {
9522    use crate::Result;
9523
9524    /// A builder for [RankService][crate::client::RankService].
9525    ///
9526    /// ```
9527    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
9528    /// # use google_cloud_discoveryengine_v1::*;
9529    /// # use builder::rank_service::ClientBuilder;
9530    /// # use client::RankService;
9531    /// let builder : ClientBuilder = RankService::builder();
9532    /// let client = builder
9533    ///     .with_endpoint("https://discoveryengine.googleapis.com")
9534    ///     .build().await?;
9535    /// # Ok(()) }
9536    /// ```
9537    pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
9538
9539    pub(crate) mod client {
9540        use super::super::super::client::RankService;
9541        pub struct Factory;
9542        impl crate::ClientFactory for Factory {
9543            type Client = RankService;
9544            type Credentials = gaxi::options::Credentials;
9545            async fn build(
9546                self,
9547                config: gaxi::options::ClientConfig,
9548            ) -> crate::ClientBuilderResult<Self::Client> {
9549                Self::Client::new(config).await
9550            }
9551        }
9552    }
9553
9554    /// Common implementation for [crate::client::RankService] request builders.
9555    #[derive(Clone, Debug)]
9556    pub(crate) struct RequestBuilder<R: std::default::Default> {
9557        stub: std::sync::Arc<dyn super::super::stub::dynamic::RankService>,
9558        request: R,
9559        options: crate::RequestOptions,
9560    }
9561
9562    impl<R> RequestBuilder<R>
9563    where
9564        R: std::default::Default,
9565    {
9566        pub(crate) fn new(
9567            stub: std::sync::Arc<dyn super::super::stub::dynamic::RankService>,
9568        ) -> Self {
9569            Self {
9570                stub,
9571                request: R::default(),
9572                options: crate::RequestOptions::default(),
9573            }
9574        }
9575    }
9576
9577    /// The request builder for [RankService::rank][crate::client::RankService::rank] calls.
9578    ///
9579    /// # Example
9580    /// ```
9581    /// # use google_cloud_discoveryengine_v1::builder::rank_service::Rank;
9582    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
9583    ///
9584    /// let builder = prepare_request_builder();
9585    /// let response = builder.send().await?;
9586    /// # Ok(()) }
9587    ///
9588    /// fn prepare_request_builder() -> Rank {
9589    ///   # panic!();
9590    ///   // ... details omitted ...
9591    /// }
9592    /// ```
9593    #[derive(Clone, Debug)]
9594    pub struct Rank(RequestBuilder<crate::model::RankRequest>);
9595
9596    impl Rank {
9597        pub(crate) fn new(
9598            stub: std::sync::Arc<dyn super::super::stub::dynamic::RankService>,
9599        ) -> Self {
9600            Self(RequestBuilder::new(stub))
9601        }
9602
9603        /// Sets the full request, replacing any prior values.
9604        pub fn with_request<V: Into<crate::model::RankRequest>>(mut self, v: V) -> Self {
9605            self.0.request = v.into();
9606            self
9607        }
9608
9609        /// Sets all the options, replacing any prior values.
9610        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
9611            self.0.options = v.into();
9612            self
9613        }
9614
9615        /// Sends the request.
9616        pub async fn send(self) -> Result<crate::model::RankResponse> {
9617            (*self.0.stub)
9618                .rank(self.0.request, self.0.options)
9619                .await
9620                .map(crate::Response::into_body)
9621        }
9622
9623        /// Sets the value of [ranking_config][crate::model::RankRequest::ranking_config].
9624        ///
9625        /// This is a **required** field for requests.
9626        pub fn set_ranking_config<T: Into<std::string::String>>(mut self, v: T) -> Self {
9627            self.0.request.ranking_config = v.into();
9628            self
9629        }
9630
9631        /// Sets the value of [model][crate::model::RankRequest::model].
9632        pub fn set_model<T: Into<std::string::String>>(mut self, v: T) -> Self {
9633            self.0.request.model = v.into();
9634            self
9635        }
9636
9637        /// Sets the value of [top_n][crate::model::RankRequest::top_n].
9638        pub fn set_top_n<T: Into<i32>>(mut self, v: T) -> Self {
9639            self.0.request.top_n = v.into();
9640            self
9641        }
9642
9643        /// Sets the value of [query][crate::model::RankRequest::query].
9644        pub fn set_query<T: Into<std::string::String>>(mut self, v: T) -> Self {
9645            self.0.request.query = v.into();
9646            self
9647        }
9648
9649        /// Sets the value of [records][crate::model::RankRequest::records].
9650        ///
9651        /// This is a **required** field for requests.
9652        pub fn set_records<T, V>(mut self, v: T) -> Self
9653        where
9654            T: std::iter::IntoIterator<Item = V>,
9655            V: std::convert::Into<crate::model::RankingRecord>,
9656        {
9657            use std::iter::Iterator;
9658            self.0.request.records = v.into_iter().map(|i| i.into()).collect();
9659            self
9660        }
9661
9662        /// Sets the value of [ignore_record_details_in_response][crate::model::RankRequest::ignore_record_details_in_response].
9663        pub fn set_ignore_record_details_in_response<T: Into<bool>>(mut self, v: T) -> Self {
9664            self.0.request.ignore_record_details_in_response = v.into();
9665            self
9666        }
9667
9668        /// Sets the value of [user_labels][crate::model::RankRequest::user_labels].
9669        pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
9670        where
9671            T: std::iter::IntoIterator<Item = (K, V)>,
9672            K: std::convert::Into<std::string::String>,
9673            V: std::convert::Into<std::string::String>,
9674        {
9675            self.0.request.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
9676            self
9677        }
9678    }
9679
9680    #[doc(hidden)]
9681    impl crate::RequestBuilder for Rank {
9682        fn request_options(&mut self) -> &mut crate::RequestOptions {
9683            &mut self.0.options
9684        }
9685    }
9686
9687    /// The request builder for [RankService::list_operations][crate::client::RankService::list_operations] calls.
9688    ///
9689    /// # Example
9690    /// ```
9691    /// # use google_cloud_discoveryengine_v1::builder::rank_service::ListOperations;
9692    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
9693    /// use google_cloud_gax::paginator::ItemPaginator;
9694    ///
9695    /// let builder = prepare_request_builder();
9696    /// let mut items = builder.by_item();
9697    /// while let Some(result) = items.next().await {
9698    ///   let item = result?;
9699    /// }
9700    /// # Ok(()) }
9701    ///
9702    /// fn prepare_request_builder() -> ListOperations {
9703    ///   # panic!();
9704    ///   // ... details omitted ...
9705    /// }
9706    /// ```
9707    #[derive(Clone, Debug)]
9708    pub struct ListOperations(
9709        RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
9710    );
9711
9712    impl ListOperations {
9713        pub(crate) fn new(
9714            stub: std::sync::Arc<dyn super::super::stub::dynamic::RankService>,
9715        ) -> Self {
9716            Self(RequestBuilder::new(stub))
9717        }
9718
9719        /// Sets the full request, replacing any prior values.
9720        pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
9721            mut self,
9722            v: V,
9723        ) -> Self {
9724            self.0.request = v.into();
9725            self
9726        }
9727
9728        /// Sets all the options, replacing any prior values.
9729        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
9730            self.0.options = v.into();
9731            self
9732        }
9733
9734        /// Sends the request.
9735        pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
9736            (*self.0.stub)
9737                .list_operations(self.0.request, self.0.options)
9738                .await
9739                .map(crate::Response::into_body)
9740        }
9741
9742        /// Streams each page in the collection.
9743        pub fn by_page(
9744            self,
9745        ) -> impl google_cloud_gax::paginator::Paginator<
9746            google_cloud_longrunning::model::ListOperationsResponse,
9747            crate::Error,
9748        > {
9749            use std::clone::Clone;
9750            let token = self.0.request.page_token.clone();
9751            let execute = move |token: String| {
9752                let mut builder = self.clone();
9753                builder.0.request = builder.0.request.set_page_token(token);
9754                builder.send()
9755            };
9756            google_cloud_gax::paginator::internal::new_paginator(token, execute)
9757        }
9758
9759        /// Streams each item in the collection.
9760        pub fn by_item(
9761            self,
9762        ) -> impl google_cloud_gax::paginator::ItemPaginator<
9763            google_cloud_longrunning::model::ListOperationsResponse,
9764            crate::Error,
9765        > {
9766            use google_cloud_gax::paginator::Paginator;
9767            self.by_page().items()
9768        }
9769
9770        /// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
9771        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9772            self.0.request.name = v.into();
9773            self
9774        }
9775
9776        /// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::filter].
9777        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
9778            self.0.request.filter = v.into();
9779            self
9780        }
9781
9782        /// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
9783        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
9784            self.0.request.page_size = v.into();
9785            self
9786        }
9787
9788        /// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
9789        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
9790            self.0.request.page_token = v.into();
9791            self
9792        }
9793
9794        /// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
9795        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
9796            self.0.request.return_partial_success = v.into();
9797            self
9798        }
9799    }
9800
9801    #[doc(hidden)]
9802    impl crate::RequestBuilder for ListOperations {
9803        fn request_options(&mut self) -> &mut crate::RequestOptions {
9804            &mut self.0.options
9805        }
9806    }
9807
9808    /// The request builder for [RankService::get_operation][crate::client::RankService::get_operation] calls.
9809    ///
9810    /// # Example
9811    /// ```
9812    /// # use google_cloud_discoveryengine_v1::builder::rank_service::GetOperation;
9813    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
9814    ///
9815    /// let builder = prepare_request_builder();
9816    /// let response = builder.send().await?;
9817    /// # Ok(()) }
9818    ///
9819    /// fn prepare_request_builder() -> GetOperation {
9820    ///   # panic!();
9821    ///   // ... details omitted ...
9822    /// }
9823    /// ```
9824    #[derive(Clone, Debug)]
9825    pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
9826
9827    impl GetOperation {
9828        pub(crate) fn new(
9829            stub: std::sync::Arc<dyn super::super::stub::dynamic::RankService>,
9830        ) -> Self {
9831            Self(RequestBuilder::new(stub))
9832        }
9833
9834        /// Sets the full request, replacing any prior values.
9835        pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
9836            mut self,
9837            v: V,
9838        ) -> Self {
9839            self.0.request = v.into();
9840            self
9841        }
9842
9843        /// Sets all the options, replacing any prior values.
9844        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
9845            self.0.options = v.into();
9846            self
9847        }
9848
9849        /// Sends the request.
9850        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
9851            (*self.0.stub)
9852                .get_operation(self.0.request, self.0.options)
9853                .await
9854                .map(crate::Response::into_body)
9855        }
9856
9857        /// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
9858        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9859            self.0.request.name = v.into();
9860            self
9861        }
9862    }
9863
9864    #[doc(hidden)]
9865    impl crate::RequestBuilder for GetOperation {
9866        fn request_options(&mut self) -> &mut crate::RequestOptions {
9867            &mut self.0.options
9868        }
9869    }
9870
9871    /// The request builder for [RankService::cancel_operation][crate::client::RankService::cancel_operation] calls.
9872    ///
9873    /// # Example
9874    /// ```
9875    /// # use google_cloud_discoveryengine_v1::builder::rank_service::CancelOperation;
9876    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
9877    ///
9878    /// let builder = prepare_request_builder();
9879    /// let response = builder.send().await?;
9880    /// # Ok(()) }
9881    ///
9882    /// fn prepare_request_builder() -> CancelOperation {
9883    ///   # panic!();
9884    ///   // ... details omitted ...
9885    /// }
9886    /// ```
9887    #[derive(Clone, Debug)]
9888    pub struct CancelOperation(
9889        RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
9890    );
9891
9892    impl CancelOperation {
9893        pub(crate) fn new(
9894            stub: std::sync::Arc<dyn super::super::stub::dynamic::RankService>,
9895        ) -> Self {
9896            Self(RequestBuilder::new(stub))
9897        }
9898
9899        /// Sets the full request, replacing any prior values.
9900        pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
9901            mut self,
9902            v: V,
9903        ) -> Self {
9904            self.0.request = v.into();
9905            self
9906        }
9907
9908        /// Sets all the options, replacing any prior values.
9909        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
9910            self.0.options = v.into();
9911            self
9912        }
9913
9914        /// Sends the request.
9915        pub async fn send(self) -> Result<()> {
9916            (*self.0.stub)
9917                .cancel_operation(self.0.request, self.0.options)
9918                .await
9919                .map(crate::Response::into_body)
9920        }
9921
9922        /// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::name].
9923        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9924            self.0.request.name = v.into();
9925            self
9926        }
9927    }
9928
9929    #[doc(hidden)]
9930    impl crate::RequestBuilder for CancelOperation {
9931        fn request_options(&mut self) -> &mut crate::RequestOptions {
9932            &mut self.0.options
9933        }
9934    }
9935}
9936
9937#[cfg(feature = "recommendation-service")]
9938#[cfg_attr(docsrs, doc(cfg(feature = "recommendation-service")))]
9939pub mod recommendation_service {
9940    use crate::Result;
9941
9942    /// A builder for [RecommendationService][crate::client::RecommendationService].
9943    ///
9944    /// ```
9945    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
9946    /// # use google_cloud_discoveryengine_v1::*;
9947    /// # use builder::recommendation_service::ClientBuilder;
9948    /// # use client::RecommendationService;
9949    /// let builder : ClientBuilder = RecommendationService::builder();
9950    /// let client = builder
9951    ///     .with_endpoint("https://discoveryengine.googleapis.com")
9952    ///     .build().await?;
9953    /// # Ok(()) }
9954    /// ```
9955    pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
9956
9957    pub(crate) mod client {
9958        use super::super::super::client::RecommendationService;
9959        pub struct Factory;
9960        impl crate::ClientFactory for Factory {
9961            type Client = RecommendationService;
9962            type Credentials = gaxi::options::Credentials;
9963            async fn build(
9964                self,
9965                config: gaxi::options::ClientConfig,
9966            ) -> crate::ClientBuilderResult<Self::Client> {
9967                Self::Client::new(config).await
9968            }
9969        }
9970    }
9971
9972    /// Common implementation for [crate::client::RecommendationService] request builders.
9973    #[derive(Clone, Debug)]
9974    pub(crate) struct RequestBuilder<R: std::default::Default> {
9975        stub: std::sync::Arc<dyn super::super::stub::dynamic::RecommendationService>,
9976        request: R,
9977        options: crate::RequestOptions,
9978    }
9979
9980    impl<R> RequestBuilder<R>
9981    where
9982        R: std::default::Default,
9983    {
9984        pub(crate) fn new(
9985            stub: std::sync::Arc<dyn super::super::stub::dynamic::RecommendationService>,
9986        ) -> Self {
9987            Self {
9988                stub,
9989                request: R::default(),
9990                options: crate::RequestOptions::default(),
9991            }
9992        }
9993    }
9994
9995    /// The request builder for [RecommendationService::recommend][crate::client::RecommendationService::recommend] calls.
9996    ///
9997    /// # Example
9998    /// ```
9999    /// # use google_cloud_discoveryengine_v1::builder::recommendation_service::Recommend;
10000    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
10001    ///
10002    /// let builder = prepare_request_builder();
10003    /// let response = builder.send().await?;
10004    /// # Ok(()) }
10005    ///
10006    /// fn prepare_request_builder() -> Recommend {
10007    ///   # panic!();
10008    ///   // ... details omitted ...
10009    /// }
10010    /// ```
10011    #[derive(Clone, Debug)]
10012    pub struct Recommend(RequestBuilder<crate::model::RecommendRequest>);
10013
10014    impl Recommend {
10015        pub(crate) fn new(
10016            stub: std::sync::Arc<dyn super::super::stub::dynamic::RecommendationService>,
10017        ) -> Self {
10018            Self(RequestBuilder::new(stub))
10019        }
10020
10021        /// Sets the full request, replacing any prior values.
10022        pub fn with_request<V: Into<crate::model::RecommendRequest>>(mut self, v: V) -> Self {
10023            self.0.request = v.into();
10024            self
10025        }
10026
10027        /// Sets all the options, replacing any prior values.
10028        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
10029            self.0.options = v.into();
10030            self
10031        }
10032
10033        /// Sends the request.
10034        pub async fn send(self) -> Result<crate::model::RecommendResponse> {
10035            (*self.0.stub)
10036                .recommend(self.0.request, self.0.options)
10037                .await
10038                .map(crate::Response::into_body)
10039        }
10040
10041        /// Sets the value of [serving_config][crate::model::RecommendRequest::serving_config].
10042        ///
10043        /// This is a **required** field for requests.
10044        pub fn set_serving_config<T: Into<std::string::String>>(mut self, v: T) -> Self {
10045            self.0.request.serving_config = v.into();
10046            self
10047        }
10048
10049        /// Sets the value of [user_event][crate::model::RecommendRequest::user_event].
10050        ///
10051        /// This is a **required** field for requests.
10052        pub fn set_user_event<T>(mut self, v: T) -> Self
10053        where
10054            T: std::convert::Into<crate::model::UserEvent>,
10055        {
10056            self.0.request.user_event = std::option::Option::Some(v.into());
10057            self
10058        }
10059
10060        /// Sets or clears the value of [user_event][crate::model::RecommendRequest::user_event].
10061        ///
10062        /// This is a **required** field for requests.
10063        pub fn set_or_clear_user_event<T>(mut self, v: std::option::Option<T>) -> Self
10064        where
10065            T: std::convert::Into<crate::model::UserEvent>,
10066        {
10067            self.0.request.user_event = v.map(|x| x.into());
10068            self
10069        }
10070
10071        /// Sets the value of [page_size][crate::model::RecommendRequest::page_size].
10072        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
10073            self.0.request.page_size = v.into();
10074            self
10075        }
10076
10077        /// Sets the value of [filter][crate::model::RecommendRequest::filter].
10078        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
10079            self.0.request.filter = v.into();
10080            self
10081        }
10082
10083        /// Sets the value of [validate_only][crate::model::RecommendRequest::validate_only].
10084        pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
10085            self.0.request.validate_only = v.into();
10086            self
10087        }
10088
10089        /// Sets the value of [params][crate::model::RecommendRequest::params].
10090        pub fn set_params<T, K, V>(mut self, v: T) -> Self
10091        where
10092            T: std::iter::IntoIterator<Item = (K, V)>,
10093            K: std::convert::Into<std::string::String>,
10094            V: std::convert::Into<wkt::Value>,
10095        {
10096            self.0.request.params = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
10097            self
10098        }
10099
10100        /// Sets the value of [user_labels][crate::model::RecommendRequest::user_labels].
10101        pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
10102        where
10103            T: std::iter::IntoIterator<Item = (K, V)>,
10104            K: std::convert::Into<std::string::String>,
10105            V: std::convert::Into<std::string::String>,
10106        {
10107            self.0.request.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
10108            self
10109        }
10110    }
10111
10112    #[doc(hidden)]
10113    impl crate::RequestBuilder for Recommend {
10114        fn request_options(&mut self) -> &mut crate::RequestOptions {
10115            &mut self.0.options
10116        }
10117    }
10118
10119    /// The request builder for [RecommendationService::list_operations][crate::client::RecommendationService::list_operations] calls.
10120    ///
10121    /// # Example
10122    /// ```
10123    /// # use google_cloud_discoveryengine_v1::builder::recommendation_service::ListOperations;
10124    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
10125    /// use google_cloud_gax::paginator::ItemPaginator;
10126    ///
10127    /// let builder = prepare_request_builder();
10128    /// let mut items = builder.by_item();
10129    /// while let Some(result) = items.next().await {
10130    ///   let item = result?;
10131    /// }
10132    /// # Ok(()) }
10133    ///
10134    /// fn prepare_request_builder() -> ListOperations {
10135    ///   # panic!();
10136    ///   // ... details omitted ...
10137    /// }
10138    /// ```
10139    #[derive(Clone, Debug)]
10140    pub struct ListOperations(
10141        RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
10142    );
10143
10144    impl ListOperations {
10145        pub(crate) fn new(
10146            stub: std::sync::Arc<dyn super::super::stub::dynamic::RecommendationService>,
10147        ) -> Self {
10148            Self(RequestBuilder::new(stub))
10149        }
10150
10151        /// Sets the full request, replacing any prior values.
10152        pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
10153            mut self,
10154            v: V,
10155        ) -> Self {
10156            self.0.request = v.into();
10157            self
10158        }
10159
10160        /// Sets all the options, replacing any prior values.
10161        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
10162            self.0.options = v.into();
10163            self
10164        }
10165
10166        /// Sends the request.
10167        pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
10168            (*self.0.stub)
10169                .list_operations(self.0.request, self.0.options)
10170                .await
10171                .map(crate::Response::into_body)
10172        }
10173
10174        /// Streams each page in the collection.
10175        pub fn by_page(
10176            self,
10177        ) -> impl google_cloud_gax::paginator::Paginator<
10178            google_cloud_longrunning::model::ListOperationsResponse,
10179            crate::Error,
10180        > {
10181            use std::clone::Clone;
10182            let token = self.0.request.page_token.clone();
10183            let execute = move |token: String| {
10184                let mut builder = self.clone();
10185                builder.0.request = builder.0.request.set_page_token(token);
10186                builder.send()
10187            };
10188            google_cloud_gax::paginator::internal::new_paginator(token, execute)
10189        }
10190
10191        /// Streams each item in the collection.
10192        pub fn by_item(
10193            self,
10194        ) -> impl google_cloud_gax::paginator::ItemPaginator<
10195            google_cloud_longrunning::model::ListOperationsResponse,
10196            crate::Error,
10197        > {
10198            use google_cloud_gax::paginator::Paginator;
10199            self.by_page().items()
10200        }
10201
10202        /// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
10203        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
10204            self.0.request.name = v.into();
10205            self
10206        }
10207
10208        /// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::filter].
10209        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
10210            self.0.request.filter = v.into();
10211            self
10212        }
10213
10214        /// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
10215        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
10216            self.0.request.page_size = v.into();
10217            self
10218        }
10219
10220        /// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
10221        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
10222            self.0.request.page_token = v.into();
10223            self
10224        }
10225
10226        /// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
10227        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
10228            self.0.request.return_partial_success = v.into();
10229            self
10230        }
10231    }
10232
10233    #[doc(hidden)]
10234    impl crate::RequestBuilder for ListOperations {
10235        fn request_options(&mut self) -> &mut crate::RequestOptions {
10236            &mut self.0.options
10237        }
10238    }
10239
10240    /// The request builder for [RecommendationService::get_operation][crate::client::RecommendationService::get_operation] calls.
10241    ///
10242    /// # Example
10243    /// ```
10244    /// # use google_cloud_discoveryengine_v1::builder::recommendation_service::GetOperation;
10245    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
10246    ///
10247    /// let builder = prepare_request_builder();
10248    /// let response = builder.send().await?;
10249    /// # Ok(()) }
10250    ///
10251    /// fn prepare_request_builder() -> GetOperation {
10252    ///   # panic!();
10253    ///   // ... details omitted ...
10254    /// }
10255    /// ```
10256    #[derive(Clone, Debug)]
10257    pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
10258
10259    impl GetOperation {
10260        pub(crate) fn new(
10261            stub: std::sync::Arc<dyn super::super::stub::dynamic::RecommendationService>,
10262        ) -> Self {
10263            Self(RequestBuilder::new(stub))
10264        }
10265
10266        /// Sets the full request, replacing any prior values.
10267        pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
10268            mut self,
10269            v: V,
10270        ) -> Self {
10271            self.0.request = v.into();
10272            self
10273        }
10274
10275        /// Sets all the options, replacing any prior values.
10276        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
10277            self.0.options = v.into();
10278            self
10279        }
10280
10281        /// Sends the request.
10282        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
10283            (*self.0.stub)
10284                .get_operation(self.0.request, self.0.options)
10285                .await
10286                .map(crate::Response::into_body)
10287        }
10288
10289        /// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
10290        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
10291            self.0.request.name = v.into();
10292            self
10293        }
10294    }
10295
10296    #[doc(hidden)]
10297    impl crate::RequestBuilder for GetOperation {
10298        fn request_options(&mut self) -> &mut crate::RequestOptions {
10299            &mut self.0.options
10300        }
10301    }
10302
10303    /// The request builder for [RecommendationService::cancel_operation][crate::client::RecommendationService::cancel_operation] calls.
10304    ///
10305    /// # Example
10306    /// ```
10307    /// # use google_cloud_discoveryengine_v1::builder::recommendation_service::CancelOperation;
10308    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
10309    ///
10310    /// let builder = prepare_request_builder();
10311    /// let response = builder.send().await?;
10312    /// # Ok(()) }
10313    ///
10314    /// fn prepare_request_builder() -> CancelOperation {
10315    ///   # panic!();
10316    ///   // ... details omitted ...
10317    /// }
10318    /// ```
10319    #[derive(Clone, Debug)]
10320    pub struct CancelOperation(
10321        RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
10322    );
10323
10324    impl CancelOperation {
10325        pub(crate) fn new(
10326            stub: std::sync::Arc<dyn super::super::stub::dynamic::RecommendationService>,
10327        ) -> Self {
10328            Self(RequestBuilder::new(stub))
10329        }
10330
10331        /// Sets the full request, replacing any prior values.
10332        pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
10333            mut self,
10334            v: V,
10335        ) -> Self {
10336            self.0.request = v.into();
10337            self
10338        }
10339
10340        /// Sets all the options, replacing any prior values.
10341        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
10342            self.0.options = v.into();
10343            self
10344        }
10345
10346        /// Sends the request.
10347        pub async fn send(self) -> Result<()> {
10348            (*self.0.stub)
10349                .cancel_operation(self.0.request, self.0.options)
10350                .await
10351                .map(crate::Response::into_body)
10352        }
10353
10354        /// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::name].
10355        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
10356            self.0.request.name = v.into();
10357            self
10358        }
10359    }
10360
10361    #[doc(hidden)]
10362    impl crate::RequestBuilder for CancelOperation {
10363        fn request_options(&mut self) -> &mut crate::RequestOptions {
10364            &mut self.0.options
10365        }
10366    }
10367}
10368
10369#[cfg(feature = "schema-service")]
10370#[cfg_attr(docsrs, doc(cfg(feature = "schema-service")))]
10371pub mod schema_service {
10372    use crate::Result;
10373
10374    /// A builder for [SchemaService][crate::client::SchemaService].
10375    ///
10376    /// ```
10377    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
10378    /// # use google_cloud_discoveryengine_v1::*;
10379    /// # use builder::schema_service::ClientBuilder;
10380    /// # use client::SchemaService;
10381    /// let builder : ClientBuilder = SchemaService::builder();
10382    /// let client = builder
10383    ///     .with_endpoint("https://discoveryengine.googleapis.com")
10384    ///     .build().await?;
10385    /// # Ok(()) }
10386    /// ```
10387    pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
10388
10389    pub(crate) mod client {
10390        use super::super::super::client::SchemaService;
10391        pub struct Factory;
10392        impl crate::ClientFactory for Factory {
10393            type Client = SchemaService;
10394            type Credentials = gaxi::options::Credentials;
10395            async fn build(
10396                self,
10397                config: gaxi::options::ClientConfig,
10398            ) -> crate::ClientBuilderResult<Self::Client> {
10399                Self::Client::new(config).await
10400            }
10401        }
10402    }
10403
10404    /// Common implementation for [crate::client::SchemaService] request builders.
10405    #[derive(Clone, Debug)]
10406    pub(crate) struct RequestBuilder<R: std::default::Default> {
10407        stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
10408        request: R,
10409        options: crate::RequestOptions,
10410    }
10411
10412    impl<R> RequestBuilder<R>
10413    where
10414        R: std::default::Default,
10415    {
10416        pub(crate) fn new(
10417            stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
10418        ) -> Self {
10419            Self {
10420                stub,
10421                request: R::default(),
10422                options: crate::RequestOptions::default(),
10423            }
10424        }
10425    }
10426
10427    /// The request builder for [SchemaService::get_schema][crate::client::SchemaService::get_schema] calls.
10428    ///
10429    /// # Example
10430    /// ```
10431    /// # use google_cloud_discoveryengine_v1::builder::schema_service::GetSchema;
10432    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
10433    ///
10434    /// let builder = prepare_request_builder();
10435    /// let response = builder.send().await?;
10436    /// # Ok(()) }
10437    ///
10438    /// fn prepare_request_builder() -> GetSchema {
10439    ///   # panic!();
10440    ///   // ... details omitted ...
10441    /// }
10442    /// ```
10443    #[derive(Clone, Debug)]
10444    pub struct GetSchema(RequestBuilder<crate::model::GetSchemaRequest>);
10445
10446    impl GetSchema {
10447        pub(crate) fn new(
10448            stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
10449        ) -> Self {
10450            Self(RequestBuilder::new(stub))
10451        }
10452
10453        /// Sets the full request, replacing any prior values.
10454        pub fn with_request<V: Into<crate::model::GetSchemaRequest>>(mut self, v: V) -> Self {
10455            self.0.request = v.into();
10456            self
10457        }
10458
10459        /// Sets all the options, replacing any prior values.
10460        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
10461            self.0.options = v.into();
10462            self
10463        }
10464
10465        /// Sends the request.
10466        pub async fn send(self) -> Result<crate::model::Schema> {
10467            (*self.0.stub)
10468                .get_schema(self.0.request, self.0.options)
10469                .await
10470                .map(crate::Response::into_body)
10471        }
10472
10473        /// Sets the value of [name][crate::model::GetSchemaRequest::name].
10474        ///
10475        /// This is a **required** field for requests.
10476        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
10477            self.0.request.name = v.into();
10478            self
10479        }
10480    }
10481
10482    #[doc(hidden)]
10483    impl crate::RequestBuilder for GetSchema {
10484        fn request_options(&mut self) -> &mut crate::RequestOptions {
10485            &mut self.0.options
10486        }
10487    }
10488
10489    /// The request builder for [SchemaService::list_schemas][crate::client::SchemaService::list_schemas] calls.
10490    ///
10491    /// # Example
10492    /// ```
10493    /// # use google_cloud_discoveryengine_v1::builder::schema_service::ListSchemas;
10494    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
10495    /// use google_cloud_gax::paginator::ItemPaginator;
10496    ///
10497    /// let builder = prepare_request_builder();
10498    /// let mut items = builder.by_item();
10499    /// while let Some(result) = items.next().await {
10500    ///   let item = result?;
10501    /// }
10502    /// # Ok(()) }
10503    ///
10504    /// fn prepare_request_builder() -> ListSchemas {
10505    ///   # panic!();
10506    ///   // ... details omitted ...
10507    /// }
10508    /// ```
10509    #[derive(Clone, Debug)]
10510    pub struct ListSchemas(RequestBuilder<crate::model::ListSchemasRequest>);
10511
10512    impl ListSchemas {
10513        pub(crate) fn new(
10514            stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
10515        ) -> Self {
10516            Self(RequestBuilder::new(stub))
10517        }
10518
10519        /// Sets the full request, replacing any prior values.
10520        pub fn with_request<V: Into<crate::model::ListSchemasRequest>>(mut self, v: V) -> Self {
10521            self.0.request = v.into();
10522            self
10523        }
10524
10525        /// Sets all the options, replacing any prior values.
10526        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
10527            self.0.options = v.into();
10528            self
10529        }
10530
10531        /// Sends the request.
10532        pub async fn send(self) -> Result<crate::model::ListSchemasResponse> {
10533            (*self.0.stub)
10534                .list_schemas(self.0.request, self.0.options)
10535                .await
10536                .map(crate::Response::into_body)
10537        }
10538
10539        /// Streams each page in the collection.
10540        pub fn by_page(
10541            self,
10542        ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListSchemasResponse, crate::Error>
10543        {
10544            use std::clone::Clone;
10545            let token = self.0.request.page_token.clone();
10546            let execute = move |token: String| {
10547                let mut builder = self.clone();
10548                builder.0.request = builder.0.request.set_page_token(token);
10549                builder.send()
10550            };
10551            google_cloud_gax::paginator::internal::new_paginator(token, execute)
10552        }
10553
10554        /// Streams each item in the collection.
10555        pub fn by_item(
10556            self,
10557        ) -> impl google_cloud_gax::paginator::ItemPaginator<
10558            crate::model::ListSchemasResponse,
10559            crate::Error,
10560        > {
10561            use google_cloud_gax::paginator::Paginator;
10562            self.by_page().items()
10563        }
10564
10565        /// Sets the value of [parent][crate::model::ListSchemasRequest::parent].
10566        ///
10567        /// This is a **required** field for requests.
10568        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
10569            self.0.request.parent = v.into();
10570            self
10571        }
10572
10573        /// Sets the value of [page_size][crate::model::ListSchemasRequest::page_size].
10574        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
10575            self.0.request.page_size = v.into();
10576            self
10577        }
10578
10579        /// Sets the value of [page_token][crate::model::ListSchemasRequest::page_token].
10580        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
10581            self.0.request.page_token = v.into();
10582            self
10583        }
10584    }
10585
10586    #[doc(hidden)]
10587    impl crate::RequestBuilder for ListSchemas {
10588        fn request_options(&mut self) -> &mut crate::RequestOptions {
10589            &mut self.0.options
10590        }
10591    }
10592
10593    /// The request builder for [SchemaService::create_schema][crate::client::SchemaService::create_schema] calls.
10594    ///
10595    /// # Example
10596    /// ```
10597    /// # use google_cloud_discoveryengine_v1::builder::schema_service::CreateSchema;
10598    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
10599    /// use google_cloud_lro::Poller;
10600    ///
10601    /// let builder = prepare_request_builder();
10602    /// let response = builder.poller().until_done().await?;
10603    /// # Ok(()) }
10604    ///
10605    /// fn prepare_request_builder() -> CreateSchema {
10606    ///   # panic!();
10607    ///   // ... details omitted ...
10608    /// }
10609    /// ```
10610    #[derive(Clone, Debug)]
10611    pub struct CreateSchema(RequestBuilder<crate::model::CreateSchemaRequest>);
10612
10613    impl CreateSchema {
10614        pub(crate) fn new(
10615            stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
10616        ) -> Self {
10617            Self(RequestBuilder::new(stub))
10618        }
10619
10620        /// Sets the full request, replacing any prior values.
10621        pub fn with_request<V: Into<crate::model::CreateSchemaRequest>>(mut self, v: V) -> Self {
10622            self.0.request = v.into();
10623            self
10624        }
10625
10626        /// Sets all the options, replacing any prior values.
10627        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
10628            self.0.options = v.into();
10629            self
10630        }
10631
10632        /// Sends the request.
10633        ///
10634        /// # Long running operations
10635        ///
10636        /// This starts, but does not poll, a longrunning operation. More information
10637        /// on [create_schema][crate::client::SchemaService::create_schema].
10638        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
10639            (*self.0.stub)
10640                .create_schema(self.0.request, self.0.options)
10641                .await
10642                .map(crate::Response::into_body)
10643        }
10644
10645        /// Creates a [Poller][google_cloud_lro::Poller] to work with `create_schema`.
10646        pub fn poller(
10647            self,
10648        ) -> impl google_cloud_lro::Poller<crate::model::Schema, crate::model::CreateSchemaMetadata>
10649        {
10650            type Operation = google_cloud_lro::internal::Operation<
10651                crate::model::Schema,
10652                crate::model::CreateSchemaMetadata,
10653            >;
10654            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
10655            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
10656
10657            let stub = self.0.stub.clone();
10658            let mut options = self.0.options.clone();
10659            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
10660            let query = move |name| {
10661                let stub = stub.clone();
10662                let options = options.clone();
10663                async {
10664                    let op = GetOperation::new(stub)
10665                        .set_name(name)
10666                        .with_options(options)
10667                        .send()
10668                        .await?;
10669                    Ok(Operation::new(op))
10670                }
10671            };
10672
10673            let start = move || async {
10674                let op = self.send().await?;
10675                Ok(Operation::new(op))
10676            };
10677
10678            google_cloud_lro::internal::new_poller(
10679                polling_error_policy,
10680                polling_backoff_policy,
10681                start,
10682                query,
10683            )
10684        }
10685
10686        /// Sets the value of [parent][crate::model::CreateSchemaRequest::parent].
10687        ///
10688        /// This is a **required** field for requests.
10689        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
10690            self.0.request.parent = v.into();
10691            self
10692        }
10693
10694        /// Sets the value of [schema][crate::model::CreateSchemaRequest::schema].
10695        ///
10696        /// This is a **required** field for requests.
10697        pub fn set_schema<T>(mut self, v: T) -> Self
10698        where
10699            T: std::convert::Into<crate::model::Schema>,
10700        {
10701            self.0.request.schema = std::option::Option::Some(v.into());
10702            self
10703        }
10704
10705        /// Sets or clears the value of [schema][crate::model::CreateSchemaRequest::schema].
10706        ///
10707        /// This is a **required** field for requests.
10708        pub fn set_or_clear_schema<T>(mut self, v: std::option::Option<T>) -> Self
10709        where
10710            T: std::convert::Into<crate::model::Schema>,
10711        {
10712            self.0.request.schema = v.map(|x| x.into());
10713            self
10714        }
10715
10716        /// Sets the value of [schema_id][crate::model::CreateSchemaRequest::schema_id].
10717        ///
10718        /// This is a **required** field for requests.
10719        pub fn set_schema_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
10720            self.0.request.schema_id = v.into();
10721            self
10722        }
10723    }
10724
10725    #[doc(hidden)]
10726    impl crate::RequestBuilder for CreateSchema {
10727        fn request_options(&mut self) -> &mut crate::RequestOptions {
10728            &mut self.0.options
10729        }
10730    }
10731
10732    /// The request builder for [SchemaService::update_schema][crate::client::SchemaService::update_schema] calls.
10733    ///
10734    /// # Example
10735    /// ```
10736    /// # use google_cloud_discoveryengine_v1::builder::schema_service::UpdateSchema;
10737    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
10738    /// use google_cloud_lro::Poller;
10739    ///
10740    /// let builder = prepare_request_builder();
10741    /// let response = builder.poller().until_done().await?;
10742    /// # Ok(()) }
10743    ///
10744    /// fn prepare_request_builder() -> UpdateSchema {
10745    ///   # panic!();
10746    ///   // ... details omitted ...
10747    /// }
10748    /// ```
10749    #[derive(Clone, Debug)]
10750    pub struct UpdateSchema(RequestBuilder<crate::model::UpdateSchemaRequest>);
10751
10752    impl UpdateSchema {
10753        pub(crate) fn new(
10754            stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
10755        ) -> Self {
10756            Self(RequestBuilder::new(stub))
10757        }
10758
10759        /// Sets the full request, replacing any prior values.
10760        pub fn with_request<V: Into<crate::model::UpdateSchemaRequest>>(mut self, v: V) -> Self {
10761            self.0.request = v.into();
10762            self
10763        }
10764
10765        /// Sets all the options, replacing any prior values.
10766        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
10767            self.0.options = v.into();
10768            self
10769        }
10770
10771        /// Sends the request.
10772        ///
10773        /// # Long running operations
10774        ///
10775        /// This starts, but does not poll, a longrunning operation. More information
10776        /// on [update_schema][crate::client::SchemaService::update_schema].
10777        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
10778            (*self.0.stub)
10779                .update_schema(self.0.request, self.0.options)
10780                .await
10781                .map(crate::Response::into_body)
10782        }
10783
10784        /// Creates a [Poller][google_cloud_lro::Poller] to work with `update_schema`.
10785        pub fn poller(
10786            self,
10787        ) -> impl google_cloud_lro::Poller<crate::model::Schema, crate::model::UpdateSchemaMetadata>
10788        {
10789            type Operation = google_cloud_lro::internal::Operation<
10790                crate::model::Schema,
10791                crate::model::UpdateSchemaMetadata,
10792            >;
10793            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
10794            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
10795
10796            let stub = self.0.stub.clone();
10797            let mut options = self.0.options.clone();
10798            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
10799            let query = move |name| {
10800                let stub = stub.clone();
10801                let options = options.clone();
10802                async {
10803                    let op = GetOperation::new(stub)
10804                        .set_name(name)
10805                        .with_options(options)
10806                        .send()
10807                        .await?;
10808                    Ok(Operation::new(op))
10809                }
10810            };
10811
10812            let start = move || async {
10813                let op = self.send().await?;
10814                Ok(Operation::new(op))
10815            };
10816
10817            google_cloud_lro::internal::new_poller(
10818                polling_error_policy,
10819                polling_backoff_policy,
10820                start,
10821                query,
10822            )
10823        }
10824
10825        /// Sets the value of [schema][crate::model::UpdateSchemaRequest::schema].
10826        ///
10827        /// This is a **required** field for requests.
10828        pub fn set_schema<T>(mut self, v: T) -> Self
10829        where
10830            T: std::convert::Into<crate::model::Schema>,
10831        {
10832            self.0.request.schema = std::option::Option::Some(v.into());
10833            self
10834        }
10835
10836        /// Sets or clears the value of [schema][crate::model::UpdateSchemaRequest::schema].
10837        ///
10838        /// This is a **required** field for requests.
10839        pub fn set_or_clear_schema<T>(mut self, v: std::option::Option<T>) -> Self
10840        where
10841            T: std::convert::Into<crate::model::Schema>,
10842        {
10843            self.0.request.schema = v.map(|x| x.into());
10844            self
10845        }
10846
10847        /// Sets the value of [allow_missing][crate::model::UpdateSchemaRequest::allow_missing].
10848        pub fn set_allow_missing<T: Into<bool>>(mut self, v: T) -> Self {
10849            self.0.request.allow_missing = v.into();
10850            self
10851        }
10852    }
10853
10854    #[doc(hidden)]
10855    impl crate::RequestBuilder for UpdateSchema {
10856        fn request_options(&mut self) -> &mut crate::RequestOptions {
10857            &mut self.0.options
10858        }
10859    }
10860
10861    /// The request builder for [SchemaService::delete_schema][crate::client::SchemaService::delete_schema] calls.
10862    ///
10863    /// # Example
10864    /// ```
10865    /// # use google_cloud_discoveryengine_v1::builder::schema_service::DeleteSchema;
10866    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
10867    /// use google_cloud_lro::Poller;
10868    ///
10869    /// let builder = prepare_request_builder();
10870    /// let response = builder.poller().until_done().await?;
10871    /// # Ok(()) }
10872    ///
10873    /// fn prepare_request_builder() -> DeleteSchema {
10874    ///   # panic!();
10875    ///   // ... details omitted ...
10876    /// }
10877    /// ```
10878    #[derive(Clone, Debug)]
10879    pub struct DeleteSchema(RequestBuilder<crate::model::DeleteSchemaRequest>);
10880
10881    impl DeleteSchema {
10882        pub(crate) fn new(
10883            stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
10884        ) -> Self {
10885            Self(RequestBuilder::new(stub))
10886        }
10887
10888        /// Sets the full request, replacing any prior values.
10889        pub fn with_request<V: Into<crate::model::DeleteSchemaRequest>>(mut self, v: V) -> Self {
10890            self.0.request = v.into();
10891            self
10892        }
10893
10894        /// Sets all the options, replacing any prior values.
10895        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
10896            self.0.options = v.into();
10897            self
10898        }
10899
10900        /// Sends the request.
10901        ///
10902        /// # Long running operations
10903        ///
10904        /// This starts, but does not poll, a longrunning operation. More information
10905        /// on [delete_schema][crate::client::SchemaService::delete_schema].
10906        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
10907            (*self.0.stub)
10908                .delete_schema(self.0.request, self.0.options)
10909                .await
10910                .map(crate::Response::into_body)
10911        }
10912
10913        /// Creates a [Poller][google_cloud_lro::Poller] to work with `delete_schema`.
10914        pub fn poller(
10915            self,
10916        ) -> impl google_cloud_lro::Poller<(), crate::model::DeleteSchemaMetadata> {
10917            type Operation = google_cloud_lro::internal::Operation<
10918                wkt::Empty,
10919                crate::model::DeleteSchemaMetadata,
10920            >;
10921            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
10922            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
10923
10924            let stub = self.0.stub.clone();
10925            let mut options = self.0.options.clone();
10926            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
10927            let query = move |name| {
10928                let stub = stub.clone();
10929                let options = options.clone();
10930                async {
10931                    let op = GetOperation::new(stub)
10932                        .set_name(name)
10933                        .with_options(options)
10934                        .send()
10935                        .await?;
10936                    Ok(Operation::new(op))
10937                }
10938            };
10939
10940            let start = move || async {
10941                let op = self.send().await?;
10942                Ok(Operation::new(op))
10943            };
10944
10945            google_cloud_lro::internal::new_unit_response_poller(
10946                polling_error_policy,
10947                polling_backoff_policy,
10948                start,
10949                query,
10950            )
10951        }
10952
10953        /// Sets the value of [name][crate::model::DeleteSchemaRequest::name].
10954        ///
10955        /// This is a **required** field for requests.
10956        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
10957            self.0.request.name = v.into();
10958            self
10959        }
10960    }
10961
10962    #[doc(hidden)]
10963    impl crate::RequestBuilder for DeleteSchema {
10964        fn request_options(&mut self) -> &mut crate::RequestOptions {
10965            &mut self.0.options
10966        }
10967    }
10968
10969    /// The request builder for [SchemaService::list_operations][crate::client::SchemaService::list_operations] calls.
10970    ///
10971    /// # Example
10972    /// ```
10973    /// # use google_cloud_discoveryengine_v1::builder::schema_service::ListOperations;
10974    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
10975    /// use google_cloud_gax::paginator::ItemPaginator;
10976    ///
10977    /// let builder = prepare_request_builder();
10978    /// let mut items = builder.by_item();
10979    /// while let Some(result) = items.next().await {
10980    ///   let item = result?;
10981    /// }
10982    /// # Ok(()) }
10983    ///
10984    /// fn prepare_request_builder() -> ListOperations {
10985    ///   # panic!();
10986    ///   // ... details omitted ...
10987    /// }
10988    /// ```
10989    #[derive(Clone, Debug)]
10990    pub struct ListOperations(
10991        RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
10992    );
10993
10994    impl ListOperations {
10995        pub(crate) fn new(
10996            stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
10997        ) -> Self {
10998            Self(RequestBuilder::new(stub))
10999        }
11000
11001        /// Sets the full request, replacing any prior values.
11002        pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
11003            mut self,
11004            v: V,
11005        ) -> Self {
11006            self.0.request = v.into();
11007            self
11008        }
11009
11010        /// Sets all the options, replacing any prior values.
11011        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
11012            self.0.options = v.into();
11013            self
11014        }
11015
11016        /// Sends the request.
11017        pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
11018            (*self.0.stub)
11019                .list_operations(self.0.request, self.0.options)
11020                .await
11021                .map(crate::Response::into_body)
11022        }
11023
11024        /// Streams each page in the collection.
11025        pub fn by_page(
11026            self,
11027        ) -> impl google_cloud_gax::paginator::Paginator<
11028            google_cloud_longrunning::model::ListOperationsResponse,
11029            crate::Error,
11030        > {
11031            use std::clone::Clone;
11032            let token = self.0.request.page_token.clone();
11033            let execute = move |token: String| {
11034                let mut builder = self.clone();
11035                builder.0.request = builder.0.request.set_page_token(token);
11036                builder.send()
11037            };
11038            google_cloud_gax::paginator::internal::new_paginator(token, execute)
11039        }
11040
11041        /// Streams each item in the collection.
11042        pub fn by_item(
11043            self,
11044        ) -> impl google_cloud_gax::paginator::ItemPaginator<
11045            google_cloud_longrunning::model::ListOperationsResponse,
11046            crate::Error,
11047        > {
11048            use google_cloud_gax::paginator::Paginator;
11049            self.by_page().items()
11050        }
11051
11052        /// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
11053        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
11054            self.0.request.name = v.into();
11055            self
11056        }
11057
11058        /// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::filter].
11059        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
11060            self.0.request.filter = v.into();
11061            self
11062        }
11063
11064        /// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
11065        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
11066            self.0.request.page_size = v.into();
11067            self
11068        }
11069
11070        /// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
11071        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
11072            self.0.request.page_token = v.into();
11073            self
11074        }
11075
11076        /// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
11077        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
11078            self.0.request.return_partial_success = v.into();
11079            self
11080        }
11081    }
11082
11083    #[doc(hidden)]
11084    impl crate::RequestBuilder for ListOperations {
11085        fn request_options(&mut self) -> &mut crate::RequestOptions {
11086            &mut self.0.options
11087        }
11088    }
11089
11090    /// The request builder for [SchemaService::get_operation][crate::client::SchemaService::get_operation] calls.
11091    ///
11092    /// # Example
11093    /// ```
11094    /// # use google_cloud_discoveryengine_v1::builder::schema_service::GetOperation;
11095    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
11096    ///
11097    /// let builder = prepare_request_builder();
11098    /// let response = builder.send().await?;
11099    /// # Ok(()) }
11100    ///
11101    /// fn prepare_request_builder() -> GetOperation {
11102    ///   # panic!();
11103    ///   // ... details omitted ...
11104    /// }
11105    /// ```
11106    #[derive(Clone, Debug)]
11107    pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
11108
11109    impl GetOperation {
11110        pub(crate) fn new(
11111            stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
11112        ) -> Self {
11113            Self(RequestBuilder::new(stub))
11114        }
11115
11116        /// Sets the full request, replacing any prior values.
11117        pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
11118            mut self,
11119            v: V,
11120        ) -> Self {
11121            self.0.request = v.into();
11122            self
11123        }
11124
11125        /// Sets all the options, replacing any prior values.
11126        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
11127            self.0.options = v.into();
11128            self
11129        }
11130
11131        /// Sends the request.
11132        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
11133            (*self.0.stub)
11134                .get_operation(self.0.request, self.0.options)
11135                .await
11136                .map(crate::Response::into_body)
11137        }
11138
11139        /// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
11140        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
11141            self.0.request.name = v.into();
11142            self
11143        }
11144    }
11145
11146    #[doc(hidden)]
11147    impl crate::RequestBuilder for GetOperation {
11148        fn request_options(&mut self) -> &mut crate::RequestOptions {
11149            &mut self.0.options
11150        }
11151    }
11152
11153    /// The request builder for [SchemaService::cancel_operation][crate::client::SchemaService::cancel_operation] calls.
11154    ///
11155    /// # Example
11156    /// ```
11157    /// # use google_cloud_discoveryengine_v1::builder::schema_service::CancelOperation;
11158    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
11159    ///
11160    /// let builder = prepare_request_builder();
11161    /// let response = builder.send().await?;
11162    /// # Ok(()) }
11163    ///
11164    /// fn prepare_request_builder() -> CancelOperation {
11165    ///   # panic!();
11166    ///   // ... details omitted ...
11167    /// }
11168    /// ```
11169    #[derive(Clone, Debug)]
11170    pub struct CancelOperation(
11171        RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
11172    );
11173
11174    impl CancelOperation {
11175        pub(crate) fn new(
11176            stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
11177        ) -> Self {
11178            Self(RequestBuilder::new(stub))
11179        }
11180
11181        /// Sets the full request, replacing any prior values.
11182        pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
11183            mut self,
11184            v: V,
11185        ) -> Self {
11186            self.0.request = v.into();
11187            self
11188        }
11189
11190        /// Sets all the options, replacing any prior values.
11191        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
11192            self.0.options = v.into();
11193            self
11194        }
11195
11196        /// Sends the request.
11197        pub async fn send(self) -> Result<()> {
11198            (*self.0.stub)
11199                .cancel_operation(self.0.request, self.0.options)
11200                .await
11201                .map(crate::Response::into_body)
11202        }
11203
11204        /// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::name].
11205        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
11206            self.0.request.name = v.into();
11207            self
11208        }
11209    }
11210
11211    #[doc(hidden)]
11212    impl crate::RequestBuilder for CancelOperation {
11213        fn request_options(&mut self) -> &mut crate::RequestOptions {
11214            &mut self.0.options
11215        }
11216    }
11217}
11218
11219#[cfg(feature = "search-service")]
11220#[cfg_attr(docsrs, doc(cfg(feature = "search-service")))]
11221pub mod search_service {
11222    use crate::Result;
11223
11224    /// A builder for [SearchService][crate::client::SearchService].
11225    ///
11226    /// ```
11227    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
11228    /// # use google_cloud_discoveryengine_v1::*;
11229    /// # use builder::search_service::ClientBuilder;
11230    /// # use client::SearchService;
11231    /// let builder : ClientBuilder = SearchService::builder();
11232    /// let client = builder
11233    ///     .with_endpoint("https://discoveryengine.googleapis.com")
11234    ///     .build().await?;
11235    /// # Ok(()) }
11236    /// ```
11237    pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
11238
11239    pub(crate) mod client {
11240        use super::super::super::client::SearchService;
11241        pub struct Factory;
11242        impl crate::ClientFactory for Factory {
11243            type Client = SearchService;
11244            type Credentials = gaxi::options::Credentials;
11245            async fn build(
11246                self,
11247                config: gaxi::options::ClientConfig,
11248            ) -> crate::ClientBuilderResult<Self::Client> {
11249                Self::Client::new(config).await
11250            }
11251        }
11252    }
11253
11254    /// Common implementation for [crate::client::SearchService] request builders.
11255    #[derive(Clone, Debug)]
11256    pub(crate) struct RequestBuilder<R: std::default::Default> {
11257        stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchService>,
11258        request: R,
11259        options: crate::RequestOptions,
11260    }
11261
11262    impl<R> RequestBuilder<R>
11263    where
11264        R: std::default::Default,
11265    {
11266        pub(crate) fn new(
11267            stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchService>,
11268        ) -> Self {
11269            Self {
11270                stub,
11271                request: R::default(),
11272                options: crate::RequestOptions::default(),
11273            }
11274        }
11275    }
11276
11277    /// The request builder for [SearchService::search][crate::client::SearchService::search] calls.
11278    ///
11279    /// # Example
11280    /// ```
11281    /// # use google_cloud_discoveryengine_v1::builder::search_service::Search;
11282    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
11283    /// use google_cloud_gax::paginator::ItemPaginator;
11284    ///
11285    /// let builder = prepare_request_builder();
11286    /// let mut items = builder.by_item();
11287    /// while let Some(result) = items.next().await {
11288    ///   let item = result?;
11289    /// }
11290    /// # Ok(()) }
11291    ///
11292    /// fn prepare_request_builder() -> Search {
11293    ///   # panic!();
11294    ///   // ... details omitted ...
11295    /// }
11296    /// ```
11297    #[derive(Clone, Debug)]
11298    pub struct Search(RequestBuilder<crate::model::SearchRequest>);
11299
11300    impl Search {
11301        pub(crate) fn new(
11302            stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchService>,
11303        ) -> Self {
11304            Self(RequestBuilder::new(stub))
11305        }
11306
11307        /// Sets the full request, replacing any prior values.
11308        pub fn with_request<V: Into<crate::model::SearchRequest>>(mut self, v: V) -> Self {
11309            self.0.request = v.into();
11310            self
11311        }
11312
11313        /// Sets all the options, replacing any prior values.
11314        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
11315            self.0.options = v.into();
11316            self
11317        }
11318
11319        /// Sends the request.
11320        pub async fn send(self) -> Result<crate::model::SearchResponse> {
11321            (*self.0.stub)
11322                .search(self.0.request, self.0.options)
11323                .await
11324                .map(crate::Response::into_body)
11325        }
11326
11327        /// Streams each page in the collection.
11328        pub fn by_page(
11329            self,
11330        ) -> impl google_cloud_gax::paginator::Paginator<crate::model::SearchResponse, crate::Error>
11331        {
11332            use std::clone::Clone;
11333            let token = self.0.request.page_token.clone();
11334            let execute = move |token: String| {
11335                let mut builder = self.clone();
11336                builder.0.request = builder.0.request.set_page_token(token);
11337                builder.send()
11338            };
11339            google_cloud_gax::paginator::internal::new_paginator(token, execute)
11340        }
11341
11342        /// Streams each item in the collection.
11343        pub fn by_item(
11344            self,
11345        ) -> impl google_cloud_gax::paginator::ItemPaginator<crate::model::SearchResponse, crate::Error>
11346        {
11347            use google_cloud_gax::paginator::Paginator;
11348            self.by_page().items()
11349        }
11350
11351        /// Sets the value of [serving_config][crate::model::SearchRequest::serving_config].
11352        ///
11353        /// This is a **required** field for requests.
11354        pub fn set_serving_config<T: Into<std::string::String>>(mut self, v: T) -> Self {
11355            self.0.request.serving_config = v.into();
11356            self
11357        }
11358
11359        /// Sets the value of [branch][crate::model::SearchRequest::branch].
11360        pub fn set_branch<T: Into<std::string::String>>(mut self, v: T) -> Self {
11361            self.0.request.branch = v.into();
11362            self
11363        }
11364
11365        /// Sets the value of [query][crate::model::SearchRequest::query].
11366        pub fn set_query<T: Into<std::string::String>>(mut self, v: T) -> Self {
11367            self.0.request.query = v.into();
11368            self
11369        }
11370
11371        /// Sets the value of [page_categories][crate::model::SearchRequest::page_categories].
11372        pub fn set_page_categories<T, V>(mut self, v: T) -> Self
11373        where
11374            T: std::iter::IntoIterator<Item = V>,
11375            V: std::convert::Into<std::string::String>,
11376        {
11377            use std::iter::Iterator;
11378            self.0.request.page_categories = v.into_iter().map(|i| i.into()).collect();
11379            self
11380        }
11381
11382        /// Sets the value of [image_query][crate::model::SearchRequest::image_query].
11383        pub fn set_image_query<T>(mut self, v: T) -> Self
11384        where
11385            T: std::convert::Into<crate::model::search_request::ImageQuery>,
11386        {
11387            self.0.request.image_query = std::option::Option::Some(v.into());
11388            self
11389        }
11390
11391        /// Sets or clears the value of [image_query][crate::model::SearchRequest::image_query].
11392        pub fn set_or_clear_image_query<T>(mut self, v: std::option::Option<T>) -> Self
11393        where
11394            T: std::convert::Into<crate::model::search_request::ImageQuery>,
11395        {
11396            self.0.request.image_query = v.map(|x| x.into());
11397            self
11398        }
11399
11400        /// Sets the value of [page_size][crate::model::SearchRequest::page_size].
11401        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
11402            self.0.request.page_size = v.into();
11403            self
11404        }
11405
11406        /// Sets the value of [page_token][crate::model::SearchRequest::page_token].
11407        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
11408            self.0.request.page_token = v.into();
11409            self
11410        }
11411
11412        /// Sets the value of [offset][crate::model::SearchRequest::offset].
11413        pub fn set_offset<T: Into<i32>>(mut self, v: T) -> Self {
11414            self.0.request.offset = v.into();
11415            self
11416        }
11417
11418        /// Sets the value of [one_box_page_size][crate::model::SearchRequest::one_box_page_size].
11419        pub fn set_one_box_page_size<T: Into<i32>>(mut self, v: T) -> Self {
11420            self.0.request.one_box_page_size = v.into();
11421            self
11422        }
11423
11424        /// Sets the value of [data_store_specs][crate::model::SearchRequest::data_store_specs].
11425        pub fn set_data_store_specs<T, V>(mut self, v: T) -> Self
11426        where
11427            T: std::iter::IntoIterator<Item = V>,
11428            V: std::convert::Into<crate::model::search_request::DataStoreSpec>,
11429        {
11430            use std::iter::Iterator;
11431            self.0.request.data_store_specs = v.into_iter().map(|i| i.into()).collect();
11432            self
11433        }
11434
11435        /// Sets the value of [filter][crate::model::SearchRequest::filter].
11436        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
11437            self.0.request.filter = v.into();
11438            self
11439        }
11440
11441        /// Sets the value of [canonical_filter][crate::model::SearchRequest::canonical_filter].
11442        pub fn set_canonical_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
11443            self.0.request.canonical_filter = v.into();
11444            self
11445        }
11446
11447        /// Sets the value of [order_by][crate::model::SearchRequest::order_by].
11448        pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
11449            self.0.request.order_by = v.into();
11450            self
11451        }
11452
11453        /// Sets the value of [user_info][crate::model::SearchRequest::user_info].
11454        pub fn set_user_info<T>(mut self, v: T) -> Self
11455        where
11456            T: std::convert::Into<crate::model::UserInfo>,
11457        {
11458            self.0.request.user_info = std::option::Option::Some(v.into());
11459            self
11460        }
11461
11462        /// Sets or clears the value of [user_info][crate::model::SearchRequest::user_info].
11463        pub fn set_or_clear_user_info<T>(mut self, v: std::option::Option<T>) -> Self
11464        where
11465            T: std::convert::Into<crate::model::UserInfo>,
11466        {
11467            self.0.request.user_info = v.map(|x| x.into());
11468            self
11469        }
11470
11471        /// Sets the value of [language_code][crate::model::SearchRequest::language_code].
11472        pub fn set_language_code<T: Into<std::string::String>>(mut self, v: T) -> Self {
11473            self.0.request.language_code = v.into();
11474            self
11475        }
11476
11477        /// Sets the value of [facet_specs][crate::model::SearchRequest::facet_specs].
11478        pub fn set_facet_specs<T, V>(mut self, v: T) -> Self
11479        where
11480            T: std::iter::IntoIterator<Item = V>,
11481            V: std::convert::Into<crate::model::search_request::FacetSpec>,
11482        {
11483            use std::iter::Iterator;
11484            self.0.request.facet_specs = v.into_iter().map(|i| i.into()).collect();
11485            self
11486        }
11487
11488        /// Sets the value of [boost_spec][crate::model::SearchRequest::boost_spec].
11489        pub fn set_boost_spec<T>(mut self, v: T) -> Self
11490        where
11491            T: std::convert::Into<crate::model::search_request::BoostSpec>,
11492        {
11493            self.0.request.boost_spec = std::option::Option::Some(v.into());
11494            self
11495        }
11496
11497        /// Sets or clears the value of [boost_spec][crate::model::SearchRequest::boost_spec].
11498        pub fn set_or_clear_boost_spec<T>(mut self, v: std::option::Option<T>) -> Self
11499        where
11500            T: std::convert::Into<crate::model::search_request::BoostSpec>,
11501        {
11502            self.0.request.boost_spec = v.map(|x| x.into());
11503            self
11504        }
11505
11506        /// Sets the value of [params][crate::model::SearchRequest::params].
11507        pub fn set_params<T, K, V>(mut self, v: T) -> Self
11508        where
11509            T: std::iter::IntoIterator<Item = (K, V)>,
11510            K: std::convert::Into<std::string::String>,
11511            V: std::convert::Into<wkt::Value>,
11512        {
11513            self.0.request.params = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
11514            self
11515        }
11516
11517        /// Sets the value of [query_expansion_spec][crate::model::SearchRequest::query_expansion_spec].
11518        pub fn set_query_expansion_spec<T>(mut self, v: T) -> Self
11519        where
11520            T: std::convert::Into<crate::model::search_request::QueryExpansionSpec>,
11521        {
11522            self.0.request.query_expansion_spec = std::option::Option::Some(v.into());
11523            self
11524        }
11525
11526        /// Sets or clears the value of [query_expansion_spec][crate::model::SearchRequest::query_expansion_spec].
11527        pub fn set_or_clear_query_expansion_spec<T>(mut self, v: std::option::Option<T>) -> Self
11528        where
11529            T: std::convert::Into<crate::model::search_request::QueryExpansionSpec>,
11530        {
11531            self.0.request.query_expansion_spec = v.map(|x| x.into());
11532            self
11533        }
11534
11535        /// Sets the value of [spell_correction_spec][crate::model::SearchRequest::spell_correction_spec].
11536        pub fn set_spell_correction_spec<T>(mut self, v: T) -> Self
11537        where
11538            T: std::convert::Into<crate::model::search_request::SpellCorrectionSpec>,
11539        {
11540            self.0.request.spell_correction_spec = std::option::Option::Some(v.into());
11541            self
11542        }
11543
11544        /// Sets or clears the value of [spell_correction_spec][crate::model::SearchRequest::spell_correction_spec].
11545        pub fn set_or_clear_spell_correction_spec<T>(mut self, v: std::option::Option<T>) -> Self
11546        where
11547            T: std::convert::Into<crate::model::search_request::SpellCorrectionSpec>,
11548        {
11549            self.0.request.spell_correction_spec = v.map(|x| x.into());
11550            self
11551        }
11552
11553        /// Sets the value of [user_pseudo_id][crate::model::SearchRequest::user_pseudo_id].
11554        pub fn set_user_pseudo_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
11555            self.0.request.user_pseudo_id = v.into();
11556            self
11557        }
11558
11559        /// Sets the value of [content_search_spec][crate::model::SearchRequest::content_search_spec].
11560        pub fn set_content_search_spec<T>(mut self, v: T) -> Self
11561        where
11562            T: std::convert::Into<crate::model::search_request::ContentSearchSpec>,
11563        {
11564            self.0.request.content_search_spec = std::option::Option::Some(v.into());
11565            self
11566        }
11567
11568        /// Sets or clears the value of [content_search_spec][crate::model::SearchRequest::content_search_spec].
11569        pub fn set_or_clear_content_search_spec<T>(mut self, v: std::option::Option<T>) -> Self
11570        where
11571            T: std::convert::Into<crate::model::search_request::ContentSearchSpec>,
11572        {
11573            self.0.request.content_search_spec = v.map(|x| x.into());
11574            self
11575        }
11576
11577        /// Sets the value of [ranking_expression][crate::model::SearchRequest::ranking_expression].
11578        pub fn set_ranking_expression<T: Into<std::string::String>>(mut self, v: T) -> Self {
11579            self.0.request.ranking_expression = v.into();
11580            self
11581        }
11582
11583        /// Sets the value of [ranking_expression_backend][crate::model::SearchRequest::ranking_expression_backend].
11584        pub fn set_ranking_expression_backend<
11585            T: Into<crate::model::search_request::RankingExpressionBackend>,
11586        >(
11587            mut self,
11588            v: T,
11589        ) -> Self {
11590            self.0.request.ranking_expression_backend = v.into();
11591            self
11592        }
11593
11594        /// Sets the value of [safe_search][crate::model::SearchRequest::safe_search].
11595        pub fn set_safe_search<T: Into<bool>>(mut self, v: T) -> Self {
11596            self.0.request.safe_search = v.into();
11597            self
11598        }
11599
11600        /// Sets the value of [user_labels][crate::model::SearchRequest::user_labels].
11601        pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
11602        where
11603            T: std::iter::IntoIterator<Item = (K, V)>,
11604            K: std::convert::Into<std::string::String>,
11605            V: std::convert::Into<std::string::String>,
11606        {
11607            self.0.request.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
11608            self
11609        }
11610
11611        /// Sets the value of [natural_language_query_understanding_spec][crate::model::SearchRequest::natural_language_query_understanding_spec].
11612        pub fn set_natural_language_query_understanding_spec<T>(mut self, v: T) -> Self
11613        where
11614            T: std::convert::Into<
11615                    crate::model::search_request::NaturalLanguageQueryUnderstandingSpec,
11616                >,
11617        {
11618            self.0.request.natural_language_query_understanding_spec =
11619                std::option::Option::Some(v.into());
11620            self
11621        }
11622
11623        /// Sets or clears the value of [natural_language_query_understanding_spec][crate::model::SearchRequest::natural_language_query_understanding_spec].
11624        pub fn set_or_clear_natural_language_query_understanding_spec<T>(
11625            mut self,
11626            v: std::option::Option<T>,
11627        ) -> 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 = v.map(|x| x.into());
11634            self
11635        }
11636
11637        /// Sets the value of [search_as_you_type_spec][crate::model::SearchRequest::search_as_you_type_spec].
11638        pub fn set_search_as_you_type_spec<T>(mut self, v: T) -> Self
11639        where
11640            T: std::convert::Into<crate::model::search_request::SearchAsYouTypeSpec>,
11641        {
11642            self.0.request.search_as_you_type_spec = std::option::Option::Some(v.into());
11643            self
11644        }
11645
11646        /// Sets or clears the value of [search_as_you_type_spec][crate::model::SearchRequest::search_as_you_type_spec].
11647        pub fn set_or_clear_search_as_you_type_spec<T>(mut self, v: std::option::Option<T>) -> Self
11648        where
11649            T: std::convert::Into<crate::model::search_request::SearchAsYouTypeSpec>,
11650        {
11651            self.0.request.search_as_you_type_spec = v.map(|x| x.into());
11652            self
11653        }
11654
11655        /// Sets the value of [display_spec][crate::model::SearchRequest::display_spec].
11656        pub fn set_display_spec<T>(mut self, v: T) -> Self
11657        where
11658            T: std::convert::Into<crate::model::search_request::DisplaySpec>,
11659        {
11660            self.0.request.display_spec = std::option::Option::Some(v.into());
11661            self
11662        }
11663
11664        /// Sets or clears the value of [display_spec][crate::model::SearchRequest::display_spec].
11665        pub fn set_or_clear_display_spec<T>(mut self, v: std::option::Option<T>) -> Self
11666        where
11667            T: std::convert::Into<crate::model::search_request::DisplaySpec>,
11668        {
11669            self.0.request.display_spec = v.map(|x| x.into());
11670            self
11671        }
11672
11673        /// Sets the value of [crowding_specs][crate::model::SearchRequest::crowding_specs].
11674        pub fn set_crowding_specs<T, V>(mut self, v: T) -> Self
11675        where
11676            T: std::iter::IntoIterator<Item = V>,
11677            V: std::convert::Into<crate::model::search_request::CrowdingSpec>,
11678        {
11679            use std::iter::Iterator;
11680            self.0.request.crowding_specs = v.into_iter().map(|i| i.into()).collect();
11681            self
11682        }
11683
11684        /// Sets the value of [session][crate::model::SearchRequest::session].
11685        pub fn set_session<T: Into<std::string::String>>(mut self, v: T) -> Self {
11686            self.0.request.session = v.into();
11687            self
11688        }
11689
11690        /// Sets the value of [session_spec][crate::model::SearchRequest::session_spec].
11691        pub fn set_session_spec<T>(mut self, v: T) -> Self
11692        where
11693            T: std::convert::Into<crate::model::search_request::SessionSpec>,
11694        {
11695            self.0.request.session_spec = std::option::Option::Some(v.into());
11696            self
11697        }
11698
11699        /// Sets or clears the value of [session_spec][crate::model::SearchRequest::session_spec].
11700        pub fn set_or_clear_session_spec<T>(mut self, v: std::option::Option<T>) -> Self
11701        where
11702            T: std::convert::Into<crate::model::search_request::SessionSpec>,
11703        {
11704            self.0.request.session_spec = v.map(|x| x.into());
11705            self
11706        }
11707
11708        /// Sets the value of [relevance_threshold][crate::model::SearchRequest::relevance_threshold].
11709        pub fn set_relevance_threshold<
11710            T: Into<crate::model::search_request::RelevanceThreshold>,
11711        >(
11712            mut self,
11713            v: T,
11714        ) -> Self {
11715            self.0.request.relevance_threshold = v.into();
11716            self
11717        }
11718
11719        /// Sets the value of [relevance_score_spec][crate::model::SearchRequest::relevance_score_spec].
11720        pub fn set_relevance_score_spec<T>(mut self, v: T) -> Self
11721        where
11722            T: std::convert::Into<crate::model::search_request::RelevanceScoreSpec>,
11723        {
11724            self.0.request.relevance_score_spec = std::option::Option::Some(v.into());
11725            self
11726        }
11727
11728        /// Sets or clears the value of [relevance_score_spec][crate::model::SearchRequest::relevance_score_spec].
11729        pub fn set_or_clear_relevance_score_spec<T>(mut self, v: std::option::Option<T>) -> Self
11730        where
11731            T: std::convert::Into<crate::model::search_request::RelevanceScoreSpec>,
11732        {
11733            self.0.request.relevance_score_spec = v.map(|x| x.into());
11734            self
11735        }
11736    }
11737
11738    #[doc(hidden)]
11739    impl crate::RequestBuilder for Search {
11740        fn request_options(&mut self) -> &mut crate::RequestOptions {
11741            &mut self.0.options
11742        }
11743    }
11744
11745    /// The request builder for [SearchService::search_lite][crate::client::SearchService::search_lite] calls.
11746    ///
11747    /// # Example
11748    /// ```
11749    /// # use google_cloud_discoveryengine_v1::builder::search_service::SearchLite;
11750    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
11751    /// use google_cloud_gax::paginator::ItemPaginator;
11752    ///
11753    /// let builder = prepare_request_builder();
11754    /// let mut items = builder.by_item();
11755    /// while let Some(result) = items.next().await {
11756    ///   let item = result?;
11757    /// }
11758    /// # Ok(()) }
11759    ///
11760    /// fn prepare_request_builder() -> SearchLite {
11761    ///   # panic!();
11762    ///   // ... details omitted ...
11763    /// }
11764    /// ```
11765    #[derive(Clone, Debug)]
11766    pub struct SearchLite(RequestBuilder<crate::model::SearchRequest>);
11767
11768    impl SearchLite {
11769        pub(crate) fn new(
11770            stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchService>,
11771        ) -> Self {
11772            Self(RequestBuilder::new(stub))
11773        }
11774
11775        /// Sets the full request, replacing any prior values.
11776        pub fn with_request<V: Into<crate::model::SearchRequest>>(mut self, v: V) -> Self {
11777            self.0.request = v.into();
11778            self
11779        }
11780
11781        /// Sets all the options, replacing any prior values.
11782        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
11783            self.0.options = v.into();
11784            self
11785        }
11786
11787        /// Sends the request.
11788        pub async fn send(self) -> Result<crate::model::SearchResponse> {
11789            (*self.0.stub)
11790                .search_lite(self.0.request, self.0.options)
11791                .await
11792                .map(crate::Response::into_body)
11793        }
11794
11795        /// Streams each page in the collection.
11796        pub fn by_page(
11797            self,
11798        ) -> impl google_cloud_gax::paginator::Paginator<crate::model::SearchResponse, crate::Error>
11799        {
11800            use std::clone::Clone;
11801            let token = self.0.request.page_token.clone();
11802            let execute = move |token: String| {
11803                let mut builder = self.clone();
11804                builder.0.request = builder.0.request.set_page_token(token);
11805                builder.send()
11806            };
11807            google_cloud_gax::paginator::internal::new_paginator(token, execute)
11808        }
11809
11810        /// Streams each item in the collection.
11811        pub fn by_item(
11812            self,
11813        ) -> impl google_cloud_gax::paginator::ItemPaginator<crate::model::SearchResponse, crate::Error>
11814        {
11815            use google_cloud_gax::paginator::Paginator;
11816            self.by_page().items()
11817        }
11818
11819        /// Sets the value of [serving_config][crate::model::SearchRequest::serving_config].
11820        ///
11821        /// This is a **required** field for requests.
11822        pub fn set_serving_config<T: Into<std::string::String>>(mut self, v: T) -> Self {
11823            self.0.request.serving_config = v.into();
11824            self
11825        }
11826
11827        /// Sets the value of [branch][crate::model::SearchRequest::branch].
11828        pub fn set_branch<T: Into<std::string::String>>(mut self, v: T) -> Self {
11829            self.0.request.branch = v.into();
11830            self
11831        }
11832
11833        /// Sets the value of [query][crate::model::SearchRequest::query].
11834        pub fn set_query<T: Into<std::string::String>>(mut self, v: T) -> Self {
11835            self.0.request.query = v.into();
11836            self
11837        }
11838
11839        /// Sets the value of [page_categories][crate::model::SearchRequest::page_categories].
11840        pub fn set_page_categories<T, V>(mut self, v: T) -> Self
11841        where
11842            T: std::iter::IntoIterator<Item = V>,
11843            V: std::convert::Into<std::string::String>,
11844        {
11845            use std::iter::Iterator;
11846            self.0.request.page_categories = v.into_iter().map(|i| i.into()).collect();
11847            self
11848        }
11849
11850        /// Sets the value of [image_query][crate::model::SearchRequest::image_query].
11851        pub fn set_image_query<T>(mut self, v: T) -> Self
11852        where
11853            T: std::convert::Into<crate::model::search_request::ImageQuery>,
11854        {
11855            self.0.request.image_query = std::option::Option::Some(v.into());
11856            self
11857        }
11858
11859        /// Sets or clears the value of [image_query][crate::model::SearchRequest::image_query].
11860        pub fn set_or_clear_image_query<T>(mut self, v: std::option::Option<T>) -> Self
11861        where
11862            T: std::convert::Into<crate::model::search_request::ImageQuery>,
11863        {
11864            self.0.request.image_query = v.map(|x| x.into());
11865            self
11866        }
11867
11868        /// Sets the value of [page_size][crate::model::SearchRequest::page_size].
11869        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
11870            self.0.request.page_size = v.into();
11871            self
11872        }
11873
11874        /// Sets the value of [page_token][crate::model::SearchRequest::page_token].
11875        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
11876            self.0.request.page_token = v.into();
11877            self
11878        }
11879
11880        /// Sets the value of [offset][crate::model::SearchRequest::offset].
11881        pub fn set_offset<T: Into<i32>>(mut self, v: T) -> Self {
11882            self.0.request.offset = v.into();
11883            self
11884        }
11885
11886        /// Sets the value of [one_box_page_size][crate::model::SearchRequest::one_box_page_size].
11887        pub fn set_one_box_page_size<T: Into<i32>>(mut self, v: T) -> Self {
11888            self.0.request.one_box_page_size = v.into();
11889            self
11890        }
11891
11892        /// Sets the value of [data_store_specs][crate::model::SearchRequest::data_store_specs].
11893        pub fn set_data_store_specs<T, V>(mut self, v: T) -> Self
11894        where
11895            T: std::iter::IntoIterator<Item = V>,
11896            V: std::convert::Into<crate::model::search_request::DataStoreSpec>,
11897        {
11898            use std::iter::Iterator;
11899            self.0.request.data_store_specs = v.into_iter().map(|i| i.into()).collect();
11900            self
11901        }
11902
11903        /// Sets the value of [filter][crate::model::SearchRequest::filter].
11904        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
11905            self.0.request.filter = v.into();
11906            self
11907        }
11908
11909        /// Sets the value of [canonical_filter][crate::model::SearchRequest::canonical_filter].
11910        pub fn set_canonical_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
11911            self.0.request.canonical_filter = v.into();
11912            self
11913        }
11914
11915        /// Sets the value of [order_by][crate::model::SearchRequest::order_by].
11916        pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
11917            self.0.request.order_by = v.into();
11918            self
11919        }
11920
11921        /// Sets the value of [user_info][crate::model::SearchRequest::user_info].
11922        pub fn set_user_info<T>(mut self, v: T) -> Self
11923        where
11924            T: std::convert::Into<crate::model::UserInfo>,
11925        {
11926            self.0.request.user_info = std::option::Option::Some(v.into());
11927            self
11928        }
11929
11930        /// Sets or clears the value of [user_info][crate::model::SearchRequest::user_info].
11931        pub fn set_or_clear_user_info<T>(mut self, v: std::option::Option<T>) -> Self
11932        where
11933            T: std::convert::Into<crate::model::UserInfo>,
11934        {
11935            self.0.request.user_info = v.map(|x| x.into());
11936            self
11937        }
11938
11939        /// Sets the value of [language_code][crate::model::SearchRequest::language_code].
11940        pub fn set_language_code<T: Into<std::string::String>>(mut self, v: T) -> Self {
11941            self.0.request.language_code = v.into();
11942            self
11943        }
11944
11945        /// Sets the value of [facet_specs][crate::model::SearchRequest::facet_specs].
11946        pub fn set_facet_specs<T, V>(mut self, v: T) -> Self
11947        where
11948            T: std::iter::IntoIterator<Item = V>,
11949            V: std::convert::Into<crate::model::search_request::FacetSpec>,
11950        {
11951            use std::iter::Iterator;
11952            self.0.request.facet_specs = v.into_iter().map(|i| i.into()).collect();
11953            self
11954        }
11955
11956        /// Sets the value of [boost_spec][crate::model::SearchRequest::boost_spec].
11957        pub fn set_boost_spec<T>(mut self, v: T) -> Self
11958        where
11959            T: std::convert::Into<crate::model::search_request::BoostSpec>,
11960        {
11961            self.0.request.boost_spec = std::option::Option::Some(v.into());
11962            self
11963        }
11964
11965        /// Sets or clears the value of [boost_spec][crate::model::SearchRequest::boost_spec].
11966        pub fn set_or_clear_boost_spec<T>(mut self, v: std::option::Option<T>) -> Self
11967        where
11968            T: std::convert::Into<crate::model::search_request::BoostSpec>,
11969        {
11970            self.0.request.boost_spec = v.map(|x| x.into());
11971            self
11972        }
11973
11974        /// Sets the value of [params][crate::model::SearchRequest::params].
11975        pub fn set_params<T, K, V>(mut self, v: T) -> Self
11976        where
11977            T: std::iter::IntoIterator<Item = (K, V)>,
11978            K: std::convert::Into<std::string::String>,
11979            V: std::convert::Into<wkt::Value>,
11980        {
11981            self.0.request.params = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
11982            self
11983        }
11984
11985        /// Sets the value of [query_expansion_spec][crate::model::SearchRequest::query_expansion_spec].
11986        pub fn set_query_expansion_spec<T>(mut self, v: T) -> Self
11987        where
11988            T: std::convert::Into<crate::model::search_request::QueryExpansionSpec>,
11989        {
11990            self.0.request.query_expansion_spec = std::option::Option::Some(v.into());
11991            self
11992        }
11993
11994        /// Sets or clears the value of [query_expansion_spec][crate::model::SearchRequest::query_expansion_spec].
11995        pub fn set_or_clear_query_expansion_spec<T>(mut self, v: std::option::Option<T>) -> Self
11996        where
11997            T: std::convert::Into<crate::model::search_request::QueryExpansionSpec>,
11998        {
11999            self.0.request.query_expansion_spec = v.map(|x| x.into());
12000            self
12001        }
12002
12003        /// Sets the value of [spell_correction_spec][crate::model::SearchRequest::spell_correction_spec].
12004        pub fn set_spell_correction_spec<T>(mut self, v: T) -> Self
12005        where
12006            T: std::convert::Into<crate::model::search_request::SpellCorrectionSpec>,
12007        {
12008            self.0.request.spell_correction_spec = std::option::Option::Some(v.into());
12009            self
12010        }
12011
12012        /// Sets or clears the value of [spell_correction_spec][crate::model::SearchRequest::spell_correction_spec].
12013        pub fn set_or_clear_spell_correction_spec<T>(mut self, v: std::option::Option<T>) -> Self
12014        where
12015            T: std::convert::Into<crate::model::search_request::SpellCorrectionSpec>,
12016        {
12017            self.0.request.spell_correction_spec = v.map(|x| x.into());
12018            self
12019        }
12020
12021        /// Sets the value of [user_pseudo_id][crate::model::SearchRequest::user_pseudo_id].
12022        pub fn set_user_pseudo_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
12023            self.0.request.user_pseudo_id = v.into();
12024            self
12025        }
12026
12027        /// Sets the value of [content_search_spec][crate::model::SearchRequest::content_search_spec].
12028        pub fn set_content_search_spec<T>(mut self, v: T) -> Self
12029        where
12030            T: std::convert::Into<crate::model::search_request::ContentSearchSpec>,
12031        {
12032            self.0.request.content_search_spec = std::option::Option::Some(v.into());
12033            self
12034        }
12035
12036        /// Sets or clears the value of [content_search_spec][crate::model::SearchRequest::content_search_spec].
12037        pub fn set_or_clear_content_search_spec<T>(mut self, v: std::option::Option<T>) -> Self
12038        where
12039            T: std::convert::Into<crate::model::search_request::ContentSearchSpec>,
12040        {
12041            self.0.request.content_search_spec = v.map(|x| x.into());
12042            self
12043        }
12044
12045        /// Sets the value of [ranking_expression][crate::model::SearchRequest::ranking_expression].
12046        pub fn set_ranking_expression<T: Into<std::string::String>>(mut self, v: T) -> Self {
12047            self.0.request.ranking_expression = v.into();
12048            self
12049        }
12050
12051        /// Sets the value of [ranking_expression_backend][crate::model::SearchRequest::ranking_expression_backend].
12052        pub fn set_ranking_expression_backend<
12053            T: Into<crate::model::search_request::RankingExpressionBackend>,
12054        >(
12055            mut self,
12056            v: T,
12057        ) -> Self {
12058            self.0.request.ranking_expression_backend = v.into();
12059            self
12060        }
12061
12062        /// Sets the value of [safe_search][crate::model::SearchRequest::safe_search].
12063        pub fn set_safe_search<T: Into<bool>>(mut self, v: T) -> Self {
12064            self.0.request.safe_search = v.into();
12065            self
12066        }
12067
12068        /// Sets the value of [user_labels][crate::model::SearchRequest::user_labels].
12069        pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
12070        where
12071            T: std::iter::IntoIterator<Item = (K, V)>,
12072            K: std::convert::Into<std::string::String>,
12073            V: std::convert::Into<std::string::String>,
12074        {
12075            self.0.request.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
12076            self
12077        }
12078
12079        /// Sets the value of [natural_language_query_understanding_spec][crate::model::SearchRequest::natural_language_query_understanding_spec].
12080        pub fn set_natural_language_query_understanding_spec<T>(mut self, v: T) -> Self
12081        where
12082            T: std::convert::Into<
12083                    crate::model::search_request::NaturalLanguageQueryUnderstandingSpec,
12084                >,
12085        {
12086            self.0.request.natural_language_query_understanding_spec =
12087                std::option::Option::Some(v.into());
12088            self
12089        }
12090
12091        /// Sets or clears the value of [natural_language_query_understanding_spec][crate::model::SearchRequest::natural_language_query_understanding_spec].
12092        pub fn set_or_clear_natural_language_query_understanding_spec<T>(
12093            mut self,
12094            v: std::option::Option<T>,
12095        ) -> 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 = v.map(|x| x.into());
12102            self
12103        }
12104
12105        /// Sets the value of [search_as_you_type_spec][crate::model::SearchRequest::search_as_you_type_spec].
12106        pub fn set_search_as_you_type_spec<T>(mut self, v: T) -> Self
12107        where
12108            T: std::convert::Into<crate::model::search_request::SearchAsYouTypeSpec>,
12109        {
12110            self.0.request.search_as_you_type_spec = std::option::Option::Some(v.into());
12111            self
12112        }
12113
12114        /// Sets or clears the value of [search_as_you_type_spec][crate::model::SearchRequest::search_as_you_type_spec].
12115        pub fn set_or_clear_search_as_you_type_spec<T>(mut self, v: std::option::Option<T>) -> Self
12116        where
12117            T: std::convert::Into<crate::model::search_request::SearchAsYouTypeSpec>,
12118        {
12119            self.0.request.search_as_you_type_spec = v.map(|x| x.into());
12120            self
12121        }
12122
12123        /// Sets the value of [display_spec][crate::model::SearchRequest::display_spec].
12124        pub fn set_display_spec<T>(mut self, v: T) -> Self
12125        where
12126            T: std::convert::Into<crate::model::search_request::DisplaySpec>,
12127        {
12128            self.0.request.display_spec = std::option::Option::Some(v.into());
12129            self
12130        }
12131
12132        /// Sets or clears the value of [display_spec][crate::model::SearchRequest::display_spec].
12133        pub fn set_or_clear_display_spec<T>(mut self, v: std::option::Option<T>) -> Self
12134        where
12135            T: std::convert::Into<crate::model::search_request::DisplaySpec>,
12136        {
12137            self.0.request.display_spec = v.map(|x| x.into());
12138            self
12139        }
12140
12141        /// Sets the value of [crowding_specs][crate::model::SearchRequest::crowding_specs].
12142        pub fn set_crowding_specs<T, V>(mut self, v: T) -> Self
12143        where
12144            T: std::iter::IntoIterator<Item = V>,
12145            V: std::convert::Into<crate::model::search_request::CrowdingSpec>,
12146        {
12147            use std::iter::Iterator;
12148            self.0.request.crowding_specs = v.into_iter().map(|i| i.into()).collect();
12149            self
12150        }
12151
12152        /// Sets the value of [session][crate::model::SearchRequest::session].
12153        pub fn set_session<T: Into<std::string::String>>(mut self, v: T) -> Self {
12154            self.0.request.session = v.into();
12155            self
12156        }
12157
12158        /// Sets the value of [session_spec][crate::model::SearchRequest::session_spec].
12159        pub fn set_session_spec<T>(mut self, v: T) -> Self
12160        where
12161            T: std::convert::Into<crate::model::search_request::SessionSpec>,
12162        {
12163            self.0.request.session_spec = std::option::Option::Some(v.into());
12164            self
12165        }
12166
12167        /// Sets or clears the value of [session_spec][crate::model::SearchRequest::session_spec].
12168        pub fn set_or_clear_session_spec<T>(mut self, v: std::option::Option<T>) -> Self
12169        where
12170            T: std::convert::Into<crate::model::search_request::SessionSpec>,
12171        {
12172            self.0.request.session_spec = v.map(|x| x.into());
12173            self
12174        }
12175
12176        /// Sets the value of [relevance_threshold][crate::model::SearchRequest::relevance_threshold].
12177        pub fn set_relevance_threshold<
12178            T: Into<crate::model::search_request::RelevanceThreshold>,
12179        >(
12180            mut self,
12181            v: T,
12182        ) -> Self {
12183            self.0.request.relevance_threshold = v.into();
12184            self
12185        }
12186
12187        /// Sets the value of [relevance_score_spec][crate::model::SearchRequest::relevance_score_spec].
12188        pub fn set_relevance_score_spec<T>(mut self, v: T) -> Self
12189        where
12190            T: std::convert::Into<crate::model::search_request::RelevanceScoreSpec>,
12191        {
12192            self.0.request.relevance_score_spec = std::option::Option::Some(v.into());
12193            self
12194        }
12195
12196        /// Sets or clears the value of [relevance_score_spec][crate::model::SearchRequest::relevance_score_spec].
12197        pub fn set_or_clear_relevance_score_spec<T>(mut self, v: std::option::Option<T>) -> Self
12198        where
12199            T: std::convert::Into<crate::model::search_request::RelevanceScoreSpec>,
12200        {
12201            self.0.request.relevance_score_spec = v.map(|x| x.into());
12202            self
12203        }
12204    }
12205
12206    #[doc(hidden)]
12207    impl crate::RequestBuilder for SearchLite {
12208        fn request_options(&mut self) -> &mut crate::RequestOptions {
12209            &mut self.0.options
12210        }
12211    }
12212
12213    /// The request builder for [SearchService::list_operations][crate::client::SearchService::list_operations] calls.
12214    ///
12215    /// # Example
12216    /// ```
12217    /// # use google_cloud_discoveryengine_v1::builder::search_service::ListOperations;
12218    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
12219    /// use google_cloud_gax::paginator::ItemPaginator;
12220    ///
12221    /// let builder = prepare_request_builder();
12222    /// let mut items = builder.by_item();
12223    /// while let Some(result) = items.next().await {
12224    ///   let item = result?;
12225    /// }
12226    /// # Ok(()) }
12227    ///
12228    /// fn prepare_request_builder() -> ListOperations {
12229    ///   # panic!();
12230    ///   // ... details omitted ...
12231    /// }
12232    /// ```
12233    #[derive(Clone, Debug)]
12234    pub struct ListOperations(
12235        RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
12236    );
12237
12238    impl ListOperations {
12239        pub(crate) fn new(
12240            stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchService>,
12241        ) -> Self {
12242            Self(RequestBuilder::new(stub))
12243        }
12244
12245        /// Sets the full request, replacing any prior values.
12246        pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
12247            mut self,
12248            v: V,
12249        ) -> Self {
12250            self.0.request = v.into();
12251            self
12252        }
12253
12254        /// Sets all the options, replacing any prior values.
12255        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
12256            self.0.options = v.into();
12257            self
12258        }
12259
12260        /// Sends the request.
12261        pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
12262            (*self.0.stub)
12263                .list_operations(self.0.request, self.0.options)
12264                .await
12265                .map(crate::Response::into_body)
12266        }
12267
12268        /// Streams each page in the collection.
12269        pub fn by_page(
12270            self,
12271        ) -> impl google_cloud_gax::paginator::Paginator<
12272            google_cloud_longrunning::model::ListOperationsResponse,
12273            crate::Error,
12274        > {
12275            use std::clone::Clone;
12276            let token = self.0.request.page_token.clone();
12277            let execute = move |token: String| {
12278                let mut builder = self.clone();
12279                builder.0.request = builder.0.request.set_page_token(token);
12280                builder.send()
12281            };
12282            google_cloud_gax::paginator::internal::new_paginator(token, execute)
12283        }
12284
12285        /// Streams each item in the collection.
12286        pub fn by_item(
12287            self,
12288        ) -> impl google_cloud_gax::paginator::ItemPaginator<
12289            google_cloud_longrunning::model::ListOperationsResponse,
12290            crate::Error,
12291        > {
12292            use google_cloud_gax::paginator::Paginator;
12293            self.by_page().items()
12294        }
12295
12296        /// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
12297        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
12298            self.0.request.name = v.into();
12299            self
12300        }
12301
12302        /// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::filter].
12303        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
12304            self.0.request.filter = v.into();
12305            self
12306        }
12307
12308        /// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
12309        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
12310            self.0.request.page_size = v.into();
12311            self
12312        }
12313
12314        /// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
12315        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
12316            self.0.request.page_token = v.into();
12317            self
12318        }
12319
12320        /// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
12321        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
12322            self.0.request.return_partial_success = v.into();
12323            self
12324        }
12325    }
12326
12327    #[doc(hidden)]
12328    impl crate::RequestBuilder for ListOperations {
12329        fn request_options(&mut self) -> &mut crate::RequestOptions {
12330            &mut self.0.options
12331        }
12332    }
12333
12334    /// The request builder for [SearchService::get_operation][crate::client::SearchService::get_operation] calls.
12335    ///
12336    /// # Example
12337    /// ```
12338    /// # use google_cloud_discoveryengine_v1::builder::search_service::GetOperation;
12339    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
12340    ///
12341    /// let builder = prepare_request_builder();
12342    /// let response = builder.send().await?;
12343    /// # Ok(()) }
12344    ///
12345    /// fn prepare_request_builder() -> GetOperation {
12346    ///   # panic!();
12347    ///   // ... details omitted ...
12348    /// }
12349    /// ```
12350    #[derive(Clone, Debug)]
12351    pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
12352
12353    impl GetOperation {
12354        pub(crate) fn new(
12355            stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchService>,
12356        ) -> Self {
12357            Self(RequestBuilder::new(stub))
12358        }
12359
12360        /// Sets the full request, replacing any prior values.
12361        pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
12362            mut self,
12363            v: V,
12364        ) -> Self {
12365            self.0.request = v.into();
12366            self
12367        }
12368
12369        /// Sets all the options, replacing any prior values.
12370        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
12371            self.0.options = v.into();
12372            self
12373        }
12374
12375        /// Sends the request.
12376        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
12377            (*self.0.stub)
12378                .get_operation(self.0.request, self.0.options)
12379                .await
12380                .map(crate::Response::into_body)
12381        }
12382
12383        /// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
12384        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
12385            self.0.request.name = v.into();
12386            self
12387        }
12388    }
12389
12390    #[doc(hidden)]
12391    impl crate::RequestBuilder for GetOperation {
12392        fn request_options(&mut self) -> &mut crate::RequestOptions {
12393            &mut self.0.options
12394        }
12395    }
12396
12397    /// The request builder for [SearchService::cancel_operation][crate::client::SearchService::cancel_operation] calls.
12398    ///
12399    /// # Example
12400    /// ```
12401    /// # use google_cloud_discoveryengine_v1::builder::search_service::CancelOperation;
12402    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
12403    ///
12404    /// let builder = prepare_request_builder();
12405    /// let response = builder.send().await?;
12406    /// # Ok(()) }
12407    ///
12408    /// fn prepare_request_builder() -> CancelOperation {
12409    ///   # panic!();
12410    ///   // ... details omitted ...
12411    /// }
12412    /// ```
12413    #[derive(Clone, Debug)]
12414    pub struct CancelOperation(
12415        RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
12416    );
12417
12418    impl CancelOperation {
12419        pub(crate) fn new(
12420            stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchService>,
12421        ) -> Self {
12422            Self(RequestBuilder::new(stub))
12423        }
12424
12425        /// Sets the full request, replacing any prior values.
12426        pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
12427            mut self,
12428            v: V,
12429        ) -> Self {
12430            self.0.request = v.into();
12431            self
12432        }
12433
12434        /// Sets all the options, replacing any prior values.
12435        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
12436            self.0.options = v.into();
12437            self
12438        }
12439
12440        /// Sends the request.
12441        pub async fn send(self) -> Result<()> {
12442            (*self.0.stub)
12443                .cancel_operation(self.0.request, self.0.options)
12444                .await
12445                .map(crate::Response::into_body)
12446        }
12447
12448        /// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::name].
12449        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
12450            self.0.request.name = v.into();
12451            self
12452        }
12453    }
12454
12455    #[doc(hidden)]
12456    impl crate::RequestBuilder for CancelOperation {
12457        fn request_options(&mut self) -> &mut crate::RequestOptions {
12458            &mut self.0.options
12459        }
12460    }
12461}
12462
12463#[cfg(feature = "search-tuning-service")]
12464#[cfg_attr(docsrs, doc(cfg(feature = "search-tuning-service")))]
12465pub mod search_tuning_service {
12466    use crate::Result;
12467
12468    /// A builder for [SearchTuningService][crate::client::SearchTuningService].
12469    ///
12470    /// ```
12471    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
12472    /// # use google_cloud_discoveryengine_v1::*;
12473    /// # use builder::search_tuning_service::ClientBuilder;
12474    /// # use client::SearchTuningService;
12475    /// let builder : ClientBuilder = SearchTuningService::builder();
12476    /// let client = builder
12477    ///     .with_endpoint("https://discoveryengine.googleapis.com")
12478    ///     .build().await?;
12479    /// # Ok(()) }
12480    /// ```
12481    pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
12482
12483    pub(crate) mod client {
12484        use super::super::super::client::SearchTuningService;
12485        pub struct Factory;
12486        impl crate::ClientFactory for Factory {
12487            type Client = SearchTuningService;
12488            type Credentials = gaxi::options::Credentials;
12489            async fn build(
12490                self,
12491                config: gaxi::options::ClientConfig,
12492            ) -> crate::ClientBuilderResult<Self::Client> {
12493                Self::Client::new(config).await
12494            }
12495        }
12496    }
12497
12498    /// Common implementation for [crate::client::SearchTuningService] request builders.
12499    #[derive(Clone, Debug)]
12500    pub(crate) struct RequestBuilder<R: std::default::Default> {
12501        stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchTuningService>,
12502        request: R,
12503        options: crate::RequestOptions,
12504    }
12505
12506    impl<R> RequestBuilder<R>
12507    where
12508        R: std::default::Default,
12509    {
12510        pub(crate) fn new(
12511            stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchTuningService>,
12512        ) -> Self {
12513            Self {
12514                stub,
12515                request: R::default(),
12516                options: crate::RequestOptions::default(),
12517            }
12518        }
12519    }
12520
12521    /// The request builder for [SearchTuningService::train_custom_model][crate::client::SearchTuningService::train_custom_model] calls.
12522    ///
12523    /// # Example
12524    /// ```
12525    /// # use google_cloud_discoveryengine_v1::builder::search_tuning_service::TrainCustomModel;
12526    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
12527    /// use google_cloud_lro::Poller;
12528    ///
12529    /// let builder = prepare_request_builder();
12530    /// let response = builder.poller().until_done().await?;
12531    /// # Ok(()) }
12532    ///
12533    /// fn prepare_request_builder() -> TrainCustomModel {
12534    ///   # panic!();
12535    ///   // ... details omitted ...
12536    /// }
12537    /// ```
12538    #[derive(Clone, Debug)]
12539    pub struct TrainCustomModel(RequestBuilder<crate::model::TrainCustomModelRequest>);
12540
12541    impl TrainCustomModel {
12542        pub(crate) fn new(
12543            stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchTuningService>,
12544        ) -> Self {
12545            Self(RequestBuilder::new(stub))
12546        }
12547
12548        /// Sets the full request, replacing any prior values.
12549        pub fn with_request<V: Into<crate::model::TrainCustomModelRequest>>(
12550            mut self,
12551            v: V,
12552        ) -> Self {
12553            self.0.request = v.into();
12554            self
12555        }
12556
12557        /// Sets all the options, replacing any prior values.
12558        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
12559            self.0.options = v.into();
12560            self
12561        }
12562
12563        /// Sends the request.
12564        ///
12565        /// # Long running operations
12566        ///
12567        /// This starts, but does not poll, a longrunning operation. More information
12568        /// on [train_custom_model][crate::client::SearchTuningService::train_custom_model].
12569        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
12570            (*self.0.stub)
12571                .train_custom_model(self.0.request, self.0.options)
12572                .await
12573                .map(crate::Response::into_body)
12574        }
12575
12576        /// Creates a [Poller][google_cloud_lro::Poller] to work with `train_custom_model`.
12577        pub fn poller(
12578            self,
12579        ) -> impl google_cloud_lro::Poller<
12580            crate::model::TrainCustomModelResponse,
12581            crate::model::TrainCustomModelMetadata,
12582        > {
12583            type Operation = google_cloud_lro::internal::Operation<
12584                crate::model::TrainCustomModelResponse,
12585                crate::model::TrainCustomModelMetadata,
12586            >;
12587            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
12588            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
12589
12590            let stub = self.0.stub.clone();
12591            let mut options = self.0.options.clone();
12592            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
12593            let query = move |name| {
12594                let stub = stub.clone();
12595                let options = options.clone();
12596                async {
12597                    let op = GetOperation::new(stub)
12598                        .set_name(name)
12599                        .with_options(options)
12600                        .send()
12601                        .await?;
12602                    Ok(Operation::new(op))
12603                }
12604            };
12605
12606            let start = move || async {
12607                let op = self.send().await?;
12608                Ok(Operation::new(op))
12609            };
12610
12611            google_cloud_lro::internal::new_poller(
12612                polling_error_policy,
12613                polling_backoff_policy,
12614                start,
12615                query,
12616            )
12617        }
12618
12619        /// Sets the value of [data_store][crate::model::TrainCustomModelRequest::data_store].
12620        ///
12621        /// This is a **required** field for requests.
12622        pub fn set_data_store<T: Into<std::string::String>>(mut self, v: T) -> Self {
12623            self.0.request.data_store = v.into();
12624            self
12625        }
12626
12627        /// Sets the value of [model_type][crate::model::TrainCustomModelRequest::model_type].
12628        pub fn set_model_type<T: Into<std::string::String>>(mut self, v: T) -> Self {
12629            self.0.request.model_type = v.into();
12630            self
12631        }
12632
12633        /// Sets the value of [error_config][crate::model::TrainCustomModelRequest::error_config].
12634        pub fn set_error_config<T>(mut self, v: T) -> Self
12635        where
12636            T: std::convert::Into<crate::model::ImportErrorConfig>,
12637        {
12638            self.0.request.error_config = std::option::Option::Some(v.into());
12639            self
12640        }
12641
12642        /// Sets or clears the value of [error_config][crate::model::TrainCustomModelRequest::error_config].
12643        pub fn set_or_clear_error_config<T>(mut self, v: std::option::Option<T>) -> Self
12644        where
12645            T: std::convert::Into<crate::model::ImportErrorConfig>,
12646        {
12647            self.0.request.error_config = v.map(|x| x.into());
12648            self
12649        }
12650
12651        /// Sets the value of [model_id][crate::model::TrainCustomModelRequest::model_id].
12652        pub fn set_model_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
12653            self.0.request.model_id = v.into();
12654            self
12655        }
12656
12657        /// Sets the value of [training_input][crate::model::TrainCustomModelRequest::training_input].
12658        ///
12659        /// Note that all the setters affecting `training_input` are
12660        /// mutually exclusive.
12661        pub fn set_training_input<
12662            T: Into<Option<crate::model::train_custom_model_request::TrainingInput>>,
12663        >(
12664            mut self,
12665            v: T,
12666        ) -> Self {
12667            self.0.request.training_input = v.into();
12668            self
12669        }
12670
12671        /// Sets the value of [training_input][crate::model::TrainCustomModelRequest::training_input]
12672        /// to hold a `GcsTrainingInput`.
12673        ///
12674        /// Note that all the setters affecting `training_input` are
12675        /// mutually exclusive.
12676        pub fn set_gcs_training_input<
12677            T: std::convert::Into<
12678                    std::boxed::Box<crate::model::train_custom_model_request::GcsTrainingInput>,
12679                >,
12680        >(
12681            mut self,
12682            v: T,
12683        ) -> Self {
12684            self.0.request = self.0.request.set_gcs_training_input(v);
12685            self
12686        }
12687    }
12688
12689    #[doc(hidden)]
12690    impl crate::RequestBuilder for TrainCustomModel {
12691        fn request_options(&mut self) -> &mut crate::RequestOptions {
12692            &mut self.0.options
12693        }
12694    }
12695
12696    /// The request builder for [SearchTuningService::list_custom_models][crate::client::SearchTuningService::list_custom_models] calls.
12697    ///
12698    /// # Example
12699    /// ```
12700    /// # use google_cloud_discoveryengine_v1::builder::search_tuning_service::ListCustomModels;
12701    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
12702    ///
12703    /// let builder = prepare_request_builder();
12704    /// let response = builder.send().await?;
12705    /// # Ok(()) }
12706    ///
12707    /// fn prepare_request_builder() -> ListCustomModels {
12708    ///   # panic!();
12709    ///   // ... details omitted ...
12710    /// }
12711    /// ```
12712    #[derive(Clone, Debug)]
12713    pub struct ListCustomModels(RequestBuilder<crate::model::ListCustomModelsRequest>);
12714
12715    impl ListCustomModels {
12716        pub(crate) fn new(
12717            stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchTuningService>,
12718        ) -> Self {
12719            Self(RequestBuilder::new(stub))
12720        }
12721
12722        /// Sets the full request, replacing any prior values.
12723        pub fn with_request<V: Into<crate::model::ListCustomModelsRequest>>(
12724            mut self,
12725            v: V,
12726        ) -> Self {
12727            self.0.request = v.into();
12728            self
12729        }
12730
12731        /// Sets all the options, replacing any prior values.
12732        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
12733            self.0.options = v.into();
12734            self
12735        }
12736
12737        /// Sends the request.
12738        pub async fn send(self) -> Result<crate::model::ListCustomModelsResponse> {
12739            (*self.0.stub)
12740                .list_custom_models(self.0.request, self.0.options)
12741                .await
12742                .map(crate::Response::into_body)
12743        }
12744
12745        /// Sets the value of [data_store][crate::model::ListCustomModelsRequest::data_store].
12746        ///
12747        /// This is a **required** field for requests.
12748        pub fn set_data_store<T: Into<std::string::String>>(mut self, v: T) -> Self {
12749            self.0.request.data_store = v.into();
12750            self
12751        }
12752    }
12753
12754    #[doc(hidden)]
12755    impl crate::RequestBuilder for ListCustomModels {
12756        fn request_options(&mut self) -> &mut crate::RequestOptions {
12757            &mut self.0.options
12758        }
12759    }
12760
12761    /// The request builder for [SearchTuningService::list_operations][crate::client::SearchTuningService::list_operations] calls.
12762    ///
12763    /// # Example
12764    /// ```
12765    /// # use google_cloud_discoveryengine_v1::builder::search_tuning_service::ListOperations;
12766    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
12767    /// use google_cloud_gax::paginator::ItemPaginator;
12768    ///
12769    /// let builder = prepare_request_builder();
12770    /// let mut items = builder.by_item();
12771    /// while let Some(result) = items.next().await {
12772    ///   let item = result?;
12773    /// }
12774    /// # Ok(()) }
12775    ///
12776    /// fn prepare_request_builder() -> ListOperations {
12777    ///   # panic!();
12778    ///   // ... details omitted ...
12779    /// }
12780    /// ```
12781    #[derive(Clone, Debug)]
12782    pub struct ListOperations(
12783        RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
12784    );
12785
12786    impl ListOperations {
12787        pub(crate) fn new(
12788            stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchTuningService>,
12789        ) -> Self {
12790            Self(RequestBuilder::new(stub))
12791        }
12792
12793        /// Sets the full request, replacing any prior values.
12794        pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
12795            mut self,
12796            v: V,
12797        ) -> Self {
12798            self.0.request = v.into();
12799            self
12800        }
12801
12802        /// Sets all the options, replacing any prior values.
12803        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
12804            self.0.options = v.into();
12805            self
12806        }
12807
12808        /// Sends the request.
12809        pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
12810            (*self.0.stub)
12811                .list_operations(self.0.request, self.0.options)
12812                .await
12813                .map(crate::Response::into_body)
12814        }
12815
12816        /// Streams each page in the collection.
12817        pub fn by_page(
12818            self,
12819        ) -> impl google_cloud_gax::paginator::Paginator<
12820            google_cloud_longrunning::model::ListOperationsResponse,
12821            crate::Error,
12822        > {
12823            use std::clone::Clone;
12824            let token = self.0.request.page_token.clone();
12825            let execute = move |token: String| {
12826                let mut builder = self.clone();
12827                builder.0.request = builder.0.request.set_page_token(token);
12828                builder.send()
12829            };
12830            google_cloud_gax::paginator::internal::new_paginator(token, execute)
12831        }
12832
12833        /// Streams each item in the collection.
12834        pub fn by_item(
12835            self,
12836        ) -> impl google_cloud_gax::paginator::ItemPaginator<
12837            google_cloud_longrunning::model::ListOperationsResponse,
12838            crate::Error,
12839        > {
12840            use google_cloud_gax::paginator::Paginator;
12841            self.by_page().items()
12842        }
12843
12844        /// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
12845        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
12846            self.0.request.name = v.into();
12847            self
12848        }
12849
12850        /// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::filter].
12851        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
12852            self.0.request.filter = v.into();
12853            self
12854        }
12855
12856        /// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
12857        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
12858            self.0.request.page_size = v.into();
12859            self
12860        }
12861
12862        /// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
12863        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
12864            self.0.request.page_token = v.into();
12865            self
12866        }
12867
12868        /// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
12869        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
12870            self.0.request.return_partial_success = v.into();
12871            self
12872        }
12873    }
12874
12875    #[doc(hidden)]
12876    impl crate::RequestBuilder for ListOperations {
12877        fn request_options(&mut self) -> &mut crate::RequestOptions {
12878            &mut self.0.options
12879        }
12880    }
12881
12882    /// The request builder for [SearchTuningService::get_operation][crate::client::SearchTuningService::get_operation] calls.
12883    ///
12884    /// # Example
12885    /// ```
12886    /// # use google_cloud_discoveryengine_v1::builder::search_tuning_service::GetOperation;
12887    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
12888    ///
12889    /// let builder = prepare_request_builder();
12890    /// let response = builder.send().await?;
12891    /// # Ok(()) }
12892    ///
12893    /// fn prepare_request_builder() -> GetOperation {
12894    ///   # panic!();
12895    ///   // ... details omitted ...
12896    /// }
12897    /// ```
12898    #[derive(Clone, Debug)]
12899    pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
12900
12901    impl GetOperation {
12902        pub(crate) fn new(
12903            stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchTuningService>,
12904        ) -> Self {
12905            Self(RequestBuilder::new(stub))
12906        }
12907
12908        /// Sets the full request, replacing any prior values.
12909        pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
12910            mut self,
12911            v: V,
12912        ) -> Self {
12913            self.0.request = v.into();
12914            self
12915        }
12916
12917        /// Sets all the options, replacing any prior values.
12918        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
12919            self.0.options = v.into();
12920            self
12921        }
12922
12923        /// Sends the request.
12924        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
12925            (*self.0.stub)
12926                .get_operation(self.0.request, self.0.options)
12927                .await
12928                .map(crate::Response::into_body)
12929        }
12930
12931        /// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
12932        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
12933            self.0.request.name = v.into();
12934            self
12935        }
12936    }
12937
12938    #[doc(hidden)]
12939    impl crate::RequestBuilder for GetOperation {
12940        fn request_options(&mut self) -> &mut crate::RequestOptions {
12941            &mut self.0.options
12942        }
12943    }
12944
12945    /// The request builder for [SearchTuningService::cancel_operation][crate::client::SearchTuningService::cancel_operation] calls.
12946    ///
12947    /// # Example
12948    /// ```
12949    /// # use google_cloud_discoveryengine_v1::builder::search_tuning_service::CancelOperation;
12950    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
12951    ///
12952    /// let builder = prepare_request_builder();
12953    /// let response = builder.send().await?;
12954    /// # Ok(()) }
12955    ///
12956    /// fn prepare_request_builder() -> CancelOperation {
12957    ///   # panic!();
12958    ///   // ... details omitted ...
12959    /// }
12960    /// ```
12961    #[derive(Clone, Debug)]
12962    pub struct CancelOperation(
12963        RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
12964    );
12965
12966    impl CancelOperation {
12967        pub(crate) fn new(
12968            stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchTuningService>,
12969        ) -> Self {
12970            Self(RequestBuilder::new(stub))
12971        }
12972
12973        /// Sets the full request, replacing any prior values.
12974        pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
12975            mut self,
12976            v: V,
12977        ) -> Self {
12978            self.0.request = v.into();
12979            self
12980        }
12981
12982        /// Sets all the options, replacing any prior values.
12983        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
12984            self.0.options = v.into();
12985            self
12986        }
12987
12988        /// Sends the request.
12989        pub async fn send(self) -> Result<()> {
12990            (*self.0.stub)
12991                .cancel_operation(self.0.request, self.0.options)
12992                .await
12993                .map(crate::Response::into_body)
12994        }
12995
12996        /// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::name].
12997        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
12998            self.0.request.name = v.into();
12999            self
13000        }
13001    }
13002
13003    #[doc(hidden)]
13004    impl crate::RequestBuilder for CancelOperation {
13005        fn request_options(&mut self) -> &mut crate::RequestOptions {
13006            &mut self.0.options
13007        }
13008    }
13009}
13010
13011#[cfg(feature = "serving-config-service")]
13012#[cfg_attr(docsrs, doc(cfg(feature = "serving-config-service")))]
13013pub mod serving_config_service {
13014    use crate::Result;
13015
13016    /// A builder for [ServingConfigService][crate::client::ServingConfigService].
13017    ///
13018    /// ```
13019    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
13020    /// # use google_cloud_discoveryengine_v1::*;
13021    /// # use builder::serving_config_service::ClientBuilder;
13022    /// # use client::ServingConfigService;
13023    /// let builder : ClientBuilder = ServingConfigService::builder();
13024    /// let client = builder
13025    ///     .with_endpoint("https://discoveryengine.googleapis.com")
13026    ///     .build().await?;
13027    /// # Ok(()) }
13028    /// ```
13029    pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
13030
13031    pub(crate) mod client {
13032        use super::super::super::client::ServingConfigService;
13033        pub struct Factory;
13034        impl crate::ClientFactory for Factory {
13035            type Client = ServingConfigService;
13036            type Credentials = gaxi::options::Credentials;
13037            async fn build(
13038                self,
13039                config: gaxi::options::ClientConfig,
13040            ) -> crate::ClientBuilderResult<Self::Client> {
13041                Self::Client::new(config).await
13042            }
13043        }
13044    }
13045
13046    /// Common implementation for [crate::client::ServingConfigService] request builders.
13047    #[derive(Clone, Debug)]
13048    pub(crate) struct RequestBuilder<R: std::default::Default> {
13049        stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
13050        request: R,
13051        options: crate::RequestOptions,
13052    }
13053
13054    impl<R> RequestBuilder<R>
13055    where
13056        R: std::default::Default,
13057    {
13058        pub(crate) fn new(
13059            stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
13060        ) -> Self {
13061            Self {
13062                stub,
13063                request: R::default(),
13064                options: crate::RequestOptions::default(),
13065            }
13066        }
13067    }
13068
13069    /// The request builder for [ServingConfigService::update_serving_config][crate::client::ServingConfigService::update_serving_config] calls.
13070    ///
13071    /// # Example
13072    /// ```
13073    /// # use google_cloud_discoveryengine_v1::builder::serving_config_service::UpdateServingConfig;
13074    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
13075    ///
13076    /// let builder = prepare_request_builder();
13077    /// let response = builder.send().await?;
13078    /// # Ok(()) }
13079    ///
13080    /// fn prepare_request_builder() -> UpdateServingConfig {
13081    ///   # panic!();
13082    ///   // ... details omitted ...
13083    /// }
13084    /// ```
13085    #[derive(Clone, Debug)]
13086    pub struct UpdateServingConfig(RequestBuilder<crate::model::UpdateServingConfigRequest>);
13087
13088    impl UpdateServingConfig {
13089        pub(crate) fn new(
13090            stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
13091        ) -> Self {
13092            Self(RequestBuilder::new(stub))
13093        }
13094
13095        /// Sets the full request, replacing any prior values.
13096        pub fn with_request<V: Into<crate::model::UpdateServingConfigRequest>>(
13097            mut self,
13098            v: V,
13099        ) -> Self {
13100            self.0.request = v.into();
13101            self
13102        }
13103
13104        /// Sets all the options, replacing any prior values.
13105        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
13106            self.0.options = v.into();
13107            self
13108        }
13109
13110        /// Sends the request.
13111        pub async fn send(self) -> Result<crate::model::ServingConfig> {
13112            (*self.0.stub)
13113                .update_serving_config(self.0.request, self.0.options)
13114                .await
13115                .map(crate::Response::into_body)
13116        }
13117
13118        /// Sets the value of [serving_config][crate::model::UpdateServingConfigRequest::serving_config].
13119        ///
13120        /// This is a **required** field for requests.
13121        pub fn set_serving_config<T>(mut self, v: T) -> Self
13122        where
13123            T: std::convert::Into<crate::model::ServingConfig>,
13124        {
13125            self.0.request.serving_config = std::option::Option::Some(v.into());
13126            self
13127        }
13128
13129        /// Sets or clears the value of [serving_config][crate::model::UpdateServingConfigRequest::serving_config].
13130        ///
13131        /// This is a **required** field for requests.
13132        pub fn set_or_clear_serving_config<T>(mut self, v: std::option::Option<T>) -> Self
13133        where
13134            T: std::convert::Into<crate::model::ServingConfig>,
13135        {
13136            self.0.request.serving_config = v.map(|x| x.into());
13137            self
13138        }
13139
13140        /// Sets the value of [update_mask][crate::model::UpdateServingConfigRequest::update_mask].
13141        pub fn set_update_mask<T>(mut self, v: T) -> Self
13142        where
13143            T: std::convert::Into<wkt::FieldMask>,
13144        {
13145            self.0.request.update_mask = std::option::Option::Some(v.into());
13146            self
13147        }
13148
13149        /// Sets or clears the value of [update_mask][crate::model::UpdateServingConfigRequest::update_mask].
13150        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
13151        where
13152            T: std::convert::Into<wkt::FieldMask>,
13153        {
13154            self.0.request.update_mask = v.map(|x| x.into());
13155            self
13156        }
13157    }
13158
13159    #[doc(hidden)]
13160    impl crate::RequestBuilder for UpdateServingConfig {
13161        fn request_options(&mut self) -> &mut crate::RequestOptions {
13162            &mut self.0.options
13163        }
13164    }
13165
13166    /// The request builder for [ServingConfigService::list_operations][crate::client::ServingConfigService::list_operations] calls.
13167    ///
13168    /// # Example
13169    /// ```
13170    /// # use google_cloud_discoveryengine_v1::builder::serving_config_service::ListOperations;
13171    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
13172    /// use google_cloud_gax::paginator::ItemPaginator;
13173    ///
13174    /// let builder = prepare_request_builder();
13175    /// let mut items = builder.by_item();
13176    /// while let Some(result) = items.next().await {
13177    ///   let item = result?;
13178    /// }
13179    /// # Ok(()) }
13180    ///
13181    /// fn prepare_request_builder() -> ListOperations {
13182    ///   # panic!();
13183    ///   // ... details omitted ...
13184    /// }
13185    /// ```
13186    #[derive(Clone, Debug)]
13187    pub struct ListOperations(
13188        RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
13189    );
13190
13191    impl ListOperations {
13192        pub(crate) fn new(
13193            stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
13194        ) -> Self {
13195            Self(RequestBuilder::new(stub))
13196        }
13197
13198        /// Sets the full request, replacing any prior values.
13199        pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
13200            mut self,
13201            v: V,
13202        ) -> Self {
13203            self.0.request = v.into();
13204            self
13205        }
13206
13207        /// Sets all the options, replacing any prior values.
13208        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
13209            self.0.options = v.into();
13210            self
13211        }
13212
13213        /// Sends the request.
13214        pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
13215            (*self.0.stub)
13216                .list_operations(self.0.request, self.0.options)
13217                .await
13218                .map(crate::Response::into_body)
13219        }
13220
13221        /// Streams each page in the collection.
13222        pub fn by_page(
13223            self,
13224        ) -> impl google_cloud_gax::paginator::Paginator<
13225            google_cloud_longrunning::model::ListOperationsResponse,
13226            crate::Error,
13227        > {
13228            use std::clone::Clone;
13229            let token = self.0.request.page_token.clone();
13230            let execute = move |token: String| {
13231                let mut builder = self.clone();
13232                builder.0.request = builder.0.request.set_page_token(token);
13233                builder.send()
13234            };
13235            google_cloud_gax::paginator::internal::new_paginator(token, execute)
13236        }
13237
13238        /// Streams each item in the collection.
13239        pub fn by_item(
13240            self,
13241        ) -> impl google_cloud_gax::paginator::ItemPaginator<
13242            google_cloud_longrunning::model::ListOperationsResponse,
13243            crate::Error,
13244        > {
13245            use google_cloud_gax::paginator::Paginator;
13246            self.by_page().items()
13247        }
13248
13249        /// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
13250        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13251            self.0.request.name = v.into();
13252            self
13253        }
13254
13255        /// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::filter].
13256        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
13257            self.0.request.filter = v.into();
13258            self
13259        }
13260
13261        /// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
13262        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
13263            self.0.request.page_size = v.into();
13264            self
13265        }
13266
13267        /// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
13268        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
13269            self.0.request.page_token = v.into();
13270            self
13271        }
13272
13273        /// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
13274        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
13275            self.0.request.return_partial_success = v.into();
13276            self
13277        }
13278    }
13279
13280    #[doc(hidden)]
13281    impl crate::RequestBuilder for ListOperations {
13282        fn request_options(&mut self) -> &mut crate::RequestOptions {
13283            &mut self.0.options
13284        }
13285    }
13286
13287    /// The request builder for [ServingConfigService::get_operation][crate::client::ServingConfigService::get_operation] calls.
13288    ///
13289    /// # Example
13290    /// ```
13291    /// # use google_cloud_discoveryengine_v1::builder::serving_config_service::GetOperation;
13292    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
13293    ///
13294    /// let builder = prepare_request_builder();
13295    /// let response = builder.send().await?;
13296    /// # Ok(()) }
13297    ///
13298    /// fn prepare_request_builder() -> GetOperation {
13299    ///   # panic!();
13300    ///   // ... details omitted ...
13301    /// }
13302    /// ```
13303    #[derive(Clone, Debug)]
13304    pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
13305
13306    impl GetOperation {
13307        pub(crate) fn new(
13308            stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
13309        ) -> Self {
13310            Self(RequestBuilder::new(stub))
13311        }
13312
13313        /// Sets the full request, replacing any prior values.
13314        pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
13315            mut self,
13316            v: V,
13317        ) -> Self {
13318            self.0.request = v.into();
13319            self
13320        }
13321
13322        /// Sets all the options, replacing any prior values.
13323        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
13324            self.0.options = v.into();
13325            self
13326        }
13327
13328        /// Sends the request.
13329        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
13330            (*self.0.stub)
13331                .get_operation(self.0.request, self.0.options)
13332                .await
13333                .map(crate::Response::into_body)
13334        }
13335
13336        /// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
13337        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13338            self.0.request.name = v.into();
13339            self
13340        }
13341    }
13342
13343    #[doc(hidden)]
13344    impl crate::RequestBuilder for GetOperation {
13345        fn request_options(&mut self) -> &mut crate::RequestOptions {
13346            &mut self.0.options
13347        }
13348    }
13349
13350    /// The request builder for [ServingConfigService::cancel_operation][crate::client::ServingConfigService::cancel_operation] calls.
13351    ///
13352    /// # Example
13353    /// ```
13354    /// # use google_cloud_discoveryengine_v1::builder::serving_config_service::CancelOperation;
13355    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
13356    ///
13357    /// let builder = prepare_request_builder();
13358    /// let response = builder.send().await?;
13359    /// # Ok(()) }
13360    ///
13361    /// fn prepare_request_builder() -> CancelOperation {
13362    ///   # panic!();
13363    ///   // ... details omitted ...
13364    /// }
13365    /// ```
13366    #[derive(Clone, Debug)]
13367    pub struct CancelOperation(
13368        RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
13369    );
13370
13371    impl CancelOperation {
13372        pub(crate) fn new(
13373            stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
13374        ) -> Self {
13375            Self(RequestBuilder::new(stub))
13376        }
13377
13378        /// Sets the full request, replacing any prior values.
13379        pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
13380            mut self,
13381            v: V,
13382        ) -> Self {
13383            self.0.request = v.into();
13384            self
13385        }
13386
13387        /// Sets all the options, replacing any prior values.
13388        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
13389            self.0.options = v.into();
13390            self
13391        }
13392
13393        /// Sends the request.
13394        pub async fn send(self) -> Result<()> {
13395            (*self.0.stub)
13396                .cancel_operation(self.0.request, self.0.options)
13397                .await
13398                .map(crate::Response::into_body)
13399        }
13400
13401        /// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::name].
13402        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13403            self.0.request.name = v.into();
13404            self
13405        }
13406    }
13407
13408    #[doc(hidden)]
13409    impl crate::RequestBuilder for CancelOperation {
13410        fn request_options(&mut self) -> &mut crate::RequestOptions {
13411            &mut self.0.options
13412        }
13413    }
13414}
13415
13416#[cfg(feature = "session-service")]
13417#[cfg_attr(docsrs, doc(cfg(feature = "session-service")))]
13418pub mod session_service {
13419    use crate::Result;
13420
13421    /// A builder for [SessionService][crate::client::SessionService].
13422    ///
13423    /// ```
13424    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
13425    /// # use google_cloud_discoveryengine_v1::*;
13426    /// # use builder::session_service::ClientBuilder;
13427    /// # use client::SessionService;
13428    /// let builder : ClientBuilder = SessionService::builder();
13429    /// let client = builder
13430    ///     .with_endpoint("https://discoveryengine.googleapis.com")
13431    ///     .build().await?;
13432    /// # Ok(()) }
13433    /// ```
13434    pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
13435
13436    pub(crate) mod client {
13437        use super::super::super::client::SessionService;
13438        pub struct Factory;
13439        impl crate::ClientFactory for Factory {
13440            type Client = SessionService;
13441            type Credentials = gaxi::options::Credentials;
13442            async fn build(
13443                self,
13444                config: gaxi::options::ClientConfig,
13445            ) -> crate::ClientBuilderResult<Self::Client> {
13446                Self::Client::new(config).await
13447            }
13448        }
13449    }
13450
13451    /// Common implementation for [crate::client::SessionService] request builders.
13452    #[derive(Clone, Debug)]
13453    pub(crate) struct RequestBuilder<R: std::default::Default> {
13454        stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
13455        request: R,
13456        options: crate::RequestOptions,
13457    }
13458
13459    impl<R> RequestBuilder<R>
13460    where
13461        R: std::default::Default,
13462    {
13463        pub(crate) fn new(
13464            stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
13465        ) -> Self {
13466            Self {
13467                stub,
13468                request: R::default(),
13469                options: crate::RequestOptions::default(),
13470            }
13471        }
13472    }
13473
13474    /// The request builder for [SessionService::create_session][crate::client::SessionService::create_session] calls.
13475    ///
13476    /// # Example
13477    /// ```
13478    /// # use google_cloud_discoveryengine_v1::builder::session_service::CreateSession;
13479    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
13480    ///
13481    /// let builder = prepare_request_builder();
13482    /// let response = builder.send().await?;
13483    /// # Ok(()) }
13484    ///
13485    /// fn prepare_request_builder() -> CreateSession {
13486    ///   # panic!();
13487    ///   // ... details omitted ...
13488    /// }
13489    /// ```
13490    #[derive(Clone, Debug)]
13491    pub struct CreateSession(RequestBuilder<crate::model::CreateSessionRequest>);
13492
13493    impl CreateSession {
13494        pub(crate) fn new(
13495            stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
13496        ) -> Self {
13497            Self(RequestBuilder::new(stub))
13498        }
13499
13500        /// Sets the full request, replacing any prior values.
13501        pub fn with_request<V: Into<crate::model::CreateSessionRequest>>(mut self, v: V) -> Self {
13502            self.0.request = v.into();
13503            self
13504        }
13505
13506        /// Sets all the options, replacing any prior values.
13507        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
13508            self.0.options = v.into();
13509            self
13510        }
13511
13512        /// Sends the request.
13513        pub async fn send(self) -> Result<crate::model::Session> {
13514            (*self.0.stub)
13515                .create_session(self.0.request, self.0.options)
13516                .await
13517                .map(crate::Response::into_body)
13518        }
13519
13520        /// Sets the value of [parent][crate::model::CreateSessionRequest::parent].
13521        ///
13522        /// This is a **required** field for requests.
13523        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
13524            self.0.request.parent = v.into();
13525            self
13526        }
13527
13528        /// Sets the value of [session][crate::model::CreateSessionRequest::session].
13529        ///
13530        /// This is a **required** field for requests.
13531        pub fn set_session<T>(mut self, v: T) -> Self
13532        where
13533            T: std::convert::Into<crate::model::Session>,
13534        {
13535            self.0.request.session = std::option::Option::Some(v.into());
13536            self
13537        }
13538
13539        /// Sets or clears the value of [session][crate::model::CreateSessionRequest::session].
13540        ///
13541        /// This is a **required** field for requests.
13542        pub fn set_or_clear_session<T>(mut self, v: std::option::Option<T>) -> Self
13543        where
13544            T: std::convert::Into<crate::model::Session>,
13545        {
13546            self.0.request.session = v.map(|x| x.into());
13547            self
13548        }
13549    }
13550
13551    #[doc(hidden)]
13552    impl crate::RequestBuilder for CreateSession {
13553        fn request_options(&mut self) -> &mut crate::RequestOptions {
13554            &mut self.0.options
13555        }
13556    }
13557
13558    /// The request builder for [SessionService::delete_session][crate::client::SessionService::delete_session] calls.
13559    ///
13560    /// # Example
13561    /// ```
13562    /// # use google_cloud_discoveryengine_v1::builder::session_service::DeleteSession;
13563    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
13564    ///
13565    /// let builder = prepare_request_builder();
13566    /// let response = builder.send().await?;
13567    /// # Ok(()) }
13568    ///
13569    /// fn prepare_request_builder() -> DeleteSession {
13570    ///   # panic!();
13571    ///   // ... details omitted ...
13572    /// }
13573    /// ```
13574    #[derive(Clone, Debug)]
13575    pub struct DeleteSession(RequestBuilder<crate::model::DeleteSessionRequest>);
13576
13577    impl DeleteSession {
13578        pub(crate) fn new(
13579            stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
13580        ) -> Self {
13581            Self(RequestBuilder::new(stub))
13582        }
13583
13584        /// Sets the full request, replacing any prior values.
13585        pub fn with_request<V: Into<crate::model::DeleteSessionRequest>>(mut self, v: V) -> Self {
13586            self.0.request = v.into();
13587            self
13588        }
13589
13590        /// Sets all the options, replacing any prior values.
13591        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
13592            self.0.options = v.into();
13593            self
13594        }
13595
13596        /// Sends the request.
13597        pub async fn send(self) -> Result<()> {
13598            (*self.0.stub)
13599                .delete_session(self.0.request, self.0.options)
13600                .await
13601                .map(crate::Response::into_body)
13602        }
13603
13604        /// Sets the value of [name][crate::model::DeleteSessionRequest::name].
13605        ///
13606        /// This is a **required** field for requests.
13607        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13608            self.0.request.name = v.into();
13609            self
13610        }
13611    }
13612
13613    #[doc(hidden)]
13614    impl crate::RequestBuilder for DeleteSession {
13615        fn request_options(&mut self) -> &mut crate::RequestOptions {
13616            &mut self.0.options
13617        }
13618    }
13619
13620    /// The request builder for [SessionService::update_session][crate::client::SessionService::update_session] calls.
13621    ///
13622    /// # Example
13623    /// ```
13624    /// # use google_cloud_discoveryengine_v1::builder::session_service::UpdateSession;
13625    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
13626    ///
13627    /// let builder = prepare_request_builder();
13628    /// let response = builder.send().await?;
13629    /// # Ok(()) }
13630    ///
13631    /// fn prepare_request_builder() -> UpdateSession {
13632    ///   # panic!();
13633    ///   // ... details omitted ...
13634    /// }
13635    /// ```
13636    #[derive(Clone, Debug)]
13637    pub struct UpdateSession(RequestBuilder<crate::model::UpdateSessionRequest>);
13638
13639    impl UpdateSession {
13640        pub(crate) fn new(
13641            stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
13642        ) -> Self {
13643            Self(RequestBuilder::new(stub))
13644        }
13645
13646        /// Sets the full request, replacing any prior values.
13647        pub fn with_request<V: Into<crate::model::UpdateSessionRequest>>(mut self, v: V) -> Self {
13648            self.0.request = v.into();
13649            self
13650        }
13651
13652        /// Sets all the options, replacing any prior values.
13653        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
13654            self.0.options = v.into();
13655            self
13656        }
13657
13658        /// Sends the request.
13659        pub async fn send(self) -> Result<crate::model::Session> {
13660            (*self.0.stub)
13661                .update_session(self.0.request, self.0.options)
13662                .await
13663                .map(crate::Response::into_body)
13664        }
13665
13666        /// Sets the value of [session][crate::model::UpdateSessionRequest::session].
13667        ///
13668        /// This is a **required** field for requests.
13669        pub fn set_session<T>(mut self, v: T) -> Self
13670        where
13671            T: std::convert::Into<crate::model::Session>,
13672        {
13673            self.0.request.session = std::option::Option::Some(v.into());
13674            self
13675        }
13676
13677        /// Sets or clears the value of [session][crate::model::UpdateSessionRequest::session].
13678        ///
13679        /// This is a **required** field for requests.
13680        pub fn set_or_clear_session<T>(mut self, v: std::option::Option<T>) -> Self
13681        where
13682            T: std::convert::Into<crate::model::Session>,
13683        {
13684            self.0.request.session = v.map(|x| x.into());
13685            self
13686        }
13687
13688        /// Sets the value of [update_mask][crate::model::UpdateSessionRequest::update_mask].
13689        pub fn set_update_mask<T>(mut self, v: T) -> Self
13690        where
13691            T: std::convert::Into<wkt::FieldMask>,
13692        {
13693            self.0.request.update_mask = std::option::Option::Some(v.into());
13694            self
13695        }
13696
13697        /// Sets or clears the value of [update_mask][crate::model::UpdateSessionRequest::update_mask].
13698        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
13699        where
13700            T: std::convert::Into<wkt::FieldMask>,
13701        {
13702            self.0.request.update_mask = v.map(|x| x.into());
13703            self
13704        }
13705    }
13706
13707    #[doc(hidden)]
13708    impl crate::RequestBuilder for UpdateSession {
13709        fn request_options(&mut self) -> &mut crate::RequestOptions {
13710            &mut self.0.options
13711        }
13712    }
13713
13714    /// The request builder for [SessionService::get_session][crate::client::SessionService::get_session] calls.
13715    ///
13716    /// # Example
13717    /// ```
13718    /// # use google_cloud_discoveryengine_v1::builder::session_service::GetSession;
13719    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
13720    ///
13721    /// let builder = prepare_request_builder();
13722    /// let response = builder.send().await?;
13723    /// # Ok(()) }
13724    ///
13725    /// fn prepare_request_builder() -> GetSession {
13726    ///   # panic!();
13727    ///   // ... details omitted ...
13728    /// }
13729    /// ```
13730    #[derive(Clone, Debug)]
13731    pub struct GetSession(RequestBuilder<crate::model::GetSessionRequest>);
13732
13733    impl GetSession {
13734        pub(crate) fn new(
13735            stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
13736        ) -> Self {
13737            Self(RequestBuilder::new(stub))
13738        }
13739
13740        /// Sets the full request, replacing any prior values.
13741        pub fn with_request<V: Into<crate::model::GetSessionRequest>>(mut self, v: V) -> Self {
13742            self.0.request = v.into();
13743            self
13744        }
13745
13746        /// Sets all the options, replacing any prior values.
13747        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
13748            self.0.options = v.into();
13749            self
13750        }
13751
13752        /// Sends the request.
13753        pub async fn send(self) -> Result<crate::model::Session> {
13754            (*self.0.stub)
13755                .get_session(self.0.request, self.0.options)
13756                .await
13757                .map(crate::Response::into_body)
13758        }
13759
13760        /// Sets the value of [name][crate::model::GetSessionRequest::name].
13761        ///
13762        /// This is a **required** field for requests.
13763        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13764            self.0.request.name = v.into();
13765            self
13766        }
13767
13768        /// Sets the value of [include_answer_details][crate::model::GetSessionRequest::include_answer_details].
13769        pub fn set_include_answer_details<T: Into<bool>>(mut self, v: T) -> Self {
13770            self.0.request.include_answer_details = v.into();
13771            self
13772        }
13773    }
13774
13775    #[doc(hidden)]
13776    impl crate::RequestBuilder for GetSession {
13777        fn request_options(&mut self) -> &mut crate::RequestOptions {
13778            &mut self.0.options
13779        }
13780    }
13781
13782    /// The request builder for [SessionService::list_sessions][crate::client::SessionService::list_sessions] calls.
13783    ///
13784    /// # Example
13785    /// ```
13786    /// # use google_cloud_discoveryengine_v1::builder::session_service::ListSessions;
13787    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
13788    /// use google_cloud_gax::paginator::ItemPaginator;
13789    ///
13790    /// let builder = prepare_request_builder();
13791    /// let mut items = builder.by_item();
13792    /// while let Some(result) = items.next().await {
13793    ///   let item = result?;
13794    /// }
13795    /// # Ok(()) }
13796    ///
13797    /// fn prepare_request_builder() -> ListSessions {
13798    ///   # panic!();
13799    ///   // ... details omitted ...
13800    /// }
13801    /// ```
13802    #[derive(Clone, Debug)]
13803    pub struct ListSessions(RequestBuilder<crate::model::ListSessionsRequest>);
13804
13805    impl ListSessions {
13806        pub(crate) fn new(
13807            stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
13808        ) -> Self {
13809            Self(RequestBuilder::new(stub))
13810        }
13811
13812        /// Sets the full request, replacing any prior values.
13813        pub fn with_request<V: Into<crate::model::ListSessionsRequest>>(mut self, v: V) -> Self {
13814            self.0.request = v.into();
13815            self
13816        }
13817
13818        /// Sets all the options, replacing any prior values.
13819        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
13820            self.0.options = v.into();
13821            self
13822        }
13823
13824        /// Sends the request.
13825        pub async fn send(self) -> Result<crate::model::ListSessionsResponse> {
13826            (*self.0.stub)
13827                .list_sessions(self.0.request, self.0.options)
13828                .await
13829                .map(crate::Response::into_body)
13830        }
13831
13832        /// Streams each page in the collection.
13833        pub fn by_page(
13834            self,
13835        ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListSessionsResponse, crate::Error>
13836        {
13837            use std::clone::Clone;
13838            let token = self.0.request.page_token.clone();
13839            let execute = move |token: String| {
13840                let mut builder = self.clone();
13841                builder.0.request = builder.0.request.set_page_token(token);
13842                builder.send()
13843            };
13844            google_cloud_gax::paginator::internal::new_paginator(token, execute)
13845        }
13846
13847        /// Streams each item in the collection.
13848        pub fn by_item(
13849            self,
13850        ) -> impl google_cloud_gax::paginator::ItemPaginator<
13851            crate::model::ListSessionsResponse,
13852            crate::Error,
13853        > {
13854            use google_cloud_gax::paginator::Paginator;
13855            self.by_page().items()
13856        }
13857
13858        /// Sets the value of [parent][crate::model::ListSessionsRequest::parent].
13859        ///
13860        /// This is a **required** field for requests.
13861        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
13862            self.0.request.parent = v.into();
13863            self
13864        }
13865
13866        /// Sets the value of [page_size][crate::model::ListSessionsRequest::page_size].
13867        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
13868            self.0.request.page_size = v.into();
13869            self
13870        }
13871
13872        /// Sets the value of [page_token][crate::model::ListSessionsRequest::page_token].
13873        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
13874            self.0.request.page_token = v.into();
13875            self
13876        }
13877
13878        /// Sets the value of [filter][crate::model::ListSessionsRequest::filter].
13879        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
13880            self.0.request.filter = v.into();
13881            self
13882        }
13883
13884        /// Sets the value of [order_by][crate::model::ListSessionsRequest::order_by].
13885        pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
13886            self.0.request.order_by = v.into();
13887            self
13888        }
13889    }
13890
13891    #[doc(hidden)]
13892    impl crate::RequestBuilder for ListSessions {
13893        fn request_options(&mut self) -> &mut crate::RequestOptions {
13894            &mut self.0.options
13895        }
13896    }
13897
13898    /// The request builder for [SessionService::list_operations][crate::client::SessionService::list_operations] calls.
13899    ///
13900    /// # Example
13901    /// ```
13902    /// # use google_cloud_discoveryengine_v1::builder::session_service::ListOperations;
13903    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
13904    /// use google_cloud_gax::paginator::ItemPaginator;
13905    ///
13906    /// let builder = prepare_request_builder();
13907    /// let mut items = builder.by_item();
13908    /// while let Some(result) = items.next().await {
13909    ///   let item = result?;
13910    /// }
13911    /// # Ok(()) }
13912    ///
13913    /// fn prepare_request_builder() -> ListOperations {
13914    ///   # panic!();
13915    ///   // ... details omitted ...
13916    /// }
13917    /// ```
13918    #[derive(Clone, Debug)]
13919    pub struct ListOperations(
13920        RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
13921    );
13922
13923    impl ListOperations {
13924        pub(crate) fn new(
13925            stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
13926        ) -> Self {
13927            Self(RequestBuilder::new(stub))
13928        }
13929
13930        /// Sets the full request, replacing any prior values.
13931        pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
13932            mut self,
13933            v: V,
13934        ) -> Self {
13935            self.0.request = v.into();
13936            self
13937        }
13938
13939        /// Sets all the options, replacing any prior values.
13940        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
13941            self.0.options = v.into();
13942            self
13943        }
13944
13945        /// Sends the request.
13946        pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
13947            (*self.0.stub)
13948                .list_operations(self.0.request, self.0.options)
13949                .await
13950                .map(crate::Response::into_body)
13951        }
13952
13953        /// Streams each page in the collection.
13954        pub fn by_page(
13955            self,
13956        ) -> impl google_cloud_gax::paginator::Paginator<
13957            google_cloud_longrunning::model::ListOperationsResponse,
13958            crate::Error,
13959        > {
13960            use std::clone::Clone;
13961            let token = self.0.request.page_token.clone();
13962            let execute = move |token: String| {
13963                let mut builder = self.clone();
13964                builder.0.request = builder.0.request.set_page_token(token);
13965                builder.send()
13966            };
13967            google_cloud_gax::paginator::internal::new_paginator(token, execute)
13968        }
13969
13970        /// Streams each item in the collection.
13971        pub fn by_item(
13972            self,
13973        ) -> impl google_cloud_gax::paginator::ItemPaginator<
13974            google_cloud_longrunning::model::ListOperationsResponse,
13975            crate::Error,
13976        > {
13977            use google_cloud_gax::paginator::Paginator;
13978            self.by_page().items()
13979        }
13980
13981        /// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
13982        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13983            self.0.request.name = v.into();
13984            self
13985        }
13986
13987        /// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::filter].
13988        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
13989            self.0.request.filter = v.into();
13990            self
13991        }
13992
13993        /// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
13994        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
13995            self.0.request.page_size = v.into();
13996            self
13997        }
13998
13999        /// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
14000        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
14001            self.0.request.page_token = v.into();
14002            self
14003        }
14004
14005        /// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
14006        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
14007            self.0.request.return_partial_success = v.into();
14008            self
14009        }
14010    }
14011
14012    #[doc(hidden)]
14013    impl crate::RequestBuilder for ListOperations {
14014        fn request_options(&mut self) -> &mut crate::RequestOptions {
14015            &mut self.0.options
14016        }
14017    }
14018
14019    /// The request builder for [SessionService::get_operation][crate::client::SessionService::get_operation] calls.
14020    ///
14021    /// # Example
14022    /// ```
14023    /// # use google_cloud_discoveryengine_v1::builder::session_service::GetOperation;
14024    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
14025    ///
14026    /// let builder = prepare_request_builder();
14027    /// let response = builder.send().await?;
14028    /// # Ok(()) }
14029    ///
14030    /// fn prepare_request_builder() -> GetOperation {
14031    ///   # panic!();
14032    ///   // ... details omitted ...
14033    /// }
14034    /// ```
14035    #[derive(Clone, Debug)]
14036    pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
14037
14038    impl GetOperation {
14039        pub(crate) fn new(
14040            stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
14041        ) -> Self {
14042            Self(RequestBuilder::new(stub))
14043        }
14044
14045        /// Sets the full request, replacing any prior values.
14046        pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
14047            mut self,
14048            v: V,
14049        ) -> Self {
14050            self.0.request = v.into();
14051            self
14052        }
14053
14054        /// Sets all the options, replacing any prior values.
14055        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
14056            self.0.options = v.into();
14057            self
14058        }
14059
14060        /// Sends the request.
14061        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
14062            (*self.0.stub)
14063                .get_operation(self.0.request, self.0.options)
14064                .await
14065                .map(crate::Response::into_body)
14066        }
14067
14068        /// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
14069        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
14070            self.0.request.name = v.into();
14071            self
14072        }
14073    }
14074
14075    #[doc(hidden)]
14076    impl crate::RequestBuilder for GetOperation {
14077        fn request_options(&mut self) -> &mut crate::RequestOptions {
14078            &mut self.0.options
14079        }
14080    }
14081
14082    /// The request builder for [SessionService::cancel_operation][crate::client::SessionService::cancel_operation] calls.
14083    ///
14084    /// # Example
14085    /// ```
14086    /// # use google_cloud_discoveryengine_v1::builder::session_service::CancelOperation;
14087    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
14088    ///
14089    /// let builder = prepare_request_builder();
14090    /// let response = builder.send().await?;
14091    /// # Ok(()) }
14092    ///
14093    /// fn prepare_request_builder() -> CancelOperation {
14094    ///   # panic!();
14095    ///   // ... details omitted ...
14096    /// }
14097    /// ```
14098    #[derive(Clone, Debug)]
14099    pub struct CancelOperation(
14100        RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
14101    );
14102
14103    impl CancelOperation {
14104        pub(crate) fn new(
14105            stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
14106        ) -> Self {
14107            Self(RequestBuilder::new(stub))
14108        }
14109
14110        /// Sets the full request, replacing any prior values.
14111        pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
14112            mut self,
14113            v: V,
14114        ) -> Self {
14115            self.0.request = v.into();
14116            self
14117        }
14118
14119        /// Sets all the options, replacing any prior values.
14120        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
14121            self.0.options = v.into();
14122            self
14123        }
14124
14125        /// Sends the request.
14126        pub async fn send(self) -> Result<()> {
14127            (*self.0.stub)
14128                .cancel_operation(self.0.request, self.0.options)
14129                .await
14130                .map(crate::Response::into_body)
14131        }
14132
14133        /// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::name].
14134        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
14135            self.0.request.name = v.into();
14136            self
14137        }
14138    }
14139
14140    #[doc(hidden)]
14141    impl crate::RequestBuilder for CancelOperation {
14142        fn request_options(&mut self) -> &mut crate::RequestOptions {
14143            &mut self.0.options
14144        }
14145    }
14146}
14147
14148#[cfg(feature = "site-search-engine-service")]
14149#[cfg_attr(docsrs, doc(cfg(feature = "site-search-engine-service")))]
14150pub mod site_search_engine_service {
14151    use crate::Result;
14152
14153    /// A builder for [SiteSearchEngineService][crate::client::SiteSearchEngineService].
14154    ///
14155    /// ```
14156    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
14157    /// # use google_cloud_discoveryengine_v1::*;
14158    /// # use builder::site_search_engine_service::ClientBuilder;
14159    /// # use client::SiteSearchEngineService;
14160    /// let builder : ClientBuilder = SiteSearchEngineService::builder();
14161    /// let client = builder
14162    ///     .with_endpoint("https://discoveryengine.googleapis.com")
14163    ///     .build().await?;
14164    /// # Ok(()) }
14165    /// ```
14166    pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
14167
14168    pub(crate) mod client {
14169        use super::super::super::client::SiteSearchEngineService;
14170        pub struct Factory;
14171        impl crate::ClientFactory for Factory {
14172            type Client = SiteSearchEngineService;
14173            type Credentials = gaxi::options::Credentials;
14174            async fn build(
14175                self,
14176                config: gaxi::options::ClientConfig,
14177            ) -> crate::ClientBuilderResult<Self::Client> {
14178                Self::Client::new(config).await
14179            }
14180        }
14181    }
14182
14183    /// Common implementation for [crate::client::SiteSearchEngineService] request builders.
14184    #[derive(Clone, Debug)]
14185    pub(crate) struct RequestBuilder<R: std::default::Default> {
14186        stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14187        request: R,
14188        options: crate::RequestOptions,
14189    }
14190
14191    impl<R> RequestBuilder<R>
14192    where
14193        R: std::default::Default,
14194    {
14195        pub(crate) fn new(
14196            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14197        ) -> Self {
14198            Self {
14199                stub,
14200                request: R::default(),
14201                options: crate::RequestOptions::default(),
14202            }
14203        }
14204    }
14205
14206    /// The request builder for [SiteSearchEngineService::get_site_search_engine][crate::client::SiteSearchEngineService::get_site_search_engine] calls.
14207    ///
14208    /// # Example
14209    /// ```
14210    /// # use google_cloud_discoveryengine_v1::builder::site_search_engine_service::GetSiteSearchEngine;
14211    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
14212    ///
14213    /// let builder = prepare_request_builder();
14214    /// let response = builder.send().await?;
14215    /// # Ok(()) }
14216    ///
14217    /// fn prepare_request_builder() -> GetSiteSearchEngine {
14218    ///   # panic!();
14219    ///   // ... details omitted ...
14220    /// }
14221    /// ```
14222    #[derive(Clone, Debug)]
14223    pub struct GetSiteSearchEngine(RequestBuilder<crate::model::GetSiteSearchEngineRequest>);
14224
14225    impl GetSiteSearchEngine {
14226        pub(crate) fn new(
14227            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14228        ) -> Self {
14229            Self(RequestBuilder::new(stub))
14230        }
14231
14232        /// Sets the full request, replacing any prior values.
14233        pub fn with_request<V: Into<crate::model::GetSiteSearchEngineRequest>>(
14234            mut self,
14235            v: V,
14236        ) -> Self {
14237            self.0.request = v.into();
14238            self
14239        }
14240
14241        /// Sets all the options, replacing any prior values.
14242        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
14243            self.0.options = v.into();
14244            self
14245        }
14246
14247        /// Sends the request.
14248        pub async fn send(self) -> Result<crate::model::SiteSearchEngine> {
14249            (*self.0.stub)
14250                .get_site_search_engine(self.0.request, self.0.options)
14251                .await
14252                .map(crate::Response::into_body)
14253        }
14254
14255        /// Sets the value of [name][crate::model::GetSiteSearchEngineRequest::name].
14256        ///
14257        /// This is a **required** field for requests.
14258        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
14259            self.0.request.name = v.into();
14260            self
14261        }
14262    }
14263
14264    #[doc(hidden)]
14265    impl crate::RequestBuilder for GetSiteSearchEngine {
14266        fn request_options(&mut self) -> &mut crate::RequestOptions {
14267            &mut self.0.options
14268        }
14269    }
14270
14271    /// The request builder for [SiteSearchEngineService::create_target_site][crate::client::SiteSearchEngineService::create_target_site] calls.
14272    ///
14273    /// # Example
14274    /// ```
14275    /// # use google_cloud_discoveryengine_v1::builder::site_search_engine_service::CreateTargetSite;
14276    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
14277    /// use google_cloud_lro::Poller;
14278    ///
14279    /// let builder = prepare_request_builder();
14280    /// let response = builder.poller().until_done().await?;
14281    /// # Ok(()) }
14282    ///
14283    /// fn prepare_request_builder() -> CreateTargetSite {
14284    ///   # panic!();
14285    ///   // ... details omitted ...
14286    /// }
14287    /// ```
14288    #[derive(Clone, Debug)]
14289    pub struct CreateTargetSite(RequestBuilder<crate::model::CreateTargetSiteRequest>);
14290
14291    impl CreateTargetSite {
14292        pub(crate) fn new(
14293            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14294        ) -> Self {
14295            Self(RequestBuilder::new(stub))
14296        }
14297
14298        /// Sets the full request, replacing any prior values.
14299        pub fn with_request<V: Into<crate::model::CreateTargetSiteRequest>>(
14300            mut self,
14301            v: V,
14302        ) -> Self {
14303            self.0.request = v.into();
14304            self
14305        }
14306
14307        /// Sets all the options, replacing any prior values.
14308        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
14309            self.0.options = v.into();
14310            self
14311        }
14312
14313        /// Sends the request.
14314        ///
14315        /// # Long running operations
14316        ///
14317        /// This starts, but does not poll, a longrunning operation. More information
14318        /// on [create_target_site][crate::client::SiteSearchEngineService::create_target_site].
14319        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
14320            (*self.0.stub)
14321                .create_target_site(self.0.request, self.0.options)
14322                .await
14323                .map(crate::Response::into_body)
14324        }
14325
14326        /// Creates a [Poller][google_cloud_lro::Poller] to work with `create_target_site`.
14327        pub fn poller(
14328            self,
14329        ) -> impl google_cloud_lro::Poller<
14330            crate::model::TargetSite,
14331            crate::model::CreateTargetSiteMetadata,
14332        > {
14333            type Operation = google_cloud_lro::internal::Operation<
14334                crate::model::TargetSite,
14335                crate::model::CreateTargetSiteMetadata,
14336            >;
14337            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
14338            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
14339
14340            let stub = self.0.stub.clone();
14341            let mut options = self.0.options.clone();
14342            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
14343            let query = move |name| {
14344                let stub = stub.clone();
14345                let options = options.clone();
14346                async {
14347                    let op = GetOperation::new(stub)
14348                        .set_name(name)
14349                        .with_options(options)
14350                        .send()
14351                        .await?;
14352                    Ok(Operation::new(op))
14353                }
14354            };
14355
14356            let start = move || async {
14357                let op = self.send().await?;
14358                Ok(Operation::new(op))
14359            };
14360
14361            google_cloud_lro::internal::new_poller(
14362                polling_error_policy,
14363                polling_backoff_policy,
14364                start,
14365                query,
14366            )
14367        }
14368
14369        /// Sets the value of [parent][crate::model::CreateTargetSiteRequest::parent].
14370        ///
14371        /// This is a **required** field for requests.
14372        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
14373            self.0.request.parent = v.into();
14374            self
14375        }
14376
14377        /// Sets the value of [target_site][crate::model::CreateTargetSiteRequest::target_site].
14378        ///
14379        /// This is a **required** field for requests.
14380        pub fn set_target_site<T>(mut self, v: T) -> Self
14381        where
14382            T: std::convert::Into<crate::model::TargetSite>,
14383        {
14384            self.0.request.target_site = std::option::Option::Some(v.into());
14385            self
14386        }
14387
14388        /// Sets or clears the value of [target_site][crate::model::CreateTargetSiteRequest::target_site].
14389        ///
14390        /// This is a **required** field for requests.
14391        pub fn set_or_clear_target_site<T>(mut self, v: std::option::Option<T>) -> Self
14392        where
14393            T: std::convert::Into<crate::model::TargetSite>,
14394        {
14395            self.0.request.target_site = v.map(|x| x.into());
14396            self
14397        }
14398    }
14399
14400    #[doc(hidden)]
14401    impl crate::RequestBuilder for CreateTargetSite {
14402        fn request_options(&mut self) -> &mut crate::RequestOptions {
14403            &mut self.0.options
14404        }
14405    }
14406
14407    /// The request builder for [SiteSearchEngineService::batch_create_target_sites][crate::client::SiteSearchEngineService::batch_create_target_sites] calls.
14408    ///
14409    /// # Example
14410    /// ```
14411    /// # use google_cloud_discoveryengine_v1::builder::site_search_engine_service::BatchCreateTargetSites;
14412    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
14413    /// use google_cloud_lro::Poller;
14414    ///
14415    /// let builder = prepare_request_builder();
14416    /// let response = builder.poller().until_done().await?;
14417    /// # Ok(()) }
14418    ///
14419    /// fn prepare_request_builder() -> BatchCreateTargetSites {
14420    ///   # panic!();
14421    ///   // ... details omitted ...
14422    /// }
14423    /// ```
14424    #[derive(Clone, Debug)]
14425    pub struct BatchCreateTargetSites(RequestBuilder<crate::model::BatchCreateTargetSitesRequest>);
14426
14427    impl BatchCreateTargetSites {
14428        pub(crate) fn new(
14429            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14430        ) -> Self {
14431            Self(RequestBuilder::new(stub))
14432        }
14433
14434        /// Sets the full request, replacing any prior values.
14435        pub fn with_request<V: Into<crate::model::BatchCreateTargetSitesRequest>>(
14436            mut self,
14437            v: V,
14438        ) -> Self {
14439            self.0.request = v.into();
14440            self
14441        }
14442
14443        /// Sets all the options, replacing any prior values.
14444        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
14445            self.0.options = v.into();
14446            self
14447        }
14448
14449        /// Sends the request.
14450        ///
14451        /// # Long running operations
14452        ///
14453        /// This starts, but does not poll, a longrunning operation. More information
14454        /// on [batch_create_target_sites][crate::client::SiteSearchEngineService::batch_create_target_sites].
14455        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
14456            (*self.0.stub)
14457                .batch_create_target_sites(self.0.request, self.0.options)
14458                .await
14459                .map(crate::Response::into_body)
14460        }
14461
14462        /// Creates a [Poller][google_cloud_lro::Poller] to work with `batch_create_target_sites`.
14463        pub fn poller(
14464            self,
14465        ) -> impl google_cloud_lro::Poller<
14466            crate::model::BatchCreateTargetSitesResponse,
14467            crate::model::BatchCreateTargetSiteMetadata,
14468        > {
14469            type Operation = google_cloud_lro::internal::Operation<
14470                crate::model::BatchCreateTargetSitesResponse,
14471                crate::model::BatchCreateTargetSiteMetadata,
14472            >;
14473            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
14474            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
14475
14476            let stub = self.0.stub.clone();
14477            let mut options = self.0.options.clone();
14478            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
14479            let query = move |name| {
14480                let stub = stub.clone();
14481                let options = options.clone();
14482                async {
14483                    let op = GetOperation::new(stub)
14484                        .set_name(name)
14485                        .with_options(options)
14486                        .send()
14487                        .await?;
14488                    Ok(Operation::new(op))
14489                }
14490            };
14491
14492            let start = move || async {
14493                let op = self.send().await?;
14494                Ok(Operation::new(op))
14495            };
14496
14497            google_cloud_lro::internal::new_poller(
14498                polling_error_policy,
14499                polling_backoff_policy,
14500                start,
14501                query,
14502            )
14503        }
14504
14505        /// Sets the value of [parent][crate::model::BatchCreateTargetSitesRequest::parent].
14506        ///
14507        /// This is a **required** field for requests.
14508        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
14509            self.0.request.parent = v.into();
14510            self
14511        }
14512
14513        /// Sets the value of [requests][crate::model::BatchCreateTargetSitesRequest::requests].
14514        ///
14515        /// This is a **required** field for requests.
14516        pub fn set_requests<T, V>(mut self, v: T) -> Self
14517        where
14518            T: std::iter::IntoIterator<Item = V>,
14519            V: std::convert::Into<crate::model::CreateTargetSiteRequest>,
14520        {
14521            use std::iter::Iterator;
14522            self.0.request.requests = v.into_iter().map(|i| i.into()).collect();
14523            self
14524        }
14525    }
14526
14527    #[doc(hidden)]
14528    impl crate::RequestBuilder for BatchCreateTargetSites {
14529        fn request_options(&mut self) -> &mut crate::RequestOptions {
14530            &mut self.0.options
14531        }
14532    }
14533
14534    /// The request builder for [SiteSearchEngineService::get_target_site][crate::client::SiteSearchEngineService::get_target_site] calls.
14535    ///
14536    /// # Example
14537    /// ```
14538    /// # use google_cloud_discoveryengine_v1::builder::site_search_engine_service::GetTargetSite;
14539    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
14540    ///
14541    /// let builder = prepare_request_builder();
14542    /// let response = builder.send().await?;
14543    /// # Ok(()) }
14544    ///
14545    /// fn prepare_request_builder() -> GetTargetSite {
14546    ///   # panic!();
14547    ///   // ... details omitted ...
14548    /// }
14549    /// ```
14550    #[derive(Clone, Debug)]
14551    pub struct GetTargetSite(RequestBuilder<crate::model::GetTargetSiteRequest>);
14552
14553    impl GetTargetSite {
14554        pub(crate) fn new(
14555            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14556        ) -> Self {
14557            Self(RequestBuilder::new(stub))
14558        }
14559
14560        /// Sets the full request, replacing any prior values.
14561        pub fn with_request<V: Into<crate::model::GetTargetSiteRequest>>(mut self, v: V) -> Self {
14562            self.0.request = v.into();
14563            self
14564        }
14565
14566        /// Sets all the options, replacing any prior values.
14567        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
14568            self.0.options = v.into();
14569            self
14570        }
14571
14572        /// Sends the request.
14573        pub async fn send(self) -> Result<crate::model::TargetSite> {
14574            (*self.0.stub)
14575                .get_target_site(self.0.request, self.0.options)
14576                .await
14577                .map(crate::Response::into_body)
14578        }
14579
14580        /// Sets the value of [name][crate::model::GetTargetSiteRequest::name].
14581        ///
14582        /// This is a **required** field for requests.
14583        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
14584            self.0.request.name = v.into();
14585            self
14586        }
14587    }
14588
14589    #[doc(hidden)]
14590    impl crate::RequestBuilder for GetTargetSite {
14591        fn request_options(&mut self) -> &mut crate::RequestOptions {
14592            &mut self.0.options
14593        }
14594    }
14595
14596    /// The request builder for [SiteSearchEngineService::update_target_site][crate::client::SiteSearchEngineService::update_target_site] calls.
14597    ///
14598    /// # Example
14599    /// ```
14600    /// # use google_cloud_discoveryengine_v1::builder::site_search_engine_service::UpdateTargetSite;
14601    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
14602    /// use google_cloud_lro::Poller;
14603    ///
14604    /// let builder = prepare_request_builder();
14605    /// let response = builder.poller().until_done().await?;
14606    /// # Ok(()) }
14607    ///
14608    /// fn prepare_request_builder() -> UpdateTargetSite {
14609    ///   # panic!();
14610    ///   // ... details omitted ...
14611    /// }
14612    /// ```
14613    #[derive(Clone, Debug)]
14614    pub struct UpdateTargetSite(RequestBuilder<crate::model::UpdateTargetSiteRequest>);
14615
14616    impl UpdateTargetSite {
14617        pub(crate) fn new(
14618            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14619        ) -> Self {
14620            Self(RequestBuilder::new(stub))
14621        }
14622
14623        /// Sets the full request, replacing any prior values.
14624        pub fn with_request<V: Into<crate::model::UpdateTargetSiteRequest>>(
14625            mut self,
14626            v: V,
14627        ) -> Self {
14628            self.0.request = v.into();
14629            self
14630        }
14631
14632        /// Sets all the options, replacing any prior values.
14633        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
14634            self.0.options = v.into();
14635            self
14636        }
14637
14638        /// Sends the request.
14639        ///
14640        /// # Long running operations
14641        ///
14642        /// This starts, but does not poll, a longrunning operation. More information
14643        /// on [update_target_site][crate::client::SiteSearchEngineService::update_target_site].
14644        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
14645            (*self.0.stub)
14646                .update_target_site(self.0.request, self.0.options)
14647                .await
14648                .map(crate::Response::into_body)
14649        }
14650
14651        /// Creates a [Poller][google_cloud_lro::Poller] to work with `update_target_site`.
14652        pub fn poller(
14653            self,
14654        ) -> impl google_cloud_lro::Poller<
14655            crate::model::TargetSite,
14656            crate::model::UpdateTargetSiteMetadata,
14657        > {
14658            type Operation = google_cloud_lro::internal::Operation<
14659                crate::model::TargetSite,
14660                crate::model::UpdateTargetSiteMetadata,
14661            >;
14662            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
14663            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
14664
14665            let stub = self.0.stub.clone();
14666            let mut options = self.0.options.clone();
14667            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
14668            let query = move |name| {
14669                let stub = stub.clone();
14670                let options = options.clone();
14671                async {
14672                    let op = GetOperation::new(stub)
14673                        .set_name(name)
14674                        .with_options(options)
14675                        .send()
14676                        .await?;
14677                    Ok(Operation::new(op))
14678                }
14679            };
14680
14681            let start = move || async {
14682                let op = self.send().await?;
14683                Ok(Operation::new(op))
14684            };
14685
14686            google_cloud_lro::internal::new_poller(
14687                polling_error_policy,
14688                polling_backoff_policy,
14689                start,
14690                query,
14691            )
14692        }
14693
14694        /// Sets the value of [target_site][crate::model::UpdateTargetSiteRequest::target_site].
14695        ///
14696        /// This is a **required** field for requests.
14697        pub fn set_target_site<T>(mut self, v: T) -> Self
14698        where
14699            T: std::convert::Into<crate::model::TargetSite>,
14700        {
14701            self.0.request.target_site = std::option::Option::Some(v.into());
14702            self
14703        }
14704
14705        /// Sets or clears the value of [target_site][crate::model::UpdateTargetSiteRequest::target_site].
14706        ///
14707        /// This is a **required** field for requests.
14708        pub fn set_or_clear_target_site<T>(mut self, v: std::option::Option<T>) -> Self
14709        where
14710            T: std::convert::Into<crate::model::TargetSite>,
14711        {
14712            self.0.request.target_site = v.map(|x| x.into());
14713            self
14714        }
14715    }
14716
14717    #[doc(hidden)]
14718    impl crate::RequestBuilder for UpdateTargetSite {
14719        fn request_options(&mut self) -> &mut crate::RequestOptions {
14720            &mut self.0.options
14721        }
14722    }
14723
14724    /// The request builder for [SiteSearchEngineService::delete_target_site][crate::client::SiteSearchEngineService::delete_target_site] calls.
14725    ///
14726    /// # Example
14727    /// ```
14728    /// # use google_cloud_discoveryengine_v1::builder::site_search_engine_service::DeleteTargetSite;
14729    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
14730    /// use google_cloud_lro::Poller;
14731    ///
14732    /// let builder = prepare_request_builder();
14733    /// let response = builder.poller().until_done().await?;
14734    /// # Ok(()) }
14735    ///
14736    /// fn prepare_request_builder() -> DeleteTargetSite {
14737    ///   # panic!();
14738    ///   // ... details omitted ...
14739    /// }
14740    /// ```
14741    #[derive(Clone, Debug)]
14742    pub struct DeleteTargetSite(RequestBuilder<crate::model::DeleteTargetSiteRequest>);
14743
14744    impl DeleteTargetSite {
14745        pub(crate) fn new(
14746            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14747        ) -> Self {
14748            Self(RequestBuilder::new(stub))
14749        }
14750
14751        /// Sets the full request, replacing any prior values.
14752        pub fn with_request<V: Into<crate::model::DeleteTargetSiteRequest>>(
14753            mut self,
14754            v: V,
14755        ) -> Self {
14756            self.0.request = v.into();
14757            self
14758        }
14759
14760        /// Sets all the options, replacing any prior values.
14761        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
14762            self.0.options = v.into();
14763            self
14764        }
14765
14766        /// Sends the request.
14767        ///
14768        /// # Long running operations
14769        ///
14770        /// This starts, but does not poll, a longrunning operation. More information
14771        /// on [delete_target_site][crate::client::SiteSearchEngineService::delete_target_site].
14772        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
14773            (*self.0.stub)
14774                .delete_target_site(self.0.request, self.0.options)
14775                .await
14776                .map(crate::Response::into_body)
14777        }
14778
14779        /// Creates a [Poller][google_cloud_lro::Poller] to work with `delete_target_site`.
14780        pub fn poller(
14781            self,
14782        ) -> impl google_cloud_lro::Poller<(), crate::model::DeleteTargetSiteMetadata> {
14783            type Operation = google_cloud_lro::internal::Operation<
14784                wkt::Empty,
14785                crate::model::DeleteTargetSiteMetadata,
14786            >;
14787            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
14788            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
14789
14790            let stub = self.0.stub.clone();
14791            let mut options = self.0.options.clone();
14792            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
14793            let query = move |name| {
14794                let stub = stub.clone();
14795                let options = options.clone();
14796                async {
14797                    let op = GetOperation::new(stub)
14798                        .set_name(name)
14799                        .with_options(options)
14800                        .send()
14801                        .await?;
14802                    Ok(Operation::new(op))
14803                }
14804            };
14805
14806            let start = move || async {
14807                let op = self.send().await?;
14808                Ok(Operation::new(op))
14809            };
14810
14811            google_cloud_lro::internal::new_unit_response_poller(
14812                polling_error_policy,
14813                polling_backoff_policy,
14814                start,
14815                query,
14816            )
14817        }
14818
14819        /// Sets the value of [name][crate::model::DeleteTargetSiteRequest::name].
14820        ///
14821        /// This is a **required** field for requests.
14822        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
14823            self.0.request.name = v.into();
14824            self
14825        }
14826    }
14827
14828    #[doc(hidden)]
14829    impl crate::RequestBuilder for DeleteTargetSite {
14830        fn request_options(&mut self) -> &mut crate::RequestOptions {
14831            &mut self.0.options
14832        }
14833    }
14834
14835    /// The request builder for [SiteSearchEngineService::list_target_sites][crate::client::SiteSearchEngineService::list_target_sites] calls.
14836    ///
14837    /// # Example
14838    /// ```
14839    /// # use google_cloud_discoveryengine_v1::builder::site_search_engine_service::ListTargetSites;
14840    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
14841    /// use google_cloud_gax::paginator::ItemPaginator;
14842    ///
14843    /// let builder = prepare_request_builder();
14844    /// let mut items = builder.by_item();
14845    /// while let Some(result) = items.next().await {
14846    ///   let item = result?;
14847    /// }
14848    /// # Ok(()) }
14849    ///
14850    /// fn prepare_request_builder() -> ListTargetSites {
14851    ///   # panic!();
14852    ///   // ... details omitted ...
14853    /// }
14854    /// ```
14855    #[derive(Clone, Debug)]
14856    pub struct ListTargetSites(RequestBuilder<crate::model::ListTargetSitesRequest>);
14857
14858    impl ListTargetSites {
14859        pub(crate) fn new(
14860            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14861        ) -> Self {
14862            Self(RequestBuilder::new(stub))
14863        }
14864
14865        /// Sets the full request, replacing any prior values.
14866        pub fn with_request<V: Into<crate::model::ListTargetSitesRequest>>(mut self, v: V) -> Self {
14867            self.0.request = v.into();
14868            self
14869        }
14870
14871        /// Sets all the options, replacing any prior values.
14872        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
14873            self.0.options = v.into();
14874            self
14875        }
14876
14877        /// Sends the request.
14878        pub async fn send(self) -> Result<crate::model::ListTargetSitesResponse> {
14879            (*self.0.stub)
14880                .list_target_sites(self.0.request, self.0.options)
14881                .await
14882                .map(crate::Response::into_body)
14883        }
14884
14885        /// Streams each page in the collection.
14886        pub fn by_page(
14887            self,
14888        ) -> impl google_cloud_gax::paginator::Paginator<
14889            crate::model::ListTargetSitesResponse,
14890            crate::Error,
14891        > {
14892            use std::clone::Clone;
14893            let token = self.0.request.page_token.clone();
14894            let execute = move |token: String| {
14895                let mut builder = self.clone();
14896                builder.0.request = builder.0.request.set_page_token(token);
14897                builder.send()
14898            };
14899            google_cloud_gax::paginator::internal::new_paginator(token, execute)
14900        }
14901
14902        /// Streams each item in the collection.
14903        pub fn by_item(
14904            self,
14905        ) -> impl google_cloud_gax::paginator::ItemPaginator<
14906            crate::model::ListTargetSitesResponse,
14907            crate::Error,
14908        > {
14909            use google_cloud_gax::paginator::Paginator;
14910            self.by_page().items()
14911        }
14912
14913        /// Sets the value of [parent][crate::model::ListTargetSitesRequest::parent].
14914        ///
14915        /// This is a **required** field for requests.
14916        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
14917            self.0.request.parent = v.into();
14918            self
14919        }
14920
14921        /// Sets the value of [page_size][crate::model::ListTargetSitesRequest::page_size].
14922        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
14923            self.0.request.page_size = v.into();
14924            self
14925        }
14926
14927        /// Sets the value of [page_token][crate::model::ListTargetSitesRequest::page_token].
14928        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
14929            self.0.request.page_token = v.into();
14930            self
14931        }
14932    }
14933
14934    #[doc(hidden)]
14935    impl crate::RequestBuilder for ListTargetSites {
14936        fn request_options(&mut self) -> &mut crate::RequestOptions {
14937            &mut self.0.options
14938        }
14939    }
14940
14941    /// The request builder for [SiteSearchEngineService::create_sitemap][crate::client::SiteSearchEngineService::create_sitemap] calls.
14942    ///
14943    /// # Example
14944    /// ```
14945    /// # use google_cloud_discoveryengine_v1::builder::site_search_engine_service::CreateSitemap;
14946    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
14947    /// use google_cloud_lro::Poller;
14948    ///
14949    /// let builder = prepare_request_builder();
14950    /// let response = builder.poller().until_done().await?;
14951    /// # Ok(()) }
14952    ///
14953    /// fn prepare_request_builder() -> CreateSitemap {
14954    ///   # panic!();
14955    ///   // ... details omitted ...
14956    /// }
14957    /// ```
14958    #[derive(Clone, Debug)]
14959    pub struct CreateSitemap(RequestBuilder<crate::model::CreateSitemapRequest>);
14960
14961    impl CreateSitemap {
14962        pub(crate) fn new(
14963            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14964        ) -> Self {
14965            Self(RequestBuilder::new(stub))
14966        }
14967
14968        /// Sets the full request, replacing any prior values.
14969        pub fn with_request<V: Into<crate::model::CreateSitemapRequest>>(mut self, v: V) -> Self {
14970            self.0.request = v.into();
14971            self
14972        }
14973
14974        /// Sets all the options, replacing any prior values.
14975        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
14976            self.0.options = v.into();
14977            self
14978        }
14979
14980        /// Sends the request.
14981        ///
14982        /// # Long running operations
14983        ///
14984        /// This starts, but does not poll, a longrunning operation. More information
14985        /// on [create_sitemap][crate::client::SiteSearchEngineService::create_sitemap].
14986        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
14987            (*self.0.stub)
14988                .create_sitemap(self.0.request, self.0.options)
14989                .await
14990                .map(crate::Response::into_body)
14991        }
14992
14993        /// Creates a [Poller][google_cloud_lro::Poller] to work with `create_sitemap`.
14994        pub fn poller(
14995            self,
14996        ) -> impl google_cloud_lro::Poller<crate::model::Sitemap, crate::model::CreateSitemapMetadata>
14997        {
14998            type Operation = google_cloud_lro::internal::Operation<
14999                crate::model::Sitemap,
15000                crate::model::CreateSitemapMetadata,
15001            >;
15002            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
15003            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
15004
15005            let stub = self.0.stub.clone();
15006            let mut options = self.0.options.clone();
15007            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
15008            let query = move |name| {
15009                let stub = stub.clone();
15010                let options = options.clone();
15011                async {
15012                    let op = GetOperation::new(stub)
15013                        .set_name(name)
15014                        .with_options(options)
15015                        .send()
15016                        .await?;
15017                    Ok(Operation::new(op))
15018                }
15019            };
15020
15021            let start = move || async {
15022                let op = self.send().await?;
15023                Ok(Operation::new(op))
15024            };
15025
15026            google_cloud_lro::internal::new_poller(
15027                polling_error_policy,
15028                polling_backoff_policy,
15029                start,
15030                query,
15031            )
15032        }
15033
15034        /// Sets the value of [parent][crate::model::CreateSitemapRequest::parent].
15035        ///
15036        /// This is a **required** field for requests.
15037        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
15038            self.0.request.parent = v.into();
15039            self
15040        }
15041
15042        /// Sets the value of [sitemap][crate::model::CreateSitemapRequest::sitemap].
15043        ///
15044        /// This is a **required** field for requests.
15045        pub fn set_sitemap<T>(mut self, v: T) -> Self
15046        where
15047            T: std::convert::Into<crate::model::Sitemap>,
15048        {
15049            self.0.request.sitemap = std::option::Option::Some(v.into());
15050            self
15051        }
15052
15053        /// Sets or clears the value of [sitemap][crate::model::CreateSitemapRequest::sitemap].
15054        ///
15055        /// This is a **required** field for requests.
15056        pub fn set_or_clear_sitemap<T>(mut self, v: std::option::Option<T>) -> Self
15057        where
15058            T: std::convert::Into<crate::model::Sitemap>,
15059        {
15060            self.0.request.sitemap = v.map(|x| x.into());
15061            self
15062        }
15063    }
15064
15065    #[doc(hidden)]
15066    impl crate::RequestBuilder for CreateSitemap {
15067        fn request_options(&mut self) -> &mut crate::RequestOptions {
15068            &mut self.0.options
15069        }
15070    }
15071
15072    /// The request builder for [SiteSearchEngineService::delete_sitemap][crate::client::SiteSearchEngineService::delete_sitemap] calls.
15073    ///
15074    /// # Example
15075    /// ```
15076    /// # use google_cloud_discoveryengine_v1::builder::site_search_engine_service::DeleteSitemap;
15077    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
15078    /// use google_cloud_lro::Poller;
15079    ///
15080    /// let builder = prepare_request_builder();
15081    /// let response = builder.poller().until_done().await?;
15082    /// # Ok(()) }
15083    ///
15084    /// fn prepare_request_builder() -> DeleteSitemap {
15085    ///   # panic!();
15086    ///   // ... details omitted ...
15087    /// }
15088    /// ```
15089    #[derive(Clone, Debug)]
15090    pub struct DeleteSitemap(RequestBuilder<crate::model::DeleteSitemapRequest>);
15091
15092    impl DeleteSitemap {
15093        pub(crate) fn new(
15094            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
15095        ) -> Self {
15096            Self(RequestBuilder::new(stub))
15097        }
15098
15099        /// Sets the full request, replacing any prior values.
15100        pub fn with_request<V: Into<crate::model::DeleteSitemapRequest>>(mut self, v: V) -> Self {
15101            self.0.request = v.into();
15102            self
15103        }
15104
15105        /// Sets all the options, replacing any prior values.
15106        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
15107            self.0.options = v.into();
15108            self
15109        }
15110
15111        /// Sends the request.
15112        ///
15113        /// # Long running operations
15114        ///
15115        /// This starts, but does not poll, a longrunning operation. More information
15116        /// on [delete_sitemap][crate::client::SiteSearchEngineService::delete_sitemap].
15117        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
15118            (*self.0.stub)
15119                .delete_sitemap(self.0.request, self.0.options)
15120                .await
15121                .map(crate::Response::into_body)
15122        }
15123
15124        /// Creates a [Poller][google_cloud_lro::Poller] to work with `delete_sitemap`.
15125        pub fn poller(
15126            self,
15127        ) -> impl google_cloud_lro::Poller<(), crate::model::DeleteSitemapMetadata> {
15128            type Operation = google_cloud_lro::internal::Operation<
15129                wkt::Empty,
15130                crate::model::DeleteSitemapMetadata,
15131            >;
15132            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
15133            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
15134
15135            let stub = self.0.stub.clone();
15136            let mut options = self.0.options.clone();
15137            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
15138            let query = move |name| {
15139                let stub = stub.clone();
15140                let options = options.clone();
15141                async {
15142                    let op = GetOperation::new(stub)
15143                        .set_name(name)
15144                        .with_options(options)
15145                        .send()
15146                        .await?;
15147                    Ok(Operation::new(op))
15148                }
15149            };
15150
15151            let start = move || async {
15152                let op = self.send().await?;
15153                Ok(Operation::new(op))
15154            };
15155
15156            google_cloud_lro::internal::new_unit_response_poller(
15157                polling_error_policy,
15158                polling_backoff_policy,
15159                start,
15160                query,
15161            )
15162        }
15163
15164        /// Sets the value of [name][crate::model::DeleteSitemapRequest::name].
15165        ///
15166        /// This is a **required** field for requests.
15167        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
15168            self.0.request.name = v.into();
15169            self
15170        }
15171    }
15172
15173    #[doc(hidden)]
15174    impl crate::RequestBuilder for DeleteSitemap {
15175        fn request_options(&mut self) -> &mut crate::RequestOptions {
15176            &mut self.0.options
15177        }
15178    }
15179
15180    /// The request builder for [SiteSearchEngineService::fetch_sitemaps][crate::client::SiteSearchEngineService::fetch_sitemaps] calls.
15181    ///
15182    /// # Example
15183    /// ```
15184    /// # use google_cloud_discoveryengine_v1::builder::site_search_engine_service::FetchSitemaps;
15185    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
15186    ///
15187    /// let builder = prepare_request_builder();
15188    /// let response = builder.send().await?;
15189    /// # Ok(()) }
15190    ///
15191    /// fn prepare_request_builder() -> FetchSitemaps {
15192    ///   # panic!();
15193    ///   // ... details omitted ...
15194    /// }
15195    /// ```
15196    #[derive(Clone, Debug)]
15197    pub struct FetchSitemaps(RequestBuilder<crate::model::FetchSitemapsRequest>);
15198
15199    impl FetchSitemaps {
15200        pub(crate) fn new(
15201            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
15202        ) -> Self {
15203            Self(RequestBuilder::new(stub))
15204        }
15205
15206        /// Sets the full request, replacing any prior values.
15207        pub fn with_request<V: Into<crate::model::FetchSitemapsRequest>>(mut self, v: V) -> Self {
15208            self.0.request = v.into();
15209            self
15210        }
15211
15212        /// Sets all the options, replacing any prior values.
15213        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
15214            self.0.options = v.into();
15215            self
15216        }
15217
15218        /// Sends the request.
15219        pub async fn send(self) -> Result<crate::model::FetchSitemapsResponse> {
15220            (*self.0.stub)
15221                .fetch_sitemaps(self.0.request, self.0.options)
15222                .await
15223                .map(crate::Response::into_body)
15224        }
15225
15226        /// Sets the value of [parent][crate::model::FetchSitemapsRequest::parent].
15227        ///
15228        /// This is a **required** field for requests.
15229        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
15230            self.0.request.parent = v.into();
15231            self
15232        }
15233
15234        /// Sets the value of [matcher][crate::model::FetchSitemapsRequest::matcher].
15235        pub fn set_matcher<T>(mut self, v: T) -> Self
15236        where
15237            T: std::convert::Into<crate::model::fetch_sitemaps_request::Matcher>,
15238        {
15239            self.0.request.matcher = std::option::Option::Some(v.into());
15240            self
15241        }
15242
15243        /// Sets or clears the value of [matcher][crate::model::FetchSitemapsRequest::matcher].
15244        pub fn set_or_clear_matcher<T>(mut self, v: std::option::Option<T>) -> Self
15245        where
15246            T: std::convert::Into<crate::model::fetch_sitemaps_request::Matcher>,
15247        {
15248            self.0.request.matcher = v.map(|x| x.into());
15249            self
15250        }
15251    }
15252
15253    #[doc(hidden)]
15254    impl crate::RequestBuilder for FetchSitemaps {
15255        fn request_options(&mut self) -> &mut crate::RequestOptions {
15256            &mut self.0.options
15257        }
15258    }
15259
15260    /// The request builder for [SiteSearchEngineService::enable_advanced_site_search][crate::client::SiteSearchEngineService::enable_advanced_site_search] calls.
15261    ///
15262    /// # Example
15263    /// ```
15264    /// # use google_cloud_discoveryengine_v1::builder::site_search_engine_service::EnableAdvancedSiteSearch;
15265    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
15266    /// use google_cloud_lro::Poller;
15267    ///
15268    /// let builder = prepare_request_builder();
15269    /// let response = builder.poller().until_done().await?;
15270    /// # Ok(()) }
15271    ///
15272    /// fn prepare_request_builder() -> EnableAdvancedSiteSearch {
15273    ///   # panic!();
15274    ///   // ... details omitted ...
15275    /// }
15276    /// ```
15277    #[derive(Clone, Debug)]
15278    pub struct EnableAdvancedSiteSearch(
15279        RequestBuilder<crate::model::EnableAdvancedSiteSearchRequest>,
15280    );
15281
15282    impl EnableAdvancedSiteSearch {
15283        pub(crate) fn new(
15284            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
15285        ) -> Self {
15286            Self(RequestBuilder::new(stub))
15287        }
15288
15289        /// Sets the full request, replacing any prior values.
15290        pub fn with_request<V: Into<crate::model::EnableAdvancedSiteSearchRequest>>(
15291            mut self,
15292            v: V,
15293        ) -> Self {
15294            self.0.request = v.into();
15295            self
15296        }
15297
15298        /// Sets all the options, replacing any prior values.
15299        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
15300            self.0.options = v.into();
15301            self
15302        }
15303
15304        /// Sends the request.
15305        ///
15306        /// # Long running operations
15307        ///
15308        /// This starts, but does not poll, a longrunning operation. More information
15309        /// on [enable_advanced_site_search][crate::client::SiteSearchEngineService::enable_advanced_site_search].
15310        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
15311            (*self.0.stub)
15312                .enable_advanced_site_search(self.0.request, self.0.options)
15313                .await
15314                .map(crate::Response::into_body)
15315        }
15316
15317        /// Creates a [Poller][google_cloud_lro::Poller] to work with `enable_advanced_site_search`.
15318        pub fn poller(
15319            self,
15320        ) -> impl google_cloud_lro::Poller<
15321            crate::model::EnableAdvancedSiteSearchResponse,
15322            crate::model::EnableAdvancedSiteSearchMetadata,
15323        > {
15324            type Operation = google_cloud_lro::internal::Operation<
15325                crate::model::EnableAdvancedSiteSearchResponse,
15326                crate::model::EnableAdvancedSiteSearchMetadata,
15327            >;
15328            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
15329            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
15330
15331            let stub = self.0.stub.clone();
15332            let mut options = self.0.options.clone();
15333            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
15334            let query = move |name| {
15335                let stub = stub.clone();
15336                let options = options.clone();
15337                async {
15338                    let op = GetOperation::new(stub)
15339                        .set_name(name)
15340                        .with_options(options)
15341                        .send()
15342                        .await?;
15343                    Ok(Operation::new(op))
15344                }
15345            };
15346
15347            let start = move || async {
15348                let op = self.send().await?;
15349                Ok(Operation::new(op))
15350            };
15351
15352            google_cloud_lro::internal::new_poller(
15353                polling_error_policy,
15354                polling_backoff_policy,
15355                start,
15356                query,
15357            )
15358        }
15359
15360        /// Sets the value of [site_search_engine][crate::model::EnableAdvancedSiteSearchRequest::site_search_engine].
15361        ///
15362        /// This is a **required** field for requests.
15363        pub fn set_site_search_engine<T: Into<std::string::String>>(mut self, v: T) -> Self {
15364            self.0.request.site_search_engine = v.into();
15365            self
15366        }
15367    }
15368
15369    #[doc(hidden)]
15370    impl crate::RequestBuilder for EnableAdvancedSiteSearch {
15371        fn request_options(&mut self) -> &mut crate::RequestOptions {
15372            &mut self.0.options
15373        }
15374    }
15375
15376    /// The request builder for [SiteSearchEngineService::disable_advanced_site_search][crate::client::SiteSearchEngineService::disable_advanced_site_search] calls.
15377    ///
15378    /// # Example
15379    /// ```
15380    /// # use google_cloud_discoveryengine_v1::builder::site_search_engine_service::DisableAdvancedSiteSearch;
15381    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
15382    /// use google_cloud_lro::Poller;
15383    ///
15384    /// let builder = prepare_request_builder();
15385    /// let response = builder.poller().until_done().await?;
15386    /// # Ok(()) }
15387    ///
15388    /// fn prepare_request_builder() -> DisableAdvancedSiteSearch {
15389    ///   # panic!();
15390    ///   // ... details omitted ...
15391    /// }
15392    /// ```
15393    #[derive(Clone, Debug)]
15394    pub struct DisableAdvancedSiteSearch(
15395        RequestBuilder<crate::model::DisableAdvancedSiteSearchRequest>,
15396    );
15397
15398    impl DisableAdvancedSiteSearch {
15399        pub(crate) fn new(
15400            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
15401        ) -> Self {
15402            Self(RequestBuilder::new(stub))
15403        }
15404
15405        /// Sets the full request, replacing any prior values.
15406        pub fn with_request<V: Into<crate::model::DisableAdvancedSiteSearchRequest>>(
15407            mut self,
15408            v: V,
15409        ) -> Self {
15410            self.0.request = v.into();
15411            self
15412        }
15413
15414        /// Sets all the options, replacing any prior values.
15415        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
15416            self.0.options = v.into();
15417            self
15418        }
15419
15420        /// Sends the request.
15421        ///
15422        /// # Long running operations
15423        ///
15424        /// This starts, but does not poll, a longrunning operation. More information
15425        /// on [disable_advanced_site_search][crate::client::SiteSearchEngineService::disable_advanced_site_search].
15426        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
15427            (*self.0.stub)
15428                .disable_advanced_site_search(self.0.request, self.0.options)
15429                .await
15430                .map(crate::Response::into_body)
15431        }
15432
15433        /// Creates a [Poller][google_cloud_lro::Poller] to work with `disable_advanced_site_search`.
15434        pub fn poller(
15435            self,
15436        ) -> impl google_cloud_lro::Poller<
15437            crate::model::DisableAdvancedSiteSearchResponse,
15438            crate::model::DisableAdvancedSiteSearchMetadata,
15439        > {
15440            type Operation = google_cloud_lro::internal::Operation<
15441                crate::model::DisableAdvancedSiteSearchResponse,
15442                crate::model::DisableAdvancedSiteSearchMetadata,
15443            >;
15444            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
15445            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
15446
15447            let stub = self.0.stub.clone();
15448            let mut options = self.0.options.clone();
15449            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
15450            let query = move |name| {
15451                let stub = stub.clone();
15452                let options = options.clone();
15453                async {
15454                    let op = GetOperation::new(stub)
15455                        .set_name(name)
15456                        .with_options(options)
15457                        .send()
15458                        .await?;
15459                    Ok(Operation::new(op))
15460                }
15461            };
15462
15463            let start = move || async {
15464                let op = self.send().await?;
15465                Ok(Operation::new(op))
15466            };
15467
15468            google_cloud_lro::internal::new_poller(
15469                polling_error_policy,
15470                polling_backoff_policy,
15471                start,
15472                query,
15473            )
15474        }
15475
15476        /// Sets the value of [site_search_engine][crate::model::DisableAdvancedSiteSearchRequest::site_search_engine].
15477        ///
15478        /// This is a **required** field for requests.
15479        pub fn set_site_search_engine<T: Into<std::string::String>>(mut self, v: T) -> Self {
15480            self.0.request.site_search_engine = v.into();
15481            self
15482        }
15483    }
15484
15485    #[doc(hidden)]
15486    impl crate::RequestBuilder for DisableAdvancedSiteSearch {
15487        fn request_options(&mut self) -> &mut crate::RequestOptions {
15488            &mut self.0.options
15489        }
15490    }
15491
15492    /// The request builder for [SiteSearchEngineService::recrawl_uris][crate::client::SiteSearchEngineService::recrawl_uris] calls.
15493    ///
15494    /// # Example
15495    /// ```
15496    /// # use google_cloud_discoveryengine_v1::builder::site_search_engine_service::RecrawlUris;
15497    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
15498    /// use google_cloud_lro::Poller;
15499    ///
15500    /// let builder = prepare_request_builder();
15501    /// let response = builder.poller().until_done().await?;
15502    /// # Ok(()) }
15503    ///
15504    /// fn prepare_request_builder() -> RecrawlUris {
15505    ///   # panic!();
15506    ///   // ... details omitted ...
15507    /// }
15508    /// ```
15509    #[derive(Clone, Debug)]
15510    pub struct RecrawlUris(RequestBuilder<crate::model::RecrawlUrisRequest>);
15511
15512    impl RecrawlUris {
15513        pub(crate) fn new(
15514            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
15515        ) -> Self {
15516            Self(RequestBuilder::new(stub))
15517        }
15518
15519        /// Sets the full request, replacing any prior values.
15520        pub fn with_request<V: Into<crate::model::RecrawlUrisRequest>>(mut self, v: V) -> Self {
15521            self.0.request = v.into();
15522            self
15523        }
15524
15525        /// Sets all the options, replacing any prior values.
15526        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
15527            self.0.options = v.into();
15528            self
15529        }
15530
15531        /// Sends the request.
15532        ///
15533        /// # Long running operations
15534        ///
15535        /// This starts, but does not poll, a longrunning operation. More information
15536        /// on [recrawl_uris][crate::client::SiteSearchEngineService::recrawl_uris].
15537        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
15538            (*self.0.stub)
15539                .recrawl_uris(self.0.request, self.0.options)
15540                .await
15541                .map(crate::Response::into_body)
15542        }
15543
15544        /// Creates a [Poller][google_cloud_lro::Poller] to work with `recrawl_uris`.
15545        pub fn poller(
15546            self,
15547        ) -> impl google_cloud_lro::Poller<
15548            crate::model::RecrawlUrisResponse,
15549            crate::model::RecrawlUrisMetadata,
15550        > {
15551            type Operation = google_cloud_lro::internal::Operation<
15552                crate::model::RecrawlUrisResponse,
15553                crate::model::RecrawlUrisMetadata,
15554            >;
15555            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
15556            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
15557
15558            let stub = self.0.stub.clone();
15559            let mut options = self.0.options.clone();
15560            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
15561            let query = move |name| {
15562                let stub = stub.clone();
15563                let options = options.clone();
15564                async {
15565                    let op = GetOperation::new(stub)
15566                        .set_name(name)
15567                        .with_options(options)
15568                        .send()
15569                        .await?;
15570                    Ok(Operation::new(op))
15571                }
15572            };
15573
15574            let start = move || async {
15575                let op = self.send().await?;
15576                Ok(Operation::new(op))
15577            };
15578
15579            google_cloud_lro::internal::new_poller(
15580                polling_error_policy,
15581                polling_backoff_policy,
15582                start,
15583                query,
15584            )
15585        }
15586
15587        /// Sets the value of [site_search_engine][crate::model::RecrawlUrisRequest::site_search_engine].
15588        ///
15589        /// This is a **required** field for requests.
15590        pub fn set_site_search_engine<T: Into<std::string::String>>(mut self, v: T) -> Self {
15591            self.0.request.site_search_engine = v.into();
15592            self
15593        }
15594
15595        /// Sets the value of [uris][crate::model::RecrawlUrisRequest::uris].
15596        ///
15597        /// This is a **required** field for requests.
15598        pub fn set_uris<T, V>(mut self, v: T) -> Self
15599        where
15600            T: std::iter::IntoIterator<Item = V>,
15601            V: std::convert::Into<std::string::String>,
15602        {
15603            use std::iter::Iterator;
15604            self.0.request.uris = v.into_iter().map(|i| i.into()).collect();
15605            self
15606        }
15607
15608        /// Sets the value of [site_credential][crate::model::RecrawlUrisRequest::site_credential].
15609        pub fn set_site_credential<T: Into<std::string::String>>(mut self, v: T) -> Self {
15610            self.0.request.site_credential = v.into();
15611            self
15612        }
15613    }
15614
15615    #[doc(hidden)]
15616    impl crate::RequestBuilder for RecrawlUris {
15617        fn request_options(&mut self) -> &mut crate::RequestOptions {
15618            &mut self.0.options
15619        }
15620    }
15621
15622    /// The request builder for [SiteSearchEngineService::batch_verify_target_sites][crate::client::SiteSearchEngineService::batch_verify_target_sites] calls.
15623    ///
15624    /// # Example
15625    /// ```
15626    /// # use google_cloud_discoveryengine_v1::builder::site_search_engine_service::BatchVerifyTargetSites;
15627    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
15628    /// use google_cloud_lro::Poller;
15629    ///
15630    /// let builder = prepare_request_builder();
15631    /// let response = builder.poller().until_done().await?;
15632    /// # Ok(()) }
15633    ///
15634    /// fn prepare_request_builder() -> BatchVerifyTargetSites {
15635    ///   # panic!();
15636    ///   // ... details omitted ...
15637    /// }
15638    /// ```
15639    #[derive(Clone, Debug)]
15640    pub struct BatchVerifyTargetSites(RequestBuilder<crate::model::BatchVerifyTargetSitesRequest>);
15641
15642    impl BatchVerifyTargetSites {
15643        pub(crate) fn new(
15644            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
15645        ) -> Self {
15646            Self(RequestBuilder::new(stub))
15647        }
15648
15649        /// Sets the full request, replacing any prior values.
15650        pub fn with_request<V: Into<crate::model::BatchVerifyTargetSitesRequest>>(
15651            mut self,
15652            v: V,
15653        ) -> Self {
15654            self.0.request = v.into();
15655            self
15656        }
15657
15658        /// Sets all the options, replacing any prior values.
15659        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
15660            self.0.options = v.into();
15661            self
15662        }
15663
15664        /// Sends the request.
15665        ///
15666        /// # Long running operations
15667        ///
15668        /// This starts, but does not poll, a longrunning operation. More information
15669        /// on [batch_verify_target_sites][crate::client::SiteSearchEngineService::batch_verify_target_sites].
15670        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
15671            (*self.0.stub)
15672                .batch_verify_target_sites(self.0.request, self.0.options)
15673                .await
15674                .map(crate::Response::into_body)
15675        }
15676
15677        /// Creates a [Poller][google_cloud_lro::Poller] to work with `batch_verify_target_sites`.
15678        pub fn poller(
15679            self,
15680        ) -> impl google_cloud_lro::Poller<
15681            crate::model::BatchVerifyTargetSitesResponse,
15682            crate::model::BatchVerifyTargetSitesMetadata,
15683        > {
15684            type Operation = google_cloud_lro::internal::Operation<
15685                crate::model::BatchVerifyTargetSitesResponse,
15686                crate::model::BatchVerifyTargetSitesMetadata,
15687            >;
15688            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
15689            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
15690
15691            let stub = self.0.stub.clone();
15692            let mut options = self.0.options.clone();
15693            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
15694            let query = move |name| {
15695                let stub = stub.clone();
15696                let options = options.clone();
15697                async {
15698                    let op = GetOperation::new(stub)
15699                        .set_name(name)
15700                        .with_options(options)
15701                        .send()
15702                        .await?;
15703                    Ok(Operation::new(op))
15704                }
15705            };
15706
15707            let start = move || async {
15708                let op = self.send().await?;
15709                Ok(Operation::new(op))
15710            };
15711
15712            google_cloud_lro::internal::new_poller(
15713                polling_error_policy,
15714                polling_backoff_policy,
15715                start,
15716                query,
15717            )
15718        }
15719
15720        /// Sets the value of [parent][crate::model::BatchVerifyTargetSitesRequest::parent].
15721        ///
15722        /// This is a **required** field for requests.
15723        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
15724            self.0.request.parent = v.into();
15725            self
15726        }
15727    }
15728
15729    #[doc(hidden)]
15730    impl crate::RequestBuilder for BatchVerifyTargetSites {
15731        fn request_options(&mut self) -> &mut crate::RequestOptions {
15732            &mut self.0.options
15733        }
15734    }
15735
15736    /// The request builder for [SiteSearchEngineService::fetch_domain_verification_status][crate::client::SiteSearchEngineService::fetch_domain_verification_status] calls.
15737    ///
15738    /// # Example
15739    /// ```
15740    /// # use google_cloud_discoveryengine_v1::builder::site_search_engine_service::FetchDomainVerificationStatus;
15741    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
15742    /// use google_cloud_gax::paginator::ItemPaginator;
15743    ///
15744    /// let builder = prepare_request_builder();
15745    /// let mut items = builder.by_item();
15746    /// while let Some(result) = items.next().await {
15747    ///   let item = result?;
15748    /// }
15749    /// # Ok(()) }
15750    ///
15751    /// fn prepare_request_builder() -> FetchDomainVerificationStatus {
15752    ///   # panic!();
15753    ///   // ... details omitted ...
15754    /// }
15755    /// ```
15756    #[derive(Clone, Debug)]
15757    pub struct FetchDomainVerificationStatus(
15758        RequestBuilder<crate::model::FetchDomainVerificationStatusRequest>,
15759    );
15760
15761    impl FetchDomainVerificationStatus {
15762        pub(crate) fn new(
15763            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
15764        ) -> Self {
15765            Self(RequestBuilder::new(stub))
15766        }
15767
15768        /// Sets the full request, replacing any prior values.
15769        pub fn with_request<V: Into<crate::model::FetchDomainVerificationStatusRequest>>(
15770            mut self,
15771            v: V,
15772        ) -> Self {
15773            self.0.request = v.into();
15774            self
15775        }
15776
15777        /// Sets all the options, replacing any prior values.
15778        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
15779            self.0.options = v.into();
15780            self
15781        }
15782
15783        /// Sends the request.
15784        pub async fn send(self) -> Result<crate::model::FetchDomainVerificationStatusResponse> {
15785            (*self.0.stub)
15786                .fetch_domain_verification_status(self.0.request, self.0.options)
15787                .await
15788                .map(crate::Response::into_body)
15789        }
15790
15791        /// Streams each page in the collection.
15792        pub fn by_page(
15793            self,
15794        ) -> impl google_cloud_gax::paginator::Paginator<
15795            crate::model::FetchDomainVerificationStatusResponse,
15796            crate::Error,
15797        > {
15798            use std::clone::Clone;
15799            let token = self.0.request.page_token.clone();
15800            let execute = move |token: String| {
15801                let mut builder = self.clone();
15802                builder.0.request = builder.0.request.set_page_token(token);
15803                builder.send()
15804            };
15805            google_cloud_gax::paginator::internal::new_paginator(token, execute)
15806        }
15807
15808        /// Streams each item in the collection.
15809        pub fn by_item(
15810            self,
15811        ) -> impl google_cloud_gax::paginator::ItemPaginator<
15812            crate::model::FetchDomainVerificationStatusResponse,
15813            crate::Error,
15814        > {
15815            use google_cloud_gax::paginator::Paginator;
15816            self.by_page().items()
15817        }
15818
15819        /// Sets the value of [site_search_engine][crate::model::FetchDomainVerificationStatusRequest::site_search_engine].
15820        ///
15821        /// This is a **required** field for requests.
15822        pub fn set_site_search_engine<T: Into<std::string::String>>(mut self, v: T) -> Self {
15823            self.0.request.site_search_engine = v.into();
15824            self
15825        }
15826
15827        /// Sets the value of [page_size][crate::model::FetchDomainVerificationStatusRequest::page_size].
15828        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
15829            self.0.request.page_size = v.into();
15830            self
15831        }
15832
15833        /// Sets the value of [page_token][crate::model::FetchDomainVerificationStatusRequest::page_token].
15834        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
15835            self.0.request.page_token = v.into();
15836            self
15837        }
15838    }
15839
15840    #[doc(hidden)]
15841    impl crate::RequestBuilder for FetchDomainVerificationStatus {
15842        fn request_options(&mut self) -> &mut crate::RequestOptions {
15843            &mut self.0.options
15844        }
15845    }
15846
15847    /// The request builder for [SiteSearchEngineService::list_operations][crate::client::SiteSearchEngineService::list_operations] calls.
15848    ///
15849    /// # Example
15850    /// ```
15851    /// # use google_cloud_discoveryengine_v1::builder::site_search_engine_service::ListOperations;
15852    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
15853    /// use google_cloud_gax::paginator::ItemPaginator;
15854    ///
15855    /// let builder = prepare_request_builder();
15856    /// let mut items = builder.by_item();
15857    /// while let Some(result) = items.next().await {
15858    ///   let item = result?;
15859    /// }
15860    /// # Ok(()) }
15861    ///
15862    /// fn prepare_request_builder() -> ListOperations {
15863    ///   # panic!();
15864    ///   // ... details omitted ...
15865    /// }
15866    /// ```
15867    #[derive(Clone, Debug)]
15868    pub struct ListOperations(
15869        RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
15870    );
15871
15872    impl ListOperations {
15873        pub(crate) fn new(
15874            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
15875        ) -> Self {
15876            Self(RequestBuilder::new(stub))
15877        }
15878
15879        /// Sets the full request, replacing any prior values.
15880        pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
15881            mut self,
15882            v: V,
15883        ) -> Self {
15884            self.0.request = v.into();
15885            self
15886        }
15887
15888        /// Sets all the options, replacing any prior values.
15889        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
15890            self.0.options = v.into();
15891            self
15892        }
15893
15894        /// Sends the request.
15895        pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
15896            (*self.0.stub)
15897                .list_operations(self.0.request, self.0.options)
15898                .await
15899                .map(crate::Response::into_body)
15900        }
15901
15902        /// Streams each page in the collection.
15903        pub fn by_page(
15904            self,
15905        ) -> impl google_cloud_gax::paginator::Paginator<
15906            google_cloud_longrunning::model::ListOperationsResponse,
15907            crate::Error,
15908        > {
15909            use std::clone::Clone;
15910            let token = self.0.request.page_token.clone();
15911            let execute = move |token: String| {
15912                let mut builder = self.clone();
15913                builder.0.request = builder.0.request.set_page_token(token);
15914                builder.send()
15915            };
15916            google_cloud_gax::paginator::internal::new_paginator(token, execute)
15917        }
15918
15919        /// Streams each item in the collection.
15920        pub fn by_item(
15921            self,
15922        ) -> impl google_cloud_gax::paginator::ItemPaginator<
15923            google_cloud_longrunning::model::ListOperationsResponse,
15924            crate::Error,
15925        > {
15926            use google_cloud_gax::paginator::Paginator;
15927            self.by_page().items()
15928        }
15929
15930        /// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
15931        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
15932            self.0.request.name = v.into();
15933            self
15934        }
15935
15936        /// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::filter].
15937        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
15938            self.0.request.filter = v.into();
15939            self
15940        }
15941
15942        /// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
15943        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
15944            self.0.request.page_size = v.into();
15945            self
15946        }
15947
15948        /// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
15949        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
15950            self.0.request.page_token = v.into();
15951            self
15952        }
15953
15954        /// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
15955        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
15956            self.0.request.return_partial_success = v.into();
15957            self
15958        }
15959    }
15960
15961    #[doc(hidden)]
15962    impl crate::RequestBuilder for ListOperations {
15963        fn request_options(&mut self) -> &mut crate::RequestOptions {
15964            &mut self.0.options
15965        }
15966    }
15967
15968    /// The request builder for [SiteSearchEngineService::get_operation][crate::client::SiteSearchEngineService::get_operation] calls.
15969    ///
15970    /// # Example
15971    /// ```
15972    /// # use google_cloud_discoveryengine_v1::builder::site_search_engine_service::GetOperation;
15973    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
15974    ///
15975    /// let builder = prepare_request_builder();
15976    /// let response = builder.send().await?;
15977    /// # Ok(()) }
15978    ///
15979    /// fn prepare_request_builder() -> GetOperation {
15980    ///   # panic!();
15981    ///   // ... details omitted ...
15982    /// }
15983    /// ```
15984    #[derive(Clone, Debug)]
15985    pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
15986
15987    impl GetOperation {
15988        pub(crate) fn new(
15989            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
15990        ) -> Self {
15991            Self(RequestBuilder::new(stub))
15992        }
15993
15994        /// Sets the full request, replacing any prior values.
15995        pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
15996            mut self,
15997            v: V,
15998        ) -> Self {
15999            self.0.request = v.into();
16000            self
16001        }
16002
16003        /// Sets all the options, replacing any prior values.
16004        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
16005            self.0.options = v.into();
16006            self
16007        }
16008
16009        /// Sends the request.
16010        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
16011            (*self.0.stub)
16012                .get_operation(self.0.request, self.0.options)
16013                .await
16014                .map(crate::Response::into_body)
16015        }
16016
16017        /// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
16018        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
16019            self.0.request.name = v.into();
16020            self
16021        }
16022    }
16023
16024    #[doc(hidden)]
16025    impl crate::RequestBuilder for GetOperation {
16026        fn request_options(&mut self) -> &mut crate::RequestOptions {
16027            &mut self.0.options
16028        }
16029    }
16030
16031    /// The request builder for [SiteSearchEngineService::cancel_operation][crate::client::SiteSearchEngineService::cancel_operation] calls.
16032    ///
16033    /// # Example
16034    /// ```
16035    /// # use google_cloud_discoveryengine_v1::builder::site_search_engine_service::CancelOperation;
16036    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
16037    ///
16038    /// let builder = prepare_request_builder();
16039    /// let response = builder.send().await?;
16040    /// # Ok(()) }
16041    ///
16042    /// fn prepare_request_builder() -> CancelOperation {
16043    ///   # panic!();
16044    ///   // ... details omitted ...
16045    /// }
16046    /// ```
16047    #[derive(Clone, Debug)]
16048    pub struct CancelOperation(
16049        RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
16050    );
16051
16052    impl CancelOperation {
16053        pub(crate) fn new(
16054            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
16055        ) -> Self {
16056            Self(RequestBuilder::new(stub))
16057        }
16058
16059        /// Sets the full request, replacing any prior values.
16060        pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
16061            mut self,
16062            v: V,
16063        ) -> Self {
16064            self.0.request = v.into();
16065            self
16066        }
16067
16068        /// Sets all the options, replacing any prior values.
16069        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
16070            self.0.options = v.into();
16071            self
16072        }
16073
16074        /// Sends the request.
16075        pub async fn send(self) -> Result<()> {
16076            (*self.0.stub)
16077                .cancel_operation(self.0.request, self.0.options)
16078                .await
16079                .map(crate::Response::into_body)
16080        }
16081
16082        /// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::name].
16083        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
16084            self.0.request.name = v.into();
16085            self
16086        }
16087    }
16088
16089    #[doc(hidden)]
16090    impl crate::RequestBuilder for CancelOperation {
16091        fn request_options(&mut self) -> &mut crate::RequestOptions {
16092            &mut self.0.options
16093        }
16094    }
16095}
16096
16097#[cfg(feature = "user-event-service")]
16098#[cfg_attr(docsrs, doc(cfg(feature = "user-event-service")))]
16099pub mod user_event_service {
16100    use crate::Result;
16101
16102    /// A builder for [UserEventService][crate::client::UserEventService].
16103    ///
16104    /// ```
16105    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
16106    /// # use google_cloud_discoveryengine_v1::*;
16107    /// # use builder::user_event_service::ClientBuilder;
16108    /// # use client::UserEventService;
16109    /// let builder : ClientBuilder = UserEventService::builder();
16110    /// let client = builder
16111    ///     .with_endpoint("https://discoveryengine.googleapis.com")
16112    ///     .build().await?;
16113    /// # Ok(()) }
16114    /// ```
16115    pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
16116
16117    pub(crate) mod client {
16118        use super::super::super::client::UserEventService;
16119        pub struct Factory;
16120        impl crate::ClientFactory for Factory {
16121            type Client = UserEventService;
16122            type Credentials = gaxi::options::Credentials;
16123            async fn build(
16124                self,
16125                config: gaxi::options::ClientConfig,
16126            ) -> crate::ClientBuilderResult<Self::Client> {
16127                Self::Client::new(config).await
16128            }
16129        }
16130    }
16131
16132    /// Common implementation for [crate::client::UserEventService] request builders.
16133    #[derive(Clone, Debug)]
16134    pub(crate) struct RequestBuilder<R: std::default::Default> {
16135        stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
16136        request: R,
16137        options: crate::RequestOptions,
16138    }
16139
16140    impl<R> RequestBuilder<R>
16141    where
16142        R: std::default::Default,
16143    {
16144        pub(crate) fn new(
16145            stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
16146        ) -> Self {
16147            Self {
16148                stub,
16149                request: R::default(),
16150                options: crate::RequestOptions::default(),
16151            }
16152        }
16153    }
16154
16155    /// The request builder for [UserEventService::write_user_event][crate::client::UserEventService::write_user_event] calls.
16156    ///
16157    /// # Example
16158    /// ```
16159    /// # use google_cloud_discoveryengine_v1::builder::user_event_service::WriteUserEvent;
16160    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
16161    ///
16162    /// let builder = prepare_request_builder();
16163    /// let response = builder.send().await?;
16164    /// # Ok(()) }
16165    ///
16166    /// fn prepare_request_builder() -> WriteUserEvent {
16167    ///   # panic!();
16168    ///   // ... details omitted ...
16169    /// }
16170    /// ```
16171    #[derive(Clone, Debug)]
16172    pub struct WriteUserEvent(RequestBuilder<crate::model::WriteUserEventRequest>);
16173
16174    impl WriteUserEvent {
16175        pub(crate) fn new(
16176            stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
16177        ) -> Self {
16178            Self(RequestBuilder::new(stub))
16179        }
16180
16181        /// Sets the full request, replacing any prior values.
16182        pub fn with_request<V: Into<crate::model::WriteUserEventRequest>>(mut self, v: V) -> Self {
16183            self.0.request = v.into();
16184            self
16185        }
16186
16187        /// Sets all the options, replacing any prior values.
16188        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
16189            self.0.options = v.into();
16190            self
16191        }
16192
16193        /// Sends the request.
16194        pub async fn send(self) -> Result<crate::model::UserEvent> {
16195            (*self.0.stub)
16196                .write_user_event(self.0.request, self.0.options)
16197                .await
16198                .map(crate::Response::into_body)
16199        }
16200
16201        /// Sets the value of [parent][crate::model::WriteUserEventRequest::parent].
16202        ///
16203        /// This is a **required** field for requests.
16204        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
16205            self.0.request.parent = v.into();
16206            self
16207        }
16208
16209        /// Sets the value of [user_event][crate::model::WriteUserEventRequest::user_event].
16210        ///
16211        /// This is a **required** field for requests.
16212        pub fn set_user_event<T>(mut self, v: T) -> Self
16213        where
16214            T: std::convert::Into<crate::model::UserEvent>,
16215        {
16216            self.0.request.user_event = std::option::Option::Some(v.into());
16217            self
16218        }
16219
16220        /// Sets or clears the value of [user_event][crate::model::WriteUserEventRequest::user_event].
16221        ///
16222        /// This is a **required** field for requests.
16223        pub fn set_or_clear_user_event<T>(mut self, v: std::option::Option<T>) -> Self
16224        where
16225            T: std::convert::Into<crate::model::UserEvent>,
16226        {
16227            self.0.request.user_event = v.map(|x| x.into());
16228            self
16229        }
16230
16231        /// Sets the value of [write_async][crate::model::WriteUserEventRequest::write_async].
16232        pub fn set_write_async<T: Into<bool>>(mut self, v: T) -> Self {
16233            self.0.request.write_async = v.into();
16234            self
16235        }
16236    }
16237
16238    #[doc(hidden)]
16239    impl crate::RequestBuilder for WriteUserEvent {
16240        fn request_options(&mut self) -> &mut crate::RequestOptions {
16241            &mut self.0.options
16242        }
16243    }
16244
16245    /// The request builder for [UserEventService::collect_user_event][crate::client::UserEventService::collect_user_event] calls.
16246    ///
16247    /// # Example
16248    /// ```
16249    /// # use google_cloud_discoveryengine_v1::builder::user_event_service::CollectUserEvent;
16250    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
16251    ///
16252    /// let builder = prepare_request_builder();
16253    /// let response = builder.send().await?;
16254    /// # Ok(()) }
16255    ///
16256    /// fn prepare_request_builder() -> CollectUserEvent {
16257    ///   # panic!();
16258    ///   // ... details omitted ...
16259    /// }
16260    /// ```
16261    #[derive(Clone, Debug)]
16262    pub struct CollectUserEvent(RequestBuilder<crate::model::CollectUserEventRequest>);
16263
16264    impl CollectUserEvent {
16265        pub(crate) fn new(
16266            stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
16267        ) -> Self {
16268            Self(RequestBuilder::new(stub))
16269        }
16270
16271        /// Sets the full request, replacing any prior values.
16272        pub fn with_request<V: Into<crate::model::CollectUserEventRequest>>(
16273            mut self,
16274            v: V,
16275        ) -> Self {
16276            self.0.request = v.into();
16277            self
16278        }
16279
16280        /// Sets all the options, replacing any prior values.
16281        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
16282            self.0.options = v.into();
16283            self
16284        }
16285
16286        /// Sends the request.
16287        pub async fn send(self) -> Result<google_cloud_api::model::HttpBody> {
16288            (*self.0.stub)
16289                .collect_user_event(self.0.request, self.0.options)
16290                .await
16291                .map(crate::Response::into_body)
16292        }
16293
16294        /// Sets the value of [parent][crate::model::CollectUserEventRequest::parent].
16295        ///
16296        /// This is a **required** field for requests.
16297        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
16298            self.0.request.parent = v.into();
16299            self
16300        }
16301
16302        /// Sets the value of [user_event][crate::model::CollectUserEventRequest::user_event].
16303        ///
16304        /// This is a **required** field for requests.
16305        pub fn set_user_event<T: Into<std::string::String>>(mut self, v: T) -> Self {
16306            self.0.request.user_event = v.into();
16307            self
16308        }
16309
16310        /// Sets the value of [uri][crate::model::CollectUserEventRequest::uri].
16311        pub fn set_uri<T>(mut self, v: T) -> Self
16312        where
16313            T: std::convert::Into<std::string::String>,
16314        {
16315            self.0.request.uri = std::option::Option::Some(v.into());
16316            self
16317        }
16318
16319        /// Sets or clears the value of [uri][crate::model::CollectUserEventRequest::uri].
16320        pub fn set_or_clear_uri<T>(mut self, v: std::option::Option<T>) -> Self
16321        where
16322            T: std::convert::Into<std::string::String>,
16323        {
16324            self.0.request.uri = v.map(|x| x.into());
16325            self
16326        }
16327
16328        /// Sets the value of [ets][crate::model::CollectUserEventRequest::ets].
16329        pub fn set_ets<T>(mut self, v: T) -> Self
16330        where
16331            T: std::convert::Into<i64>,
16332        {
16333            self.0.request.ets = std::option::Option::Some(v.into());
16334            self
16335        }
16336
16337        /// Sets or clears the value of [ets][crate::model::CollectUserEventRequest::ets].
16338        pub fn set_or_clear_ets<T>(mut self, v: std::option::Option<T>) -> Self
16339        where
16340            T: std::convert::Into<i64>,
16341        {
16342            self.0.request.ets = v.map(|x| x.into());
16343            self
16344        }
16345    }
16346
16347    #[doc(hidden)]
16348    impl crate::RequestBuilder for CollectUserEvent {
16349        fn request_options(&mut self) -> &mut crate::RequestOptions {
16350            &mut self.0.options
16351        }
16352    }
16353
16354    /// The request builder for [UserEventService::purge_user_events][crate::client::UserEventService::purge_user_events] calls.
16355    ///
16356    /// # Example
16357    /// ```
16358    /// # use google_cloud_discoveryengine_v1::builder::user_event_service::PurgeUserEvents;
16359    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
16360    /// use google_cloud_lro::Poller;
16361    ///
16362    /// let builder = prepare_request_builder();
16363    /// let response = builder.poller().until_done().await?;
16364    /// # Ok(()) }
16365    ///
16366    /// fn prepare_request_builder() -> PurgeUserEvents {
16367    ///   # panic!();
16368    ///   // ... details omitted ...
16369    /// }
16370    /// ```
16371    #[derive(Clone, Debug)]
16372    pub struct PurgeUserEvents(RequestBuilder<crate::model::PurgeUserEventsRequest>);
16373
16374    impl PurgeUserEvents {
16375        pub(crate) fn new(
16376            stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
16377        ) -> Self {
16378            Self(RequestBuilder::new(stub))
16379        }
16380
16381        /// Sets the full request, replacing any prior values.
16382        pub fn with_request<V: Into<crate::model::PurgeUserEventsRequest>>(mut self, v: V) -> Self {
16383            self.0.request = v.into();
16384            self
16385        }
16386
16387        /// Sets all the options, replacing any prior values.
16388        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
16389            self.0.options = v.into();
16390            self
16391        }
16392
16393        /// Sends the request.
16394        ///
16395        /// # Long running operations
16396        ///
16397        /// This starts, but does not poll, a longrunning operation. More information
16398        /// on [purge_user_events][crate::client::UserEventService::purge_user_events].
16399        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
16400            (*self.0.stub)
16401                .purge_user_events(self.0.request, self.0.options)
16402                .await
16403                .map(crate::Response::into_body)
16404        }
16405
16406        /// Creates a [Poller][google_cloud_lro::Poller] to work with `purge_user_events`.
16407        pub fn poller(
16408            self,
16409        ) -> impl google_cloud_lro::Poller<
16410            crate::model::PurgeUserEventsResponse,
16411            crate::model::PurgeUserEventsMetadata,
16412        > {
16413            type Operation = google_cloud_lro::internal::Operation<
16414                crate::model::PurgeUserEventsResponse,
16415                crate::model::PurgeUserEventsMetadata,
16416            >;
16417            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
16418            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
16419
16420            let stub = self.0.stub.clone();
16421            let mut options = self.0.options.clone();
16422            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
16423            let query = move |name| {
16424                let stub = stub.clone();
16425                let options = options.clone();
16426                async {
16427                    let op = GetOperation::new(stub)
16428                        .set_name(name)
16429                        .with_options(options)
16430                        .send()
16431                        .await?;
16432                    Ok(Operation::new(op))
16433                }
16434            };
16435
16436            let start = move || async {
16437                let op = self.send().await?;
16438                Ok(Operation::new(op))
16439            };
16440
16441            google_cloud_lro::internal::new_poller(
16442                polling_error_policy,
16443                polling_backoff_policy,
16444                start,
16445                query,
16446            )
16447        }
16448
16449        /// Sets the value of [parent][crate::model::PurgeUserEventsRequest::parent].
16450        ///
16451        /// This is a **required** field for requests.
16452        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
16453            self.0.request.parent = v.into();
16454            self
16455        }
16456
16457        /// Sets the value of [filter][crate::model::PurgeUserEventsRequest::filter].
16458        ///
16459        /// This is a **required** field for requests.
16460        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
16461            self.0.request.filter = v.into();
16462            self
16463        }
16464
16465        /// Sets the value of [force][crate::model::PurgeUserEventsRequest::force].
16466        pub fn set_force<T: Into<bool>>(mut self, v: T) -> Self {
16467            self.0.request.force = v.into();
16468            self
16469        }
16470    }
16471
16472    #[doc(hidden)]
16473    impl crate::RequestBuilder for PurgeUserEvents {
16474        fn request_options(&mut self) -> &mut crate::RequestOptions {
16475            &mut self.0.options
16476        }
16477    }
16478
16479    /// The request builder for [UserEventService::import_user_events][crate::client::UserEventService::import_user_events] calls.
16480    ///
16481    /// # Example
16482    /// ```
16483    /// # use google_cloud_discoveryengine_v1::builder::user_event_service::ImportUserEvents;
16484    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
16485    /// use google_cloud_lro::Poller;
16486    ///
16487    /// let builder = prepare_request_builder();
16488    /// let response = builder.poller().until_done().await?;
16489    /// # Ok(()) }
16490    ///
16491    /// fn prepare_request_builder() -> ImportUserEvents {
16492    ///   # panic!();
16493    ///   // ... details omitted ...
16494    /// }
16495    /// ```
16496    #[derive(Clone, Debug)]
16497    pub struct ImportUserEvents(RequestBuilder<crate::model::ImportUserEventsRequest>);
16498
16499    impl ImportUserEvents {
16500        pub(crate) fn new(
16501            stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
16502        ) -> Self {
16503            Self(RequestBuilder::new(stub))
16504        }
16505
16506        /// Sets the full request, replacing any prior values.
16507        pub fn with_request<V: Into<crate::model::ImportUserEventsRequest>>(
16508            mut self,
16509            v: V,
16510        ) -> Self {
16511            self.0.request = v.into();
16512            self
16513        }
16514
16515        /// Sets all the options, replacing any prior values.
16516        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
16517            self.0.options = v.into();
16518            self
16519        }
16520
16521        /// Sends the request.
16522        ///
16523        /// # Long running operations
16524        ///
16525        /// This starts, but does not poll, a longrunning operation. More information
16526        /// on [import_user_events][crate::client::UserEventService::import_user_events].
16527        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
16528            (*self.0.stub)
16529                .import_user_events(self.0.request, self.0.options)
16530                .await
16531                .map(crate::Response::into_body)
16532        }
16533
16534        /// Creates a [Poller][google_cloud_lro::Poller] to work with `import_user_events`.
16535        pub fn poller(
16536            self,
16537        ) -> impl google_cloud_lro::Poller<
16538            crate::model::ImportUserEventsResponse,
16539            crate::model::ImportUserEventsMetadata,
16540        > {
16541            type Operation = google_cloud_lro::internal::Operation<
16542                crate::model::ImportUserEventsResponse,
16543                crate::model::ImportUserEventsMetadata,
16544            >;
16545            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
16546            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
16547
16548            let stub = self.0.stub.clone();
16549            let mut options = self.0.options.clone();
16550            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
16551            let query = move |name| {
16552                let stub = stub.clone();
16553                let options = options.clone();
16554                async {
16555                    let op = GetOperation::new(stub)
16556                        .set_name(name)
16557                        .with_options(options)
16558                        .send()
16559                        .await?;
16560                    Ok(Operation::new(op))
16561                }
16562            };
16563
16564            let start = move || async {
16565                let op = self.send().await?;
16566                Ok(Operation::new(op))
16567            };
16568
16569            google_cloud_lro::internal::new_poller(
16570                polling_error_policy,
16571                polling_backoff_policy,
16572                start,
16573                query,
16574            )
16575        }
16576
16577        /// Sets the value of [parent][crate::model::ImportUserEventsRequest::parent].
16578        ///
16579        /// This is a **required** field for requests.
16580        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
16581            self.0.request.parent = v.into();
16582            self
16583        }
16584
16585        /// Sets the value of [error_config][crate::model::ImportUserEventsRequest::error_config].
16586        pub fn set_error_config<T>(mut self, v: T) -> Self
16587        where
16588            T: std::convert::Into<crate::model::ImportErrorConfig>,
16589        {
16590            self.0.request.error_config = std::option::Option::Some(v.into());
16591            self
16592        }
16593
16594        /// Sets or clears the value of [error_config][crate::model::ImportUserEventsRequest::error_config].
16595        pub fn set_or_clear_error_config<T>(mut self, v: std::option::Option<T>) -> Self
16596        where
16597            T: std::convert::Into<crate::model::ImportErrorConfig>,
16598        {
16599            self.0.request.error_config = v.map(|x| x.into());
16600            self
16601        }
16602
16603        /// Sets the value of [source][crate::model::ImportUserEventsRequest::source].
16604        ///
16605        /// Note that all the setters affecting `source` are
16606        /// mutually exclusive.
16607        pub fn set_source<T: Into<Option<crate::model::import_user_events_request::Source>>>(
16608            mut self,
16609            v: T,
16610        ) -> Self {
16611            self.0.request.source = v.into();
16612            self
16613        }
16614
16615        /// Sets the value of [source][crate::model::ImportUserEventsRequest::source]
16616        /// to hold a `InlineSource`.
16617        ///
16618        /// Note that all the setters affecting `source` are
16619        /// mutually exclusive.
16620        pub fn set_inline_source<
16621            T: std::convert::Into<
16622                    std::boxed::Box<crate::model::import_user_events_request::InlineSource>,
16623                >,
16624        >(
16625            mut self,
16626            v: T,
16627        ) -> Self {
16628            self.0.request = self.0.request.set_inline_source(v);
16629            self
16630        }
16631
16632        /// Sets the value of [source][crate::model::ImportUserEventsRequest::source]
16633        /// to hold a `GcsSource`.
16634        ///
16635        /// Note that all the setters affecting `source` are
16636        /// mutually exclusive.
16637        pub fn set_gcs_source<T: std::convert::Into<std::boxed::Box<crate::model::GcsSource>>>(
16638            mut self,
16639            v: T,
16640        ) -> Self {
16641            self.0.request = self.0.request.set_gcs_source(v);
16642            self
16643        }
16644
16645        /// Sets the value of [source][crate::model::ImportUserEventsRequest::source]
16646        /// to hold a `BigquerySource`.
16647        ///
16648        /// Note that all the setters affecting `source` are
16649        /// mutually exclusive.
16650        pub fn set_bigquery_source<
16651            T: std::convert::Into<std::boxed::Box<crate::model::BigQuerySource>>,
16652        >(
16653            mut self,
16654            v: T,
16655        ) -> Self {
16656            self.0.request = self.0.request.set_bigquery_source(v);
16657            self
16658        }
16659    }
16660
16661    #[doc(hidden)]
16662    impl crate::RequestBuilder for ImportUserEvents {
16663        fn request_options(&mut self) -> &mut crate::RequestOptions {
16664            &mut self.0.options
16665        }
16666    }
16667
16668    /// The request builder for [UserEventService::list_operations][crate::client::UserEventService::list_operations] calls.
16669    ///
16670    /// # Example
16671    /// ```
16672    /// # use google_cloud_discoveryengine_v1::builder::user_event_service::ListOperations;
16673    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
16674    /// use google_cloud_gax::paginator::ItemPaginator;
16675    ///
16676    /// let builder = prepare_request_builder();
16677    /// let mut items = builder.by_item();
16678    /// while let Some(result) = items.next().await {
16679    ///   let item = result?;
16680    /// }
16681    /// # Ok(()) }
16682    ///
16683    /// fn prepare_request_builder() -> ListOperations {
16684    ///   # panic!();
16685    ///   // ... details omitted ...
16686    /// }
16687    /// ```
16688    #[derive(Clone, Debug)]
16689    pub struct ListOperations(
16690        RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
16691    );
16692
16693    impl ListOperations {
16694        pub(crate) fn new(
16695            stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
16696        ) -> Self {
16697            Self(RequestBuilder::new(stub))
16698        }
16699
16700        /// Sets the full request, replacing any prior values.
16701        pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
16702            mut self,
16703            v: V,
16704        ) -> Self {
16705            self.0.request = v.into();
16706            self
16707        }
16708
16709        /// Sets all the options, replacing any prior values.
16710        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
16711            self.0.options = v.into();
16712            self
16713        }
16714
16715        /// Sends the request.
16716        pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
16717            (*self.0.stub)
16718                .list_operations(self.0.request, self.0.options)
16719                .await
16720                .map(crate::Response::into_body)
16721        }
16722
16723        /// Streams each page in the collection.
16724        pub fn by_page(
16725            self,
16726        ) -> impl google_cloud_gax::paginator::Paginator<
16727            google_cloud_longrunning::model::ListOperationsResponse,
16728            crate::Error,
16729        > {
16730            use std::clone::Clone;
16731            let token = self.0.request.page_token.clone();
16732            let execute = move |token: String| {
16733                let mut builder = self.clone();
16734                builder.0.request = builder.0.request.set_page_token(token);
16735                builder.send()
16736            };
16737            google_cloud_gax::paginator::internal::new_paginator(token, execute)
16738        }
16739
16740        /// Streams each item in the collection.
16741        pub fn by_item(
16742            self,
16743        ) -> impl google_cloud_gax::paginator::ItemPaginator<
16744            google_cloud_longrunning::model::ListOperationsResponse,
16745            crate::Error,
16746        > {
16747            use google_cloud_gax::paginator::Paginator;
16748            self.by_page().items()
16749        }
16750
16751        /// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
16752        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
16753            self.0.request.name = v.into();
16754            self
16755        }
16756
16757        /// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::filter].
16758        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
16759            self.0.request.filter = v.into();
16760            self
16761        }
16762
16763        /// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
16764        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
16765            self.0.request.page_size = v.into();
16766            self
16767        }
16768
16769        /// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
16770        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
16771            self.0.request.page_token = v.into();
16772            self
16773        }
16774
16775        /// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
16776        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
16777            self.0.request.return_partial_success = v.into();
16778            self
16779        }
16780    }
16781
16782    #[doc(hidden)]
16783    impl crate::RequestBuilder for ListOperations {
16784        fn request_options(&mut self) -> &mut crate::RequestOptions {
16785            &mut self.0.options
16786        }
16787    }
16788
16789    /// The request builder for [UserEventService::get_operation][crate::client::UserEventService::get_operation] calls.
16790    ///
16791    /// # Example
16792    /// ```
16793    /// # use google_cloud_discoveryengine_v1::builder::user_event_service::GetOperation;
16794    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
16795    ///
16796    /// let builder = prepare_request_builder();
16797    /// let response = builder.send().await?;
16798    /// # Ok(()) }
16799    ///
16800    /// fn prepare_request_builder() -> GetOperation {
16801    ///   # panic!();
16802    ///   // ... details omitted ...
16803    /// }
16804    /// ```
16805    #[derive(Clone, Debug)]
16806    pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
16807
16808    impl GetOperation {
16809        pub(crate) fn new(
16810            stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
16811        ) -> Self {
16812            Self(RequestBuilder::new(stub))
16813        }
16814
16815        /// Sets the full request, replacing any prior values.
16816        pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
16817            mut self,
16818            v: V,
16819        ) -> Self {
16820            self.0.request = v.into();
16821            self
16822        }
16823
16824        /// Sets all the options, replacing any prior values.
16825        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
16826            self.0.options = v.into();
16827            self
16828        }
16829
16830        /// Sends the request.
16831        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
16832            (*self.0.stub)
16833                .get_operation(self.0.request, self.0.options)
16834                .await
16835                .map(crate::Response::into_body)
16836        }
16837
16838        /// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
16839        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
16840            self.0.request.name = v.into();
16841            self
16842        }
16843    }
16844
16845    #[doc(hidden)]
16846    impl crate::RequestBuilder for GetOperation {
16847        fn request_options(&mut self) -> &mut crate::RequestOptions {
16848            &mut self.0.options
16849        }
16850    }
16851
16852    /// The request builder for [UserEventService::cancel_operation][crate::client::UserEventService::cancel_operation] calls.
16853    ///
16854    /// # Example
16855    /// ```
16856    /// # use google_cloud_discoveryengine_v1::builder::user_event_service::CancelOperation;
16857    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
16858    ///
16859    /// let builder = prepare_request_builder();
16860    /// let response = builder.send().await?;
16861    /// # Ok(()) }
16862    ///
16863    /// fn prepare_request_builder() -> CancelOperation {
16864    ///   # panic!();
16865    ///   // ... details omitted ...
16866    /// }
16867    /// ```
16868    #[derive(Clone, Debug)]
16869    pub struct CancelOperation(
16870        RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
16871    );
16872
16873    impl CancelOperation {
16874        pub(crate) fn new(
16875            stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
16876        ) -> Self {
16877            Self(RequestBuilder::new(stub))
16878        }
16879
16880        /// Sets the full request, replacing any prior values.
16881        pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
16882            mut self,
16883            v: V,
16884        ) -> Self {
16885            self.0.request = v.into();
16886            self
16887        }
16888
16889        /// Sets all the options, replacing any prior values.
16890        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
16891            self.0.options = v.into();
16892            self
16893        }
16894
16895        /// Sends the request.
16896        pub async fn send(self) -> Result<()> {
16897            (*self.0.stub)
16898                .cancel_operation(self.0.request, self.0.options)
16899                .await
16900                .map(crate::Response::into_body)
16901        }
16902
16903        /// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::name].
16904        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
16905            self.0.request.name = v.into();
16906            self
16907        }
16908    }
16909
16910    #[doc(hidden)]
16911    impl crate::RequestBuilder for CancelOperation {
16912        fn request_options(&mut self) -> &mut crate::RequestOptions {
16913            &mut self.0.options
16914        }
16915    }
16916}
16917
16918#[cfg(feature = "user-license-service")]
16919#[cfg_attr(docsrs, doc(cfg(feature = "user-license-service")))]
16920pub mod user_license_service {
16921    use crate::Result;
16922
16923    /// A builder for [UserLicenseService][crate::client::UserLicenseService].
16924    ///
16925    /// ```
16926    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
16927    /// # use google_cloud_discoveryengine_v1::*;
16928    /// # use builder::user_license_service::ClientBuilder;
16929    /// # use client::UserLicenseService;
16930    /// let builder : ClientBuilder = UserLicenseService::builder();
16931    /// let client = builder
16932    ///     .with_endpoint("https://discoveryengine.googleapis.com")
16933    ///     .build().await?;
16934    /// # Ok(()) }
16935    /// ```
16936    pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
16937
16938    pub(crate) mod client {
16939        use super::super::super::client::UserLicenseService;
16940        pub struct Factory;
16941        impl crate::ClientFactory for Factory {
16942            type Client = UserLicenseService;
16943            type Credentials = gaxi::options::Credentials;
16944            async fn build(
16945                self,
16946                config: gaxi::options::ClientConfig,
16947            ) -> crate::ClientBuilderResult<Self::Client> {
16948                Self::Client::new(config).await
16949            }
16950        }
16951    }
16952
16953    /// Common implementation for [crate::client::UserLicenseService] request builders.
16954    #[derive(Clone, Debug)]
16955    pub(crate) struct RequestBuilder<R: std::default::Default> {
16956        stub: std::sync::Arc<dyn super::super::stub::dynamic::UserLicenseService>,
16957        request: R,
16958        options: crate::RequestOptions,
16959    }
16960
16961    impl<R> RequestBuilder<R>
16962    where
16963        R: std::default::Default,
16964    {
16965        pub(crate) fn new(
16966            stub: std::sync::Arc<dyn super::super::stub::dynamic::UserLicenseService>,
16967        ) -> Self {
16968            Self {
16969                stub,
16970                request: R::default(),
16971                options: crate::RequestOptions::default(),
16972            }
16973        }
16974    }
16975
16976    /// The request builder for [UserLicenseService::list_user_licenses][crate::client::UserLicenseService::list_user_licenses] calls.
16977    ///
16978    /// # Example
16979    /// ```
16980    /// # use google_cloud_discoveryengine_v1::builder::user_license_service::ListUserLicenses;
16981    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
16982    /// use google_cloud_gax::paginator::ItemPaginator;
16983    ///
16984    /// let builder = prepare_request_builder();
16985    /// let mut items = builder.by_item();
16986    /// while let Some(result) = items.next().await {
16987    ///   let item = result?;
16988    /// }
16989    /// # Ok(()) }
16990    ///
16991    /// fn prepare_request_builder() -> ListUserLicenses {
16992    ///   # panic!();
16993    ///   // ... details omitted ...
16994    /// }
16995    /// ```
16996    #[derive(Clone, Debug)]
16997    pub struct ListUserLicenses(RequestBuilder<crate::model::ListUserLicensesRequest>);
16998
16999    impl ListUserLicenses {
17000        pub(crate) fn new(
17001            stub: std::sync::Arc<dyn super::super::stub::dynamic::UserLicenseService>,
17002        ) -> Self {
17003            Self(RequestBuilder::new(stub))
17004        }
17005
17006        /// Sets the full request, replacing any prior values.
17007        pub fn with_request<V: Into<crate::model::ListUserLicensesRequest>>(
17008            mut self,
17009            v: V,
17010        ) -> Self {
17011            self.0.request = v.into();
17012            self
17013        }
17014
17015        /// Sets all the options, replacing any prior values.
17016        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
17017            self.0.options = v.into();
17018            self
17019        }
17020
17021        /// Sends the request.
17022        pub async fn send(self) -> Result<crate::model::ListUserLicensesResponse> {
17023            (*self.0.stub)
17024                .list_user_licenses(self.0.request, self.0.options)
17025                .await
17026                .map(crate::Response::into_body)
17027        }
17028
17029        /// Streams each page in the collection.
17030        pub fn by_page(
17031            self,
17032        ) -> impl google_cloud_gax::paginator::Paginator<
17033            crate::model::ListUserLicensesResponse,
17034            crate::Error,
17035        > {
17036            use std::clone::Clone;
17037            let token = self.0.request.page_token.clone();
17038            let execute = move |token: String| {
17039                let mut builder = self.clone();
17040                builder.0.request = builder.0.request.set_page_token(token);
17041                builder.send()
17042            };
17043            google_cloud_gax::paginator::internal::new_paginator(token, execute)
17044        }
17045
17046        /// Streams each item in the collection.
17047        pub fn by_item(
17048            self,
17049        ) -> impl google_cloud_gax::paginator::ItemPaginator<
17050            crate::model::ListUserLicensesResponse,
17051            crate::Error,
17052        > {
17053            use google_cloud_gax::paginator::Paginator;
17054            self.by_page().items()
17055        }
17056
17057        /// Sets the value of [parent][crate::model::ListUserLicensesRequest::parent].
17058        ///
17059        /// This is a **required** field for requests.
17060        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
17061            self.0.request.parent = v.into();
17062            self
17063        }
17064
17065        /// Sets the value of [page_size][crate::model::ListUserLicensesRequest::page_size].
17066        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
17067            self.0.request.page_size = v.into();
17068            self
17069        }
17070
17071        /// Sets the value of [page_token][crate::model::ListUserLicensesRequest::page_token].
17072        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
17073            self.0.request.page_token = v.into();
17074            self
17075        }
17076
17077        /// Sets the value of [filter][crate::model::ListUserLicensesRequest::filter].
17078        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
17079            self.0.request.filter = v.into();
17080            self
17081        }
17082    }
17083
17084    #[doc(hidden)]
17085    impl crate::RequestBuilder for ListUserLicenses {
17086        fn request_options(&mut self) -> &mut crate::RequestOptions {
17087            &mut self.0.options
17088        }
17089    }
17090
17091    /// The request builder for [UserLicenseService::batch_update_user_licenses][crate::client::UserLicenseService::batch_update_user_licenses] calls.
17092    ///
17093    /// # Example
17094    /// ```
17095    /// # use google_cloud_discoveryengine_v1::builder::user_license_service::BatchUpdateUserLicenses;
17096    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
17097    /// use google_cloud_lro::Poller;
17098    ///
17099    /// let builder = prepare_request_builder();
17100    /// let response = builder.poller().until_done().await?;
17101    /// # Ok(()) }
17102    ///
17103    /// fn prepare_request_builder() -> BatchUpdateUserLicenses {
17104    ///   # panic!();
17105    ///   // ... details omitted ...
17106    /// }
17107    /// ```
17108    #[derive(Clone, Debug)]
17109    pub struct BatchUpdateUserLicenses(
17110        RequestBuilder<crate::model::BatchUpdateUserLicensesRequest>,
17111    );
17112
17113    impl BatchUpdateUserLicenses {
17114        pub(crate) fn new(
17115            stub: std::sync::Arc<dyn super::super::stub::dynamic::UserLicenseService>,
17116        ) -> Self {
17117            Self(RequestBuilder::new(stub))
17118        }
17119
17120        /// Sets the full request, replacing any prior values.
17121        pub fn with_request<V: Into<crate::model::BatchUpdateUserLicensesRequest>>(
17122            mut self,
17123            v: V,
17124        ) -> Self {
17125            self.0.request = v.into();
17126            self
17127        }
17128
17129        /// Sets all the options, replacing any prior values.
17130        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
17131            self.0.options = v.into();
17132            self
17133        }
17134
17135        /// Sends the request.
17136        ///
17137        /// # Long running operations
17138        ///
17139        /// This starts, but does not poll, a longrunning operation. More information
17140        /// on [batch_update_user_licenses][crate::client::UserLicenseService::batch_update_user_licenses].
17141        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
17142            (*self.0.stub)
17143                .batch_update_user_licenses(self.0.request, self.0.options)
17144                .await
17145                .map(crate::Response::into_body)
17146        }
17147
17148        /// Creates a [Poller][google_cloud_lro::Poller] to work with `batch_update_user_licenses`.
17149        pub fn poller(
17150            self,
17151        ) -> impl google_cloud_lro::Poller<
17152            crate::model::BatchUpdateUserLicensesResponse,
17153            crate::model::BatchUpdateUserLicensesMetadata,
17154        > {
17155            type Operation = google_cloud_lro::internal::Operation<
17156                crate::model::BatchUpdateUserLicensesResponse,
17157                crate::model::BatchUpdateUserLicensesMetadata,
17158            >;
17159            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
17160            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
17161
17162            let stub = self.0.stub.clone();
17163            let mut options = self.0.options.clone();
17164            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
17165            let query = move |name| {
17166                let stub = stub.clone();
17167                let options = options.clone();
17168                async {
17169                    let op = GetOperation::new(stub)
17170                        .set_name(name)
17171                        .with_options(options)
17172                        .send()
17173                        .await?;
17174                    Ok(Operation::new(op))
17175                }
17176            };
17177
17178            let start = move || async {
17179                let op = self.send().await?;
17180                Ok(Operation::new(op))
17181            };
17182
17183            google_cloud_lro::internal::new_poller(
17184                polling_error_policy,
17185                polling_backoff_policy,
17186                start,
17187                query,
17188            )
17189        }
17190
17191        /// Sets the value of [parent][crate::model::BatchUpdateUserLicensesRequest::parent].
17192        ///
17193        /// This is a **required** field for requests.
17194        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
17195            self.0.request.parent = v.into();
17196            self
17197        }
17198
17199        /// Sets the value of [delete_unassigned_user_licenses][crate::model::BatchUpdateUserLicensesRequest::delete_unassigned_user_licenses].
17200        pub fn set_delete_unassigned_user_licenses<T: Into<bool>>(mut self, v: T) -> Self {
17201            self.0.request.delete_unassigned_user_licenses = v.into();
17202            self
17203        }
17204
17205        /// Sets the value of [source][crate::model::BatchUpdateUserLicensesRequest::source].
17206        ///
17207        /// Note that all the setters affecting `source` are
17208        /// mutually exclusive.
17209        pub fn set_source<
17210            T: Into<Option<crate::model::batch_update_user_licenses_request::Source>>,
17211        >(
17212            mut self,
17213            v: T,
17214        ) -> Self {
17215            self.0.request.source = v.into();
17216            self
17217        }
17218
17219        /// Sets the value of [source][crate::model::BatchUpdateUserLicensesRequest::source]
17220        /// to hold a `InlineSource`.
17221        ///
17222        /// Note that all the setters affecting `source` are
17223        /// mutually exclusive.
17224        pub fn set_inline_source<
17225            T: std::convert::Into<
17226                    std::boxed::Box<crate::model::batch_update_user_licenses_request::InlineSource>,
17227                >,
17228        >(
17229            mut self,
17230            v: T,
17231        ) -> Self {
17232            self.0.request = self.0.request.set_inline_source(v);
17233            self
17234        }
17235    }
17236
17237    #[doc(hidden)]
17238    impl crate::RequestBuilder for BatchUpdateUserLicenses {
17239        fn request_options(&mut self) -> &mut crate::RequestOptions {
17240            &mut self.0.options
17241        }
17242    }
17243
17244    /// The request builder for [UserLicenseService::list_operations][crate::client::UserLicenseService::list_operations] calls.
17245    ///
17246    /// # Example
17247    /// ```
17248    /// # use google_cloud_discoveryengine_v1::builder::user_license_service::ListOperations;
17249    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
17250    /// use google_cloud_gax::paginator::ItemPaginator;
17251    ///
17252    /// let builder = prepare_request_builder();
17253    /// let mut items = builder.by_item();
17254    /// while let Some(result) = items.next().await {
17255    ///   let item = result?;
17256    /// }
17257    /// # Ok(()) }
17258    ///
17259    /// fn prepare_request_builder() -> ListOperations {
17260    ///   # panic!();
17261    ///   // ... details omitted ...
17262    /// }
17263    /// ```
17264    #[derive(Clone, Debug)]
17265    pub struct ListOperations(
17266        RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
17267    );
17268
17269    impl ListOperations {
17270        pub(crate) fn new(
17271            stub: std::sync::Arc<dyn super::super::stub::dynamic::UserLicenseService>,
17272        ) -> Self {
17273            Self(RequestBuilder::new(stub))
17274        }
17275
17276        /// Sets the full request, replacing any prior values.
17277        pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
17278            mut self,
17279            v: V,
17280        ) -> Self {
17281            self.0.request = v.into();
17282            self
17283        }
17284
17285        /// Sets all the options, replacing any prior values.
17286        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
17287            self.0.options = v.into();
17288            self
17289        }
17290
17291        /// Sends the request.
17292        pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
17293            (*self.0.stub)
17294                .list_operations(self.0.request, self.0.options)
17295                .await
17296                .map(crate::Response::into_body)
17297        }
17298
17299        /// Streams each page in the collection.
17300        pub fn by_page(
17301            self,
17302        ) -> impl google_cloud_gax::paginator::Paginator<
17303            google_cloud_longrunning::model::ListOperationsResponse,
17304            crate::Error,
17305        > {
17306            use std::clone::Clone;
17307            let token = self.0.request.page_token.clone();
17308            let execute = move |token: String| {
17309                let mut builder = self.clone();
17310                builder.0.request = builder.0.request.set_page_token(token);
17311                builder.send()
17312            };
17313            google_cloud_gax::paginator::internal::new_paginator(token, execute)
17314        }
17315
17316        /// Streams each item in the collection.
17317        pub fn by_item(
17318            self,
17319        ) -> impl google_cloud_gax::paginator::ItemPaginator<
17320            google_cloud_longrunning::model::ListOperationsResponse,
17321            crate::Error,
17322        > {
17323            use google_cloud_gax::paginator::Paginator;
17324            self.by_page().items()
17325        }
17326
17327        /// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
17328        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
17329            self.0.request.name = v.into();
17330            self
17331        }
17332
17333        /// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::filter].
17334        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
17335            self.0.request.filter = v.into();
17336            self
17337        }
17338
17339        /// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
17340        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
17341            self.0.request.page_size = v.into();
17342            self
17343        }
17344
17345        /// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
17346        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
17347            self.0.request.page_token = v.into();
17348            self
17349        }
17350
17351        /// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
17352        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
17353            self.0.request.return_partial_success = v.into();
17354            self
17355        }
17356    }
17357
17358    #[doc(hidden)]
17359    impl crate::RequestBuilder for ListOperations {
17360        fn request_options(&mut self) -> &mut crate::RequestOptions {
17361            &mut self.0.options
17362        }
17363    }
17364
17365    /// The request builder for [UserLicenseService::get_operation][crate::client::UserLicenseService::get_operation] calls.
17366    ///
17367    /// # Example
17368    /// ```
17369    /// # use google_cloud_discoveryengine_v1::builder::user_license_service::GetOperation;
17370    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
17371    ///
17372    /// let builder = prepare_request_builder();
17373    /// let response = builder.send().await?;
17374    /// # Ok(()) }
17375    ///
17376    /// fn prepare_request_builder() -> GetOperation {
17377    ///   # panic!();
17378    ///   // ... details omitted ...
17379    /// }
17380    /// ```
17381    #[derive(Clone, Debug)]
17382    pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
17383
17384    impl GetOperation {
17385        pub(crate) fn new(
17386            stub: std::sync::Arc<dyn super::super::stub::dynamic::UserLicenseService>,
17387        ) -> Self {
17388            Self(RequestBuilder::new(stub))
17389        }
17390
17391        /// Sets the full request, replacing any prior values.
17392        pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
17393            mut self,
17394            v: V,
17395        ) -> Self {
17396            self.0.request = v.into();
17397            self
17398        }
17399
17400        /// Sets all the options, replacing any prior values.
17401        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
17402            self.0.options = v.into();
17403            self
17404        }
17405
17406        /// Sends the request.
17407        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
17408            (*self.0.stub)
17409                .get_operation(self.0.request, self.0.options)
17410                .await
17411                .map(crate::Response::into_body)
17412        }
17413
17414        /// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
17415        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
17416            self.0.request.name = v.into();
17417            self
17418        }
17419    }
17420
17421    #[doc(hidden)]
17422    impl crate::RequestBuilder for GetOperation {
17423        fn request_options(&mut self) -> &mut crate::RequestOptions {
17424            &mut self.0.options
17425        }
17426    }
17427
17428    /// The request builder for [UserLicenseService::cancel_operation][crate::client::UserLicenseService::cancel_operation] calls.
17429    ///
17430    /// # Example
17431    /// ```
17432    /// # use google_cloud_discoveryengine_v1::builder::user_license_service::CancelOperation;
17433    /// # async fn sample() -> google_cloud_discoveryengine_v1::Result<()> {
17434    ///
17435    /// let builder = prepare_request_builder();
17436    /// let response = builder.send().await?;
17437    /// # Ok(()) }
17438    ///
17439    /// fn prepare_request_builder() -> CancelOperation {
17440    ///   # panic!();
17441    ///   // ... details omitted ...
17442    /// }
17443    /// ```
17444    #[derive(Clone, Debug)]
17445    pub struct CancelOperation(
17446        RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
17447    );
17448
17449    impl CancelOperation {
17450        pub(crate) fn new(
17451            stub: std::sync::Arc<dyn super::super::stub::dynamic::UserLicenseService>,
17452        ) -> Self {
17453            Self(RequestBuilder::new(stub))
17454        }
17455
17456        /// Sets the full request, replacing any prior values.
17457        pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
17458            mut self,
17459            v: V,
17460        ) -> Self {
17461            self.0.request = v.into();
17462            self
17463        }
17464
17465        /// Sets all the options, replacing any prior values.
17466        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
17467            self.0.options = v.into();
17468            self
17469        }
17470
17471        /// Sends the request.
17472        pub async fn send(self) -> Result<()> {
17473            (*self.0.stub)
17474                .cancel_operation(self.0.request, self.0.options)
17475                .await
17476                .map(crate::Response::into_body)
17477        }
17478
17479        /// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::name].
17480        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
17481            self.0.request.name = v.into();
17482            self
17483        }
17484    }
17485
17486    #[doc(hidden)]
17487    impl crate::RequestBuilder for CancelOperation {
17488        fn request_options(&mut self) -> &mut crate::RequestOptions {
17489            &mut self.0.options
17490        }
17491    }
17492}