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() -> 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 =
36        gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
37
38    pub(crate) mod client {
39        use super::super::super::client::AssistantService;
40        pub struct Factory;
41        impl gax::client_builder::internal::ClientFactory for Factory {
42            type Client = AssistantService;
43            type Credentials = gaxi::options::Credentials;
44            async fn build(
45                self,
46                config: gaxi::options::ClientConfig,
47            ) -> gax::client_builder::Result<Self::Client> {
48                Self::Client::new(config).await
49            }
50        }
51    }
52
53    /// Common implementation for [crate::client::AssistantService] request builders.
54    #[derive(Clone, Debug)]
55    pub(crate) struct RequestBuilder<R: std::default::Default> {
56        stub: std::sync::Arc<dyn super::super::stub::dynamic::AssistantService>,
57        request: R,
58        options: gax::options::RequestOptions,
59    }
60
61    impl<R> RequestBuilder<R>
62    where
63        R: std::default::Default,
64    {
65        pub(crate) fn new(
66            stub: std::sync::Arc<dyn super::super::stub::dynamic::AssistantService>,
67        ) -> Self {
68            Self {
69                stub,
70                request: R::default(),
71                options: gax::options::RequestOptions::default(),
72            }
73        }
74    }
75
76    /// The request builder for [AssistantService::list_operations][crate::client::AssistantService::list_operations] calls.
77    ///
78    /// # Example
79    /// ```
80    /// # use google_cloud_discoveryengine_v1::builder::assistant_service::ListOperations;
81    /// # async fn sample() -> gax::Result<()> {
82    /// use gax::paginator::ItemPaginator;
83    ///
84    /// let builder = prepare_request_builder();
85    /// let mut items = builder.by_item();
86    /// while let Some(result) = items.next().await {
87    ///   let item = result?;
88    /// }
89    /// # Ok(()) }
90    ///
91    /// fn prepare_request_builder() -> ListOperations {
92    ///   # panic!();
93    ///   // ... details omitted ...
94    /// }
95    /// ```
96    #[derive(Clone, Debug)]
97    pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
98
99    impl ListOperations {
100        pub(crate) fn new(
101            stub: std::sync::Arc<dyn super::super::stub::dynamic::AssistantService>,
102        ) -> Self {
103            Self(RequestBuilder::new(stub))
104        }
105
106        /// Sets the full request, replacing any prior values.
107        pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
108            mut self,
109            v: V,
110        ) -> Self {
111            self.0.request = v.into();
112            self
113        }
114
115        /// Sets all the options, replacing any prior values.
116        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
117            self.0.options = v.into();
118            self
119        }
120
121        /// Sends the request.
122        pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
123            (*self.0.stub)
124                .list_operations(self.0.request, self.0.options)
125                .await
126                .map(gax::response::Response::into_body)
127        }
128
129        /// Streams each page in the collection.
130        pub fn by_page(
131            self,
132        ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
133        {
134            use std::clone::Clone;
135            let token = self.0.request.page_token.clone();
136            let execute = move |token: String| {
137                let mut builder = self.clone();
138                builder.0.request = builder.0.request.set_page_token(token);
139                builder.send()
140            };
141            gax::paginator::internal::new_paginator(token, execute)
142        }
143
144        /// Streams each item in the collection.
145        pub fn by_item(
146            self,
147        ) -> impl gax::paginator::ItemPaginator<
148            longrunning::model::ListOperationsResponse,
149            gax::error::Error,
150        > {
151            use gax::paginator::Paginator;
152            self.by_page().items()
153        }
154
155        /// Sets the value of [name][longrunning::model::ListOperationsRequest::name].
156        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
157            self.0.request.name = v.into();
158            self
159        }
160
161        /// Sets the value of [filter][longrunning::model::ListOperationsRequest::filter].
162        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
163            self.0.request.filter = v.into();
164            self
165        }
166
167        /// Sets the value of [page_size][longrunning::model::ListOperationsRequest::page_size].
168        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
169            self.0.request.page_size = v.into();
170            self
171        }
172
173        /// Sets the value of [page_token][longrunning::model::ListOperationsRequest::page_token].
174        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
175            self.0.request.page_token = v.into();
176            self
177        }
178
179        /// Sets the value of [return_partial_success][longrunning::model::ListOperationsRequest::return_partial_success].
180        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
181            self.0.request.return_partial_success = v.into();
182            self
183        }
184    }
185
186    #[doc(hidden)]
187    impl gax::options::internal::RequestBuilder for ListOperations {
188        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
189            &mut self.0.options
190        }
191    }
192
193    /// The request builder for [AssistantService::get_operation][crate::client::AssistantService::get_operation] calls.
194    ///
195    /// # Example
196    /// ```
197    /// # use google_cloud_discoveryengine_v1::builder::assistant_service::GetOperation;
198    /// # async fn sample() -> gax::Result<()> {
199    ///
200    /// let builder = prepare_request_builder();
201    /// let response = builder.send().await?;
202    /// # Ok(()) }
203    ///
204    /// fn prepare_request_builder() -> GetOperation {
205    ///   # panic!();
206    ///   // ... details omitted ...
207    /// }
208    /// ```
209    #[derive(Clone, Debug)]
210    pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
211
212    impl GetOperation {
213        pub(crate) fn new(
214            stub: std::sync::Arc<dyn super::super::stub::dynamic::AssistantService>,
215        ) -> Self {
216            Self(RequestBuilder::new(stub))
217        }
218
219        /// Sets the full request, replacing any prior values.
220        pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
221            mut self,
222            v: V,
223        ) -> Self {
224            self.0.request = v.into();
225            self
226        }
227
228        /// Sets all the options, replacing any prior values.
229        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
230            self.0.options = v.into();
231            self
232        }
233
234        /// Sends the request.
235        pub async fn send(self) -> Result<longrunning::model::Operation> {
236            (*self.0.stub)
237                .get_operation(self.0.request, self.0.options)
238                .await
239                .map(gax::response::Response::into_body)
240        }
241
242        /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
243        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
244            self.0.request.name = v.into();
245            self
246        }
247    }
248
249    #[doc(hidden)]
250    impl gax::options::internal::RequestBuilder for GetOperation {
251        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
252            &mut self.0.options
253        }
254    }
255
256    /// The request builder for [AssistantService::cancel_operation][crate::client::AssistantService::cancel_operation] calls.
257    ///
258    /// # Example
259    /// ```
260    /// # use google_cloud_discoveryengine_v1::builder::assistant_service::CancelOperation;
261    /// # async fn sample() -> gax::Result<()> {
262    ///
263    /// let builder = prepare_request_builder();
264    /// let response = builder.send().await?;
265    /// # Ok(()) }
266    ///
267    /// fn prepare_request_builder() -> CancelOperation {
268    ///   # panic!();
269    ///   // ... details omitted ...
270    /// }
271    /// ```
272    #[derive(Clone, Debug)]
273    pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
274
275    impl CancelOperation {
276        pub(crate) fn new(
277            stub: std::sync::Arc<dyn super::super::stub::dynamic::AssistantService>,
278        ) -> Self {
279            Self(RequestBuilder::new(stub))
280        }
281
282        /// Sets the full request, replacing any prior values.
283        pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
284            mut self,
285            v: V,
286        ) -> Self {
287            self.0.request = v.into();
288            self
289        }
290
291        /// Sets all the options, replacing any prior values.
292        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
293            self.0.options = v.into();
294            self
295        }
296
297        /// Sends the request.
298        pub async fn send(self) -> Result<()> {
299            (*self.0.stub)
300                .cancel_operation(self.0.request, self.0.options)
301                .await
302                .map(gax::response::Response::into_body)
303        }
304
305        /// Sets the value of [name][longrunning::model::CancelOperationRequest::name].
306        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
307            self.0.request.name = v.into();
308            self
309        }
310    }
311
312    #[doc(hidden)]
313    impl gax::options::internal::RequestBuilder for CancelOperation {
314        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
315            &mut self.0.options
316        }
317    }
318}
319
320#[cfg(feature = "cmek-config-service")]
321#[cfg_attr(docsrs, doc(cfg(feature = "cmek-config-service")))]
322pub mod cmek_config_service {
323    use crate::Result;
324
325    /// A builder for [CmekConfigService][crate::client::CmekConfigService].
326    ///
327    /// ```
328    /// # async fn sample() -> gax::client_builder::Result<()> {
329    /// # use google_cloud_discoveryengine_v1::*;
330    /// # use builder::cmek_config_service::ClientBuilder;
331    /// # use client::CmekConfigService;
332    /// let builder : ClientBuilder = CmekConfigService::builder();
333    /// let client = builder
334    ///     .with_endpoint("https://discoveryengine.googleapis.com")
335    ///     .build().await?;
336    /// # Ok(()) }
337    /// ```
338    pub type ClientBuilder =
339        gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
340
341    pub(crate) mod client {
342        use super::super::super::client::CmekConfigService;
343        pub struct Factory;
344        impl gax::client_builder::internal::ClientFactory for Factory {
345            type Client = CmekConfigService;
346            type Credentials = gaxi::options::Credentials;
347            async fn build(
348                self,
349                config: gaxi::options::ClientConfig,
350            ) -> gax::client_builder::Result<Self::Client> {
351                Self::Client::new(config).await
352            }
353        }
354    }
355
356    /// Common implementation for [crate::client::CmekConfigService] request builders.
357    #[derive(Clone, Debug)]
358    pub(crate) struct RequestBuilder<R: std::default::Default> {
359        stub: std::sync::Arc<dyn super::super::stub::dynamic::CmekConfigService>,
360        request: R,
361        options: gax::options::RequestOptions,
362    }
363
364    impl<R> RequestBuilder<R>
365    where
366        R: std::default::Default,
367    {
368        pub(crate) fn new(
369            stub: std::sync::Arc<dyn super::super::stub::dynamic::CmekConfigService>,
370        ) -> Self {
371            Self {
372                stub,
373                request: R::default(),
374                options: gax::options::RequestOptions::default(),
375            }
376        }
377    }
378
379    /// The request builder for [CmekConfigService::update_cmek_config][crate::client::CmekConfigService::update_cmek_config] calls.
380    ///
381    /// # Example
382    /// ```
383    /// # use google_cloud_discoveryengine_v1::builder::cmek_config_service::UpdateCmekConfig;
384    /// # async fn sample() -> gax::Result<()> {
385    /// use lro::Poller;
386    ///
387    /// let builder = prepare_request_builder();
388    /// let response = builder.poller().until_done().await?;
389    /// # Ok(()) }
390    ///
391    /// fn prepare_request_builder() -> UpdateCmekConfig {
392    ///   # panic!();
393    ///   // ... details omitted ...
394    /// }
395    /// ```
396    #[derive(Clone, Debug)]
397    pub struct UpdateCmekConfig(RequestBuilder<crate::model::UpdateCmekConfigRequest>);
398
399    impl UpdateCmekConfig {
400        pub(crate) fn new(
401            stub: std::sync::Arc<dyn super::super::stub::dynamic::CmekConfigService>,
402        ) -> Self {
403            Self(RequestBuilder::new(stub))
404        }
405
406        /// Sets the full request, replacing any prior values.
407        pub fn with_request<V: Into<crate::model::UpdateCmekConfigRequest>>(
408            mut self,
409            v: V,
410        ) -> Self {
411            self.0.request = v.into();
412            self
413        }
414
415        /// Sets all the options, replacing any prior values.
416        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
417            self.0.options = v.into();
418            self
419        }
420
421        /// Sends the request.
422        ///
423        /// # Long running operations
424        ///
425        /// This starts, but does not poll, a longrunning operation. More information
426        /// on [update_cmek_config][crate::client::CmekConfigService::update_cmek_config].
427        pub async fn send(self) -> Result<longrunning::model::Operation> {
428            (*self.0.stub)
429                .update_cmek_config(self.0.request, self.0.options)
430                .await
431                .map(gax::response::Response::into_body)
432        }
433
434        /// Creates a [Poller][lro::Poller] to work with `update_cmek_config`.
435        pub fn poller(
436            self,
437        ) -> impl lro::Poller<crate::model::CmekConfig, crate::model::UpdateCmekConfigMetadata>
438        {
439            type Operation = lro::internal::Operation<
440                crate::model::CmekConfig,
441                crate::model::UpdateCmekConfigMetadata,
442            >;
443            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
444            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
445
446            let stub = self.0.stub.clone();
447            let mut options = self.0.options.clone();
448            options.set_retry_policy(gax::retry_policy::NeverRetry);
449            let query = move |name| {
450                let stub = stub.clone();
451                let options = options.clone();
452                async {
453                    let op = GetOperation::new(stub)
454                        .set_name(name)
455                        .with_options(options)
456                        .send()
457                        .await?;
458                    Ok(Operation::new(op))
459                }
460            };
461
462            let start = move || async {
463                let op = self.send().await?;
464                Ok(Operation::new(op))
465            };
466
467            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
468        }
469
470        /// Sets the value of [config][crate::model::UpdateCmekConfigRequest::config].
471        ///
472        /// This is a **required** field for requests.
473        pub fn set_config<T>(mut self, v: T) -> Self
474        where
475            T: std::convert::Into<crate::model::CmekConfig>,
476        {
477            self.0.request.config = std::option::Option::Some(v.into());
478            self
479        }
480
481        /// Sets or clears the value of [config][crate::model::UpdateCmekConfigRequest::config].
482        ///
483        /// This is a **required** field for requests.
484        pub fn set_or_clear_config<T>(mut self, v: std::option::Option<T>) -> Self
485        where
486            T: std::convert::Into<crate::model::CmekConfig>,
487        {
488            self.0.request.config = v.map(|x| x.into());
489            self
490        }
491
492        /// Sets the value of [set_default][crate::model::UpdateCmekConfigRequest::set_default].
493        pub fn set_set_default<T: Into<bool>>(mut self, v: T) -> Self {
494            self.0.request.set_default = v.into();
495            self
496        }
497    }
498
499    #[doc(hidden)]
500    impl gax::options::internal::RequestBuilder for UpdateCmekConfig {
501        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
502            &mut self.0.options
503        }
504    }
505
506    /// The request builder for [CmekConfigService::get_cmek_config][crate::client::CmekConfigService::get_cmek_config] calls.
507    ///
508    /// # Example
509    /// ```
510    /// # use google_cloud_discoveryengine_v1::builder::cmek_config_service::GetCmekConfig;
511    /// # async fn sample() -> gax::Result<()> {
512    ///
513    /// let builder = prepare_request_builder();
514    /// let response = builder.send().await?;
515    /// # Ok(()) }
516    ///
517    /// fn prepare_request_builder() -> GetCmekConfig {
518    ///   # panic!();
519    ///   // ... details omitted ...
520    /// }
521    /// ```
522    #[derive(Clone, Debug)]
523    pub struct GetCmekConfig(RequestBuilder<crate::model::GetCmekConfigRequest>);
524
525    impl GetCmekConfig {
526        pub(crate) fn new(
527            stub: std::sync::Arc<dyn super::super::stub::dynamic::CmekConfigService>,
528        ) -> Self {
529            Self(RequestBuilder::new(stub))
530        }
531
532        /// Sets the full request, replacing any prior values.
533        pub fn with_request<V: Into<crate::model::GetCmekConfigRequest>>(mut self, v: V) -> Self {
534            self.0.request = v.into();
535            self
536        }
537
538        /// Sets all the options, replacing any prior values.
539        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
540            self.0.options = v.into();
541            self
542        }
543
544        /// Sends the request.
545        pub async fn send(self) -> Result<crate::model::CmekConfig> {
546            (*self.0.stub)
547                .get_cmek_config(self.0.request, self.0.options)
548                .await
549                .map(gax::response::Response::into_body)
550        }
551
552        /// Sets the value of [name][crate::model::GetCmekConfigRequest::name].
553        ///
554        /// This is a **required** field for requests.
555        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
556            self.0.request.name = v.into();
557            self
558        }
559    }
560
561    #[doc(hidden)]
562    impl gax::options::internal::RequestBuilder for GetCmekConfig {
563        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
564            &mut self.0.options
565        }
566    }
567
568    /// The request builder for [CmekConfigService::list_cmek_configs][crate::client::CmekConfigService::list_cmek_configs] calls.
569    ///
570    /// # Example
571    /// ```
572    /// # use google_cloud_discoveryengine_v1::builder::cmek_config_service::ListCmekConfigs;
573    /// # async fn sample() -> gax::Result<()> {
574    ///
575    /// let builder = prepare_request_builder();
576    /// let response = builder.send().await?;
577    /// # Ok(()) }
578    ///
579    /// fn prepare_request_builder() -> ListCmekConfigs {
580    ///   # panic!();
581    ///   // ... details omitted ...
582    /// }
583    /// ```
584    #[derive(Clone, Debug)]
585    pub struct ListCmekConfigs(RequestBuilder<crate::model::ListCmekConfigsRequest>);
586
587    impl ListCmekConfigs {
588        pub(crate) fn new(
589            stub: std::sync::Arc<dyn super::super::stub::dynamic::CmekConfigService>,
590        ) -> Self {
591            Self(RequestBuilder::new(stub))
592        }
593
594        /// Sets the full request, replacing any prior values.
595        pub fn with_request<V: Into<crate::model::ListCmekConfigsRequest>>(mut self, v: V) -> Self {
596            self.0.request = v.into();
597            self
598        }
599
600        /// Sets all the options, replacing any prior values.
601        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
602            self.0.options = v.into();
603            self
604        }
605
606        /// Sends the request.
607        pub async fn send(self) -> Result<crate::model::ListCmekConfigsResponse> {
608            (*self.0.stub)
609                .list_cmek_configs(self.0.request, self.0.options)
610                .await
611                .map(gax::response::Response::into_body)
612        }
613
614        /// Sets the value of [parent][crate::model::ListCmekConfigsRequest::parent].
615        ///
616        /// This is a **required** field for requests.
617        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
618            self.0.request.parent = v.into();
619            self
620        }
621    }
622
623    #[doc(hidden)]
624    impl gax::options::internal::RequestBuilder for ListCmekConfigs {
625        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
626            &mut self.0.options
627        }
628    }
629
630    /// The request builder for [CmekConfigService::delete_cmek_config][crate::client::CmekConfigService::delete_cmek_config] calls.
631    ///
632    /// # Example
633    /// ```
634    /// # use google_cloud_discoveryengine_v1::builder::cmek_config_service::DeleteCmekConfig;
635    /// # async fn sample() -> gax::Result<()> {
636    /// use lro::Poller;
637    ///
638    /// let builder = prepare_request_builder();
639    /// let response = builder.poller().until_done().await?;
640    /// # Ok(()) }
641    ///
642    /// fn prepare_request_builder() -> DeleteCmekConfig {
643    ///   # panic!();
644    ///   // ... details omitted ...
645    /// }
646    /// ```
647    #[derive(Clone, Debug)]
648    pub struct DeleteCmekConfig(RequestBuilder<crate::model::DeleteCmekConfigRequest>);
649
650    impl DeleteCmekConfig {
651        pub(crate) fn new(
652            stub: std::sync::Arc<dyn super::super::stub::dynamic::CmekConfigService>,
653        ) -> Self {
654            Self(RequestBuilder::new(stub))
655        }
656
657        /// Sets the full request, replacing any prior values.
658        pub fn with_request<V: Into<crate::model::DeleteCmekConfigRequest>>(
659            mut self,
660            v: V,
661        ) -> Self {
662            self.0.request = v.into();
663            self
664        }
665
666        /// Sets all the options, replacing any prior values.
667        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
668            self.0.options = v.into();
669            self
670        }
671
672        /// Sends the request.
673        ///
674        /// # Long running operations
675        ///
676        /// This starts, but does not poll, a longrunning operation. More information
677        /// on [delete_cmek_config][crate::client::CmekConfigService::delete_cmek_config].
678        pub async fn send(self) -> Result<longrunning::model::Operation> {
679            (*self.0.stub)
680                .delete_cmek_config(self.0.request, self.0.options)
681                .await
682                .map(gax::response::Response::into_body)
683        }
684
685        /// Creates a [Poller][lro::Poller] to work with `delete_cmek_config`.
686        pub fn poller(self) -> impl lro::Poller<(), crate::model::DeleteCmekConfigMetadata> {
687            type Operation =
688                lro::internal::Operation<wkt::Empty, crate::model::DeleteCmekConfigMetadata>;
689            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
690            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
691
692            let stub = self.0.stub.clone();
693            let mut options = self.0.options.clone();
694            options.set_retry_policy(gax::retry_policy::NeverRetry);
695            let query = move |name| {
696                let stub = stub.clone();
697                let options = options.clone();
698                async {
699                    let op = GetOperation::new(stub)
700                        .set_name(name)
701                        .with_options(options)
702                        .send()
703                        .await?;
704                    Ok(Operation::new(op))
705                }
706            };
707
708            let start = move || async {
709                let op = self.send().await?;
710                Ok(Operation::new(op))
711            };
712
713            lro::internal::new_unit_response_poller(
714                polling_error_policy,
715                polling_backoff_policy,
716                start,
717                query,
718            )
719        }
720
721        /// Sets the value of [name][crate::model::DeleteCmekConfigRequest::name].
722        ///
723        /// This is a **required** field for requests.
724        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
725            self.0.request.name = v.into();
726            self
727        }
728    }
729
730    #[doc(hidden)]
731    impl gax::options::internal::RequestBuilder for DeleteCmekConfig {
732        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
733            &mut self.0.options
734        }
735    }
736
737    /// The request builder for [CmekConfigService::list_operations][crate::client::CmekConfigService::list_operations] calls.
738    ///
739    /// # Example
740    /// ```
741    /// # use google_cloud_discoveryengine_v1::builder::cmek_config_service::ListOperations;
742    /// # async fn sample() -> gax::Result<()> {
743    /// use gax::paginator::ItemPaginator;
744    ///
745    /// let builder = prepare_request_builder();
746    /// let mut items = builder.by_item();
747    /// while let Some(result) = items.next().await {
748    ///   let item = result?;
749    /// }
750    /// # Ok(()) }
751    ///
752    /// fn prepare_request_builder() -> ListOperations {
753    ///   # panic!();
754    ///   // ... details omitted ...
755    /// }
756    /// ```
757    #[derive(Clone, Debug)]
758    pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
759
760    impl ListOperations {
761        pub(crate) fn new(
762            stub: std::sync::Arc<dyn super::super::stub::dynamic::CmekConfigService>,
763        ) -> Self {
764            Self(RequestBuilder::new(stub))
765        }
766
767        /// Sets the full request, replacing any prior values.
768        pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
769            mut self,
770            v: V,
771        ) -> Self {
772            self.0.request = v.into();
773            self
774        }
775
776        /// Sets all the options, replacing any prior values.
777        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
778            self.0.options = v.into();
779            self
780        }
781
782        /// Sends the request.
783        pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
784            (*self.0.stub)
785                .list_operations(self.0.request, self.0.options)
786                .await
787                .map(gax::response::Response::into_body)
788        }
789
790        /// Streams each page in the collection.
791        pub fn by_page(
792            self,
793        ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
794        {
795            use std::clone::Clone;
796            let token = self.0.request.page_token.clone();
797            let execute = move |token: String| {
798                let mut builder = self.clone();
799                builder.0.request = builder.0.request.set_page_token(token);
800                builder.send()
801            };
802            gax::paginator::internal::new_paginator(token, execute)
803        }
804
805        /// Streams each item in the collection.
806        pub fn by_item(
807            self,
808        ) -> impl gax::paginator::ItemPaginator<
809            longrunning::model::ListOperationsResponse,
810            gax::error::Error,
811        > {
812            use gax::paginator::Paginator;
813            self.by_page().items()
814        }
815
816        /// Sets the value of [name][longrunning::model::ListOperationsRequest::name].
817        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
818            self.0.request.name = v.into();
819            self
820        }
821
822        /// Sets the value of [filter][longrunning::model::ListOperationsRequest::filter].
823        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
824            self.0.request.filter = v.into();
825            self
826        }
827
828        /// Sets the value of [page_size][longrunning::model::ListOperationsRequest::page_size].
829        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
830            self.0.request.page_size = v.into();
831            self
832        }
833
834        /// Sets the value of [page_token][longrunning::model::ListOperationsRequest::page_token].
835        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
836            self.0.request.page_token = v.into();
837            self
838        }
839
840        /// Sets the value of [return_partial_success][longrunning::model::ListOperationsRequest::return_partial_success].
841        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
842            self.0.request.return_partial_success = v.into();
843            self
844        }
845    }
846
847    #[doc(hidden)]
848    impl gax::options::internal::RequestBuilder for ListOperations {
849        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
850            &mut self.0.options
851        }
852    }
853
854    /// The request builder for [CmekConfigService::get_operation][crate::client::CmekConfigService::get_operation] calls.
855    ///
856    /// # Example
857    /// ```
858    /// # use google_cloud_discoveryengine_v1::builder::cmek_config_service::GetOperation;
859    /// # async fn sample() -> gax::Result<()> {
860    ///
861    /// let builder = prepare_request_builder();
862    /// let response = builder.send().await?;
863    /// # Ok(()) }
864    ///
865    /// fn prepare_request_builder() -> GetOperation {
866    ///   # panic!();
867    ///   // ... details omitted ...
868    /// }
869    /// ```
870    #[derive(Clone, Debug)]
871    pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
872
873    impl GetOperation {
874        pub(crate) fn new(
875            stub: std::sync::Arc<dyn super::super::stub::dynamic::CmekConfigService>,
876        ) -> Self {
877            Self(RequestBuilder::new(stub))
878        }
879
880        /// Sets the full request, replacing any prior values.
881        pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
882            mut self,
883            v: V,
884        ) -> Self {
885            self.0.request = v.into();
886            self
887        }
888
889        /// Sets all the options, replacing any prior values.
890        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
891            self.0.options = v.into();
892            self
893        }
894
895        /// Sends the request.
896        pub async fn send(self) -> Result<longrunning::model::Operation> {
897            (*self.0.stub)
898                .get_operation(self.0.request, self.0.options)
899                .await
900                .map(gax::response::Response::into_body)
901        }
902
903        /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
904        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
905            self.0.request.name = v.into();
906            self
907        }
908    }
909
910    #[doc(hidden)]
911    impl gax::options::internal::RequestBuilder for GetOperation {
912        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
913            &mut self.0.options
914        }
915    }
916
917    /// The request builder for [CmekConfigService::cancel_operation][crate::client::CmekConfigService::cancel_operation] calls.
918    ///
919    /// # Example
920    /// ```
921    /// # use google_cloud_discoveryengine_v1::builder::cmek_config_service::CancelOperation;
922    /// # async fn sample() -> gax::Result<()> {
923    ///
924    /// let builder = prepare_request_builder();
925    /// let response = builder.send().await?;
926    /// # Ok(()) }
927    ///
928    /// fn prepare_request_builder() -> CancelOperation {
929    ///   # panic!();
930    ///   // ... details omitted ...
931    /// }
932    /// ```
933    #[derive(Clone, Debug)]
934    pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
935
936    impl CancelOperation {
937        pub(crate) fn new(
938            stub: std::sync::Arc<dyn super::super::stub::dynamic::CmekConfigService>,
939        ) -> Self {
940            Self(RequestBuilder::new(stub))
941        }
942
943        /// Sets the full request, replacing any prior values.
944        pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
945            mut self,
946            v: V,
947        ) -> Self {
948            self.0.request = v.into();
949            self
950        }
951
952        /// Sets all the options, replacing any prior values.
953        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
954            self.0.options = v.into();
955            self
956        }
957
958        /// Sends the request.
959        pub async fn send(self) -> Result<()> {
960            (*self.0.stub)
961                .cancel_operation(self.0.request, self.0.options)
962                .await
963                .map(gax::response::Response::into_body)
964        }
965
966        /// Sets the value of [name][longrunning::model::CancelOperationRequest::name].
967        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
968            self.0.request.name = v.into();
969            self
970        }
971    }
972
973    #[doc(hidden)]
974    impl gax::options::internal::RequestBuilder for CancelOperation {
975        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
976            &mut self.0.options
977        }
978    }
979}
980
981#[cfg(feature = "completion-service")]
982#[cfg_attr(docsrs, doc(cfg(feature = "completion-service")))]
983pub mod completion_service {
984    use crate::Result;
985
986    /// A builder for [CompletionService][crate::client::CompletionService].
987    ///
988    /// ```
989    /// # async fn sample() -> gax::client_builder::Result<()> {
990    /// # use google_cloud_discoveryengine_v1::*;
991    /// # use builder::completion_service::ClientBuilder;
992    /// # use client::CompletionService;
993    /// let builder : ClientBuilder = CompletionService::builder();
994    /// let client = builder
995    ///     .with_endpoint("https://discoveryengine.googleapis.com")
996    ///     .build().await?;
997    /// # Ok(()) }
998    /// ```
999    pub type ClientBuilder =
1000        gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
1001
1002    pub(crate) mod client {
1003        use super::super::super::client::CompletionService;
1004        pub struct Factory;
1005        impl gax::client_builder::internal::ClientFactory for Factory {
1006            type Client = CompletionService;
1007            type Credentials = gaxi::options::Credentials;
1008            async fn build(
1009                self,
1010                config: gaxi::options::ClientConfig,
1011            ) -> gax::client_builder::Result<Self::Client> {
1012                Self::Client::new(config).await
1013            }
1014        }
1015    }
1016
1017    /// Common implementation for [crate::client::CompletionService] request builders.
1018    #[derive(Clone, Debug)]
1019    pub(crate) struct RequestBuilder<R: std::default::Default> {
1020        stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1021        request: R,
1022        options: gax::options::RequestOptions,
1023    }
1024
1025    impl<R> RequestBuilder<R>
1026    where
1027        R: std::default::Default,
1028    {
1029        pub(crate) fn new(
1030            stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1031        ) -> Self {
1032            Self {
1033                stub,
1034                request: R::default(),
1035                options: gax::options::RequestOptions::default(),
1036            }
1037        }
1038    }
1039
1040    /// The request builder for [CompletionService::complete_query][crate::client::CompletionService::complete_query] calls.
1041    ///
1042    /// # Example
1043    /// ```
1044    /// # use google_cloud_discoveryengine_v1::builder::completion_service::CompleteQuery;
1045    /// # async fn sample() -> gax::Result<()> {
1046    ///
1047    /// let builder = prepare_request_builder();
1048    /// let response = builder.send().await?;
1049    /// # Ok(()) }
1050    ///
1051    /// fn prepare_request_builder() -> CompleteQuery {
1052    ///   # panic!();
1053    ///   // ... details omitted ...
1054    /// }
1055    /// ```
1056    #[derive(Clone, Debug)]
1057    pub struct CompleteQuery(RequestBuilder<crate::model::CompleteQueryRequest>);
1058
1059    impl CompleteQuery {
1060        pub(crate) fn new(
1061            stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1062        ) -> Self {
1063            Self(RequestBuilder::new(stub))
1064        }
1065
1066        /// Sets the full request, replacing any prior values.
1067        pub fn with_request<V: Into<crate::model::CompleteQueryRequest>>(mut self, v: V) -> Self {
1068            self.0.request = v.into();
1069            self
1070        }
1071
1072        /// Sets all the options, replacing any prior values.
1073        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1074            self.0.options = v.into();
1075            self
1076        }
1077
1078        /// Sends the request.
1079        pub async fn send(self) -> Result<crate::model::CompleteQueryResponse> {
1080            (*self.0.stub)
1081                .complete_query(self.0.request, self.0.options)
1082                .await
1083                .map(gax::response::Response::into_body)
1084        }
1085
1086        /// Sets the value of [data_store][crate::model::CompleteQueryRequest::data_store].
1087        ///
1088        /// This is a **required** field for requests.
1089        pub fn set_data_store<T: Into<std::string::String>>(mut self, v: T) -> Self {
1090            self.0.request.data_store = v.into();
1091            self
1092        }
1093
1094        /// Sets the value of [query][crate::model::CompleteQueryRequest::query].
1095        ///
1096        /// This is a **required** field for requests.
1097        pub fn set_query<T: Into<std::string::String>>(mut self, v: T) -> Self {
1098            self.0.request.query = v.into();
1099            self
1100        }
1101
1102        /// Sets the value of [query_model][crate::model::CompleteQueryRequest::query_model].
1103        pub fn set_query_model<T: Into<std::string::String>>(mut self, v: T) -> Self {
1104            self.0.request.query_model = v.into();
1105            self
1106        }
1107
1108        /// Sets the value of [user_pseudo_id][crate::model::CompleteQueryRequest::user_pseudo_id].
1109        pub fn set_user_pseudo_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1110            self.0.request.user_pseudo_id = v.into();
1111            self
1112        }
1113
1114        /// Sets the value of [include_tail_suggestions][crate::model::CompleteQueryRequest::include_tail_suggestions].
1115        pub fn set_include_tail_suggestions<T: Into<bool>>(mut self, v: T) -> Self {
1116            self.0.request.include_tail_suggestions = v.into();
1117            self
1118        }
1119    }
1120
1121    #[doc(hidden)]
1122    impl gax::options::internal::RequestBuilder for CompleteQuery {
1123        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1124            &mut self.0.options
1125        }
1126    }
1127
1128    /// The request builder for [CompletionService::import_suggestion_deny_list_entries][crate::client::CompletionService::import_suggestion_deny_list_entries] calls.
1129    ///
1130    /// # Example
1131    /// ```
1132    /// # use google_cloud_discoveryengine_v1::builder::completion_service::ImportSuggestionDenyListEntries;
1133    /// # async fn sample() -> gax::Result<()> {
1134    /// use lro::Poller;
1135    ///
1136    /// let builder = prepare_request_builder();
1137    /// let response = builder.poller().until_done().await?;
1138    /// # Ok(()) }
1139    ///
1140    /// fn prepare_request_builder() -> ImportSuggestionDenyListEntries {
1141    ///   # panic!();
1142    ///   // ... details omitted ...
1143    /// }
1144    /// ```
1145    #[derive(Clone, Debug)]
1146    pub struct ImportSuggestionDenyListEntries(
1147        RequestBuilder<crate::model::ImportSuggestionDenyListEntriesRequest>,
1148    );
1149
1150    impl ImportSuggestionDenyListEntries {
1151        pub(crate) fn new(
1152            stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1153        ) -> Self {
1154            Self(RequestBuilder::new(stub))
1155        }
1156
1157        /// Sets the full request, replacing any prior values.
1158        pub fn with_request<V: Into<crate::model::ImportSuggestionDenyListEntriesRequest>>(
1159            mut self,
1160            v: V,
1161        ) -> Self {
1162            self.0.request = v.into();
1163            self
1164        }
1165
1166        /// Sets all the options, replacing any prior values.
1167        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1168            self.0.options = v.into();
1169            self
1170        }
1171
1172        /// Sends the request.
1173        ///
1174        /// # Long running operations
1175        ///
1176        /// This starts, but does not poll, a longrunning operation. More information
1177        /// on [import_suggestion_deny_list_entries][crate::client::CompletionService::import_suggestion_deny_list_entries].
1178        pub async fn send(self) -> Result<longrunning::model::Operation> {
1179            (*self.0.stub)
1180                .import_suggestion_deny_list_entries(self.0.request, self.0.options)
1181                .await
1182                .map(gax::response::Response::into_body)
1183        }
1184
1185        /// Creates a [Poller][lro::Poller] to work with `import_suggestion_deny_list_entries`.
1186        pub fn poller(
1187            self,
1188        ) -> impl lro::Poller<
1189            crate::model::ImportSuggestionDenyListEntriesResponse,
1190            crate::model::ImportSuggestionDenyListEntriesMetadata,
1191        > {
1192            type Operation = lro::internal::Operation<
1193                crate::model::ImportSuggestionDenyListEntriesResponse,
1194                crate::model::ImportSuggestionDenyListEntriesMetadata,
1195            >;
1196            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1197            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1198
1199            let stub = self.0.stub.clone();
1200            let mut options = self.0.options.clone();
1201            options.set_retry_policy(gax::retry_policy::NeverRetry);
1202            let query = move |name| {
1203                let stub = stub.clone();
1204                let options = options.clone();
1205                async {
1206                    let op = GetOperation::new(stub)
1207                        .set_name(name)
1208                        .with_options(options)
1209                        .send()
1210                        .await?;
1211                    Ok(Operation::new(op))
1212                }
1213            };
1214
1215            let start = move || async {
1216                let op = self.send().await?;
1217                Ok(Operation::new(op))
1218            };
1219
1220            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
1221        }
1222
1223        /// Sets the value of [parent][crate::model::ImportSuggestionDenyListEntriesRequest::parent].
1224        ///
1225        /// This is a **required** field for requests.
1226        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1227            self.0.request.parent = v.into();
1228            self
1229        }
1230
1231        /// Sets the value of [source][crate::model::ImportSuggestionDenyListEntriesRequest::source].
1232        ///
1233        /// Note that all the setters affecting `source` are
1234        /// mutually exclusive.
1235        pub fn set_source<
1236            T: Into<Option<crate::model::import_suggestion_deny_list_entries_request::Source>>,
1237        >(
1238            mut self,
1239            v: T,
1240        ) -> Self {
1241            self.0.request.source = v.into();
1242            self
1243        }
1244
1245        /// Sets the value of [source][crate::model::ImportSuggestionDenyListEntriesRequest::source]
1246        /// to hold a `InlineSource`.
1247        ///
1248        /// Note that all the setters affecting `source` are
1249        /// mutually exclusive.
1250        pub fn set_inline_source<
1251            T: std::convert::Into<
1252                    std::boxed::Box<
1253                        crate::model::import_suggestion_deny_list_entries_request::InlineSource,
1254                    >,
1255                >,
1256        >(
1257            mut self,
1258            v: T,
1259        ) -> Self {
1260            self.0.request = self.0.request.set_inline_source(v);
1261            self
1262        }
1263
1264        /// Sets the value of [source][crate::model::ImportSuggestionDenyListEntriesRequest::source]
1265        /// to hold a `GcsSource`.
1266        ///
1267        /// Note that all the setters affecting `source` are
1268        /// mutually exclusive.
1269        pub fn set_gcs_source<T: std::convert::Into<std::boxed::Box<crate::model::GcsSource>>>(
1270            mut self,
1271            v: T,
1272        ) -> Self {
1273            self.0.request = self.0.request.set_gcs_source(v);
1274            self
1275        }
1276    }
1277
1278    #[doc(hidden)]
1279    impl gax::options::internal::RequestBuilder for ImportSuggestionDenyListEntries {
1280        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1281            &mut self.0.options
1282        }
1283    }
1284
1285    /// The request builder for [CompletionService::purge_suggestion_deny_list_entries][crate::client::CompletionService::purge_suggestion_deny_list_entries] calls.
1286    ///
1287    /// # Example
1288    /// ```
1289    /// # use google_cloud_discoveryengine_v1::builder::completion_service::PurgeSuggestionDenyListEntries;
1290    /// # async fn sample() -> gax::Result<()> {
1291    /// use lro::Poller;
1292    ///
1293    /// let builder = prepare_request_builder();
1294    /// let response = builder.poller().until_done().await?;
1295    /// # Ok(()) }
1296    ///
1297    /// fn prepare_request_builder() -> PurgeSuggestionDenyListEntries {
1298    ///   # panic!();
1299    ///   // ... details omitted ...
1300    /// }
1301    /// ```
1302    #[derive(Clone, Debug)]
1303    pub struct PurgeSuggestionDenyListEntries(
1304        RequestBuilder<crate::model::PurgeSuggestionDenyListEntriesRequest>,
1305    );
1306
1307    impl PurgeSuggestionDenyListEntries {
1308        pub(crate) fn new(
1309            stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1310        ) -> Self {
1311            Self(RequestBuilder::new(stub))
1312        }
1313
1314        /// Sets the full request, replacing any prior values.
1315        pub fn with_request<V: Into<crate::model::PurgeSuggestionDenyListEntriesRequest>>(
1316            mut self,
1317            v: V,
1318        ) -> Self {
1319            self.0.request = v.into();
1320            self
1321        }
1322
1323        /// Sets all the options, replacing any prior values.
1324        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1325            self.0.options = v.into();
1326            self
1327        }
1328
1329        /// Sends the request.
1330        ///
1331        /// # Long running operations
1332        ///
1333        /// This starts, but does not poll, a longrunning operation. More information
1334        /// on [purge_suggestion_deny_list_entries][crate::client::CompletionService::purge_suggestion_deny_list_entries].
1335        pub async fn send(self) -> Result<longrunning::model::Operation> {
1336            (*self.0.stub)
1337                .purge_suggestion_deny_list_entries(self.0.request, self.0.options)
1338                .await
1339                .map(gax::response::Response::into_body)
1340        }
1341
1342        /// Creates a [Poller][lro::Poller] to work with `purge_suggestion_deny_list_entries`.
1343        pub fn poller(
1344            self,
1345        ) -> impl lro::Poller<
1346            crate::model::PurgeSuggestionDenyListEntriesResponse,
1347            crate::model::PurgeSuggestionDenyListEntriesMetadata,
1348        > {
1349            type Operation = lro::internal::Operation<
1350                crate::model::PurgeSuggestionDenyListEntriesResponse,
1351                crate::model::PurgeSuggestionDenyListEntriesMetadata,
1352            >;
1353            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1354            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1355
1356            let stub = self.0.stub.clone();
1357            let mut options = self.0.options.clone();
1358            options.set_retry_policy(gax::retry_policy::NeverRetry);
1359            let query = move |name| {
1360                let stub = stub.clone();
1361                let options = options.clone();
1362                async {
1363                    let op = GetOperation::new(stub)
1364                        .set_name(name)
1365                        .with_options(options)
1366                        .send()
1367                        .await?;
1368                    Ok(Operation::new(op))
1369                }
1370            };
1371
1372            let start = move || async {
1373                let op = self.send().await?;
1374                Ok(Operation::new(op))
1375            };
1376
1377            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
1378        }
1379
1380        /// Sets the value of [parent][crate::model::PurgeSuggestionDenyListEntriesRequest::parent].
1381        ///
1382        /// This is a **required** field for requests.
1383        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1384            self.0.request.parent = v.into();
1385            self
1386        }
1387    }
1388
1389    #[doc(hidden)]
1390    impl gax::options::internal::RequestBuilder for PurgeSuggestionDenyListEntries {
1391        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1392            &mut self.0.options
1393        }
1394    }
1395
1396    /// The request builder for [CompletionService::import_completion_suggestions][crate::client::CompletionService::import_completion_suggestions] calls.
1397    ///
1398    /// # Example
1399    /// ```
1400    /// # use google_cloud_discoveryengine_v1::builder::completion_service::ImportCompletionSuggestions;
1401    /// # async fn sample() -> gax::Result<()> {
1402    /// use lro::Poller;
1403    ///
1404    /// let builder = prepare_request_builder();
1405    /// let response = builder.poller().until_done().await?;
1406    /// # Ok(()) }
1407    ///
1408    /// fn prepare_request_builder() -> ImportCompletionSuggestions {
1409    ///   # panic!();
1410    ///   // ... details omitted ...
1411    /// }
1412    /// ```
1413    #[derive(Clone, Debug)]
1414    pub struct ImportCompletionSuggestions(
1415        RequestBuilder<crate::model::ImportCompletionSuggestionsRequest>,
1416    );
1417
1418    impl ImportCompletionSuggestions {
1419        pub(crate) fn new(
1420            stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1421        ) -> Self {
1422            Self(RequestBuilder::new(stub))
1423        }
1424
1425        /// Sets the full request, replacing any prior values.
1426        pub fn with_request<V: Into<crate::model::ImportCompletionSuggestionsRequest>>(
1427            mut self,
1428            v: V,
1429        ) -> Self {
1430            self.0.request = v.into();
1431            self
1432        }
1433
1434        /// Sets all the options, replacing any prior values.
1435        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1436            self.0.options = v.into();
1437            self
1438        }
1439
1440        /// Sends the request.
1441        ///
1442        /// # Long running operations
1443        ///
1444        /// This starts, but does not poll, a longrunning operation. More information
1445        /// on [import_completion_suggestions][crate::client::CompletionService::import_completion_suggestions].
1446        pub async fn send(self) -> Result<longrunning::model::Operation> {
1447            (*self.0.stub)
1448                .import_completion_suggestions(self.0.request, self.0.options)
1449                .await
1450                .map(gax::response::Response::into_body)
1451        }
1452
1453        /// Creates a [Poller][lro::Poller] to work with `import_completion_suggestions`.
1454        pub fn poller(
1455            self,
1456        ) -> impl lro::Poller<
1457            crate::model::ImportCompletionSuggestionsResponse,
1458            crate::model::ImportCompletionSuggestionsMetadata,
1459        > {
1460            type Operation = lro::internal::Operation<
1461                crate::model::ImportCompletionSuggestionsResponse,
1462                crate::model::ImportCompletionSuggestionsMetadata,
1463            >;
1464            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1465            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1466
1467            let stub = self.0.stub.clone();
1468            let mut options = self.0.options.clone();
1469            options.set_retry_policy(gax::retry_policy::NeverRetry);
1470            let query = move |name| {
1471                let stub = stub.clone();
1472                let options = options.clone();
1473                async {
1474                    let op = GetOperation::new(stub)
1475                        .set_name(name)
1476                        .with_options(options)
1477                        .send()
1478                        .await?;
1479                    Ok(Operation::new(op))
1480                }
1481            };
1482
1483            let start = move || async {
1484                let op = self.send().await?;
1485                Ok(Operation::new(op))
1486            };
1487
1488            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
1489        }
1490
1491        /// Sets the value of [parent][crate::model::ImportCompletionSuggestionsRequest::parent].
1492        ///
1493        /// This is a **required** field for requests.
1494        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1495            self.0.request.parent = v.into();
1496            self
1497        }
1498
1499        /// Sets the value of [error_config][crate::model::ImportCompletionSuggestionsRequest::error_config].
1500        pub fn set_error_config<T>(mut self, v: T) -> Self
1501        where
1502            T: std::convert::Into<crate::model::ImportErrorConfig>,
1503        {
1504            self.0.request.error_config = std::option::Option::Some(v.into());
1505            self
1506        }
1507
1508        /// Sets or clears the value of [error_config][crate::model::ImportCompletionSuggestionsRequest::error_config].
1509        pub fn set_or_clear_error_config<T>(mut self, v: std::option::Option<T>) -> Self
1510        where
1511            T: std::convert::Into<crate::model::ImportErrorConfig>,
1512        {
1513            self.0.request.error_config = v.map(|x| x.into());
1514            self
1515        }
1516
1517        /// Sets the value of [source][crate::model::ImportCompletionSuggestionsRequest::source].
1518        ///
1519        /// Note that all the setters affecting `source` are
1520        /// mutually exclusive.
1521        pub fn set_source<
1522            T: Into<Option<crate::model::import_completion_suggestions_request::Source>>,
1523        >(
1524            mut self,
1525            v: T,
1526        ) -> Self {
1527            self.0.request.source = v.into();
1528            self
1529        }
1530
1531        /// Sets the value of [source][crate::model::ImportCompletionSuggestionsRequest::source]
1532        /// to hold a `InlineSource`.
1533        ///
1534        /// Note that all the setters affecting `source` are
1535        /// mutually exclusive.
1536        pub fn set_inline_source<
1537            T: std::convert::Into<
1538                    std::boxed::Box<
1539                        crate::model::import_completion_suggestions_request::InlineSource,
1540                    >,
1541                >,
1542        >(
1543            mut self,
1544            v: T,
1545        ) -> Self {
1546            self.0.request = self.0.request.set_inline_source(v);
1547            self
1548        }
1549
1550        /// Sets the value of [source][crate::model::ImportCompletionSuggestionsRequest::source]
1551        /// to hold a `GcsSource`.
1552        ///
1553        /// Note that all the setters affecting `source` are
1554        /// mutually exclusive.
1555        pub fn set_gcs_source<T: std::convert::Into<std::boxed::Box<crate::model::GcsSource>>>(
1556            mut self,
1557            v: T,
1558        ) -> Self {
1559            self.0.request = self.0.request.set_gcs_source(v);
1560            self
1561        }
1562
1563        /// Sets the value of [source][crate::model::ImportCompletionSuggestionsRequest::source]
1564        /// to hold a `BigquerySource`.
1565        ///
1566        /// Note that all the setters affecting `source` are
1567        /// mutually exclusive.
1568        pub fn set_bigquery_source<
1569            T: std::convert::Into<std::boxed::Box<crate::model::BigQuerySource>>,
1570        >(
1571            mut self,
1572            v: T,
1573        ) -> Self {
1574            self.0.request = self.0.request.set_bigquery_source(v);
1575            self
1576        }
1577    }
1578
1579    #[doc(hidden)]
1580    impl gax::options::internal::RequestBuilder for ImportCompletionSuggestions {
1581        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1582            &mut self.0.options
1583        }
1584    }
1585
1586    /// The request builder for [CompletionService::purge_completion_suggestions][crate::client::CompletionService::purge_completion_suggestions] calls.
1587    ///
1588    /// # Example
1589    /// ```
1590    /// # use google_cloud_discoveryengine_v1::builder::completion_service::PurgeCompletionSuggestions;
1591    /// # async fn sample() -> gax::Result<()> {
1592    /// use lro::Poller;
1593    ///
1594    /// let builder = prepare_request_builder();
1595    /// let response = builder.poller().until_done().await?;
1596    /// # Ok(()) }
1597    ///
1598    /// fn prepare_request_builder() -> PurgeCompletionSuggestions {
1599    ///   # panic!();
1600    ///   // ... details omitted ...
1601    /// }
1602    /// ```
1603    #[derive(Clone, Debug)]
1604    pub struct PurgeCompletionSuggestions(
1605        RequestBuilder<crate::model::PurgeCompletionSuggestionsRequest>,
1606    );
1607
1608    impl PurgeCompletionSuggestions {
1609        pub(crate) fn new(
1610            stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1611        ) -> Self {
1612            Self(RequestBuilder::new(stub))
1613        }
1614
1615        /// Sets the full request, replacing any prior values.
1616        pub fn with_request<V: Into<crate::model::PurgeCompletionSuggestionsRequest>>(
1617            mut self,
1618            v: V,
1619        ) -> Self {
1620            self.0.request = v.into();
1621            self
1622        }
1623
1624        /// Sets all the options, replacing any prior values.
1625        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1626            self.0.options = v.into();
1627            self
1628        }
1629
1630        /// Sends the request.
1631        ///
1632        /// # Long running operations
1633        ///
1634        /// This starts, but does not poll, a longrunning operation. More information
1635        /// on [purge_completion_suggestions][crate::client::CompletionService::purge_completion_suggestions].
1636        pub async fn send(self) -> Result<longrunning::model::Operation> {
1637            (*self.0.stub)
1638                .purge_completion_suggestions(self.0.request, self.0.options)
1639                .await
1640                .map(gax::response::Response::into_body)
1641        }
1642
1643        /// Creates a [Poller][lro::Poller] to work with `purge_completion_suggestions`.
1644        pub fn poller(
1645            self,
1646        ) -> impl lro::Poller<
1647            crate::model::PurgeCompletionSuggestionsResponse,
1648            crate::model::PurgeCompletionSuggestionsMetadata,
1649        > {
1650            type Operation = lro::internal::Operation<
1651                crate::model::PurgeCompletionSuggestionsResponse,
1652                crate::model::PurgeCompletionSuggestionsMetadata,
1653            >;
1654            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1655            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1656
1657            let stub = self.0.stub.clone();
1658            let mut options = self.0.options.clone();
1659            options.set_retry_policy(gax::retry_policy::NeverRetry);
1660            let query = move |name| {
1661                let stub = stub.clone();
1662                let options = options.clone();
1663                async {
1664                    let op = GetOperation::new(stub)
1665                        .set_name(name)
1666                        .with_options(options)
1667                        .send()
1668                        .await?;
1669                    Ok(Operation::new(op))
1670                }
1671            };
1672
1673            let start = move || async {
1674                let op = self.send().await?;
1675                Ok(Operation::new(op))
1676            };
1677
1678            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
1679        }
1680
1681        /// Sets the value of [parent][crate::model::PurgeCompletionSuggestionsRequest::parent].
1682        ///
1683        /// This is a **required** field for requests.
1684        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1685            self.0.request.parent = v.into();
1686            self
1687        }
1688    }
1689
1690    #[doc(hidden)]
1691    impl gax::options::internal::RequestBuilder for PurgeCompletionSuggestions {
1692        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1693            &mut self.0.options
1694        }
1695    }
1696
1697    /// The request builder for [CompletionService::list_operations][crate::client::CompletionService::list_operations] calls.
1698    ///
1699    /// # Example
1700    /// ```
1701    /// # use google_cloud_discoveryengine_v1::builder::completion_service::ListOperations;
1702    /// # async fn sample() -> gax::Result<()> {
1703    /// use gax::paginator::ItemPaginator;
1704    ///
1705    /// let builder = prepare_request_builder();
1706    /// let mut items = builder.by_item();
1707    /// while let Some(result) = items.next().await {
1708    ///   let item = result?;
1709    /// }
1710    /// # Ok(()) }
1711    ///
1712    /// fn prepare_request_builder() -> ListOperations {
1713    ///   # panic!();
1714    ///   // ... details omitted ...
1715    /// }
1716    /// ```
1717    #[derive(Clone, Debug)]
1718    pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
1719
1720    impl ListOperations {
1721        pub(crate) fn new(
1722            stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1723        ) -> Self {
1724            Self(RequestBuilder::new(stub))
1725        }
1726
1727        /// Sets the full request, replacing any prior values.
1728        pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
1729            mut self,
1730            v: V,
1731        ) -> Self {
1732            self.0.request = v.into();
1733            self
1734        }
1735
1736        /// Sets all the options, replacing any prior values.
1737        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1738            self.0.options = v.into();
1739            self
1740        }
1741
1742        /// Sends the request.
1743        pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
1744            (*self.0.stub)
1745                .list_operations(self.0.request, self.0.options)
1746                .await
1747                .map(gax::response::Response::into_body)
1748        }
1749
1750        /// Streams each page in the collection.
1751        pub fn by_page(
1752            self,
1753        ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
1754        {
1755            use std::clone::Clone;
1756            let token = self.0.request.page_token.clone();
1757            let execute = move |token: String| {
1758                let mut builder = self.clone();
1759                builder.0.request = builder.0.request.set_page_token(token);
1760                builder.send()
1761            };
1762            gax::paginator::internal::new_paginator(token, execute)
1763        }
1764
1765        /// Streams each item in the collection.
1766        pub fn by_item(
1767            self,
1768        ) -> impl gax::paginator::ItemPaginator<
1769            longrunning::model::ListOperationsResponse,
1770            gax::error::Error,
1771        > {
1772            use gax::paginator::Paginator;
1773            self.by_page().items()
1774        }
1775
1776        /// Sets the value of [name][longrunning::model::ListOperationsRequest::name].
1777        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1778            self.0.request.name = v.into();
1779            self
1780        }
1781
1782        /// Sets the value of [filter][longrunning::model::ListOperationsRequest::filter].
1783        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1784            self.0.request.filter = v.into();
1785            self
1786        }
1787
1788        /// Sets the value of [page_size][longrunning::model::ListOperationsRequest::page_size].
1789        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1790            self.0.request.page_size = v.into();
1791            self
1792        }
1793
1794        /// Sets the value of [page_token][longrunning::model::ListOperationsRequest::page_token].
1795        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1796            self.0.request.page_token = v.into();
1797            self
1798        }
1799
1800        /// Sets the value of [return_partial_success][longrunning::model::ListOperationsRequest::return_partial_success].
1801        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
1802            self.0.request.return_partial_success = v.into();
1803            self
1804        }
1805    }
1806
1807    #[doc(hidden)]
1808    impl gax::options::internal::RequestBuilder for ListOperations {
1809        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1810            &mut self.0.options
1811        }
1812    }
1813
1814    /// The request builder for [CompletionService::get_operation][crate::client::CompletionService::get_operation] calls.
1815    ///
1816    /// # Example
1817    /// ```
1818    /// # use google_cloud_discoveryengine_v1::builder::completion_service::GetOperation;
1819    /// # async fn sample() -> gax::Result<()> {
1820    ///
1821    /// let builder = prepare_request_builder();
1822    /// let response = builder.send().await?;
1823    /// # Ok(()) }
1824    ///
1825    /// fn prepare_request_builder() -> GetOperation {
1826    ///   # panic!();
1827    ///   // ... details omitted ...
1828    /// }
1829    /// ```
1830    #[derive(Clone, Debug)]
1831    pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
1832
1833    impl GetOperation {
1834        pub(crate) fn new(
1835            stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1836        ) -> Self {
1837            Self(RequestBuilder::new(stub))
1838        }
1839
1840        /// Sets the full request, replacing any prior values.
1841        pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
1842            mut self,
1843            v: V,
1844        ) -> Self {
1845            self.0.request = v.into();
1846            self
1847        }
1848
1849        /// Sets all the options, replacing any prior values.
1850        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1851            self.0.options = v.into();
1852            self
1853        }
1854
1855        /// Sends the request.
1856        pub async fn send(self) -> Result<longrunning::model::Operation> {
1857            (*self.0.stub)
1858                .get_operation(self.0.request, self.0.options)
1859                .await
1860                .map(gax::response::Response::into_body)
1861        }
1862
1863        /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
1864        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1865            self.0.request.name = v.into();
1866            self
1867        }
1868    }
1869
1870    #[doc(hidden)]
1871    impl gax::options::internal::RequestBuilder for GetOperation {
1872        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1873            &mut self.0.options
1874        }
1875    }
1876
1877    /// The request builder for [CompletionService::cancel_operation][crate::client::CompletionService::cancel_operation] calls.
1878    ///
1879    /// # Example
1880    /// ```
1881    /// # use google_cloud_discoveryengine_v1::builder::completion_service::CancelOperation;
1882    /// # async fn sample() -> gax::Result<()> {
1883    ///
1884    /// let builder = prepare_request_builder();
1885    /// let response = builder.send().await?;
1886    /// # Ok(()) }
1887    ///
1888    /// fn prepare_request_builder() -> CancelOperation {
1889    ///   # panic!();
1890    ///   // ... details omitted ...
1891    /// }
1892    /// ```
1893    #[derive(Clone, Debug)]
1894    pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
1895
1896    impl CancelOperation {
1897        pub(crate) fn new(
1898            stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1899        ) -> Self {
1900            Self(RequestBuilder::new(stub))
1901        }
1902
1903        /// Sets the full request, replacing any prior values.
1904        pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
1905            mut self,
1906            v: V,
1907        ) -> Self {
1908            self.0.request = v.into();
1909            self
1910        }
1911
1912        /// Sets all the options, replacing any prior values.
1913        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1914            self.0.options = v.into();
1915            self
1916        }
1917
1918        /// Sends the request.
1919        pub async fn send(self) -> Result<()> {
1920            (*self.0.stub)
1921                .cancel_operation(self.0.request, self.0.options)
1922                .await
1923                .map(gax::response::Response::into_body)
1924        }
1925
1926        /// Sets the value of [name][longrunning::model::CancelOperationRequest::name].
1927        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1928            self.0.request.name = v.into();
1929            self
1930        }
1931    }
1932
1933    #[doc(hidden)]
1934    impl gax::options::internal::RequestBuilder for CancelOperation {
1935        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1936            &mut self.0.options
1937        }
1938    }
1939}
1940
1941#[cfg(feature = "control-service")]
1942#[cfg_attr(docsrs, doc(cfg(feature = "control-service")))]
1943pub mod control_service {
1944    use crate::Result;
1945
1946    /// A builder for [ControlService][crate::client::ControlService].
1947    ///
1948    /// ```
1949    /// # async fn sample() -> gax::client_builder::Result<()> {
1950    /// # use google_cloud_discoveryengine_v1::*;
1951    /// # use builder::control_service::ClientBuilder;
1952    /// # use client::ControlService;
1953    /// let builder : ClientBuilder = ControlService::builder();
1954    /// let client = builder
1955    ///     .with_endpoint("https://discoveryengine.googleapis.com")
1956    ///     .build().await?;
1957    /// # Ok(()) }
1958    /// ```
1959    pub type ClientBuilder =
1960        gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
1961
1962    pub(crate) mod client {
1963        use super::super::super::client::ControlService;
1964        pub struct Factory;
1965        impl gax::client_builder::internal::ClientFactory for Factory {
1966            type Client = ControlService;
1967            type Credentials = gaxi::options::Credentials;
1968            async fn build(
1969                self,
1970                config: gaxi::options::ClientConfig,
1971            ) -> gax::client_builder::Result<Self::Client> {
1972                Self::Client::new(config).await
1973            }
1974        }
1975    }
1976
1977    /// Common implementation for [crate::client::ControlService] request builders.
1978    #[derive(Clone, Debug)]
1979    pub(crate) struct RequestBuilder<R: std::default::Default> {
1980        stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
1981        request: R,
1982        options: gax::options::RequestOptions,
1983    }
1984
1985    impl<R> RequestBuilder<R>
1986    where
1987        R: std::default::Default,
1988    {
1989        pub(crate) fn new(
1990            stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
1991        ) -> Self {
1992            Self {
1993                stub,
1994                request: R::default(),
1995                options: gax::options::RequestOptions::default(),
1996            }
1997        }
1998    }
1999
2000    /// The request builder for [ControlService::create_control][crate::client::ControlService::create_control] calls.
2001    ///
2002    /// # Example
2003    /// ```
2004    /// # use google_cloud_discoveryengine_v1::builder::control_service::CreateControl;
2005    /// # async fn sample() -> gax::Result<()> {
2006    ///
2007    /// let builder = prepare_request_builder();
2008    /// let response = builder.send().await?;
2009    /// # Ok(()) }
2010    ///
2011    /// fn prepare_request_builder() -> CreateControl {
2012    ///   # panic!();
2013    ///   // ... details omitted ...
2014    /// }
2015    /// ```
2016    #[derive(Clone, Debug)]
2017    pub struct CreateControl(RequestBuilder<crate::model::CreateControlRequest>);
2018
2019    impl CreateControl {
2020        pub(crate) fn new(
2021            stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2022        ) -> Self {
2023            Self(RequestBuilder::new(stub))
2024        }
2025
2026        /// Sets the full request, replacing any prior values.
2027        pub fn with_request<V: Into<crate::model::CreateControlRequest>>(mut self, v: V) -> Self {
2028            self.0.request = v.into();
2029            self
2030        }
2031
2032        /// Sets all the options, replacing any prior values.
2033        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2034            self.0.options = v.into();
2035            self
2036        }
2037
2038        /// Sends the request.
2039        pub async fn send(self) -> Result<crate::model::Control> {
2040            (*self.0.stub)
2041                .create_control(self.0.request, self.0.options)
2042                .await
2043                .map(gax::response::Response::into_body)
2044        }
2045
2046        /// Sets the value of [parent][crate::model::CreateControlRequest::parent].
2047        ///
2048        /// This is a **required** field for requests.
2049        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2050            self.0.request.parent = v.into();
2051            self
2052        }
2053
2054        /// Sets the value of [control][crate::model::CreateControlRequest::control].
2055        ///
2056        /// This is a **required** field for requests.
2057        pub fn set_control<T>(mut self, v: T) -> Self
2058        where
2059            T: std::convert::Into<crate::model::Control>,
2060        {
2061            self.0.request.control = std::option::Option::Some(v.into());
2062            self
2063        }
2064
2065        /// Sets or clears the value of [control][crate::model::CreateControlRequest::control].
2066        ///
2067        /// This is a **required** field for requests.
2068        pub fn set_or_clear_control<T>(mut self, v: std::option::Option<T>) -> Self
2069        where
2070            T: std::convert::Into<crate::model::Control>,
2071        {
2072            self.0.request.control = v.map(|x| x.into());
2073            self
2074        }
2075
2076        /// Sets the value of [control_id][crate::model::CreateControlRequest::control_id].
2077        ///
2078        /// This is a **required** field for requests.
2079        pub fn set_control_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2080            self.0.request.control_id = v.into();
2081            self
2082        }
2083    }
2084
2085    #[doc(hidden)]
2086    impl gax::options::internal::RequestBuilder for CreateControl {
2087        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2088            &mut self.0.options
2089        }
2090    }
2091
2092    /// The request builder for [ControlService::delete_control][crate::client::ControlService::delete_control] calls.
2093    ///
2094    /// # Example
2095    /// ```
2096    /// # use google_cloud_discoveryengine_v1::builder::control_service::DeleteControl;
2097    /// # async fn sample() -> gax::Result<()> {
2098    ///
2099    /// let builder = prepare_request_builder();
2100    /// let response = builder.send().await?;
2101    /// # Ok(()) }
2102    ///
2103    /// fn prepare_request_builder() -> DeleteControl {
2104    ///   # panic!();
2105    ///   // ... details omitted ...
2106    /// }
2107    /// ```
2108    #[derive(Clone, Debug)]
2109    pub struct DeleteControl(RequestBuilder<crate::model::DeleteControlRequest>);
2110
2111    impl DeleteControl {
2112        pub(crate) fn new(
2113            stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2114        ) -> Self {
2115            Self(RequestBuilder::new(stub))
2116        }
2117
2118        /// Sets the full request, replacing any prior values.
2119        pub fn with_request<V: Into<crate::model::DeleteControlRequest>>(mut self, v: V) -> Self {
2120            self.0.request = v.into();
2121            self
2122        }
2123
2124        /// Sets all the options, replacing any prior values.
2125        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2126            self.0.options = v.into();
2127            self
2128        }
2129
2130        /// Sends the request.
2131        pub async fn send(self) -> Result<()> {
2132            (*self.0.stub)
2133                .delete_control(self.0.request, self.0.options)
2134                .await
2135                .map(gax::response::Response::into_body)
2136        }
2137
2138        /// Sets the value of [name][crate::model::DeleteControlRequest::name].
2139        ///
2140        /// This is a **required** field for requests.
2141        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2142            self.0.request.name = v.into();
2143            self
2144        }
2145    }
2146
2147    #[doc(hidden)]
2148    impl gax::options::internal::RequestBuilder for DeleteControl {
2149        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2150            &mut self.0.options
2151        }
2152    }
2153
2154    /// The request builder for [ControlService::update_control][crate::client::ControlService::update_control] calls.
2155    ///
2156    /// # Example
2157    /// ```
2158    /// # use google_cloud_discoveryengine_v1::builder::control_service::UpdateControl;
2159    /// # async fn sample() -> gax::Result<()> {
2160    ///
2161    /// let builder = prepare_request_builder();
2162    /// let response = builder.send().await?;
2163    /// # Ok(()) }
2164    ///
2165    /// fn prepare_request_builder() -> UpdateControl {
2166    ///   # panic!();
2167    ///   // ... details omitted ...
2168    /// }
2169    /// ```
2170    #[derive(Clone, Debug)]
2171    pub struct UpdateControl(RequestBuilder<crate::model::UpdateControlRequest>);
2172
2173    impl UpdateControl {
2174        pub(crate) fn new(
2175            stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2176        ) -> Self {
2177            Self(RequestBuilder::new(stub))
2178        }
2179
2180        /// Sets the full request, replacing any prior values.
2181        pub fn with_request<V: Into<crate::model::UpdateControlRequest>>(mut self, v: V) -> Self {
2182            self.0.request = v.into();
2183            self
2184        }
2185
2186        /// Sets all the options, replacing any prior values.
2187        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2188            self.0.options = v.into();
2189            self
2190        }
2191
2192        /// Sends the request.
2193        pub async fn send(self) -> Result<crate::model::Control> {
2194            (*self.0.stub)
2195                .update_control(self.0.request, self.0.options)
2196                .await
2197                .map(gax::response::Response::into_body)
2198        }
2199
2200        /// Sets the value of [control][crate::model::UpdateControlRequest::control].
2201        ///
2202        /// This is a **required** field for requests.
2203        pub fn set_control<T>(mut self, v: T) -> Self
2204        where
2205            T: std::convert::Into<crate::model::Control>,
2206        {
2207            self.0.request.control = std::option::Option::Some(v.into());
2208            self
2209        }
2210
2211        /// Sets or clears the value of [control][crate::model::UpdateControlRequest::control].
2212        ///
2213        /// This is a **required** field for requests.
2214        pub fn set_or_clear_control<T>(mut self, v: std::option::Option<T>) -> Self
2215        where
2216            T: std::convert::Into<crate::model::Control>,
2217        {
2218            self.0.request.control = v.map(|x| x.into());
2219            self
2220        }
2221
2222        /// Sets the value of [update_mask][crate::model::UpdateControlRequest::update_mask].
2223        pub fn set_update_mask<T>(mut self, v: T) -> Self
2224        where
2225            T: std::convert::Into<wkt::FieldMask>,
2226        {
2227            self.0.request.update_mask = std::option::Option::Some(v.into());
2228            self
2229        }
2230
2231        /// Sets or clears the value of [update_mask][crate::model::UpdateControlRequest::update_mask].
2232        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
2233        where
2234            T: std::convert::Into<wkt::FieldMask>,
2235        {
2236            self.0.request.update_mask = v.map(|x| x.into());
2237            self
2238        }
2239    }
2240
2241    #[doc(hidden)]
2242    impl gax::options::internal::RequestBuilder for UpdateControl {
2243        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2244            &mut self.0.options
2245        }
2246    }
2247
2248    /// The request builder for [ControlService::get_control][crate::client::ControlService::get_control] calls.
2249    ///
2250    /// # Example
2251    /// ```
2252    /// # use google_cloud_discoveryengine_v1::builder::control_service::GetControl;
2253    /// # async fn sample() -> gax::Result<()> {
2254    ///
2255    /// let builder = prepare_request_builder();
2256    /// let response = builder.send().await?;
2257    /// # Ok(()) }
2258    ///
2259    /// fn prepare_request_builder() -> GetControl {
2260    ///   # panic!();
2261    ///   // ... details omitted ...
2262    /// }
2263    /// ```
2264    #[derive(Clone, Debug)]
2265    pub struct GetControl(RequestBuilder<crate::model::GetControlRequest>);
2266
2267    impl GetControl {
2268        pub(crate) fn new(
2269            stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2270        ) -> Self {
2271            Self(RequestBuilder::new(stub))
2272        }
2273
2274        /// Sets the full request, replacing any prior values.
2275        pub fn with_request<V: Into<crate::model::GetControlRequest>>(mut self, v: V) -> Self {
2276            self.0.request = v.into();
2277            self
2278        }
2279
2280        /// Sets all the options, replacing any prior values.
2281        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2282            self.0.options = v.into();
2283            self
2284        }
2285
2286        /// Sends the request.
2287        pub async fn send(self) -> Result<crate::model::Control> {
2288            (*self.0.stub)
2289                .get_control(self.0.request, self.0.options)
2290                .await
2291                .map(gax::response::Response::into_body)
2292        }
2293
2294        /// Sets the value of [name][crate::model::GetControlRequest::name].
2295        ///
2296        /// This is a **required** field for requests.
2297        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2298            self.0.request.name = v.into();
2299            self
2300        }
2301    }
2302
2303    #[doc(hidden)]
2304    impl gax::options::internal::RequestBuilder for GetControl {
2305        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2306            &mut self.0.options
2307        }
2308    }
2309
2310    /// The request builder for [ControlService::list_controls][crate::client::ControlService::list_controls] calls.
2311    ///
2312    /// # Example
2313    /// ```
2314    /// # use google_cloud_discoveryengine_v1::builder::control_service::ListControls;
2315    /// # async fn sample() -> gax::Result<()> {
2316    /// use gax::paginator::ItemPaginator;
2317    ///
2318    /// let builder = prepare_request_builder();
2319    /// let mut items = builder.by_item();
2320    /// while let Some(result) = items.next().await {
2321    ///   let item = result?;
2322    /// }
2323    /// # Ok(()) }
2324    ///
2325    /// fn prepare_request_builder() -> ListControls {
2326    ///   # panic!();
2327    ///   // ... details omitted ...
2328    /// }
2329    /// ```
2330    #[derive(Clone, Debug)]
2331    pub struct ListControls(RequestBuilder<crate::model::ListControlsRequest>);
2332
2333    impl ListControls {
2334        pub(crate) fn new(
2335            stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2336        ) -> Self {
2337            Self(RequestBuilder::new(stub))
2338        }
2339
2340        /// Sets the full request, replacing any prior values.
2341        pub fn with_request<V: Into<crate::model::ListControlsRequest>>(mut self, v: V) -> Self {
2342            self.0.request = v.into();
2343            self
2344        }
2345
2346        /// Sets all the options, replacing any prior values.
2347        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2348            self.0.options = v.into();
2349            self
2350        }
2351
2352        /// Sends the request.
2353        pub async fn send(self) -> Result<crate::model::ListControlsResponse> {
2354            (*self.0.stub)
2355                .list_controls(self.0.request, self.0.options)
2356                .await
2357                .map(gax::response::Response::into_body)
2358        }
2359
2360        /// Streams each page in the collection.
2361        pub fn by_page(
2362            self,
2363        ) -> impl gax::paginator::Paginator<crate::model::ListControlsResponse, gax::error::Error>
2364        {
2365            use std::clone::Clone;
2366            let token = self.0.request.page_token.clone();
2367            let execute = move |token: String| {
2368                let mut builder = self.clone();
2369                builder.0.request = builder.0.request.set_page_token(token);
2370                builder.send()
2371            };
2372            gax::paginator::internal::new_paginator(token, execute)
2373        }
2374
2375        /// Streams each item in the collection.
2376        pub fn by_item(
2377            self,
2378        ) -> impl gax::paginator::ItemPaginator<crate::model::ListControlsResponse, gax::error::Error>
2379        {
2380            use gax::paginator::Paginator;
2381            self.by_page().items()
2382        }
2383
2384        /// Sets the value of [parent][crate::model::ListControlsRequest::parent].
2385        ///
2386        /// This is a **required** field for requests.
2387        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2388            self.0.request.parent = v.into();
2389            self
2390        }
2391
2392        /// Sets the value of [page_size][crate::model::ListControlsRequest::page_size].
2393        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2394            self.0.request.page_size = v.into();
2395            self
2396        }
2397
2398        /// Sets the value of [page_token][crate::model::ListControlsRequest::page_token].
2399        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2400            self.0.request.page_token = v.into();
2401            self
2402        }
2403
2404        /// Sets the value of [filter][crate::model::ListControlsRequest::filter].
2405        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
2406            self.0.request.filter = v.into();
2407            self
2408        }
2409    }
2410
2411    #[doc(hidden)]
2412    impl gax::options::internal::RequestBuilder for ListControls {
2413        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2414            &mut self.0.options
2415        }
2416    }
2417
2418    /// The request builder for [ControlService::list_operations][crate::client::ControlService::list_operations] calls.
2419    ///
2420    /// # Example
2421    /// ```
2422    /// # use google_cloud_discoveryengine_v1::builder::control_service::ListOperations;
2423    /// # async fn sample() -> gax::Result<()> {
2424    /// use gax::paginator::ItemPaginator;
2425    ///
2426    /// let builder = prepare_request_builder();
2427    /// let mut items = builder.by_item();
2428    /// while let Some(result) = items.next().await {
2429    ///   let item = result?;
2430    /// }
2431    /// # Ok(()) }
2432    ///
2433    /// fn prepare_request_builder() -> ListOperations {
2434    ///   # panic!();
2435    ///   // ... details omitted ...
2436    /// }
2437    /// ```
2438    #[derive(Clone, Debug)]
2439    pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
2440
2441    impl ListOperations {
2442        pub(crate) fn new(
2443            stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2444        ) -> Self {
2445            Self(RequestBuilder::new(stub))
2446        }
2447
2448        /// Sets the full request, replacing any prior values.
2449        pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
2450            mut self,
2451            v: V,
2452        ) -> Self {
2453            self.0.request = v.into();
2454            self
2455        }
2456
2457        /// Sets all the options, replacing any prior values.
2458        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2459            self.0.options = v.into();
2460            self
2461        }
2462
2463        /// Sends the request.
2464        pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
2465            (*self.0.stub)
2466                .list_operations(self.0.request, self.0.options)
2467                .await
2468                .map(gax::response::Response::into_body)
2469        }
2470
2471        /// Streams each page in the collection.
2472        pub fn by_page(
2473            self,
2474        ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
2475        {
2476            use std::clone::Clone;
2477            let token = self.0.request.page_token.clone();
2478            let execute = move |token: String| {
2479                let mut builder = self.clone();
2480                builder.0.request = builder.0.request.set_page_token(token);
2481                builder.send()
2482            };
2483            gax::paginator::internal::new_paginator(token, execute)
2484        }
2485
2486        /// Streams each item in the collection.
2487        pub fn by_item(
2488            self,
2489        ) -> impl gax::paginator::ItemPaginator<
2490            longrunning::model::ListOperationsResponse,
2491            gax::error::Error,
2492        > {
2493            use gax::paginator::Paginator;
2494            self.by_page().items()
2495        }
2496
2497        /// Sets the value of [name][longrunning::model::ListOperationsRequest::name].
2498        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2499            self.0.request.name = v.into();
2500            self
2501        }
2502
2503        /// Sets the value of [filter][longrunning::model::ListOperationsRequest::filter].
2504        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
2505            self.0.request.filter = v.into();
2506            self
2507        }
2508
2509        /// Sets the value of [page_size][longrunning::model::ListOperationsRequest::page_size].
2510        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2511            self.0.request.page_size = v.into();
2512            self
2513        }
2514
2515        /// Sets the value of [page_token][longrunning::model::ListOperationsRequest::page_token].
2516        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2517            self.0.request.page_token = v.into();
2518            self
2519        }
2520
2521        /// Sets the value of [return_partial_success][longrunning::model::ListOperationsRequest::return_partial_success].
2522        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
2523            self.0.request.return_partial_success = v.into();
2524            self
2525        }
2526    }
2527
2528    #[doc(hidden)]
2529    impl gax::options::internal::RequestBuilder for ListOperations {
2530        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2531            &mut self.0.options
2532        }
2533    }
2534
2535    /// The request builder for [ControlService::get_operation][crate::client::ControlService::get_operation] calls.
2536    ///
2537    /// # Example
2538    /// ```
2539    /// # use google_cloud_discoveryengine_v1::builder::control_service::GetOperation;
2540    /// # async fn sample() -> gax::Result<()> {
2541    ///
2542    /// let builder = prepare_request_builder();
2543    /// let response = builder.send().await?;
2544    /// # Ok(()) }
2545    ///
2546    /// fn prepare_request_builder() -> GetOperation {
2547    ///   # panic!();
2548    ///   // ... details omitted ...
2549    /// }
2550    /// ```
2551    #[derive(Clone, Debug)]
2552    pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
2553
2554    impl GetOperation {
2555        pub(crate) fn new(
2556            stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2557        ) -> Self {
2558            Self(RequestBuilder::new(stub))
2559        }
2560
2561        /// Sets the full request, replacing any prior values.
2562        pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
2563            mut self,
2564            v: V,
2565        ) -> Self {
2566            self.0.request = v.into();
2567            self
2568        }
2569
2570        /// Sets all the options, replacing any prior values.
2571        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2572            self.0.options = v.into();
2573            self
2574        }
2575
2576        /// Sends the request.
2577        pub async fn send(self) -> Result<longrunning::model::Operation> {
2578            (*self.0.stub)
2579                .get_operation(self.0.request, self.0.options)
2580                .await
2581                .map(gax::response::Response::into_body)
2582        }
2583
2584        /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
2585        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2586            self.0.request.name = v.into();
2587            self
2588        }
2589    }
2590
2591    #[doc(hidden)]
2592    impl gax::options::internal::RequestBuilder for GetOperation {
2593        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2594            &mut self.0.options
2595        }
2596    }
2597
2598    /// The request builder for [ControlService::cancel_operation][crate::client::ControlService::cancel_operation] calls.
2599    ///
2600    /// # Example
2601    /// ```
2602    /// # use google_cloud_discoveryengine_v1::builder::control_service::CancelOperation;
2603    /// # async fn sample() -> gax::Result<()> {
2604    ///
2605    /// let builder = prepare_request_builder();
2606    /// let response = builder.send().await?;
2607    /// # Ok(()) }
2608    ///
2609    /// fn prepare_request_builder() -> CancelOperation {
2610    ///   # panic!();
2611    ///   // ... details omitted ...
2612    /// }
2613    /// ```
2614    #[derive(Clone, Debug)]
2615    pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
2616
2617    impl CancelOperation {
2618        pub(crate) fn new(
2619            stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2620        ) -> Self {
2621            Self(RequestBuilder::new(stub))
2622        }
2623
2624        /// Sets the full request, replacing any prior values.
2625        pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
2626            mut self,
2627            v: V,
2628        ) -> Self {
2629            self.0.request = v.into();
2630            self
2631        }
2632
2633        /// Sets all the options, replacing any prior values.
2634        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2635            self.0.options = v.into();
2636            self
2637        }
2638
2639        /// Sends the request.
2640        pub async fn send(self) -> Result<()> {
2641            (*self.0.stub)
2642                .cancel_operation(self.0.request, self.0.options)
2643                .await
2644                .map(gax::response::Response::into_body)
2645        }
2646
2647        /// Sets the value of [name][longrunning::model::CancelOperationRequest::name].
2648        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2649            self.0.request.name = v.into();
2650            self
2651        }
2652    }
2653
2654    #[doc(hidden)]
2655    impl gax::options::internal::RequestBuilder for CancelOperation {
2656        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2657            &mut self.0.options
2658        }
2659    }
2660}
2661
2662#[cfg(feature = "conversational-search-service")]
2663#[cfg_attr(docsrs, doc(cfg(feature = "conversational-search-service")))]
2664pub mod conversational_search_service {
2665    use crate::Result;
2666
2667    /// A builder for [ConversationalSearchService][crate::client::ConversationalSearchService].
2668    ///
2669    /// ```
2670    /// # async fn sample() -> gax::client_builder::Result<()> {
2671    /// # use google_cloud_discoveryengine_v1::*;
2672    /// # use builder::conversational_search_service::ClientBuilder;
2673    /// # use client::ConversationalSearchService;
2674    /// let builder : ClientBuilder = ConversationalSearchService::builder();
2675    /// let client = builder
2676    ///     .with_endpoint("https://discoveryengine.googleapis.com")
2677    ///     .build().await?;
2678    /// # Ok(()) }
2679    /// ```
2680    pub type ClientBuilder =
2681        gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
2682
2683    pub(crate) mod client {
2684        use super::super::super::client::ConversationalSearchService;
2685        pub struct Factory;
2686        impl gax::client_builder::internal::ClientFactory for Factory {
2687            type Client = ConversationalSearchService;
2688            type Credentials = gaxi::options::Credentials;
2689            async fn build(
2690                self,
2691                config: gaxi::options::ClientConfig,
2692            ) -> gax::client_builder::Result<Self::Client> {
2693                Self::Client::new(config).await
2694            }
2695        }
2696    }
2697
2698    /// Common implementation for [crate::client::ConversationalSearchService] request builders.
2699    #[derive(Clone, Debug)]
2700    pub(crate) struct RequestBuilder<R: std::default::Default> {
2701        stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
2702        request: R,
2703        options: gax::options::RequestOptions,
2704    }
2705
2706    impl<R> RequestBuilder<R>
2707    where
2708        R: std::default::Default,
2709    {
2710        pub(crate) fn new(
2711            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
2712        ) -> Self {
2713            Self {
2714                stub,
2715                request: R::default(),
2716                options: gax::options::RequestOptions::default(),
2717            }
2718        }
2719    }
2720
2721    /// The request builder for [ConversationalSearchService::converse_conversation][crate::client::ConversationalSearchService::converse_conversation] calls.
2722    ///
2723    /// # Example
2724    /// ```
2725    /// # use google_cloud_discoveryengine_v1::builder::conversational_search_service::ConverseConversation;
2726    /// # async fn sample() -> gax::Result<()> {
2727    ///
2728    /// let builder = prepare_request_builder();
2729    /// let response = builder.send().await?;
2730    /// # Ok(()) }
2731    ///
2732    /// fn prepare_request_builder() -> ConverseConversation {
2733    ///   # panic!();
2734    ///   // ... details omitted ...
2735    /// }
2736    /// ```
2737    #[derive(Clone, Debug)]
2738    pub struct ConverseConversation(RequestBuilder<crate::model::ConverseConversationRequest>);
2739
2740    impl ConverseConversation {
2741        pub(crate) fn new(
2742            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
2743        ) -> Self {
2744            Self(RequestBuilder::new(stub))
2745        }
2746
2747        /// Sets the full request, replacing any prior values.
2748        pub fn with_request<V: Into<crate::model::ConverseConversationRequest>>(
2749            mut self,
2750            v: V,
2751        ) -> Self {
2752            self.0.request = v.into();
2753            self
2754        }
2755
2756        /// Sets all the options, replacing any prior values.
2757        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2758            self.0.options = v.into();
2759            self
2760        }
2761
2762        /// Sends the request.
2763        pub async fn send(self) -> Result<crate::model::ConverseConversationResponse> {
2764            (*self.0.stub)
2765                .converse_conversation(self.0.request, self.0.options)
2766                .await
2767                .map(gax::response::Response::into_body)
2768        }
2769
2770        /// Sets the value of [name][crate::model::ConverseConversationRequest::name].
2771        ///
2772        /// This is a **required** field for requests.
2773        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2774            self.0.request.name = v.into();
2775            self
2776        }
2777
2778        /// Sets the value of [query][crate::model::ConverseConversationRequest::query].
2779        ///
2780        /// This is a **required** field for requests.
2781        pub fn set_query<T>(mut self, v: T) -> Self
2782        where
2783            T: std::convert::Into<crate::model::TextInput>,
2784        {
2785            self.0.request.query = std::option::Option::Some(v.into());
2786            self
2787        }
2788
2789        /// Sets or clears the value of [query][crate::model::ConverseConversationRequest::query].
2790        ///
2791        /// This is a **required** field for requests.
2792        pub fn set_or_clear_query<T>(mut self, v: std::option::Option<T>) -> Self
2793        where
2794            T: std::convert::Into<crate::model::TextInput>,
2795        {
2796            self.0.request.query = v.map(|x| x.into());
2797            self
2798        }
2799
2800        /// Sets the value of [serving_config][crate::model::ConverseConversationRequest::serving_config].
2801        pub fn set_serving_config<T: Into<std::string::String>>(mut self, v: T) -> Self {
2802            self.0.request.serving_config = v.into();
2803            self
2804        }
2805
2806        /// Sets the value of [conversation][crate::model::ConverseConversationRequest::conversation].
2807        pub fn set_conversation<T>(mut self, v: T) -> Self
2808        where
2809            T: std::convert::Into<crate::model::Conversation>,
2810        {
2811            self.0.request.conversation = std::option::Option::Some(v.into());
2812            self
2813        }
2814
2815        /// Sets or clears the value of [conversation][crate::model::ConverseConversationRequest::conversation].
2816        pub fn set_or_clear_conversation<T>(mut self, v: std::option::Option<T>) -> Self
2817        where
2818            T: std::convert::Into<crate::model::Conversation>,
2819        {
2820            self.0.request.conversation = v.map(|x| x.into());
2821            self
2822        }
2823
2824        /// Sets the value of [safe_search][crate::model::ConverseConversationRequest::safe_search].
2825        pub fn set_safe_search<T: Into<bool>>(mut self, v: T) -> Self {
2826            self.0.request.safe_search = v.into();
2827            self
2828        }
2829
2830        /// Sets the value of [user_labels][crate::model::ConverseConversationRequest::user_labels].
2831        pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
2832        where
2833            T: std::iter::IntoIterator<Item = (K, V)>,
2834            K: std::convert::Into<std::string::String>,
2835            V: std::convert::Into<std::string::String>,
2836        {
2837            self.0.request.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
2838            self
2839        }
2840
2841        /// Sets the value of [summary_spec][crate::model::ConverseConversationRequest::summary_spec].
2842        pub fn set_summary_spec<T>(mut self, v: T) -> Self
2843        where
2844            T: std::convert::Into<crate::model::search_request::content_search_spec::SummarySpec>,
2845        {
2846            self.0.request.summary_spec = std::option::Option::Some(v.into());
2847            self
2848        }
2849
2850        /// Sets or clears the value of [summary_spec][crate::model::ConverseConversationRequest::summary_spec].
2851        pub fn set_or_clear_summary_spec<T>(mut self, v: std::option::Option<T>) -> Self
2852        where
2853            T: std::convert::Into<crate::model::search_request::content_search_spec::SummarySpec>,
2854        {
2855            self.0.request.summary_spec = v.map(|x| x.into());
2856            self
2857        }
2858
2859        /// Sets the value of [filter][crate::model::ConverseConversationRequest::filter].
2860        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
2861            self.0.request.filter = v.into();
2862            self
2863        }
2864
2865        /// Sets the value of [boost_spec][crate::model::ConverseConversationRequest::boost_spec].
2866        pub fn set_boost_spec<T>(mut self, v: T) -> Self
2867        where
2868            T: std::convert::Into<crate::model::search_request::BoostSpec>,
2869        {
2870            self.0.request.boost_spec = std::option::Option::Some(v.into());
2871            self
2872        }
2873
2874        /// Sets or clears the value of [boost_spec][crate::model::ConverseConversationRequest::boost_spec].
2875        pub fn set_or_clear_boost_spec<T>(mut self, v: std::option::Option<T>) -> Self
2876        where
2877            T: std::convert::Into<crate::model::search_request::BoostSpec>,
2878        {
2879            self.0.request.boost_spec = v.map(|x| x.into());
2880            self
2881        }
2882    }
2883
2884    #[doc(hidden)]
2885    impl gax::options::internal::RequestBuilder for ConverseConversation {
2886        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2887            &mut self.0.options
2888        }
2889    }
2890
2891    /// The request builder for [ConversationalSearchService::create_conversation][crate::client::ConversationalSearchService::create_conversation] calls.
2892    ///
2893    /// # Example
2894    /// ```
2895    /// # use google_cloud_discoveryengine_v1::builder::conversational_search_service::CreateConversation;
2896    /// # async fn sample() -> gax::Result<()> {
2897    ///
2898    /// let builder = prepare_request_builder();
2899    /// let response = builder.send().await?;
2900    /// # Ok(()) }
2901    ///
2902    /// fn prepare_request_builder() -> CreateConversation {
2903    ///   # panic!();
2904    ///   // ... details omitted ...
2905    /// }
2906    /// ```
2907    #[derive(Clone, Debug)]
2908    pub struct CreateConversation(RequestBuilder<crate::model::CreateConversationRequest>);
2909
2910    impl CreateConversation {
2911        pub(crate) fn new(
2912            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
2913        ) -> Self {
2914            Self(RequestBuilder::new(stub))
2915        }
2916
2917        /// Sets the full request, replacing any prior values.
2918        pub fn with_request<V: Into<crate::model::CreateConversationRequest>>(
2919            mut self,
2920            v: V,
2921        ) -> Self {
2922            self.0.request = v.into();
2923            self
2924        }
2925
2926        /// Sets all the options, replacing any prior values.
2927        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2928            self.0.options = v.into();
2929            self
2930        }
2931
2932        /// Sends the request.
2933        pub async fn send(self) -> Result<crate::model::Conversation> {
2934            (*self.0.stub)
2935                .create_conversation(self.0.request, self.0.options)
2936                .await
2937                .map(gax::response::Response::into_body)
2938        }
2939
2940        /// Sets the value of [parent][crate::model::CreateConversationRequest::parent].
2941        ///
2942        /// This is a **required** field for requests.
2943        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2944            self.0.request.parent = v.into();
2945            self
2946        }
2947
2948        /// Sets the value of [conversation][crate::model::CreateConversationRequest::conversation].
2949        ///
2950        /// This is a **required** field for requests.
2951        pub fn set_conversation<T>(mut self, v: T) -> Self
2952        where
2953            T: std::convert::Into<crate::model::Conversation>,
2954        {
2955            self.0.request.conversation = std::option::Option::Some(v.into());
2956            self
2957        }
2958
2959        /// Sets or clears the value of [conversation][crate::model::CreateConversationRequest::conversation].
2960        ///
2961        /// This is a **required** field for requests.
2962        pub fn set_or_clear_conversation<T>(mut self, v: std::option::Option<T>) -> Self
2963        where
2964            T: std::convert::Into<crate::model::Conversation>,
2965        {
2966            self.0.request.conversation = v.map(|x| x.into());
2967            self
2968        }
2969    }
2970
2971    #[doc(hidden)]
2972    impl gax::options::internal::RequestBuilder for CreateConversation {
2973        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2974            &mut self.0.options
2975        }
2976    }
2977
2978    /// The request builder for [ConversationalSearchService::delete_conversation][crate::client::ConversationalSearchService::delete_conversation] calls.
2979    ///
2980    /// # Example
2981    /// ```
2982    /// # use google_cloud_discoveryengine_v1::builder::conversational_search_service::DeleteConversation;
2983    /// # async fn sample() -> gax::Result<()> {
2984    ///
2985    /// let builder = prepare_request_builder();
2986    /// let response = builder.send().await?;
2987    /// # Ok(()) }
2988    ///
2989    /// fn prepare_request_builder() -> DeleteConversation {
2990    ///   # panic!();
2991    ///   // ... details omitted ...
2992    /// }
2993    /// ```
2994    #[derive(Clone, Debug)]
2995    pub struct DeleteConversation(RequestBuilder<crate::model::DeleteConversationRequest>);
2996
2997    impl DeleteConversation {
2998        pub(crate) fn new(
2999            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3000        ) -> Self {
3001            Self(RequestBuilder::new(stub))
3002        }
3003
3004        /// Sets the full request, replacing any prior values.
3005        pub fn with_request<V: Into<crate::model::DeleteConversationRequest>>(
3006            mut self,
3007            v: V,
3008        ) -> Self {
3009            self.0.request = v.into();
3010            self
3011        }
3012
3013        /// Sets all the options, replacing any prior values.
3014        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3015            self.0.options = v.into();
3016            self
3017        }
3018
3019        /// Sends the request.
3020        pub async fn send(self) -> Result<()> {
3021            (*self.0.stub)
3022                .delete_conversation(self.0.request, self.0.options)
3023                .await
3024                .map(gax::response::Response::into_body)
3025        }
3026
3027        /// Sets the value of [name][crate::model::DeleteConversationRequest::name].
3028        ///
3029        /// This is a **required** field for requests.
3030        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3031            self.0.request.name = v.into();
3032            self
3033        }
3034    }
3035
3036    #[doc(hidden)]
3037    impl gax::options::internal::RequestBuilder for DeleteConversation {
3038        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3039            &mut self.0.options
3040        }
3041    }
3042
3043    /// The request builder for [ConversationalSearchService::update_conversation][crate::client::ConversationalSearchService::update_conversation] calls.
3044    ///
3045    /// # Example
3046    /// ```
3047    /// # use google_cloud_discoveryengine_v1::builder::conversational_search_service::UpdateConversation;
3048    /// # async fn sample() -> gax::Result<()> {
3049    ///
3050    /// let builder = prepare_request_builder();
3051    /// let response = builder.send().await?;
3052    /// # Ok(()) }
3053    ///
3054    /// fn prepare_request_builder() -> UpdateConversation {
3055    ///   # panic!();
3056    ///   // ... details omitted ...
3057    /// }
3058    /// ```
3059    #[derive(Clone, Debug)]
3060    pub struct UpdateConversation(RequestBuilder<crate::model::UpdateConversationRequest>);
3061
3062    impl UpdateConversation {
3063        pub(crate) fn new(
3064            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3065        ) -> Self {
3066            Self(RequestBuilder::new(stub))
3067        }
3068
3069        /// Sets the full request, replacing any prior values.
3070        pub fn with_request<V: Into<crate::model::UpdateConversationRequest>>(
3071            mut self,
3072            v: V,
3073        ) -> Self {
3074            self.0.request = v.into();
3075            self
3076        }
3077
3078        /// Sets all the options, replacing any prior values.
3079        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3080            self.0.options = v.into();
3081            self
3082        }
3083
3084        /// Sends the request.
3085        pub async fn send(self) -> Result<crate::model::Conversation> {
3086            (*self.0.stub)
3087                .update_conversation(self.0.request, self.0.options)
3088                .await
3089                .map(gax::response::Response::into_body)
3090        }
3091
3092        /// Sets the value of [conversation][crate::model::UpdateConversationRequest::conversation].
3093        ///
3094        /// This is a **required** field for requests.
3095        pub fn set_conversation<T>(mut self, v: T) -> Self
3096        where
3097            T: std::convert::Into<crate::model::Conversation>,
3098        {
3099            self.0.request.conversation = std::option::Option::Some(v.into());
3100            self
3101        }
3102
3103        /// Sets or clears the value of [conversation][crate::model::UpdateConversationRequest::conversation].
3104        ///
3105        /// This is a **required** field for requests.
3106        pub fn set_or_clear_conversation<T>(mut self, v: std::option::Option<T>) -> Self
3107        where
3108            T: std::convert::Into<crate::model::Conversation>,
3109        {
3110            self.0.request.conversation = v.map(|x| x.into());
3111            self
3112        }
3113
3114        /// Sets the value of [update_mask][crate::model::UpdateConversationRequest::update_mask].
3115        pub fn set_update_mask<T>(mut self, v: T) -> Self
3116        where
3117            T: std::convert::Into<wkt::FieldMask>,
3118        {
3119            self.0.request.update_mask = std::option::Option::Some(v.into());
3120            self
3121        }
3122
3123        /// Sets or clears the value of [update_mask][crate::model::UpdateConversationRequest::update_mask].
3124        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
3125        where
3126            T: std::convert::Into<wkt::FieldMask>,
3127        {
3128            self.0.request.update_mask = v.map(|x| x.into());
3129            self
3130        }
3131    }
3132
3133    #[doc(hidden)]
3134    impl gax::options::internal::RequestBuilder for UpdateConversation {
3135        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3136            &mut self.0.options
3137        }
3138    }
3139
3140    /// The request builder for [ConversationalSearchService::get_conversation][crate::client::ConversationalSearchService::get_conversation] calls.
3141    ///
3142    /// # Example
3143    /// ```
3144    /// # use google_cloud_discoveryengine_v1::builder::conversational_search_service::GetConversation;
3145    /// # async fn sample() -> gax::Result<()> {
3146    ///
3147    /// let builder = prepare_request_builder();
3148    /// let response = builder.send().await?;
3149    /// # Ok(()) }
3150    ///
3151    /// fn prepare_request_builder() -> GetConversation {
3152    ///   # panic!();
3153    ///   // ... details omitted ...
3154    /// }
3155    /// ```
3156    #[derive(Clone, Debug)]
3157    pub struct GetConversation(RequestBuilder<crate::model::GetConversationRequest>);
3158
3159    impl GetConversation {
3160        pub(crate) fn new(
3161            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3162        ) -> Self {
3163            Self(RequestBuilder::new(stub))
3164        }
3165
3166        /// Sets the full request, replacing any prior values.
3167        pub fn with_request<V: Into<crate::model::GetConversationRequest>>(mut self, v: V) -> Self {
3168            self.0.request = v.into();
3169            self
3170        }
3171
3172        /// Sets all the options, replacing any prior values.
3173        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3174            self.0.options = v.into();
3175            self
3176        }
3177
3178        /// Sends the request.
3179        pub async fn send(self) -> Result<crate::model::Conversation> {
3180            (*self.0.stub)
3181                .get_conversation(self.0.request, self.0.options)
3182                .await
3183                .map(gax::response::Response::into_body)
3184        }
3185
3186        /// Sets the value of [name][crate::model::GetConversationRequest::name].
3187        ///
3188        /// This is a **required** field for requests.
3189        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3190            self.0.request.name = v.into();
3191            self
3192        }
3193    }
3194
3195    #[doc(hidden)]
3196    impl gax::options::internal::RequestBuilder for GetConversation {
3197        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3198            &mut self.0.options
3199        }
3200    }
3201
3202    /// The request builder for [ConversationalSearchService::list_conversations][crate::client::ConversationalSearchService::list_conversations] calls.
3203    ///
3204    /// # Example
3205    /// ```
3206    /// # use google_cloud_discoveryengine_v1::builder::conversational_search_service::ListConversations;
3207    /// # async fn sample() -> gax::Result<()> {
3208    /// use gax::paginator::ItemPaginator;
3209    ///
3210    /// let builder = prepare_request_builder();
3211    /// let mut items = builder.by_item();
3212    /// while let Some(result) = items.next().await {
3213    ///   let item = result?;
3214    /// }
3215    /// # Ok(()) }
3216    ///
3217    /// fn prepare_request_builder() -> ListConversations {
3218    ///   # panic!();
3219    ///   // ... details omitted ...
3220    /// }
3221    /// ```
3222    #[derive(Clone, Debug)]
3223    pub struct ListConversations(RequestBuilder<crate::model::ListConversationsRequest>);
3224
3225    impl ListConversations {
3226        pub(crate) fn new(
3227            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3228        ) -> Self {
3229            Self(RequestBuilder::new(stub))
3230        }
3231
3232        /// Sets the full request, replacing any prior values.
3233        pub fn with_request<V: Into<crate::model::ListConversationsRequest>>(
3234            mut self,
3235            v: V,
3236        ) -> Self {
3237            self.0.request = v.into();
3238            self
3239        }
3240
3241        /// Sets all the options, replacing any prior values.
3242        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3243            self.0.options = v.into();
3244            self
3245        }
3246
3247        /// Sends the request.
3248        pub async fn send(self) -> Result<crate::model::ListConversationsResponse> {
3249            (*self.0.stub)
3250                .list_conversations(self.0.request, self.0.options)
3251                .await
3252                .map(gax::response::Response::into_body)
3253        }
3254
3255        /// Streams each page in the collection.
3256        pub fn by_page(
3257            self,
3258        ) -> impl gax::paginator::Paginator<crate::model::ListConversationsResponse, gax::error::Error>
3259        {
3260            use std::clone::Clone;
3261            let token = self.0.request.page_token.clone();
3262            let execute = move |token: String| {
3263                let mut builder = self.clone();
3264                builder.0.request = builder.0.request.set_page_token(token);
3265                builder.send()
3266            };
3267            gax::paginator::internal::new_paginator(token, execute)
3268        }
3269
3270        /// Streams each item in the collection.
3271        pub fn by_item(
3272            self,
3273        ) -> impl gax::paginator::ItemPaginator<crate::model::ListConversationsResponse, gax::error::Error>
3274        {
3275            use gax::paginator::Paginator;
3276            self.by_page().items()
3277        }
3278
3279        /// Sets the value of [parent][crate::model::ListConversationsRequest::parent].
3280        ///
3281        /// This is a **required** field for requests.
3282        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
3283            self.0.request.parent = v.into();
3284            self
3285        }
3286
3287        /// Sets the value of [page_size][crate::model::ListConversationsRequest::page_size].
3288        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
3289            self.0.request.page_size = v.into();
3290            self
3291        }
3292
3293        /// Sets the value of [page_token][crate::model::ListConversationsRequest::page_token].
3294        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
3295            self.0.request.page_token = v.into();
3296            self
3297        }
3298
3299        /// Sets the value of [filter][crate::model::ListConversationsRequest::filter].
3300        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
3301            self.0.request.filter = v.into();
3302            self
3303        }
3304
3305        /// Sets the value of [order_by][crate::model::ListConversationsRequest::order_by].
3306        pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
3307            self.0.request.order_by = v.into();
3308            self
3309        }
3310    }
3311
3312    #[doc(hidden)]
3313    impl gax::options::internal::RequestBuilder for ListConversations {
3314        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3315            &mut self.0.options
3316        }
3317    }
3318
3319    /// The request builder for [ConversationalSearchService::answer_query][crate::client::ConversationalSearchService::answer_query] calls.
3320    ///
3321    /// # Example
3322    /// ```
3323    /// # use google_cloud_discoveryengine_v1::builder::conversational_search_service::AnswerQuery;
3324    /// # async fn sample() -> gax::Result<()> {
3325    ///
3326    /// let builder = prepare_request_builder();
3327    /// let response = builder.send().await?;
3328    /// # Ok(()) }
3329    ///
3330    /// fn prepare_request_builder() -> AnswerQuery {
3331    ///   # panic!();
3332    ///   // ... details omitted ...
3333    /// }
3334    /// ```
3335    #[derive(Clone, Debug)]
3336    pub struct AnswerQuery(RequestBuilder<crate::model::AnswerQueryRequest>);
3337
3338    impl AnswerQuery {
3339        pub(crate) fn new(
3340            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3341        ) -> Self {
3342            Self(RequestBuilder::new(stub))
3343        }
3344
3345        /// Sets the full request, replacing any prior values.
3346        pub fn with_request<V: Into<crate::model::AnswerQueryRequest>>(mut self, v: V) -> Self {
3347            self.0.request = v.into();
3348            self
3349        }
3350
3351        /// Sets all the options, replacing any prior values.
3352        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3353            self.0.options = v.into();
3354            self
3355        }
3356
3357        /// Sends the request.
3358        pub async fn send(self) -> Result<crate::model::AnswerQueryResponse> {
3359            (*self.0.stub)
3360                .answer_query(self.0.request, self.0.options)
3361                .await
3362                .map(gax::response::Response::into_body)
3363        }
3364
3365        /// Sets the value of [serving_config][crate::model::AnswerQueryRequest::serving_config].
3366        ///
3367        /// This is a **required** field for requests.
3368        pub fn set_serving_config<T: Into<std::string::String>>(mut self, v: T) -> Self {
3369            self.0.request.serving_config = v.into();
3370            self
3371        }
3372
3373        /// Sets the value of [query][crate::model::AnswerQueryRequest::query].
3374        ///
3375        /// This is a **required** field for requests.
3376        pub fn set_query<T>(mut self, v: T) -> Self
3377        where
3378            T: std::convert::Into<crate::model::Query>,
3379        {
3380            self.0.request.query = std::option::Option::Some(v.into());
3381            self
3382        }
3383
3384        /// Sets or clears the value of [query][crate::model::AnswerQueryRequest::query].
3385        ///
3386        /// This is a **required** field for requests.
3387        pub fn set_or_clear_query<T>(mut self, v: std::option::Option<T>) -> Self
3388        where
3389            T: std::convert::Into<crate::model::Query>,
3390        {
3391            self.0.request.query = v.map(|x| x.into());
3392            self
3393        }
3394
3395        /// Sets the value of [session][crate::model::AnswerQueryRequest::session].
3396        pub fn set_session<T: Into<std::string::String>>(mut self, v: T) -> Self {
3397            self.0.request.session = v.into();
3398            self
3399        }
3400
3401        /// Sets the value of [safety_spec][crate::model::AnswerQueryRequest::safety_spec].
3402        pub fn set_safety_spec<T>(mut self, v: T) -> Self
3403        where
3404            T: std::convert::Into<crate::model::answer_query_request::SafetySpec>,
3405        {
3406            self.0.request.safety_spec = std::option::Option::Some(v.into());
3407            self
3408        }
3409
3410        /// Sets or clears the value of [safety_spec][crate::model::AnswerQueryRequest::safety_spec].
3411        pub fn set_or_clear_safety_spec<T>(mut self, v: std::option::Option<T>) -> Self
3412        where
3413            T: std::convert::Into<crate::model::answer_query_request::SafetySpec>,
3414        {
3415            self.0.request.safety_spec = v.map(|x| x.into());
3416            self
3417        }
3418
3419        /// Sets the value of [related_questions_spec][crate::model::AnswerQueryRequest::related_questions_spec].
3420        pub fn set_related_questions_spec<T>(mut self, v: T) -> Self
3421        where
3422            T: std::convert::Into<crate::model::answer_query_request::RelatedQuestionsSpec>,
3423        {
3424            self.0.request.related_questions_spec = std::option::Option::Some(v.into());
3425            self
3426        }
3427
3428        /// Sets or clears the value of [related_questions_spec][crate::model::AnswerQueryRequest::related_questions_spec].
3429        pub fn set_or_clear_related_questions_spec<T>(mut self, v: std::option::Option<T>) -> Self
3430        where
3431            T: std::convert::Into<crate::model::answer_query_request::RelatedQuestionsSpec>,
3432        {
3433            self.0.request.related_questions_spec = v.map(|x| x.into());
3434            self
3435        }
3436
3437        /// Sets the value of [grounding_spec][crate::model::AnswerQueryRequest::grounding_spec].
3438        pub fn set_grounding_spec<T>(mut self, v: T) -> Self
3439        where
3440            T: std::convert::Into<crate::model::answer_query_request::GroundingSpec>,
3441        {
3442            self.0.request.grounding_spec = std::option::Option::Some(v.into());
3443            self
3444        }
3445
3446        /// Sets or clears the value of [grounding_spec][crate::model::AnswerQueryRequest::grounding_spec].
3447        pub fn set_or_clear_grounding_spec<T>(mut self, v: std::option::Option<T>) -> Self
3448        where
3449            T: std::convert::Into<crate::model::answer_query_request::GroundingSpec>,
3450        {
3451            self.0.request.grounding_spec = v.map(|x| x.into());
3452            self
3453        }
3454
3455        /// Sets the value of [answer_generation_spec][crate::model::AnswerQueryRequest::answer_generation_spec].
3456        pub fn set_answer_generation_spec<T>(mut self, v: T) -> Self
3457        where
3458            T: std::convert::Into<crate::model::answer_query_request::AnswerGenerationSpec>,
3459        {
3460            self.0.request.answer_generation_spec = std::option::Option::Some(v.into());
3461            self
3462        }
3463
3464        /// Sets or clears the value of [answer_generation_spec][crate::model::AnswerQueryRequest::answer_generation_spec].
3465        pub fn set_or_clear_answer_generation_spec<T>(mut self, v: std::option::Option<T>) -> Self
3466        where
3467            T: std::convert::Into<crate::model::answer_query_request::AnswerGenerationSpec>,
3468        {
3469            self.0.request.answer_generation_spec = v.map(|x| x.into());
3470            self
3471        }
3472
3473        /// Sets the value of [search_spec][crate::model::AnswerQueryRequest::search_spec].
3474        pub fn set_search_spec<T>(mut self, v: T) -> Self
3475        where
3476            T: std::convert::Into<crate::model::answer_query_request::SearchSpec>,
3477        {
3478            self.0.request.search_spec = std::option::Option::Some(v.into());
3479            self
3480        }
3481
3482        /// Sets or clears the value of [search_spec][crate::model::AnswerQueryRequest::search_spec].
3483        pub fn set_or_clear_search_spec<T>(mut self, v: std::option::Option<T>) -> Self
3484        where
3485            T: std::convert::Into<crate::model::answer_query_request::SearchSpec>,
3486        {
3487            self.0.request.search_spec = v.map(|x| x.into());
3488            self
3489        }
3490
3491        /// Sets the value of [query_understanding_spec][crate::model::AnswerQueryRequest::query_understanding_spec].
3492        pub fn set_query_understanding_spec<T>(mut self, v: T) -> Self
3493        where
3494            T: std::convert::Into<crate::model::answer_query_request::QueryUnderstandingSpec>,
3495        {
3496            self.0.request.query_understanding_spec = std::option::Option::Some(v.into());
3497            self
3498        }
3499
3500        /// Sets or clears the value of [query_understanding_spec][crate::model::AnswerQueryRequest::query_understanding_spec].
3501        pub fn set_or_clear_query_understanding_spec<T>(mut self, v: std::option::Option<T>) -> Self
3502        where
3503            T: std::convert::Into<crate::model::answer_query_request::QueryUnderstandingSpec>,
3504        {
3505            self.0.request.query_understanding_spec = v.map(|x| x.into());
3506            self
3507        }
3508
3509        /// Sets the value of [asynchronous_mode][crate::model::AnswerQueryRequest::asynchronous_mode].
3510        #[deprecated]
3511        pub fn set_asynchronous_mode<T: Into<bool>>(mut self, v: T) -> Self {
3512            self.0.request.asynchronous_mode = v.into();
3513            self
3514        }
3515
3516        /// Sets the value of [user_pseudo_id][crate::model::AnswerQueryRequest::user_pseudo_id].
3517        pub fn set_user_pseudo_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
3518            self.0.request.user_pseudo_id = v.into();
3519            self
3520        }
3521
3522        /// Sets the value of [user_labels][crate::model::AnswerQueryRequest::user_labels].
3523        pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
3524        where
3525            T: std::iter::IntoIterator<Item = (K, V)>,
3526            K: std::convert::Into<std::string::String>,
3527            V: std::convert::Into<std::string::String>,
3528        {
3529            self.0.request.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
3530            self
3531        }
3532
3533        /// Sets the value of [end_user_spec][crate::model::AnswerQueryRequest::end_user_spec].
3534        pub fn set_end_user_spec<T>(mut self, v: T) -> Self
3535        where
3536            T: std::convert::Into<crate::model::answer_query_request::EndUserSpec>,
3537        {
3538            self.0.request.end_user_spec = std::option::Option::Some(v.into());
3539            self
3540        }
3541
3542        /// Sets or clears the value of [end_user_spec][crate::model::AnswerQueryRequest::end_user_spec].
3543        pub fn set_or_clear_end_user_spec<T>(mut self, v: std::option::Option<T>) -> Self
3544        where
3545            T: std::convert::Into<crate::model::answer_query_request::EndUserSpec>,
3546        {
3547            self.0.request.end_user_spec = v.map(|x| x.into());
3548            self
3549        }
3550    }
3551
3552    #[doc(hidden)]
3553    impl gax::options::internal::RequestBuilder for AnswerQuery {
3554        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3555            &mut self.0.options
3556        }
3557    }
3558
3559    /// The request builder for [ConversationalSearchService::get_answer][crate::client::ConversationalSearchService::get_answer] calls.
3560    ///
3561    /// # Example
3562    /// ```
3563    /// # use google_cloud_discoveryengine_v1::builder::conversational_search_service::GetAnswer;
3564    /// # async fn sample() -> gax::Result<()> {
3565    ///
3566    /// let builder = prepare_request_builder();
3567    /// let response = builder.send().await?;
3568    /// # Ok(()) }
3569    ///
3570    /// fn prepare_request_builder() -> GetAnswer {
3571    ///   # panic!();
3572    ///   // ... details omitted ...
3573    /// }
3574    /// ```
3575    #[derive(Clone, Debug)]
3576    pub struct GetAnswer(RequestBuilder<crate::model::GetAnswerRequest>);
3577
3578    impl GetAnswer {
3579        pub(crate) fn new(
3580            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3581        ) -> Self {
3582            Self(RequestBuilder::new(stub))
3583        }
3584
3585        /// Sets the full request, replacing any prior values.
3586        pub fn with_request<V: Into<crate::model::GetAnswerRequest>>(mut self, v: V) -> Self {
3587            self.0.request = v.into();
3588            self
3589        }
3590
3591        /// Sets all the options, replacing any prior values.
3592        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3593            self.0.options = v.into();
3594            self
3595        }
3596
3597        /// Sends the request.
3598        pub async fn send(self) -> Result<crate::model::Answer> {
3599            (*self.0.stub)
3600                .get_answer(self.0.request, self.0.options)
3601                .await
3602                .map(gax::response::Response::into_body)
3603        }
3604
3605        /// Sets the value of [name][crate::model::GetAnswerRequest::name].
3606        ///
3607        /// This is a **required** field for requests.
3608        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3609            self.0.request.name = v.into();
3610            self
3611        }
3612    }
3613
3614    #[doc(hidden)]
3615    impl gax::options::internal::RequestBuilder for GetAnswer {
3616        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3617            &mut self.0.options
3618        }
3619    }
3620
3621    /// The request builder for [ConversationalSearchService::create_session][crate::client::ConversationalSearchService::create_session] calls.
3622    ///
3623    /// # Example
3624    /// ```
3625    /// # use google_cloud_discoveryengine_v1::builder::conversational_search_service::CreateSession;
3626    /// # async fn sample() -> gax::Result<()> {
3627    ///
3628    /// let builder = prepare_request_builder();
3629    /// let response = builder.send().await?;
3630    /// # Ok(()) }
3631    ///
3632    /// fn prepare_request_builder() -> CreateSession {
3633    ///   # panic!();
3634    ///   // ... details omitted ...
3635    /// }
3636    /// ```
3637    #[derive(Clone, Debug)]
3638    pub struct CreateSession(RequestBuilder<crate::model::CreateSessionRequest>);
3639
3640    impl CreateSession {
3641        pub(crate) fn new(
3642            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3643        ) -> Self {
3644            Self(RequestBuilder::new(stub))
3645        }
3646
3647        /// Sets the full request, replacing any prior values.
3648        pub fn with_request<V: Into<crate::model::CreateSessionRequest>>(mut self, v: V) -> Self {
3649            self.0.request = v.into();
3650            self
3651        }
3652
3653        /// Sets all the options, replacing any prior values.
3654        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3655            self.0.options = v.into();
3656            self
3657        }
3658
3659        /// Sends the request.
3660        pub async fn send(self) -> Result<crate::model::Session> {
3661            (*self.0.stub)
3662                .create_session(self.0.request, self.0.options)
3663                .await
3664                .map(gax::response::Response::into_body)
3665        }
3666
3667        /// Sets the value of [parent][crate::model::CreateSessionRequest::parent].
3668        ///
3669        /// This is a **required** field for requests.
3670        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
3671            self.0.request.parent = v.into();
3672            self
3673        }
3674
3675        /// Sets the value of [session][crate::model::CreateSessionRequest::session].
3676        ///
3677        /// This is a **required** field for requests.
3678        pub fn set_session<T>(mut self, v: T) -> Self
3679        where
3680            T: std::convert::Into<crate::model::Session>,
3681        {
3682            self.0.request.session = std::option::Option::Some(v.into());
3683            self
3684        }
3685
3686        /// Sets or clears the value of [session][crate::model::CreateSessionRequest::session].
3687        ///
3688        /// This is a **required** field for requests.
3689        pub fn set_or_clear_session<T>(mut self, v: std::option::Option<T>) -> Self
3690        where
3691            T: std::convert::Into<crate::model::Session>,
3692        {
3693            self.0.request.session = v.map(|x| x.into());
3694            self
3695        }
3696    }
3697
3698    #[doc(hidden)]
3699    impl gax::options::internal::RequestBuilder for CreateSession {
3700        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3701            &mut self.0.options
3702        }
3703    }
3704
3705    /// The request builder for [ConversationalSearchService::delete_session][crate::client::ConversationalSearchService::delete_session] calls.
3706    ///
3707    /// # Example
3708    /// ```
3709    /// # use google_cloud_discoveryengine_v1::builder::conversational_search_service::DeleteSession;
3710    /// # async fn sample() -> gax::Result<()> {
3711    ///
3712    /// let builder = prepare_request_builder();
3713    /// let response = builder.send().await?;
3714    /// # Ok(()) }
3715    ///
3716    /// fn prepare_request_builder() -> DeleteSession {
3717    ///   # panic!();
3718    ///   // ... details omitted ...
3719    /// }
3720    /// ```
3721    #[derive(Clone, Debug)]
3722    pub struct DeleteSession(RequestBuilder<crate::model::DeleteSessionRequest>);
3723
3724    impl DeleteSession {
3725        pub(crate) fn new(
3726            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3727        ) -> Self {
3728            Self(RequestBuilder::new(stub))
3729        }
3730
3731        /// Sets the full request, replacing any prior values.
3732        pub fn with_request<V: Into<crate::model::DeleteSessionRequest>>(mut self, v: V) -> Self {
3733            self.0.request = v.into();
3734            self
3735        }
3736
3737        /// Sets all the options, replacing any prior values.
3738        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3739            self.0.options = v.into();
3740            self
3741        }
3742
3743        /// Sends the request.
3744        pub async fn send(self) -> Result<()> {
3745            (*self.0.stub)
3746                .delete_session(self.0.request, self.0.options)
3747                .await
3748                .map(gax::response::Response::into_body)
3749        }
3750
3751        /// Sets the value of [name][crate::model::DeleteSessionRequest::name].
3752        ///
3753        /// This is a **required** field for requests.
3754        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3755            self.0.request.name = v.into();
3756            self
3757        }
3758    }
3759
3760    #[doc(hidden)]
3761    impl gax::options::internal::RequestBuilder for DeleteSession {
3762        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3763            &mut self.0.options
3764        }
3765    }
3766
3767    /// The request builder for [ConversationalSearchService::update_session][crate::client::ConversationalSearchService::update_session] calls.
3768    ///
3769    /// # Example
3770    /// ```
3771    /// # use google_cloud_discoveryengine_v1::builder::conversational_search_service::UpdateSession;
3772    /// # async fn sample() -> gax::Result<()> {
3773    ///
3774    /// let builder = prepare_request_builder();
3775    /// let response = builder.send().await?;
3776    /// # Ok(()) }
3777    ///
3778    /// fn prepare_request_builder() -> UpdateSession {
3779    ///   # panic!();
3780    ///   // ... details omitted ...
3781    /// }
3782    /// ```
3783    #[derive(Clone, Debug)]
3784    pub struct UpdateSession(RequestBuilder<crate::model::UpdateSessionRequest>);
3785
3786    impl UpdateSession {
3787        pub(crate) fn new(
3788            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3789        ) -> Self {
3790            Self(RequestBuilder::new(stub))
3791        }
3792
3793        /// Sets the full request, replacing any prior values.
3794        pub fn with_request<V: Into<crate::model::UpdateSessionRequest>>(mut self, v: V) -> Self {
3795            self.0.request = v.into();
3796            self
3797        }
3798
3799        /// Sets all the options, replacing any prior values.
3800        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3801            self.0.options = v.into();
3802            self
3803        }
3804
3805        /// Sends the request.
3806        pub async fn send(self) -> Result<crate::model::Session> {
3807            (*self.0.stub)
3808                .update_session(self.0.request, self.0.options)
3809                .await
3810                .map(gax::response::Response::into_body)
3811        }
3812
3813        /// Sets the value of [session][crate::model::UpdateSessionRequest::session].
3814        ///
3815        /// This is a **required** field for requests.
3816        pub fn set_session<T>(mut self, v: T) -> Self
3817        where
3818            T: std::convert::Into<crate::model::Session>,
3819        {
3820            self.0.request.session = std::option::Option::Some(v.into());
3821            self
3822        }
3823
3824        /// Sets or clears the value of [session][crate::model::UpdateSessionRequest::session].
3825        ///
3826        /// This is a **required** field for requests.
3827        pub fn set_or_clear_session<T>(mut self, v: std::option::Option<T>) -> Self
3828        where
3829            T: std::convert::Into<crate::model::Session>,
3830        {
3831            self.0.request.session = v.map(|x| x.into());
3832            self
3833        }
3834
3835        /// Sets the value of [update_mask][crate::model::UpdateSessionRequest::update_mask].
3836        pub fn set_update_mask<T>(mut self, v: T) -> Self
3837        where
3838            T: std::convert::Into<wkt::FieldMask>,
3839        {
3840            self.0.request.update_mask = std::option::Option::Some(v.into());
3841            self
3842        }
3843
3844        /// Sets or clears the value of [update_mask][crate::model::UpdateSessionRequest::update_mask].
3845        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
3846        where
3847            T: std::convert::Into<wkt::FieldMask>,
3848        {
3849            self.0.request.update_mask = v.map(|x| x.into());
3850            self
3851        }
3852    }
3853
3854    #[doc(hidden)]
3855    impl gax::options::internal::RequestBuilder for UpdateSession {
3856        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3857            &mut self.0.options
3858        }
3859    }
3860
3861    /// The request builder for [ConversationalSearchService::get_session][crate::client::ConversationalSearchService::get_session] calls.
3862    ///
3863    /// # Example
3864    /// ```
3865    /// # use google_cloud_discoveryengine_v1::builder::conversational_search_service::GetSession;
3866    /// # async fn sample() -> gax::Result<()> {
3867    ///
3868    /// let builder = prepare_request_builder();
3869    /// let response = builder.send().await?;
3870    /// # Ok(()) }
3871    ///
3872    /// fn prepare_request_builder() -> GetSession {
3873    ///   # panic!();
3874    ///   // ... details omitted ...
3875    /// }
3876    /// ```
3877    #[derive(Clone, Debug)]
3878    pub struct GetSession(RequestBuilder<crate::model::GetSessionRequest>);
3879
3880    impl GetSession {
3881        pub(crate) fn new(
3882            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3883        ) -> Self {
3884            Self(RequestBuilder::new(stub))
3885        }
3886
3887        /// Sets the full request, replacing any prior values.
3888        pub fn with_request<V: Into<crate::model::GetSessionRequest>>(mut self, v: V) -> Self {
3889            self.0.request = v.into();
3890            self
3891        }
3892
3893        /// Sets all the options, replacing any prior values.
3894        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3895            self.0.options = v.into();
3896            self
3897        }
3898
3899        /// Sends the request.
3900        pub async fn send(self) -> Result<crate::model::Session> {
3901            (*self.0.stub)
3902                .get_session(self.0.request, self.0.options)
3903                .await
3904                .map(gax::response::Response::into_body)
3905        }
3906
3907        /// Sets the value of [name][crate::model::GetSessionRequest::name].
3908        ///
3909        /// This is a **required** field for requests.
3910        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3911            self.0.request.name = v.into();
3912            self
3913        }
3914
3915        /// Sets the value of [include_answer_details][crate::model::GetSessionRequest::include_answer_details].
3916        pub fn set_include_answer_details<T: Into<bool>>(mut self, v: T) -> Self {
3917            self.0.request.include_answer_details = v.into();
3918            self
3919        }
3920    }
3921
3922    #[doc(hidden)]
3923    impl gax::options::internal::RequestBuilder for GetSession {
3924        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3925            &mut self.0.options
3926        }
3927    }
3928
3929    /// The request builder for [ConversationalSearchService::list_sessions][crate::client::ConversationalSearchService::list_sessions] calls.
3930    ///
3931    /// # Example
3932    /// ```
3933    /// # use google_cloud_discoveryengine_v1::builder::conversational_search_service::ListSessions;
3934    /// # async fn sample() -> gax::Result<()> {
3935    /// use gax::paginator::ItemPaginator;
3936    ///
3937    /// let builder = prepare_request_builder();
3938    /// let mut items = builder.by_item();
3939    /// while let Some(result) = items.next().await {
3940    ///   let item = result?;
3941    /// }
3942    /// # Ok(()) }
3943    ///
3944    /// fn prepare_request_builder() -> ListSessions {
3945    ///   # panic!();
3946    ///   // ... details omitted ...
3947    /// }
3948    /// ```
3949    #[derive(Clone, Debug)]
3950    pub struct ListSessions(RequestBuilder<crate::model::ListSessionsRequest>);
3951
3952    impl ListSessions {
3953        pub(crate) fn new(
3954            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3955        ) -> Self {
3956            Self(RequestBuilder::new(stub))
3957        }
3958
3959        /// Sets the full request, replacing any prior values.
3960        pub fn with_request<V: Into<crate::model::ListSessionsRequest>>(mut self, v: V) -> Self {
3961            self.0.request = v.into();
3962            self
3963        }
3964
3965        /// Sets all the options, replacing any prior values.
3966        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3967            self.0.options = v.into();
3968            self
3969        }
3970
3971        /// Sends the request.
3972        pub async fn send(self) -> Result<crate::model::ListSessionsResponse> {
3973            (*self.0.stub)
3974                .list_sessions(self.0.request, self.0.options)
3975                .await
3976                .map(gax::response::Response::into_body)
3977        }
3978
3979        /// Streams each page in the collection.
3980        pub fn by_page(
3981            self,
3982        ) -> impl gax::paginator::Paginator<crate::model::ListSessionsResponse, gax::error::Error>
3983        {
3984            use std::clone::Clone;
3985            let token = self.0.request.page_token.clone();
3986            let execute = move |token: String| {
3987                let mut builder = self.clone();
3988                builder.0.request = builder.0.request.set_page_token(token);
3989                builder.send()
3990            };
3991            gax::paginator::internal::new_paginator(token, execute)
3992        }
3993
3994        /// Streams each item in the collection.
3995        pub fn by_item(
3996            self,
3997        ) -> impl gax::paginator::ItemPaginator<crate::model::ListSessionsResponse, gax::error::Error>
3998        {
3999            use gax::paginator::Paginator;
4000            self.by_page().items()
4001        }
4002
4003        /// Sets the value of [parent][crate::model::ListSessionsRequest::parent].
4004        ///
4005        /// This is a **required** field for requests.
4006        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
4007            self.0.request.parent = v.into();
4008            self
4009        }
4010
4011        /// Sets the value of [page_size][crate::model::ListSessionsRequest::page_size].
4012        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
4013            self.0.request.page_size = v.into();
4014            self
4015        }
4016
4017        /// Sets the value of [page_token][crate::model::ListSessionsRequest::page_token].
4018        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
4019            self.0.request.page_token = v.into();
4020            self
4021        }
4022
4023        /// Sets the value of [filter][crate::model::ListSessionsRequest::filter].
4024        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
4025            self.0.request.filter = v.into();
4026            self
4027        }
4028
4029        /// Sets the value of [order_by][crate::model::ListSessionsRequest::order_by].
4030        pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
4031            self.0.request.order_by = v.into();
4032            self
4033        }
4034    }
4035
4036    #[doc(hidden)]
4037    impl gax::options::internal::RequestBuilder for ListSessions {
4038        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4039            &mut self.0.options
4040        }
4041    }
4042
4043    /// The request builder for [ConversationalSearchService::list_operations][crate::client::ConversationalSearchService::list_operations] calls.
4044    ///
4045    /// # Example
4046    /// ```
4047    /// # use google_cloud_discoveryengine_v1::builder::conversational_search_service::ListOperations;
4048    /// # async fn sample() -> gax::Result<()> {
4049    /// use gax::paginator::ItemPaginator;
4050    ///
4051    /// let builder = prepare_request_builder();
4052    /// let mut items = builder.by_item();
4053    /// while let Some(result) = items.next().await {
4054    ///   let item = result?;
4055    /// }
4056    /// # Ok(()) }
4057    ///
4058    /// fn prepare_request_builder() -> ListOperations {
4059    ///   # panic!();
4060    ///   // ... details omitted ...
4061    /// }
4062    /// ```
4063    #[derive(Clone, Debug)]
4064    pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
4065
4066    impl ListOperations {
4067        pub(crate) fn new(
4068            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
4069        ) -> Self {
4070            Self(RequestBuilder::new(stub))
4071        }
4072
4073        /// Sets the full request, replacing any prior values.
4074        pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
4075            mut self,
4076            v: V,
4077        ) -> Self {
4078            self.0.request = v.into();
4079            self
4080        }
4081
4082        /// Sets all the options, replacing any prior values.
4083        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4084            self.0.options = v.into();
4085            self
4086        }
4087
4088        /// Sends the request.
4089        pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
4090            (*self.0.stub)
4091                .list_operations(self.0.request, self.0.options)
4092                .await
4093                .map(gax::response::Response::into_body)
4094        }
4095
4096        /// Streams each page in the collection.
4097        pub fn by_page(
4098            self,
4099        ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
4100        {
4101            use std::clone::Clone;
4102            let token = self.0.request.page_token.clone();
4103            let execute = move |token: String| {
4104                let mut builder = self.clone();
4105                builder.0.request = builder.0.request.set_page_token(token);
4106                builder.send()
4107            };
4108            gax::paginator::internal::new_paginator(token, execute)
4109        }
4110
4111        /// Streams each item in the collection.
4112        pub fn by_item(
4113            self,
4114        ) -> impl gax::paginator::ItemPaginator<
4115            longrunning::model::ListOperationsResponse,
4116            gax::error::Error,
4117        > {
4118            use gax::paginator::Paginator;
4119            self.by_page().items()
4120        }
4121
4122        /// Sets the value of [name][longrunning::model::ListOperationsRequest::name].
4123        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4124            self.0.request.name = v.into();
4125            self
4126        }
4127
4128        /// Sets the value of [filter][longrunning::model::ListOperationsRequest::filter].
4129        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
4130            self.0.request.filter = v.into();
4131            self
4132        }
4133
4134        /// Sets the value of [page_size][longrunning::model::ListOperationsRequest::page_size].
4135        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
4136            self.0.request.page_size = v.into();
4137            self
4138        }
4139
4140        /// Sets the value of [page_token][longrunning::model::ListOperationsRequest::page_token].
4141        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
4142            self.0.request.page_token = v.into();
4143            self
4144        }
4145
4146        /// Sets the value of [return_partial_success][longrunning::model::ListOperationsRequest::return_partial_success].
4147        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
4148            self.0.request.return_partial_success = v.into();
4149            self
4150        }
4151    }
4152
4153    #[doc(hidden)]
4154    impl gax::options::internal::RequestBuilder for ListOperations {
4155        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4156            &mut self.0.options
4157        }
4158    }
4159
4160    /// The request builder for [ConversationalSearchService::get_operation][crate::client::ConversationalSearchService::get_operation] calls.
4161    ///
4162    /// # Example
4163    /// ```
4164    /// # use google_cloud_discoveryengine_v1::builder::conversational_search_service::GetOperation;
4165    /// # async fn sample() -> gax::Result<()> {
4166    ///
4167    /// let builder = prepare_request_builder();
4168    /// let response = builder.send().await?;
4169    /// # Ok(()) }
4170    ///
4171    /// fn prepare_request_builder() -> GetOperation {
4172    ///   # panic!();
4173    ///   // ... details omitted ...
4174    /// }
4175    /// ```
4176    #[derive(Clone, Debug)]
4177    pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
4178
4179    impl GetOperation {
4180        pub(crate) fn new(
4181            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
4182        ) -> Self {
4183            Self(RequestBuilder::new(stub))
4184        }
4185
4186        /// Sets the full request, replacing any prior values.
4187        pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
4188            mut self,
4189            v: V,
4190        ) -> Self {
4191            self.0.request = v.into();
4192            self
4193        }
4194
4195        /// Sets all the options, replacing any prior values.
4196        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4197            self.0.options = v.into();
4198            self
4199        }
4200
4201        /// Sends the request.
4202        pub async fn send(self) -> Result<longrunning::model::Operation> {
4203            (*self.0.stub)
4204                .get_operation(self.0.request, self.0.options)
4205                .await
4206                .map(gax::response::Response::into_body)
4207        }
4208
4209        /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
4210        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4211            self.0.request.name = v.into();
4212            self
4213        }
4214    }
4215
4216    #[doc(hidden)]
4217    impl gax::options::internal::RequestBuilder for GetOperation {
4218        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4219            &mut self.0.options
4220        }
4221    }
4222
4223    /// The request builder for [ConversationalSearchService::cancel_operation][crate::client::ConversationalSearchService::cancel_operation] calls.
4224    ///
4225    /// # Example
4226    /// ```
4227    /// # use google_cloud_discoveryengine_v1::builder::conversational_search_service::CancelOperation;
4228    /// # async fn sample() -> gax::Result<()> {
4229    ///
4230    /// let builder = prepare_request_builder();
4231    /// let response = builder.send().await?;
4232    /// # Ok(()) }
4233    ///
4234    /// fn prepare_request_builder() -> CancelOperation {
4235    ///   # panic!();
4236    ///   // ... details omitted ...
4237    /// }
4238    /// ```
4239    #[derive(Clone, Debug)]
4240    pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
4241
4242    impl CancelOperation {
4243        pub(crate) fn new(
4244            stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
4245        ) -> Self {
4246            Self(RequestBuilder::new(stub))
4247        }
4248
4249        /// Sets the full request, replacing any prior values.
4250        pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
4251            mut self,
4252            v: V,
4253        ) -> Self {
4254            self.0.request = v.into();
4255            self
4256        }
4257
4258        /// Sets all the options, replacing any prior values.
4259        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4260            self.0.options = v.into();
4261            self
4262        }
4263
4264        /// Sends the request.
4265        pub async fn send(self) -> Result<()> {
4266            (*self.0.stub)
4267                .cancel_operation(self.0.request, self.0.options)
4268                .await
4269                .map(gax::response::Response::into_body)
4270        }
4271
4272        /// Sets the value of [name][longrunning::model::CancelOperationRequest::name].
4273        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4274            self.0.request.name = v.into();
4275            self
4276        }
4277    }
4278
4279    #[doc(hidden)]
4280    impl gax::options::internal::RequestBuilder for CancelOperation {
4281        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4282            &mut self.0.options
4283        }
4284    }
4285}
4286
4287#[cfg(feature = "data-store-service")]
4288#[cfg_attr(docsrs, doc(cfg(feature = "data-store-service")))]
4289pub mod data_store_service {
4290    use crate::Result;
4291
4292    /// A builder for [DataStoreService][crate::client::DataStoreService].
4293    ///
4294    /// ```
4295    /// # async fn sample() -> gax::client_builder::Result<()> {
4296    /// # use google_cloud_discoveryengine_v1::*;
4297    /// # use builder::data_store_service::ClientBuilder;
4298    /// # use client::DataStoreService;
4299    /// let builder : ClientBuilder = DataStoreService::builder();
4300    /// let client = builder
4301    ///     .with_endpoint("https://discoveryengine.googleapis.com")
4302    ///     .build().await?;
4303    /// # Ok(()) }
4304    /// ```
4305    pub type ClientBuilder =
4306        gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
4307
4308    pub(crate) mod client {
4309        use super::super::super::client::DataStoreService;
4310        pub struct Factory;
4311        impl gax::client_builder::internal::ClientFactory for Factory {
4312            type Client = DataStoreService;
4313            type Credentials = gaxi::options::Credentials;
4314            async fn build(
4315                self,
4316                config: gaxi::options::ClientConfig,
4317            ) -> gax::client_builder::Result<Self::Client> {
4318                Self::Client::new(config).await
4319            }
4320        }
4321    }
4322
4323    /// Common implementation for [crate::client::DataStoreService] request builders.
4324    #[derive(Clone, Debug)]
4325    pub(crate) struct RequestBuilder<R: std::default::Default> {
4326        stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
4327        request: R,
4328        options: gax::options::RequestOptions,
4329    }
4330
4331    impl<R> RequestBuilder<R>
4332    where
4333        R: std::default::Default,
4334    {
4335        pub(crate) fn new(
4336            stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
4337        ) -> Self {
4338            Self {
4339                stub,
4340                request: R::default(),
4341                options: gax::options::RequestOptions::default(),
4342            }
4343        }
4344    }
4345
4346    /// The request builder for [DataStoreService::create_data_store][crate::client::DataStoreService::create_data_store] calls.
4347    ///
4348    /// # Example
4349    /// ```
4350    /// # use google_cloud_discoveryengine_v1::builder::data_store_service::CreateDataStore;
4351    /// # async fn sample() -> gax::Result<()> {
4352    /// use lro::Poller;
4353    ///
4354    /// let builder = prepare_request_builder();
4355    /// let response = builder.poller().until_done().await?;
4356    /// # Ok(()) }
4357    ///
4358    /// fn prepare_request_builder() -> CreateDataStore {
4359    ///   # panic!();
4360    ///   // ... details omitted ...
4361    /// }
4362    /// ```
4363    #[derive(Clone, Debug)]
4364    pub struct CreateDataStore(RequestBuilder<crate::model::CreateDataStoreRequest>);
4365
4366    impl CreateDataStore {
4367        pub(crate) fn new(
4368            stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
4369        ) -> Self {
4370            Self(RequestBuilder::new(stub))
4371        }
4372
4373        /// Sets the full request, replacing any prior values.
4374        pub fn with_request<V: Into<crate::model::CreateDataStoreRequest>>(mut self, v: V) -> Self {
4375            self.0.request = v.into();
4376            self
4377        }
4378
4379        /// Sets all the options, replacing any prior values.
4380        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4381            self.0.options = v.into();
4382            self
4383        }
4384
4385        /// Sends the request.
4386        ///
4387        /// # Long running operations
4388        ///
4389        /// This starts, but does not poll, a longrunning operation. More information
4390        /// on [create_data_store][crate::client::DataStoreService::create_data_store].
4391        pub async fn send(self) -> Result<longrunning::model::Operation> {
4392            (*self.0.stub)
4393                .create_data_store(self.0.request, self.0.options)
4394                .await
4395                .map(gax::response::Response::into_body)
4396        }
4397
4398        /// Creates a [Poller][lro::Poller] to work with `create_data_store`.
4399        pub fn poller(
4400            self,
4401        ) -> impl lro::Poller<crate::model::DataStore, crate::model::CreateDataStoreMetadata>
4402        {
4403            type Operation = lro::internal::Operation<
4404                crate::model::DataStore,
4405                crate::model::CreateDataStoreMetadata,
4406            >;
4407            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
4408            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
4409
4410            let stub = self.0.stub.clone();
4411            let mut options = self.0.options.clone();
4412            options.set_retry_policy(gax::retry_policy::NeverRetry);
4413            let query = move |name| {
4414                let stub = stub.clone();
4415                let options = options.clone();
4416                async {
4417                    let op = GetOperation::new(stub)
4418                        .set_name(name)
4419                        .with_options(options)
4420                        .send()
4421                        .await?;
4422                    Ok(Operation::new(op))
4423                }
4424            };
4425
4426            let start = move || async {
4427                let op = self.send().await?;
4428                Ok(Operation::new(op))
4429            };
4430
4431            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
4432        }
4433
4434        /// Sets the value of [parent][crate::model::CreateDataStoreRequest::parent].
4435        ///
4436        /// This is a **required** field for requests.
4437        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
4438            self.0.request.parent = v.into();
4439            self
4440        }
4441
4442        /// Sets the value of [data_store][crate::model::CreateDataStoreRequest::data_store].
4443        ///
4444        /// This is a **required** field for requests.
4445        pub fn set_data_store<T>(mut self, v: T) -> Self
4446        where
4447            T: std::convert::Into<crate::model::DataStore>,
4448        {
4449            self.0.request.data_store = std::option::Option::Some(v.into());
4450            self
4451        }
4452
4453        /// Sets or clears the value of [data_store][crate::model::CreateDataStoreRequest::data_store].
4454        ///
4455        /// This is a **required** field for requests.
4456        pub fn set_or_clear_data_store<T>(mut self, v: std::option::Option<T>) -> Self
4457        where
4458            T: std::convert::Into<crate::model::DataStore>,
4459        {
4460            self.0.request.data_store = v.map(|x| x.into());
4461            self
4462        }
4463
4464        /// Sets the value of [data_store_id][crate::model::CreateDataStoreRequest::data_store_id].
4465        ///
4466        /// This is a **required** field for requests.
4467        pub fn set_data_store_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
4468            self.0.request.data_store_id = v.into();
4469            self
4470        }
4471
4472        /// Sets the value of [create_advanced_site_search][crate::model::CreateDataStoreRequest::create_advanced_site_search].
4473        pub fn set_create_advanced_site_search<T: Into<bool>>(mut self, v: T) -> Self {
4474            self.0.request.create_advanced_site_search = v.into();
4475            self
4476        }
4477
4478        /// Sets the value of [skip_default_schema_creation][crate::model::CreateDataStoreRequest::skip_default_schema_creation].
4479        pub fn set_skip_default_schema_creation<T: Into<bool>>(mut self, v: T) -> Self {
4480            self.0.request.skip_default_schema_creation = v.into();
4481            self
4482        }
4483
4484        /// Sets the value of [cmek_options][crate::model::CreateDataStoreRequest::cmek_options].
4485        ///
4486        /// Note that all the setters affecting `cmek_options` are
4487        /// mutually exclusive.
4488        pub fn set_cmek_options<
4489            T: Into<Option<crate::model::create_data_store_request::CmekOptions>>,
4490        >(
4491            mut self,
4492            v: T,
4493        ) -> Self {
4494            self.0.request.cmek_options = v.into();
4495            self
4496        }
4497
4498        /// Sets the value of [cmek_options][crate::model::CreateDataStoreRequest::cmek_options]
4499        /// to hold a `CmekConfigName`.
4500        ///
4501        /// Note that all the setters affecting `cmek_options` are
4502        /// mutually exclusive.
4503        pub fn set_cmek_config_name<T: std::convert::Into<std::string::String>>(
4504            mut self,
4505            v: T,
4506        ) -> Self {
4507            self.0.request = self.0.request.set_cmek_config_name(v);
4508            self
4509        }
4510
4511        /// Sets the value of [cmek_options][crate::model::CreateDataStoreRequest::cmek_options]
4512        /// to hold a `DisableCmek`.
4513        ///
4514        /// Note that all the setters affecting `cmek_options` are
4515        /// mutually exclusive.
4516        pub fn set_disable_cmek<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4517            self.0.request = self.0.request.set_disable_cmek(v);
4518            self
4519        }
4520    }
4521
4522    #[doc(hidden)]
4523    impl gax::options::internal::RequestBuilder for CreateDataStore {
4524        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4525            &mut self.0.options
4526        }
4527    }
4528
4529    /// The request builder for [DataStoreService::get_data_store][crate::client::DataStoreService::get_data_store] calls.
4530    ///
4531    /// # Example
4532    /// ```
4533    /// # use google_cloud_discoveryengine_v1::builder::data_store_service::GetDataStore;
4534    /// # async fn sample() -> gax::Result<()> {
4535    ///
4536    /// let builder = prepare_request_builder();
4537    /// let response = builder.send().await?;
4538    /// # Ok(()) }
4539    ///
4540    /// fn prepare_request_builder() -> GetDataStore {
4541    ///   # panic!();
4542    ///   // ... details omitted ...
4543    /// }
4544    /// ```
4545    #[derive(Clone, Debug)]
4546    pub struct GetDataStore(RequestBuilder<crate::model::GetDataStoreRequest>);
4547
4548    impl GetDataStore {
4549        pub(crate) fn new(
4550            stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
4551        ) -> Self {
4552            Self(RequestBuilder::new(stub))
4553        }
4554
4555        /// Sets the full request, replacing any prior values.
4556        pub fn with_request<V: Into<crate::model::GetDataStoreRequest>>(mut self, v: V) -> Self {
4557            self.0.request = v.into();
4558            self
4559        }
4560
4561        /// Sets all the options, replacing any prior values.
4562        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4563            self.0.options = v.into();
4564            self
4565        }
4566
4567        /// Sends the request.
4568        pub async fn send(self) -> Result<crate::model::DataStore> {
4569            (*self.0.stub)
4570                .get_data_store(self.0.request, self.0.options)
4571                .await
4572                .map(gax::response::Response::into_body)
4573        }
4574
4575        /// Sets the value of [name][crate::model::GetDataStoreRequest::name].
4576        ///
4577        /// This is a **required** field for requests.
4578        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4579            self.0.request.name = v.into();
4580            self
4581        }
4582    }
4583
4584    #[doc(hidden)]
4585    impl gax::options::internal::RequestBuilder for GetDataStore {
4586        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4587            &mut self.0.options
4588        }
4589    }
4590
4591    /// The request builder for [DataStoreService::list_data_stores][crate::client::DataStoreService::list_data_stores] calls.
4592    ///
4593    /// # Example
4594    /// ```
4595    /// # use google_cloud_discoveryengine_v1::builder::data_store_service::ListDataStores;
4596    /// # async fn sample() -> gax::Result<()> {
4597    /// use gax::paginator::ItemPaginator;
4598    ///
4599    /// let builder = prepare_request_builder();
4600    /// let mut items = builder.by_item();
4601    /// while let Some(result) = items.next().await {
4602    ///   let item = result?;
4603    /// }
4604    /// # Ok(()) }
4605    ///
4606    /// fn prepare_request_builder() -> ListDataStores {
4607    ///   # panic!();
4608    ///   // ... details omitted ...
4609    /// }
4610    /// ```
4611    #[derive(Clone, Debug)]
4612    pub struct ListDataStores(RequestBuilder<crate::model::ListDataStoresRequest>);
4613
4614    impl ListDataStores {
4615        pub(crate) fn new(
4616            stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
4617        ) -> Self {
4618            Self(RequestBuilder::new(stub))
4619        }
4620
4621        /// Sets the full request, replacing any prior values.
4622        pub fn with_request<V: Into<crate::model::ListDataStoresRequest>>(mut self, v: V) -> Self {
4623            self.0.request = v.into();
4624            self
4625        }
4626
4627        /// Sets all the options, replacing any prior values.
4628        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4629            self.0.options = v.into();
4630            self
4631        }
4632
4633        /// Sends the request.
4634        pub async fn send(self) -> Result<crate::model::ListDataStoresResponse> {
4635            (*self.0.stub)
4636                .list_data_stores(self.0.request, self.0.options)
4637                .await
4638                .map(gax::response::Response::into_body)
4639        }
4640
4641        /// Streams each page in the collection.
4642        pub fn by_page(
4643            self,
4644        ) -> impl gax::paginator::Paginator<crate::model::ListDataStoresResponse, gax::error::Error>
4645        {
4646            use std::clone::Clone;
4647            let token = self.0.request.page_token.clone();
4648            let execute = move |token: String| {
4649                let mut builder = self.clone();
4650                builder.0.request = builder.0.request.set_page_token(token);
4651                builder.send()
4652            };
4653            gax::paginator::internal::new_paginator(token, execute)
4654        }
4655
4656        /// Streams each item in the collection.
4657        pub fn by_item(
4658            self,
4659        ) -> impl gax::paginator::ItemPaginator<crate::model::ListDataStoresResponse, gax::error::Error>
4660        {
4661            use gax::paginator::Paginator;
4662            self.by_page().items()
4663        }
4664
4665        /// Sets the value of [parent][crate::model::ListDataStoresRequest::parent].
4666        ///
4667        /// This is a **required** field for requests.
4668        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
4669            self.0.request.parent = v.into();
4670            self
4671        }
4672
4673        /// Sets the value of [page_size][crate::model::ListDataStoresRequest::page_size].
4674        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
4675            self.0.request.page_size = v.into();
4676            self
4677        }
4678
4679        /// Sets the value of [page_token][crate::model::ListDataStoresRequest::page_token].
4680        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
4681            self.0.request.page_token = v.into();
4682            self
4683        }
4684
4685        /// Sets the value of [filter][crate::model::ListDataStoresRequest::filter].
4686        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
4687            self.0.request.filter = v.into();
4688            self
4689        }
4690    }
4691
4692    #[doc(hidden)]
4693    impl gax::options::internal::RequestBuilder for ListDataStores {
4694        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4695            &mut self.0.options
4696        }
4697    }
4698
4699    /// The request builder for [DataStoreService::delete_data_store][crate::client::DataStoreService::delete_data_store] calls.
4700    ///
4701    /// # Example
4702    /// ```
4703    /// # use google_cloud_discoveryengine_v1::builder::data_store_service::DeleteDataStore;
4704    /// # async fn sample() -> gax::Result<()> {
4705    /// use lro::Poller;
4706    ///
4707    /// let builder = prepare_request_builder();
4708    /// let response = builder.poller().until_done().await?;
4709    /// # Ok(()) }
4710    ///
4711    /// fn prepare_request_builder() -> DeleteDataStore {
4712    ///   # panic!();
4713    ///   // ... details omitted ...
4714    /// }
4715    /// ```
4716    #[derive(Clone, Debug)]
4717    pub struct DeleteDataStore(RequestBuilder<crate::model::DeleteDataStoreRequest>);
4718
4719    impl DeleteDataStore {
4720        pub(crate) fn new(
4721            stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
4722        ) -> Self {
4723            Self(RequestBuilder::new(stub))
4724        }
4725
4726        /// Sets the full request, replacing any prior values.
4727        pub fn with_request<V: Into<crate::model::DeleteDataStoreRequest>>(mut self, v: V) -> Self {
4728            self.0.request = v.into();
4729            self
4730        }
4731
4732        /// Sets all the options, replacing any prior values.
4733        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4734            self.0.options = v.into();
4735            self
4736        }
4737
4738        /// Sends the request.
4739        ///
4740        /// # Long running operations
4741        ///
4742        /// This starts, but does not poll, a longrunning operation. More information
4743        /// on [delete_data_store][crate::client::DataStoreService::delete_data_store].
4744        pub async fn send(self) -> Result<longrunning::model::Operation> {
4745            (*self.0.stub)
4746                .delete_data_store(self.0.request, self.0.options)
4747                .await
4748                .map(gax::response::Response::into_body)
4749        }
4750
4751        /// Creates a [Poller][lro::Poller] to work with `delete_data_store`.
4752        pub fn poller(self) -> impl lro::Poller<(), crate::model::DeleteDataStoreMetadata> {
4753            type Operation =
4754                lro::internal::Operation<wkt::Empty, crate::model::DeleteDataStoreMetadata>;
4755            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
4756            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
4757
4758            let stub = self.0.stub.clone();
4759            let mut options = self.0.options.clone();
4760            options.set_retry_policy(gax::retry_policy::NeverRetry);
4761            let query = move |name| {
4762                let stub = stub.clone();
4763                let options = options.clone();
4764                async {
4765                    let op = GetOperation::new(stub)
4766                        .set_name(name)
4767                        .with_options(options)
4768                        .send()
4769                        .await?;
4770                    Ok(Operation::new(op))
4771                }
4772            };
4773
4774            let start = move || async {
4775                let op = self.send().await?;
4776                Ok(Operation::new(op))
4777            };
4778
4779            lro::internal::new_unit_response_poller(
4780                polling_error_policy,
4781                polling_backoff_policy,
4782                start,
4783                query,
4784            )
4785        }
4786
4787        /// Sets the value of [name][crate::model::DeleteDataStoreRequest::name].
4788        ///
4789        /// This is a **required** field for requests.
4790        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4791            self.0.request.name = v.into();
4792            self
4793        }
4794    }
4795
4796    #[doc(hidden)]
4797    impl gax::options::internal::RequestBuilder for DeleteDataStore {
4798        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4799            &mut self.0.options
4800        }
4801    }
4802
4803    /// The request builder for [DataStoreService::update_data_store][crate::client::DataStoreService::update_data_store] calls.
4804    ///
4805    /// # Example
4806    /// ```
4807    /// # use google_cloud_discoveryengine_v1::builder::data_store_service::UpdateDataStore;
4808    /// # async fn sample() -> gax::Result<()> {
4809    ///
4810    /// let builder = prepare_request_builder();
4811    /// let response = builder.send().await?;
4812    /// # Ok(()) }
4813    ///
4814    /// fn prepare_request_builder() -> UpdateDataStore {
4815    ///   # panic!();
4816    ///   // ... details omitted ...
4817    /// }
4818    /// ```
4819    #[derive(Clone, Debug)]
4820    pub struct UpdateDataStore(RequestBuilder<crate::model::UpdateDataStoreRequest>);
4821
4822    impl UpdateDataStore {
4823        pub(crate) fn new(
4824            stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
4825        ) -> Self {
4826            Self(RequestBuilder::new(stub))
4827        }
4828
4829        /// Sets the full request, replacing any prior values.
4830        pub fn with_request<V: Into<crate::model::UpdateDataStoreRequest>>(mut self, v: V) -> Self {
4831            self.0.request = v.into();
4832            self
4833        }
4834
4835        /// Sets all the options, replacing any prior values.
4836        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4837            self.0.options = v.into();
4838            self
4839        }
4840
4841        /// Sends the request.
4842        pub async fn send(self) -> Result<crate::model::DataStore> {
4843            (*self.0.stub)
4844                .update_data_store(self.0.request, self.0.options)
4845                .await
4846                .map(gax::response::Response::into_body)
4847        }
4848
4849        /// Sets the value of [data_store][crate::model::UpdateDataStoreRequest::data_store].
4850        ///
4851        /// This is a **required** field for requests.
4852        pub fn set_data_store<T>(mut self, v: T) -> Self
4853        where
4854            T: std::convert::Into<crate::model::DataStore>,
4855        {
4856            self.0.request.data_store = std::option::Option::Some(v.into());
4857            self
4858        }
4859
4860        /// Sets or clears the value of [data_store][crate::model::UpdateDataStoreRequest::data_store].
4861        ///
4862        /// This is a **required** field for requests.
4863        pub fn set_or_clear_data_store<T>(mut self, v: std::option::Option<T>) -> Self
4864        where
4865            T: std::convert::Into<crate::model::DataStore>,
4866        {
4867            self.0.request.data_store = v.map(|x| x.into());
4868            self
4869        }
4870
4871        /// Sets the value of [update_mask][crate::model::UpdateDataStoreRequest::update_mask].
4872        pub fn set_update_mask<T>(mut self, v: T) -> Self
4873        where
4874            T: std::convert::Into<wkt::FieldMask>,
4875        {
4876            self.0.request.update_mask = std::option::Option::Some(v.into());
4877            self
4878        }
4879
4880        /// Sets or clears the value of [update_mask][crate::model::UpdateDataStoreRequest::update_mask].
4881        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
4882        where
4883            T: std::convert::Into<wkt::FieldMask>,
4884        {
4885            self.0.request.update_mask = v.map(|x| x.into());
4886            self
4887        }
4888    }
4889
4890    #[doc(hidden)]
4891    impl gax::options::internal::RequestBuilder for UpdateDataStore {
4892        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4893            &mut self.0.options
4894        }
4895    }
4896
4897    /// The request builder for [DataStoreService::list_operations][crate::client::DataStoreService::list_operations] calls.
4898    ///
4899    /// # Example
4900    /// ```
4901    /// # use google_cloud_discoveryengine_v1::builder::data_store_service::ListOperations;
4902    /// # async fn sample() -> gax::Result<()> {
4903    /// use gax::paginator::ItemPaginator;
4904    ///
4905    /// let builder = prepare_request_builder();
4906    /// let mut items = builder.by_item();
4907    /// while let Some(result) = items.next().await {
4908    ///   let item = result?;
4909    /// }
4910    /// # Ok(()) }
4911    ///
4912    /// fn prepare_request_builder() -> ListOperations {
4913    ///   # panic!();
4914    ///   // ... details omitted ...
4915    /// }
4916    /// ```
4917    #[derive(Clone, Debug)]
4918    pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
4919
4920    impl ListOperations {
4921        pub(crate) fn new(
4922            stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
4923        ) -> Self {
4924            Self(RequestBuilder::new(stub))
4925        }
4926
4927        /// Sets the full request, replacing any prior values.
4928        pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
4929            mut self,
4930            v: V,
4931        ) -> Self {
4932            self.0.request = v.into();
4933            self
4934        }
4935
4936        /// Sets all the options, replacing any prior values.
4937        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4938            self.0.options = v.into();
4939            self
4940        }
4941
4942        /// Sends the request.
4943        pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
4944            (*self.0.stub)
4945                .list_operations(self.0.request, self.0.options)
4946                .await
4947                .map(gax::response::Response::into_body)
4948        }
4949
4950        /// Streams each page in the collection.
4951        pub fn by_page(
4952            self,
4953        ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
4954        {
4955            use std::clone::Clone;
4956            let token = self.0.request.page_token.clone();
4957            let execute = move |token: String| {
4958                let mut builder = self.clone();
4959                builder.0.request = builder.0.request.set_page_token(token);
4960                builder.send()
4961            };
4962            gax::paginator::internal::new_paginator(token, execute)
4963        }
4964
4965        /// Streams each item in the collection.
4966        pub fn by_item(
4967            self,
4968        ) -> impl gax::paginator::ItemPaginator<
4969            longrunning::model::ListOperationsResponse,
4970            gax::error::Error,
4971        > {
4972            use gax::paginator::Paginator;
4973            self.by_page().items()
4974        }
4975
4976        /// Sets the value of [name][longrunning::model::ListOperationsRequest::name].
4977        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4978            self.0.request.name = v.into();
4979            self
4980        }
4981
4982        /// Sets the value of [filter][longrunning::model::ListOperationsRequest::filter].
4983        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
4984            self.0.request.filter = v.into();
4985            self
4986        }
4987
4988        /// Sets the value of [page_size][longrunning::model::ListOperationsRequest::page_size].
4989        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
4990            self.0.request.page_size = v.into();
4991            self
4992        }
4993
4994        /// Sets the value of [page_token][longrunning::model::ListOperationsRequest::page_token].
4995        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
4996            self.0.request.page_token = v.into();
4997            self
4998        }
4999
5000        /// Sets the value of [return_partial_success][longrunning::model::ListOperationsRequest::return_partial_success].
5001        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
5002            self.0.request.return_partial_success = v.into();
5003            self
5004        }
5005    }
5006
5007    #[doc(hidden)]
5008    impl gax::options::internal::RequestBuilder for ListOperations {
5009        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5010            &mut self.0.options
5011        }
5012    }
5013
5014    /// The request builder for [DataStoreService::get_operation][crate::client::DataStoreService::get_operation] calls.
5015    ///
5016    /// # Example
5017    /// ```
5018    /// # use google_cloud_discoveryengine_v1::builder::data_store_service::GetOperation;
5019    /// # async fn sample() -> gax::Result<()> {
5020    ///
5021    /// let builder = prepare_request_builder();
5022    /// let response = builder.send().await?;
5023    /// # Ok(()) }
5024    ///
5025    /// fn prepare_request_builder() -> GetOperation {
5026    ///   # panic!();
5027    ///   // ... details omitted ...
5028    /// }
5029    /// ```
5030    #[derive(Clone, Debug)]
5031    pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
5032
5033    impl GetOperation {
5034        pub(crate) fn new(
5035            stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
5036        ) -> Self {
5037            Self(RequestBuilder::new(stub))
5038        }
5039
5040        /// Sets the full request, replacing any prior values.
5041        pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
5042            mut self,
5043            v: V,
5044        ) -> Self {
5045            self.0.request = v.into();
5046            self
5047        }
5048
5049        /// Sets all the options, replacing any prior values.
5050        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5051            self.0.options = v.into();
5052            self
5053        }
5054
5055        /// Sends the request.
5056        pub async fn send(self) -> Result<longrunning::model::Operation> {
5057            (*self.0.stub)
5058                .get_operation(self.0.request, self.0.options)
5059                .await
5060                .map(gax::response::Response::into_body)
5061        }
5062
5063        /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
5064        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5065            self.0.request.name = v.into();
5066            self
5067        }
5068    }
5069
5070    #[doc(hidden)]
5071    impl gax::options::internal::RequestBuilder for GetOperation {
5072        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5073            &mut self.0.options
5074        }
5075    }
5076
5077    /// The request builder for [DataStoreService::cancel_operation][crate::client::DataStoreService::cancel_operation] calls.
5078    ///
5079    /// # Example
5080    /// ```
5081    /// # use google_cloud_discoveryengine_v1::builder::data_store_service::CancelOperation;
5082    /// # async fn sample() -> gax::Result<()> {
5083    ///
5084    /// let builder = prepare_request_builder();
5085    /// let response = builder.send().await?;
5086    /// # Ok(()) }
5087    ///
5088    /// fn prepare_request_builder() -> CancelOperation {
5089    ///   # panic!();
5090    ///   // ... details omitted ...
5091    /// }
5092    /// ```
5093    #[derive(Clone, Debug)]
5094    pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
5095
5096    impl CancelOperation {
5097        pub(crate) fn new(
5098            stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
5099        ) -> Self {
5100            Self(RequestBuilder::new(stub))
5101        }
5102
5103        /// Sets the full request, replacing any prior values.
5104        pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
5105            mut self,
5106            v: V,
5107        ) -> Self {
5108            self.0.request = v.into();
5109            self
5110        }
5111
5112        /// Sets all the options, replacing any prior values.
5113        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5114            self.0.options = v.into();
5115            self
5116        }
5117
5118        /// Sends the request.
5119        pub async fn send(self) -> Result<()> {
5120            (*self.0.stub)
5121                .cancel_operation(self.0.request, self.0.options)
5122                .await
5123                .map(gax::response::Response::into_body)
5124        }
5125
5126        /// Sets the value of [name][longrunning::model::CancelOperationRequest::name].
5127        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5128            self.0.request.name = v.into();
5129            self
5130        }
5131    }
5132
5133    #[doc(hidden)]
5134    impl gax::options::internal::RequestBuilder for CancelOperation {
5135        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5136            &mut self.0.options
5137        }
5138    }
5139}
5140
5141#[cfg(feature = "document-service")]
5142#[cfg_attr(docsrs, doc(cfg(feature = "document-service")))]
5143pub mod document_service {
5144    use crate::Result;
5145
5146    /// A builder for [DocumentService][crate::client::DocumentService].
5147    ///
5148    /// ```
5149    /// # async fn sample() -> gax::client_builder::Result<()> {
5150    /// # use google_cloud_discoveryengine_v1::*;
5151    /// # use builder::document_service::ClientBuilder;
5152    /// # use client::DocumentService;
5153    /// let builder : ClientBuilder = DocumentService::builder();
5154    /// let client = builder
5155    ///     .with_endpoint("https://discoveryengine.googleapis.com")
5156    ///     .build().await?;
5157    /// # Ok(()) }
5158    /// ```
5159    pub type ClientBuilder =
5160        gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
5161
5162    pub(crate) mod client {
5163        use super::super::super::client::DocumentService;
5164        pub struct Factory;
5165        impl gax::client_builder::internal::ClientFactory for Factory {
5166            type Client = DocumentService;
5167            type Credentials = gaxi::options::Credentials;
5168            async fn build(
5169                self,
5170                config: gaxi::options::ClientConfig,
5171            ) -> gax::client_builder::Result<Self::Client> {
5172                Self::Client::new(config).await
5173            }
5174        }
5175    }
5176
5177    /// Common implementation for [crate::client::DocumentService] request builders.
5178    #[derive(Clone, Debug)]
5179    pub(crate) struct RequestBuilder<R: std::default::Default> {
5180        stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
5181        request: R,
5182        options: gax::options::RequestOptions,
5183    }
5184
5185    impl<R> RequestBuilder<R>
5186    where
5187        R: std::default::Default,
5188    {
5189        pub(crate) fn new(
5190            stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
5191        ) -> Self {
5192            Self {
5193                stub,
5194                request: R::default(),
5195                options: gax::options::RequestOptions::default(),
5196            }
5197        }
5198    }
5199
5200    /// The request builder for [DocumentService::get_document][crate::client::DocumentService::get_document] calls.
5201    ///
5202    /// # Example
5203    /// ```
5204    /// # use google_cloud_discoveryengine_v1::builder::document_service::GetDocument;
5205    /// # async fn sample() -> gax::Result<()> {
5206    ///
5207    /// let builder = prepare_request_builder();
5208    /// let response = builder.send().await?;
5209    /// # Ok(()) }
5210    ///
5211    /// fn prepare_request_builder() -> GetDocument {
5212    ///   # panic!();
5213    ///   // ... details omitted ...
5214    /// }
5215    /// ```
5216    #[derive(Clone, Debug)]
5217    pub struct GetDocument(RequestBuilder<crate::model::GetDocumentRequest>);
5218
5219    impl GetDocument {
5220        pub(crate) fn new(
5221            stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
5222        ) -> Self {
5223            Self(RequestBuilder::new(stub))
5224        }
5225
5226        /// Sets the full request, replacing any prior values.
5227        pub fn with_request<V: Into<crate::model::GetDocumentRequest>>(mut self, v: V) -> Self {
5228            self.0.request = v.into();
5229            self
5230        }
5231
5232        /// Sets all the options, replacing any prior values.
5233        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5234            self.0.options = v.into();
5235            self
5236        }
5237
5238        /// Sends the request.
5239        pub async fn send(self) -> Result<crate::model::Document> {
5240            (*self.0.stub)
5241                .get_document(self.0.request, self.0.options)
5242                .await
5243                .map(gax::response::Response::into_body)
5244        }
5245
5246        /// Sets the value of [name][crate::model::GetDocumentRequest::name].
5247        ///
5248        /// This is a **required** field for requests.
5249        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5250            self.0.request.name = v.into();
5251            self
5252        }
5253    }
5254
5255    #[doc(hidden)]
5256    impl gax::options::internal::RequestBuilder for GetDocument {
5257        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5258            &mut self.0.options
5259        }
5260    }
5261
5262    /// The request builder for [DocumentService::list_documents][crate::client::DocumentService::list_documents] calls.
5263    ///
5264    /// # Example
5265    /// ```
5266    /// # use google_cloud_discoveryengine_v1::builder::document_service::ListDocuments;
5267    /// # async fn sample() -> gax::Result<()> {
5268    /// use gax::paginator::ItemPaginator;
5269    ///
5270    /// let builder = prepare_request_builder();
5271    /// let mut items = builder.by_item();
5272    /// while let Some(result) = items.next().await {
5273    ///   let item = result?;
5274    /// }
5275    /// # Ok(()) }
5276    ///
5277    /// fn prepare_request_builder() -> ListDocuments {
5278    ///   # panic!();
5279    ///   // ... details omitted ...
5280    /// }
5281    /// ```
5282    #[derive(Clone, Debug)]
5283    pub struct ListDocuments(RequestBuilder<crate::model::ListDocumentsRequest>);
5284
5285    impl ListDocuments {
5286        pub(crate) fn new(
5287            stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
5288        ) -> Self {
5289            Self(RequestBuilder::new(stub))
5290        }
5291
5292        /// Sets the full request, replacing any prior values.
5293        pub fn with_request<V: Into<crate::model::ListDocumentsRequest>>(mut self, v: V) -> Self {
5294            self.0.request = v.into();
5295            self
5296        }
5297
5298        /// Sets all the options, replacing any prior values.
5299        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5300            self.0.options = v.into();
5301            self
5302        }
5303
5304        /// Sends the request.
5305        pub async fn send(self) -> Result<crate::model::ListDocumentsResponse> {
5306            (*self.0.stub)
5307                .list_documents(self.0.request, self.0.options)
5308                .await
5309                .map(gax::response::Response::into_body)
5310        }
5311
5312        /// Streams each page in the collection.
5313        pub fn by_page(
5314            self,
5315        ) -> impl gax::paginator::Paginator<crate::model::ListDocumentsResponse, gax::error::Error>
5316        {
5317            use std::clone::Clone;
5318            let token = self.0.request.page_token.clone();
5319            let execute = move |token: String| {
5320                let mut builder = self.clone();
5321                builder.0.request = builder.0.request.set_page_token(token);
5322                builder.send()
5323            };
5324            gax::paginator::internal::new_paginator(token, execute)
5325        }
5326
5327        /// Streams each item in the collection.
5328        pub fn by_item(
5329            self,
5330        ) -> impl gax::paginator::ItemPaginator<crate::model::ListDocumentsResponse, gax::error::Error>
5331        {
5332            use gax::paginator::Paginator;
5333            self.by_page().items()
5334        }
5335
5336        /// Sets the value of [parent][crate::model::ListDocumentsRequest::parent].
5337        ///
5338        /// This is a **required** field for requests.
5339        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
5340            self.0.request.parent = v.into();
5341            self
5342        }
5343
5344        /// Sets the value of [page_size][crate::model::ListDocumentsRequest::page_size].
5345        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
5346            self.0.request.page_size = v.into();
5347            self
5348        }
5349
5350        /// Sets the value of [page_token][crate::model::ListDocumentsRequest::page_token].
5351        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
5352            self.0.request.page_token = v.into();
5353            self
5354        }
5355    }
5356
5357    #[doc(hidden)]
5358    impl gax::options::internal::RequestBuilder for ListDocuments {
5359        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5360            &mut self.0.options
5361        }
5362    }
5363
5364    /// The request builder for [DocumentService::create_document][crate::client::DocumentService::create_document] calls.
5365    ///
5366    /// # Example
5367    /// ```
5368    /// # use google_cloud_discoveryengine_v1::builder::document_service::CreateDocument;
5369    /// # async fn sample() -> gax::Result<()> {
5370    ///
5371    /// let builder = prepare_request_builder();
5372    /// let response = builder.send().await?;
5373    /// # Ok(()) }
5374    ///
5375    /// fn prepare_request_builder() -> CreateDocument {
5376    ///   # panic!();
5377    ///   // ... details omitted ...
5378    /// }
5379    /// ```
5380    #[derive(Clone, Debug)]
5381    pub struct CreateDocument(RequestBuilder<crate::model::CreateDocumentRequest>);
5382
5383    impl CreateDocument {
5384        pub(crate) fn new(
5385            stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
5386        ) -> Self {
5387            Self(RequestBuilder::new(stub))
5388        }
5389
5390        /// Sets the full request, replacing any prior values.
5391        pub fn with_request<V: Into<crate::model::CreateDocumentRequest>>(mut self, v: V) -> Self {
5392            self.0.request = v.into();
5393            self
5394        }
5395
5396        /// Sets all the options, replacing any prior values.
5397        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5398            self.0.options = v.into();
5399            self
5400        }
5401
5402        /// Sends the request.
5403        pub async fn send(self) -> Result<crate::model::Document> {
5404            (*self.0.stub)
5405                .create_document(self.0.request, self.0.options)
5406                .await
5407                .map(gax::response::Response::into_body)
5408        }
5409
5410        /// Sets the value of [parent][crate::model::CreateDocumentRequest::parent].
5411        ///
5412        /// This is a **required** field for requests.
5413        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
5414            self.0.request.parent = v.into();
5415            self
5416        }
5417
5418        /// Sets the value of [document][crate::model::CreateDocumentRequest::document].
5419        ///
5420        /// This is a **required** field for requests.
5421        pub fn set_document<T>(mut self, v: T) -> Self
5422        where
5423            T: std::convert::Into<crate::model::Document>,
5424        {
5425            self.0.request.document = std::option::Option::Some(v.into());
5426            self
5427        }
5428
5429        /// Sets or clears the value of [document][crate::model::CreateDocumentRequest::document].
5430        ///
5431        /// This is a **required** field for requests.
5432        pub fn set_or_clear_document<T>(mut self, v: std::option::Option<T>) -> Self
5433        where
5434            T: std::convert::Into<crate::model::Document>,
5435        {
5436            self.0.request.document = v.map(|x| x.into());
5437            self
5438        }
5439
5440        /// Sets the value of [document_id][crate::model::CreateDocumentRequest::document_id].
5441        ///
5442        /// This is a **required** field for requests.
5443        pub fn set_document_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
5444            self.0.request.document_id = v.into();
5445            self
5446        }
5447    }
5448
5449    #[doc(hidden)]
5450    impl gax::options::internal::RequestBuilder for CreateDocument {
5451        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5452            &mut self.0.options
5453        }
5454    }
5455
5456    /// The request builder for [DocumentService::update_document][crate::client::DocumentService::update_document] calls.
5457    ///
5458    /// # Example
5459    /// ```
5460    /// # use google_cloud_discoveryengine_v1::builder::document_service::UpdateDocument;
5461    /// # async fn sample() -> gax::Result<()> {
5462    ///
5463    /// let builder = prepare_request_builder();
5464    /// let response = builder.send().await?;
5465    /// # Ok(()) }
5466    ///
5467    /// fn prepare_request_builder() -> UpdateDocument {
5468    ///   # panic!();
5469    ///   // ... details omitted ...
5470    /// }
5471    /// ```
5472    #[derive(Clone, Debug)]
5473    pub struct UpdateDocument(RequestBuilder<crate::model::UpdateDocumentRequest>);
5474
5475    impl UpdateDocument {
5476        pub(crate) fn new(
5477            stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
5478        ) -> Self {
5479            Self(RequestBuilder::new(stub))
5480        }
5481
5482        /// Sets the full request, replacing any prior values.
5483        pub fn with_request<V: Into<crate::model::UpdateDocumentRequest>>(mut self, v: V) -> Self {
5484            self.0.request = v.into();
5485            self
5486        }
5487
5488        /// Sets all the options, replacing any prior values.
5489        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5490            self.0.options = v.into();
5491            self
5492        }
5493
5494        /// Sends the request.
5495        pub async fn send(self) -> Result<crate::model::Document> {
5496            (*self.0.stub)
5497                .update_document(self.0.request, self.0.options)
5498                .await
5499                .map(gax::response::Response::into_body)
5500        }
5501
5502        /// Sets the value of [document][crate::model::UpdateDocumentRequest::document].
5503        ///
5504        /// This is a **required** field for requests.
5505        pub fn set_document<T>(mut self, v: T) -> Self
5506        where
5507            T: std::convert::Into<crate::model::Document>,
5508        {
5509            self.0.request.document = std::option::Option::Some(v.into());
5510            self
5511        }
5512
5513        /// Sets or clears the value of [document][crate::model::UpdateDocumentRequest::document].
5514        ///
5515        /// This is a **required** field for requests.
5516        pub fn set_or_clear_document<T>(mut self, v: std::option::Option<T>) -> Self
5517        where
5518            T: std::convert::Into<crate::model::Document>,
5519        {
5520            self.0.request.document = v.map(|x| x.into());
5521            self
5522        }
5523
5524        /// Sets the value of [allow_missing][crate::model::UpdateDocumentRequest::allow_missing].
5525        pub fn set_allow_missing<T: Into<bool>>(mut self, v: T) -> Self {
5526            self.0.request.allow_missing = v.into();
5527            self
5528        }
5529
5530        /// Sets the value of [update_mask][crate::model::UpdateDocumentRequest::update_mask].
5531        pub fn set_update_mask<T>(mut self, v: T) -> Self
5532        where
5533            T: std::convert::Into<wkt::FieldMask>,
5534        {
5535            self.0.request.update_mask = std::option::Option::Some(v.into());
5536            self
5537        }
5538
5539        /// Sets or clears the value of [update_mask][crate::model::UpdateDocumentRequest::update_mask].
5540        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
5541        where
5542            T: std::convert::Into<wkt::FieldMask>,
5543        {
5544            self.0.request.update_mask = v.map(|x| x.into());
5545            self
5546        }
5547    }
5548
5549    #[doc(hidden)]
5550    impl gax::options::internal::RequestBuilder for UpdateDocument {
5551        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5552            &mut self.0.options
5553        }
5554    }
5555
5556    /// The request builder for [DocumentService::delete_document][crate::client::DocumentService::delete_document] calls.
5557    ///
5558    /// # Example
5559    /// ```
5560    /// # use google_cloud_discoveryengine_v1::builder::document_service::DeleteDocument;
5561    /// # async fn sample() -> gax::Result<()> {
5562    ///
5563    /// let builder = prepare_request_builder();
5564    /// let response = builder.send().await?;
5565    /// # Ok(()) }
5566    ///
5567    /// fn prepare_request_builder() -> DeleteDocument {
5568    ///   # panic!();
5569    ///   // ... details omitted ...
5570    /// }
5571    /// ```
5572    #[derive(Clone, Debug)]
5573    pub struct DeleteDocument(RequestBuilder<crate::model::DeleteDocumentRequest>);
5574
5575    impl DeleteDocument {
5576        pub(crate) fn new(
5577            stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
5578        ) -> Self {
5579            Self(RequestBuilder::new(stub))
5580        }
5581
5582        /// Sets the full request, replacing any prior values.
5583        pub fn with_request<V: Into<crate::model::DeleteDocumentRequest>>(mut self, v: V) -> Self {
5584            self.0.request = v.into();
5585            self
5586        }
5587
5588        /// Sets all the options, replacing any prior values.
5589        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5590            self.0.options = v.into();
5591            self
5592        }
5593
5594        /// Sends the request.
5595        pub async fn send(self) -> Result<()> {
5596            (*self.0.stub)
5597                .delete_document(self.0.request, self.0.options)
5598                .await
5599                .map(gax::response::Response::into_body)
5600        }
5601
5602        /// Sets the value of [name][crate::model::DeleteDocumentRequest::name].
5603        ///
5604        /// This is a **required** field for requests.
5605        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5606            self.0.request.name = v.into();
5607            self
5608        }
5609    }
5610
5611    #[doc(hidden)]
5612    impl gax::options::internal::RequestBuilder for DeleteDocument {
5613        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5614            &mut self.0.options
5615        }
5616    }
5617
5618    /// The request builder for [DocumentService::import_documents][crate::client::DocumentService::import_documents] calls.
5619    ///
5620    /// # Example
5621    /// ```
5622    /// # use google_cloud_discoveryengine_v1::builder::document_service::ImportDocuments;
5623    /// # async fn sample() -> gax::Result<()> {
5624    /// use lro::Poller;
5625    ///
5626    /// let builder = prepare_request_builder();
5627    /// let response = builder.poller().until_done().await?;
5628    /// # Ok(()) }
5629    ///
5630    /// fn prepare_request_builder() -> ImportDocuments {
5631    ///   # panic!();
5632    ///   // ... details omitted ...
5633    /// }
5634    /// ```
5635    #[derive(Clone, Debug)]
5636    pub struct ImportDocuments(RequestBuilder<crate::model::ImportDocumentsRequest>);
5637
5638    impl ImportDocuments {
5639        pub(crate) fn new(
5640            stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
5641        ) -> Self {
5642            Self(RequestBuilder::new(stub))
5643        }
5644
5645        /// Sets the full request, replacing any prior values.
5646        pub fn with_request<V: Into<crate::model::ImportDocumentsRequest>>(mut self, v: V) -> Self {
5647            self.0.request = v.into();
5648            self
5649        }
5650
5651        /// Sets all the options, replacing any prior values.
5652        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5653            self.0.options = v.into();
5654            self
5655        }
5656
5657        /// Sends the request.
5658        ///
5659        /// # Long running operations
5660        ///
5661        /// This starts, but does not poll, a longrunning operation. More information
5662        /// on [import_documents][crate::client::DocumentService::import_documents].
5663        pub async fn send(self) -> Result<longrunning::model::Operation> {
5664            (*self.0.stub)
5665                .import_documents(self.0.request, self.0.options)
5666                .await
5667                .map(gax::response::Response::into_body)
5668        }
5669
5670        /// Creates a [Poller][lro::Poller] to work with `import_documents`.
5671        pub fn poller(
5672            self,
5673        ) -> impl lro::Poller<crate::model::ImportDocumentsResponse, crate::model::ImportDocumentsMetadata>
5674        {
5675            type Operation = lro::internal::Operation<
5676                crate::model::ImportDocumentsResponse,
5677                crate::model::ImportDocumentsMetadata,
5678            >;
5679            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
5680            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
5681
5682            let stub = self.0.stub.clone();
5683            let mut options = self.0.options.clone();
5684            options.set_retry_policy(gax::retry_policy::NeverRetry);
5685            let query = move |name| {
5686                let stub = stub.clone();
5687                let options = options.clone();
5688                async {
5689                    let op = GetOperation::new(stub)
5690                        .set_name(name)
5691                        .with_options(options)
5692                        .send()
5693                        .await?;
5694                    Ok(Operation::new(op))
5695                }
5696            };
5697
5698            let start = move || async {
5699                let op = self.send().await?;
5700                Ok(Operation::new(op))
5701            };
5702
5703            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
5704        }
5705
5706        /// Sets the value of [parent][crate::model::ImportDocumentsRequest::parent].
5707        ///
5708        /// This is a **required** field for requests.
5709        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
5710            self.0.request.parent = v.into();
5711            self
5712        }
5713
5714        /// Sets the value of [error_config][crate::model::ImportDocumentsRequest::error_config].
5715        pub fn set_error_config<T>(mut self, v: T) -> Self
5716        where
5717            T: std::convert::Into<crate::model::ImportErrorConfig>,
5718        {
5719            self.0.request.error_config = std::option::Option::Some(v.into());
5720            self
5721        }
5722
5723        /// Sets or clears the value of [error_config][crate::model::ImportDocumentsRequest::error_config].
5724        pub fn set_or_clear_error_config<T>(mut self, v: std::option::Option<T>) -> Self
5725        where
5726            T: std::convert::Into<crate::model::ImportErrorConfig>,
5727        {
5728            self.0.request.error_config = v.map(|x| x.into());
5729            self
5730        }
5731
5732        /// Sets the value of [reconciliation_mode][crate::model::ImportDocumentsRequest::reconciliation_mode].
5733        pub fn set_reconciliation_mode<
5734            T: Into<crate::model::import_documents_request::ReconciliationMode>,
5735        >(
5736            mut self,
5737            v: T,
5738        ) -> Self {
5739            self.0.request.reconciliation_mode = v.into();
5740            self
5741        }
5742
5743        /// Sets the value of [update_mask][crate::model::ImportDocumentsRequest::update_mask].
5744        pub fn set_update_mask<T>(mut self, v: T) -> Self
5745        where
5746            T: std::convert::Into<wkt::FieldMask>,
5747        {
5748            self.0.request.update_mask = std::option::Option::Some(v.into());
5749            self
5750        }
5751
5752        /// Sets or clears the value of [update_mask][crate::model::ImportDocumentsRequest::update_mask].
5753        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
5754        where
5755            T: std::convert::Into<wkt::FieldMask>,
5756        {
5757            self.0.request.update_mask = v.map(|x| x.into());
5758            self
5759        }
5760
5761        /// Sets the value of [auto_generate_ids][crate::model::ImportDocumentsRequest::auto_generate_ids].
5762        pub fn set_auto_generate_ids<T: Into<bool>>(mut self, v: T) -> Self {
5763            self.0.request.auto_generate_ids = v.into();
5764            self
5765        }
5766
5767        /// Sets the value of [id_field][crate::model::ImportDocumentsRequest::id_field].
5768        pub fn set_id_field<T: Into<std::string::String>>(mut self, v: T) -> Self {
5769            self.0.request.id_field = v.into();
5770            self
5771        }
5772
5773        /// Sets the value of [force_refresh_content][crate::model::ImportDocumentsRequest::force_refresh_content].
5774        pub fn set_force_refresh_content<T: Into<bool>>(mut self, v: T) -> Self {
5775            self.0.request.force_refresh_content = v.into();
5776            self
5777        }
5778
5779        /// Sets the value of [source][crate::model::ImportDocumentsRequest::source].
5780        ///
5781        /// Note that all the setters affecting `source` are
5782        /// mutually exclusive.
5783        pub fn set_source<T: Into<Option<crate::model::import_documents_request::Source>>>(
5784            mut self,
5785            v: T,
5786        ) -> Self {
5787            self.0.request.source = v.into();
5788            self
5789        }
5790
5791        /// Sets the value of [source][crate::model::ImportDocumentsRequest::source]
5792        /// to hold a `InlineSource`.
5793        ///
5794        /// Note that all the setters affecting `source` are
5795        /// mutually exclusive.
5796        pub fn set_inline_source<
5797            T: std::convert::Into<
5798                    std::boxed::Box<crate::model::import_documents_request::InlineSource>,
5799                >,
5800        >(
5801            mut self,
5802            v: T,
5803        ) -> Self {
5804            self.0.request = self.0.request.set_inline_source(v);
5805            self
5806        }
5807
5808        /// Sets the value of [source][crate::model::ImportDocumentsRequest::source]
5809        /// to hold a `GcsSource`.
5810        ///
5811        /// Note that all the setters affecting `source` are
5812        /// mutually exclusive.
5813        pub fn set_gcs_source<T: std::convert::Into<std::boxed::Box<crate::model::GcsSource>>>(
5814            mut self,
5815            v: T,
5816        ) -> Self {
5817            self.0.request = self.0.request.set_gcs_source(v);
5818            self
5819        }
5820
5821        /// Sets the value of [source][crate::model::ImportDocumentsRequest::source]
5822        /// to hold a `BigquerySource`.
5823        ///
5824        /// Note that all the setters affecting `source` are
5825        /// mutually exclusive.
5826        pub fn set_bigquery_source<
5827            T: std::convert::Into<std::boxed::Box<crate::model::BigQuerySource>>,
5828        >(
5829            mut self,
5830            v: T,
5831        ) -> Self {
5832            self.0.request = self.0.request.set_bigquery_source(v);
5833            self
5834        }
5835
5836        /// Sets the value of [source][crate::model::ImportDocumentsRequest::source]
5837        /// to hold a `FhirStoreSource`.
5838        ///
5839        /// Note that all the setters affecting `source` are
5840        /// mutually exclusive.
5841        pub fn set_fhir_store_source<
5842            T: std::convert::Into<std::boxed::Box<crate::model::FhirStoreSource>>,
5843        >(
5844            mut self,
5845            v: T,
5846        ) -> Self {
5847            self.0.request = self.0.request.set_fhir_store_source(v);
5848            self
5849        }
5850
5851        /// Sets the value of [source][crate::model::ImportDocumentsRequest::source]
5852        /// to hold a `SpannerSource`.
5853        ///
5854        /// Note that all the setters affecting `source` are
5855        /// mutually exclusive.
5856        pub fn set_spanner_source<
5857            T: std::convert::Into<std::boxed::Box<crate::model::SpannerSource>>,
5858        >(
5859            mut self,
5860            v: T,
5861        ) -> Self {
5862            self.0.request = self.0.request.set_spanner_source(v);
5863            self
5864        }
5865
5866        /// Sets the value of [source][crate::model::ImportDocumentsRequest::source]
5867        /// to hold a `CloudSqlSource`.
5868        ///
5869        /// Note that all the setters affecting `source` are
5870        /// mutually exclusive.
5871        pub fn set_cloud_sql_source<
5872            T: std::convert::Into<std::boxed::Box<crate::model::CloudSqlSource>>,
5873        >(
5874            mut self,
5875            v: T,
5876        ) -> Self {
5877            self.0.request = self.0.request.set_cloud_sql_source(v);
5878            self
5879        }
5880
5881        /// Sets the value of [source][crate::model::ImportDocumentsRequest::source]
5882        /// to hold a `FirestoreSource`.
5883        ///
5884        /// Note that all the setters affecting `source` are
5885        /// mutually exclusive.
5886        pub fn set_firestore_source<
5887            T: std::convert::Into<std::boxed::Box<crate::model::FirestoreSource>>,
5888        >(
5889            mut self,
5890            v: T,
5891        ) -> Self {
5892            self.0.request = self.0.request.set_firestore_source(v);
5893            self
5894        }
5895
5896        /// Sets the value of [source][crate::model::ImportDocumentsRequest::source]
5897        /// to hold a `AlloyDbSource`.
5898        ///
5899        /// Note that all the setters affecting `source` are
5900        /// mutually exclusive.
5901        pub fn set_alloy_db_source<
5902            T: std::convert::Into<std::boxed::Box<crate::model::AlloyDbSource>>,
5903        >(
5904            mut self,
5905            v: T,
5906        ) -> Self {
5907            self.0.request = self.0.request.set_alloy_db_source(v);
5908            self
5909        }
5910
5911        /// Sets the value of [source][crate::model::ImportDocumentsRequest::source]
5912        /// to hold a `BigtableSource`.
5913        ///
5914        /// Note that all the setters affecting `source` are
5915        /// mutually exclusive.
5916        pub fn set_bigtable_source<
5917            T: std::convert::Into<std::boxed::Box<crate::model::BigtableSource>>,
5918        >(
5919            mut self,
5920            v: T,
5921        ) -> Self {
5922            self.0.request = self.0.request.set_bigtable_source(v);
5923            self
5924        }
5925    }
5926
5927    #[doc(hidden)]
5928    impl gax::options::internal::RequestBuilder for ImportDocuments {
5929        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5930            &mut self.0.options
5931        }
5932    }
5933
5934    /// The request builder for [DocumentService::purge_documents][crate::client::DocumentService::purge_documents] calls.
5935    ///
5936    /// # Example
5937    /// ```
5938    /// # use google_cloud_discoveryengine_v1::builder::document_service::PurgeDocuments;
5939    /// # async fn sample() -> gax::Result<()> {
5940    /// use lro::Poller;
5941    ///
5942    /// let builder = prepare_request_builder();
5943    /// let response = builder.poller().until_done().await?;
5944    /// # Ok(()) }
5945    ///
5946    /// fn prepare_request_builder() -> PurgeDocuments {
5947    ///   # panic!();
5948    ///   // ... details omitted ...
5949    /// }
5950    /// ```
5951    #[derive(Clone, Debug)]
5952    pub struct PurgeDocuments(RequestBuilder<crate::model::PurgeDocumentsRequest>);
5953
5954    impl PurgeDocuments {
5955        pub(crate) fn new(
5956            stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
5957        ) -> Self {
5958            Self(RequestBuilder::new(stub))
5959        }
5960
5961        /// Sets the full request, replacing any prior values.
5962        pub fn with_request<V: Into<crate::model::PurgeDocumentsRequest>>(mut self, v: V) -> Self {
5963            self.0.request = v.into();
5964            self
5965        }
5966
5967        /// Sets all the options, replacing any prior values.
5968        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5969            self.0.options = v.into();
5970            self
5971        }
5972
5973        /// Sends the request.
5974        ///
5975        /// # Long running operations
5976        ///
5977        /// This starts, but does not poll, a longrunning operation. More information
5978        /// on [purge_documents][crate::client::DocumentService::purge_documents].
5979        pub async fn send(self) -> Result<longrunning::model::Operation> {
5980            (*self.0.stub)
5981                .purge_documents(self.0.request, self.0.options)
5982                .await
5983                .map(gax::response::Response::into_body)
5984        }
5985
5986        /// Creates a [Poller][lro::Poller] to work with `purge_documents`.
5987        pub fn poller(
5988            self,
5989        ) -> impl lro::Poller<crate::model::PurgeDocumentsResponse, crate::model::PurgeDocumentsMetadata>
5990        {
5991            type Operation = lro::internal::Operation<
5992                crate::model::PurgeDocumentsResponse,
5993                crate::model::PurgeDocumentsMetadata,
5994            >;
5995            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
5996            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
5997
5998            let stub = self.0.stub.clone();
5999            let mut options = self.0.options.clone();
6000            options.set_retry_policy(gax::retry_policy::NeverRetry);
6001            let query = move |name| {
6002                let stub = stub.clone();
6003                let options = options.clone();
6004                async {
6005                    let op = GetOperation::new(stub)
6006                        .set_name(name)
6007                        .with_options(options)
6008                        .send()
6009                        .await?;
6010                    Ok(Operation::new(op))
6011                }
6012            };
6013
6014            let start = move || async {
6015                let op = self.send().await?;
6016                Ok(Operation::new(op))
6017            };
6018
6019            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
6020        }
6021
6022        /// Sets the value of [parent][crate::model::PurgeDocumentsRequest::parent].
6023        ///
6024        /// This is a **required** field for requests.
6025        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
6026            self.0.request.parent = v.into();
6027            self
6028        }
6029
6030        /// Sets the value of [filter][crate::model::PurgeDocumentsRequest::filter].
6031        ///
6032        /// This is a **required** field for requests.
6033        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
6034            self.0.request.filter = v.into();
6035            self
6036        }
6037
6038        /// Sets the value of [error_config][crate::model::PurgeDocumentsRequest::error_config].
6039        pub fn set_error_config<T>(mut self, v: T) -> Self
6040        where
6041            T: std::convert::Into<crate::model::PurgeErrorConfig>,
6042        {
6043            self.0.request.error_config = std::option::Option::Some(v.into());
6044            self
6045        }
6046
6047        /// Sets or clears the value of [error_config][crate::model::PurgeDocumentsRequest::error_config].
6048        pub fn set_or_clear_error_config<T>(mut self, v: std::option::Option<T>) -> Self
6049        where
6050            T: std::convert::Into<crate::model::PurgeErrorConfig>,
6051        {
6052            self.0.request.error_config = v.map(|x| x.into());
6053            self
6054        }
6055
6056        /// Sets the value of [force][crate::model::PurgeDocumentsRequest::force].
6057        pub fn set_force<T: Into<bool>>(mut self, v: T) -> Self {
6058            self.0.request.force = v.into();
6059            self
6060        }
6061
6062        /// Sets the value of [source][crate::model::PurgeDocumentsRequest::source].
6063        ///
6064        /// Note that all the setters affecting `source` are
6065        /// mutually exclusive.
6066        pub fn set_source<T: Into<Option<crate::model::purge_documents_request::Source>>>(
6067            mut self,
6068            v: T,
6069        ) -> Self {
6070            self.0.request.source = v.into();
6071            self
6072        }
6073
6074        /// Sets the value of [source][crate::model::PurgeDocumentsRequest::source]
6075        /// to hold a `GcsSource`.
6076        ///
6077        /// Note that all the setters affecting `source` are
6078        /// mutually exclusive.
6079        pub fn set_gcs_source<T: std::convert::Into<std::boxed::Box<crate::model::GcsSource>>>(
6080            mut self,
6081            v: T,
6082        ) -> Self {
6083            self.0.request = self.0.request.set_gcs_source(v);
6084            self
6085        }
6086
6087        /// Sets the value of [source][crate::model::PurgeDocumentsRequest::source]
6088        /// to hold a `InlineSource`.
6089        ///
6090        /// Note that all the setters affecting `source` are
6091        /// mutually exclusive.
6092        pub fn set_inline_source<
6093            T: std::convert::Into<
6094                    std::boxed::Box<crate::model::purge_documents_request::InlineSource>,
6095                >,
6096        >(
6097            mut self,
6098            v: T,
6099        ) -> Self {
6100            self.0.request = self.0.request.set_inline_source(v);
6101            self
6102        }
6103    }
6104
6105    #[doc(hidden)]
6106    impl gax::options::internal::RequestBuilder for PurgeDocuments {
6107        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6108            &mut self.0.options
6109        }
6110    }
6111
6112    /// The request builder for [DocumentService::batch_get_documents_metadata][crate::client::DocumentService::batch_get_documents_metadata] calls.
6113    ///
6114    /// # Example
6115    /// ```
6116    /// # use google_cloud_discoveryengine_v1::builder::document_service::BatchGetDocumentsMetadata;
6117    /// # async fn sample() -> gax::Result<()> {
6118    ///
6119    /// let builder = prepare_request_builder();
6120    /// let response = builder.send().await?;
6121    /// # Ok(()) }
6122    ///
6123    /// fn prepare_request_builder() -> BatchGetDocumentsMetadata {
6124    ///   # panic!();
6125    ///   // ... details omitted ...
6126    /// }
6127    /// ```
6128    #[derive(Clone, Debug)]
6129    pub struct BatchGetDocumentsMetadata(
6130        RequestBuilder<crate::model::BatchGetDocumentsMetadataRequest>,
6131    );
6132
6133    impl BatchGetDocumentsMetadata {
6134        pub(crate) fn new(
6135            stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
6136        ) -> Self {
6137            Self(RequestBuilder::new(stub))
6138        }
6139
6140        /// Sets the full request, replacing any prior values.
6141        pub fn with_request<V: Into<crate::model::BatchGetDocumentsMetadataRequest>>(
6142            mut self,
6143            v: V,
6144        ) -> Self {
6145            self.0.request = v.into();
6146            self
6147        }
6148
6149        /// Sets all the options, replacing any prior values.
6150        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6151            self.0.options = v.into();
6152            self
6153        }
6154
6155        /// Sends the request.
6156        pub async fn send(self) -> Result<crate::model::BatchGetDocumentsMetadataResponse> {
6157            (*self.0.stub)
6158                .batch_get_documents_metadata(self.0.request, self.0.options)
6159                .await
6160                .map(gax::response::Response::into_body)
6161        }
6162
6163        /// Sets the value of [parent][crate::model::BatchGetDocumentsMetadataRequest::parent].
6164        ///
6165        /// This is a **required** field for requests.
6166        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
6167            self.0.request.parent = v.into();
6168            self
6169        }
6170
6171        /// Sets the value of [matcher][crate::model::BatchGetDocumentsMetadataRequest::matcher].
6172        ///
6173        /// This is a **required** field for requests.
6174        pub fn set_matcher<T>(mut self, v: T) -> Self
6175        where
6176            T: std::convert::Into<crate::model::batch_get_documents_metadata_request::Matcher>,
6177        {
6178            self.0.request.matcher = std::option::Option::Some(v.into());
6179            self
6180        }
6181
6182        /// Sets or clears the value of [matcher][crate::model::BatchGetDocumentsMetadataRequest::matcher].
6183        ///
6184        /// This is a **required** field for requests.
6185        pub fn set_or_clear_matcher<T>(mut self, v: std::option::Option<T>) -> Self
6186        where
6187            T: std::convert::Into<crate::model::batch_get_documents_metadata_request::Matcher>,
6188        {
6189            self.0.request.matcher = v.map(|x| x.into());
6190            self
6191        }
6192    }
6193
6194    #[doc(hidden)]
6195    impl gax::options::internal::RequestBuilder for BatchGetDocumentsMetadata {
6196        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6197            &mut self.0.options
6198        }
6199    }
6200
6201    /// The request builder for [DocumentService::list_operations][crate::client::DocumentService::list_operations] calls.
6202    ///
6203    /// # Example
6204    /// ```
6205    /// # use google_cloud_discoveryengine_v1::builder::document_service::ListOperations;
6206    /// # async fn sample() -> gax::Result<()> {
6207    /// use gax::paginator::ItemPaginator;
6208    ///
6209    /// let builder = prepare_request_builder();
6210    /// let mut items = builder.by_item();
6211    /// while let Some(result) = items.next().await {
6212    ///   let item = result?;
6213    /// }
6214    /// # Ok(()) }
6215    ///
6216    /// fn prepare_request_builder() -> ListOperations {
6217    ///   # panic!();
6218    ///   // ... details omitted ...
6219    /// }
6220    /// ```
6221    #[derive(Clone, Debug)]
6222    pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
6223
6224    impl ListOperations {
6225        pub(crate) fn new(
6226            stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
6227        ) -> Self {
6228            Self(RequestBuilder::new(stub))
6229        }
6230
6231        /// Sets the full request, replacing any prior values.
6232        pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
6233            mut self,
6234            v: V,
6235        ) -> Self {
6236            self.0.request = v.into();
6237            self
6238        }
6239
6240        /// Sets all the options, replacing any prior values.
6241        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6242            self.0.options = v.into();
6243            self
6244        }
6245
6246        /// Sends the request.
6247        pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
6248            (*self.0.stub)
6249                .list_operations(self.0.request, self.0.options)
6250                .await
6251                .map(gax::response::Response::into_body)
6252        }
6253
6254        /// Streams each page in the collection.
6255        pub fn by_page(
6256            self,
6257        ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
6258        {
6259            use std::clone::Clone;
6260            let token = self.0.request.page_token.clone();
6261            let execute = move |token: String| {
6262                let mut builder = self.clone();
6263                builder.0.request = builder.0.request.set_page_token(token);
6264                builder.send()
6265            };
6266            gax::paginator::internal::new_paginator(token, execute)
6267        }
6268
6269        /// Streams each item in the collection.
6270        pub fn by_item(
6271            self,
6272        ) -> impl gax::paginator::ItemPaginator<
6273            longrunning::model::ListOperationsResponse,
6274            gax::error::Error,
6275        > {
6276            use gax::paginator::Paginator;
6277            self.by_page().items()
6278        }
6279
6280        /// Sets the value of [name][longrunning::model::ListOperationsRequest::name].
6281        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6282            self.0.request.name = v.into();
6283            self
6284        }
6285
6286        /// Sets the value of [filter][longrunning::model::ListOperationsRequest::filter].
6287        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
6288            self.0.request.filter = v.into();
6289            self
6290        }
6291
6292        /// Sets the value of [page_size][longrunning::model::ListOperationsRequest::page_size].
6293        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
6294            self.0.request.page_size = v.into();
6295            self
6296        }
6297
6298        /// Sets the value of [page_token][longrunning::model::ListOperationsRequest::page_token].
6299        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
6300            self.0.request.page_token = v.into();
6301            self
6302        }
6303
6304        /// Sets the value of [return_partial_success][longrunning::model::ListOperationsRequest::return_partial_success].
6305        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
6306            self.0.request.return_partial_success = v.into();
6307            self
6308        }
6309    }
6310
6311    #[doc(hidden)]
6312    impl gax::options::internal::RequestBuilder for ListOperations {
6313        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6314            &mut self.0.options
6315        }
6316    }
6317
6318    /// The request builder for [DocumentService::get_operation][crate::client::DocumentService::get_operation] calls.
6319    ///
6320    /// # Example
6321    /// ```
6322    /// # use google_cloud_discoveryengine_v1::builder::document_service::GetOperation;
6323    /// # async fn sample() -> gax::Result<()> {
6324    ///
6325    /// let builder = prepare_request_builder();
6326    /// let response = builder.send().await?;
6327    /// # Ok(()) }
6328    ///
6329    /// fn prepare_request_builder() -> GetOperation {
6330    ///   # panic!();
6331    ///   // ... details omitted ...
6332    /// }
6333    /// ```
6334    #[derive(Clone, Debug)]
6335    pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
6336
6337    impl GetOperation {
6338        pub(crate) fn new(
6339            stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
6340        ) -> Self {
6341            Self(RequestBuilder::new(stub))
6342        }
6343
6344        /// Sets the full request, replacing any prior values.
6345        pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
6346            mut self,
6347            v: V,
6348        ) -> Self {
6349            self.0.request = v.into();
6350            self
6351        }
6352
6353        /// Sets all the options, replacing any prior values.
6354        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6355            self.0.options = v.into();
6356            self
6357        }
6358
6359        /// Sends the request.
6360        pub async fn send(self) -> Result<longrunning::model::Operation> {
6361            (*self.0.stub)
6362                .get_operation(self.0.request, self.0.options)
6363                .await
6364                .map(gax::response::Response::into_body)
6365        }
6366
6367        /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
6368        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6369            self.0.request.name = v.into();
6370            self
6371        }
6372    }
6373
6374    #[doc(hidden)]
6375    impl gax::options::internal::RequestBuilder for GetOperation {
6376        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6377            &mut self.0.options
6378        }
6379    }
6380
6381    /// The request builder for [DocumentService::cancel_operation][crate::client::DocumentService::cancel_operation] calls.
6382    ///
6383    /// # Example
6384    /// ```
6385    /// # use google_cloud_discoveryengine_v1::builder::document_service::CancelOperation;
6386    /// # async fn sample() -> gax::Result<()> {
6387    ///
6388    /// let builder = prepare_request_builder();
6389    /// let response = builder.send().await?;
6390    /// # Ok(()) }
6391    ///
6392    /// fn prepare_request_builder() -> CancelOperation {
6393    ///   # panic!();
6394    ///   // ... details omitted ...
6395    /// }
6396    /// ```
6397    #[derive(Clone, Debug)]
6398    pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
6399
6400    impl CancelOperation {
6401        pub(crate) fn new(
6402            stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
6403        ) -> Self {
6404            Self(RequestBuilder::new(stub))
6405        }
6406
6407        /// Sets the full request, replacing any prior values.
6408        pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
6409            mut self,
6410            v: V,
6411        ) -> Self {
6412            self.0.request = v.into();
6413            self
6414        }
6415
6416        /// Sets all the options, replacing any prior values.
6417        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6418            self.0.options = v.into();
6419            self
6420        }
6421
6422        /// Sends the request.
6423        pub async fn send(self) -> Result<()> {
6424            (*self.0.stub)
6425                .cancel_operation(self.0.request, self.0.options)
6426                .await
6427                .map(gax::response::Response::into_body)
6428        }
6429
6430        /// Sets the value of [name][longrunning::model::CancelOperationRequest::name].
6431        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6432            self.0.request.name = v.into();
6433            self
6434        }
6435    }
6436
6437    #[doc(hidden)]
6438    impl gax::options::internal::RequestBuilder for CancelOperation {
6439        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6440            &mut self.0.options
6441        }
6442    }
6443}
6444
6445#[cfg(feature = "engine-service")]
6446#[cfg_attr(docsrs, doc(cfg(feature = "engine-service")))]
6447pub mod engine_service {
6448    use crate::Result;
6449
6450    /// A builder for [EngineService][crate::client::EngineService].
6451    ///
6452    /// ```
6453    /// # async fn sample() -> gax::client_builder::Result<()> {
6454    /// # use google_cloud_discoveryengine_v1::*;
6455    /// # use builder::engine_service::ClientBuilder;
6456    /// # use client::EngineService;
6457    /// let builder : ClientBuilder = EngineService::builder();
6458    /// let client = builder
6459    ///     .with_endpoint("https://discoveryengine.googleapis.com")
6460    ///     .build().await?;
6461    /// # Ok(()) }
6462    /// ```
6463    pub type ClientBuilder =
6464        gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
6465
6466    pub(crate) mod client {
6467        use super::super::super::client::EngineService;
6468        pub struct Factory;
6469        impl gax::client_builder::internal::ClientFactory for Factory {
6470            type Client = EngineService;
6471            type Credentials = gaxi::options::Credentials;
6472            async fn build(
6473                self,
6474                config: gaxi::options::ClientConfig,
6475            ) -> gax::client_builder::Result<Self::Client> {
6476                Self::Client::new(config).await
6477            }
6478        }
6479    }
6480
6481    /// Common implementation for [crate::client::EngineService] request builders.
6482    #[derive(Clone, Debug)]
6483    pub(crate) struct RequestBuilder<R: std::default::Default> {
6484        stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
6485        request: R,
6486        options: gax::options::RequestOptions,
6487    }
6488
6489    impl<R> RequestBuilder<R>
6490    where
6491        R: std::default::Default,
6492    {
6493        pub(crate) fn new(
6494            stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
6495        ) -> Self {
6496            Self {
6497                stub,
6498                request: R::default(),
6499                options: gax::options::RequestOptions::default(),
6500            }
6501        }
6502    }
6503
6504    /// The request builder for [EngineService::create_engine][crate::client::EngineService::create_engine] calls.
6505    ///
6506    /// # Example
6507    /// ```
6508    /// # use google_cloud_discoveryengine_v1::builder::engine_service::CreateEngine;
6509    /// # async fn sample() -> gax::Result<()> {
6510    /// use lro::Poller;
6511    ///
6512    /// let builder = prepare_request_builder();
6513    /// let response = builder.poller().until_done().await?;
6514    /// # Ok(()) }
6515    ///
6516    /// fn prepare_request_builder() -> CreateEngine {
6517    ///   # panic!();
6518    ///   // ... details omitted ...
6519    /// }
6520    /// ```
6521    #[derive(Clone, Debug)]
6522    pub struct CreateEngine(RequestBuilder<crate::model::CreateEngineRequest>);
6523
6524    impl CreateEngine {
6525        pub(crate) fn new(
6526            stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
6527        ) -> Self {
6528            Self(RequestBuilder::new(stub))
6529        }
6530
6531        /// Sets the full request, replacing any prior values.
6532        pub fn with_request<V: Into<crate::model::CreateEngineRequest>>(mut self, v: V) -> Self {
6533            self.0.request = v.into();
6534            self
6535        }
6536
6537        /// Sets all the options, replacing any prior values.
6538        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6539            self.0.options = v.into();
6540            self
6541        }
6542
6543        /// Sends the request.
6544        ///
6545        /// # Long running operations
6546        ///
6547        /// This starts, but does not poll, a longrunning operation. More information
6548        /// on [create_engine][crate::client::EngineService::create_engine].
6549        pub async fn send(self) -> Result<longrunning::model::Operation> {
6550            (*self.0.stub)
6551                .create_engine(self.0.request, self.0.options)
6552                .await
6553                .map(gax::response::Response::into_body)
6554        }
6555
6556        /// Creates a [Poller][lro::Poller] to work with `create_engine`.
6557        pub fn poller(
6558            self,
6559        ) -> impl lro::Poller<crate::model::Engine, crate::model::CreateEngineMetadata> {
6560            type Operation =
6561                lro::internal::Operation<crate::model::Engine, crate::model::CreateEngineMetadata>;
6562            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
6563            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
6564
6565            let stub = self.0.stub.clone();
6566            let mut options = self.0.options.clone();
6567            options.set_retry_policy(gax::retry_policy::NeverRetry);
6568            let query = move |name| {
6569                let stub = stub.clone();
6570                let options = options.clone();
6571                async {
6572                    let op = GetOperation::new(stub)
6573                        .set_name(name)
6574                        .with_options(options)
6575                        .send()
6576                        .await?;
6577                    Ok(Operation::new(op))
6578                }
6579            };
6580
6581            let start = move || async {
6582                let op = self.send().await?;
6583                Ok(Operation::new(op))
6584            };
6585
6586            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
6587        }
6588
6589        /// Sets the value of [parent][crate::model::CreateEngineRequest::parent].
6590        ///
6591        /// This is a **required** field for requests.
6592        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
6593            self.0.request.parent = v.into();
6594            self
6595        }
6596
6597        /// Sets the value of [engine][crate::model::CreateEngineRequest::engine].
6598        ///
6599        /// This is a **required** field for requests.
6600        pub fn set_engine<T>(mut self, v: T) -> Self
6601        where
6602            T: std::convert::Into<crate::model::Engine>,
6603        {
6604            self.0.request.engine = std::option::Option::Some(v.into());
6605            self
6606        }
6607
6608        /// Sets or clears the value of [engine][crate::model::CreateEngineRequest::engine].
6609        ///
6610        /// This is a **required** field for requests.
6611        pub fn set_or_clear_engine<T>(mut self, v: std::option::Option<T>) -> Self
6612        where
6613            T: std::convert::Into<crate::model::Engine>,
6614        {
6615            self.0.request.engine = v.map(|x| x.into());
6616            self
6617        }
6618
6619        /// Sets the value of [engine_id][crate::model::CreateEngineRequest::engine_id].
6620        ///
6621        /// This is a **required** field for requests.
6622        pub fn set_engine_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
6623            self.0.request.engine_id = v.into();
6624            self
6625        }
6626    }
6627
6628    #[doc(hidden)]
6629    impl gax::options::internal::RequestBuilder for CreateEngine {
6630        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6631            &mut self.0.options
6632        }
6633    }
6634
6635    /// The request builder for [EngineService::delete_engine][crate::client::EngineService::delete_engine] calls.
6636    ///
6637    /// # Example
6638    /// ```
6639    /// # use google_cloud_discoveryengine_v1::builder::engine_service::DeleteEngine;
6640    /// # async fn sample() -> gax::Result<()> {
6641    /// use lro::Poller;
6642    ///
6643    /// let builder = prepare_request_builder();
6644    /// let response = builder.poller().until_done().await?;
6645    /// # Ok(()) }
6646    ///
6647    /// fn prepare_request_builder() -> DeleteEngine {
6648    ///   # panic!();
6649    ///   // ... details omitted ...
6650    /// }
6651    /// ```
6652    #[derive(Clone, Debug)]
6653    pub struct DeleteEngine(RequestBuilder<crate::model::DeleteEngineRequest>);
6654
6655    impl DeleteEngine {
6656        pub(crate) fn new(
6657            stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
6658        ) -> Self {
6659            Self(RequestBuilder::new(stub))
6660        }
6661
6662        /// Sets the full request, replacing any prior values.
6663        pub fn with_request<V: Into<crate::model::DeleteEngineRequest>>(mut self, v: V) -> Self {
6664            self.0.request = v.into();
6665            self
6666        }
6667
6668        /// Sets all the options, replacing any prior values.
6669        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6670            self.0.options = v.into();
6671            self
6672        }
6673
6674        /// Sends the request.
6675        ///
6676        /// # Long running operations
6677        ///
6678        /// This starts, but does not poll, a longrunning operation. More information
6679        /// on [delete_engine][crate::client::EngineService::delete_engine].
6680        pub async fn send(self) -> Result<longrunning::model::Operation> {
6681            (*self.0.stub)
6682                .delete_engine(self.0.request, self.0.options)
6683                .await
6684                .map(gax::response::Response::into_body)
6685        }
6686
6687        /// Creates a [Poller][lro::Poller] to work with `delete_engine`.
6688        pub fn poller(self) -> impl lro::Poller<(), crate::model::DeleteEngineMetadata> {
6689            type Operation =
6690                lro::internal::Operation<wkt::Empty, crate::model::DeleteEngineMetadata>;
6691            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
6692            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
6693
6694            let stub = self.0.stub.clone();
6695            let mut options = self.0.options.clone();
6696            options.set_retry_policy(gax::retry_policy::NeverRetry);
6697            let query = move |name| {
6698                let stub = stub.clone();
6699                let options = options.clone();
6700                async {
6701                    let op = GetOperation::new(stub)
6702                        .set_name(name)
6703                        .with_options(options)
6704                        .send()
6705                        .await?;
6706                    Ok(Operation::new(op))
6707                }
6708            };
6709
6710            let start = move || async {
6711                let op = self.send().await?;
6712                Ok(Operation::new(op))
6713            };
6714
6715            lro::internal::new_unit_response_poller(
6716                polling_error_policy,
6717                polling_backoff_policy,
6718                start,
6719                query,
6720            )
6721        }
6722
6723        /// Sets the value of [name][crate::model::DeleteEngineRequest::name].
6724        ///
6725        /// This is a **required** field for requests.
6726        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6727            self.0.request.name = v.into();
6728            self
6729        }
6730    }
6731
6732    #[doc(hidden)]
6733    impl gax::options::internal::RequestBuilder for DeleteEngine {
6734        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6735            &mut self.0.options
6736        }
6737    }
6738
6739    /// The request builder for [EngineService::update_engine][crate::client::EngineService::update_engine] calls.
6740    ///
6741    /// # Example
6742    /// ```
6743    /// # use google_cloud_discoveryengine_v1::builder::engine_service::UpdateEngine;
6744    /// # async fn sample() -> gax::Result<()> {
6745    ///
6746    /// let builder = prepare_request_builder();
6747    /// let response = builder.send().await?;
6748    /// # Ok(()) }
6749    ///
6750    /// fn prepare_request_builder() -> UpdateEngine {
6751    ///   # panic!();
6752    ///   // ... details omitted ...
6753    /// }
6754    /// ```
6755    #[derive(Clone, Debug)]
6756    pub struct UpdateEngine(RequestBuilder<crate::model::UpdateEngineRequest>);
6757
6758    impl UpdateEngine {
6759        pub(crate) fn new(
6760            stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
6761        ) -> Self {
6762            Self(RequestBuilder::new(stub))
6763        }
6764
6765        /// Sets the full request, replacing any prior values.
6766        pub fn with_request<V: Into<crate::model::UpdateEngineRequest>>(mut self, v: V) -> Self {
6767            self.0.request = v.into();
6768            self
6769        }
6770
6771        /// Sets all the options, replacing any prior values.
6772        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6773            self.0.options = v.into();
6774            self
6775        }
6776
6777        /// Sends the request.
6778        pub async fn send(self) -> Result<crate::model::Engine> {
6779            (*self.0.stub)
6780                .update_engine(self.0.request, self.0.options)
6781                .await
6782                .map(gax::response::Response::into_body)
6783        }
6784
6785        /// Sets the value of [engine][crate::model::UpdateEngineRequest::engine].
6786        ///
6787        /// This is a **required** field for requests.
6788        pub fn set_engine<T>(mut self, v: T) -> Self
6789        where
6790            T: std::convert::Into<crate::model::Engine>,
6791        {
6792            self.0.request.engine = std::option::Option::Some(v.into());
6793            self
6794        }
6795
6796        /// Sets or clears the value of [engine][crate::model::UpdateEngineRequest::engine].
6797        ///
6798        /// This is a **required** field for requests.
6799        pub fn set_or_clear_engine<T>(mut self, v: std::option::Option<T>) -> Self
6800        where
6801            T: std::convert::Into<crate::model::Engine>,
6802        {
6803            self.0.request.engine = v.map(|x| x.into());
6804            self
6805        }
6806
6807        /// Sets the value of [update_mask][crate::model::UpdateEngineRequest::update_mask].
6808        pub fn set_update_mask<T>(mut self, v: T) -> Self
6809        where
6810            T: std::convert::Into<wkt::FieldMask>,
6811        {
6812            self.0.request.update_mask = std::option::Option::Some(v.into());
6813            self
6814        }
6815
6816        /// Sets or clears the value of [update_mask][crate::model::UpdateEngineRequest::update_mask].
6817        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
6818        where
6819            T: std::convert::Into<wkt::FieldMask>,
6820        {
6821            self.0.request.update_mask = v.map(|x| x.into());
6822            self
6823        }
6824    }
6825
6826    #[doc(hidden)]
6827    impl gax::options::internal::RequestBuilder for UpdateEngine {
6828        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6829            &mut self.0.options
6830        }
6831    }
6832
6833    /// The request builder for [EngineService::get_engine][crate::client::EngineService::get_engine] calls.
6834    ///
6835    /// # Example
6836    /// ```
6837    /// # use google_cloud_discoveryengine_v1::builder::engine_service::GetEngine;
6838    /// # async fn sample() -> gax::Result<()> {
6839    ///
6840    /// let builder = prepare_request_builder();
6841    /// let response = builder.send().await?;
6842    /// # Ok(()) }
6843    ///
6844    /// fn prepare_request_builder() -> GetEngine {
6845    ///   # panic!();
6846    ///   // ... details omitted ...
6847    /// }
6848    /// ```
6849    #[derive(Clone, Debug)]
6850    pub struct GetEngine(RequestBuilder<crate::model::GetEngineRequest>);
6851
6852    impl GetEngine {
6853        pub(crate) fn new(
6854            stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
6855        ) -> Self {
6856            Self(RequestBuilder::new(stub))
6857        }
6858
6859        /// Sets the full request, replacing any prior values.
6860        pub fn with_request<V: Into<crate::model::GetEngineRequest>>(mut self, v: V) -> Self {
6861            self.0.request = v.into();
6862            self
6863        }
6864
6865        /// Sets all the options, replacing any prior values.
6866        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6867            self.0.options = v.into();
6868            self
6869        }
6870
6871        /// Sends the request.
6872        pub async fn send(self) -> Result<crate::model::Engine> {
6873            (*self.0.stub)
6874                .get_engine(self.0.request, self.0.options)
6875                .await
6876                .map(gax::response::Response::into_body)
6877        }
6878
6879        /// Sets the value of [name][crate::model::GetEngineRequest::name].
6880        ///
6881        /// This is a **required** field for requests.
6882        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6883            self.0.request.name = v.into();
6884            self
6885        }
6886    }
6887
6888    #[doc(hidden)]
6889    impl gax::options::internal::RequestBuilder for GetEngine {
6890        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6891            &mut self.0.options
6892        }
6893    }
6894
6895    /// The request builder for [EngineService::list_engines][crate::client::EngineService::list_engines] calls.
6896    ///
6897    /// # Example
6898    /// ```
6899    /// # use google_cloud_discoveryengine_v1::builder::engine_service::ListEngines;
6900    /// # async fn sample() -> gax::Result<()> {
6901    /// use gax::paginator::ItemPaginator;
6902    ///
6903    /// let builder = prepare_request_builder();
6904    /// let mut items = builder.by_item();
6905    /// while let Some(result) = items.next().await {
6906    ///   let item = result?;
6907    /// }
6908    /// # Ok(()) }
6909    ///
6910    /// fn prepare_request_builder() -> ListEngines {
6911    ///   # panic!();
6912    ///   // ... details omitted ...
6913    /// }
6914    /// ```
6915    #[derive(Clone, Debug)]
6916    pub struct ListEngines(RequestBuilder<crate::model::ListEnginesRequest>);
6917
6918    impl ListEngines {
6919        pub(crate) fn new(
6920            stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
6921        ) -> Self {
6922            Self(RequestBuilder::new(stub))
6923        }
6924
6925        /// Sets the full request, replacing any prior values.
6926        pub fn with_request<V: Into<crate::model::ListEnginesRequest>>(mut self, v: V) -> Self {
6927            self.0.request = v.into();
6928            self
6929        }
6930
6931        /// Sets all the options, replacing any prior values.
6932        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6933            self.0.options = v.into();
6934            self
6935        }
6936
6937        /// Sends the request.
6938        pub async fn send(self) -> Result<crate::model::ListEnginesResponse> {
6939            (*self.0.stub)
6940                .list_engines(self.0.request, self.0.options)
6941                .await
6942                .map(gax::response::Response::into_body)
6943        }
6944
6945        /// Streams each page in the collection.
6946        pub fn by_page(
6947            self,
6948        ) -> impl gax::paginator::Paginator<crate::model::ListEnginesResponse, gax::error::Error>
6949        {
6950            use std::clone::Clone;
6951            let token = self.0.request.page_token.clone();
6952            let execute = move |token: String| {
6953                let mut builder = self.clone();
6954                builder.0.request = builder.0.request.set_page_token(token);
6955                builder.send()
6956            };
6957            gax::paginator::internal::new_paginator(token, execute)
6958        }
6959
6960        /// Streams each item in the collection.
6961        pub fn by_item(
6962            self,
6963        ) -> impl gax::paginator::ItemPaginator<crate::model::ListEnginesResponse, gax::error::Error>
6964        {
6965            use gax::paginator::Paginator;
6966            self.by_page().items()
6967        }
6968
6969        /// Sets the value of [parent][crate::model::ListEnginesRequest::parent].
6970        ///
6971        /// This is a **required** field for requests.
6972        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
6973            self.0.request.parent = v.into();
6974            self
6975        }
6976
6977        /// Sets the value of [page_size][crate::model::ListEnginesRequest::page_size].
6978        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
6979            self.0.request.page_size = v.into();
6980            self
6981        }
6982
6983        /// Sets the value of [page_token][crate::model::ListEnginesRequest::page_token].
6984        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
6985            self.0.request.page_token = v.into();
6986            self
6987        }
6988
6989        /// Sets the value of [filter][crate::model::ListEnginesRequest::filter].
6990        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
6991            self.0.request.filter = v.into();
6992            self
6993        }
6994    }
6995
6996    #[doc(hidden)]
6997    impl gax::options::internal::RequestBuilder for ListEngines {
6998        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6999            &mut self.0.options
7000        }
7001    }
7002
7003    /// The request builder for [EngineService::list_operations][crate::client::EngineService::list_operations] calls.
7004    ///
7005    /// # Example
7006    /// ```
7007    /// # use google_cloud_discoveryengine_v1::builder::engine_service::ListOperations;
7008    /// # async fn sample() -> gax::Result<()> {
7009    /// use gax::paginator::ItemPaginator;
7010    ///
7011    /// let builder = prepare_request_builder();
7012    /// let mut items = builder.by_item();
7013    /// while let Some(result) = items.next().await {
7014    ///   let item = result?;
7015    /// }
7016    /// # Ok(()) }
7017    ///
7018    /// fn prepare_request_builder() -> ListOperations {
7019    ///   # panic!();
7020    ///   // ... details omitted ...
7021    /// }
7022    /// ```
7023    #[derive(Clone, Debug)]
7024    pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
7025
7026    impl ListOperations {
7027        pub(crate) fn new(
7028            stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
7029        ) -> Self {
7030            Self(RequestBuilder::new(stub))
7031        }
7032
7033        /// Sets the full request, replacing any prior values.
7034        pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
7035            mut self,
7036            v: V,
7037        ) -> Self {
7038            self.0.request = v.into();
7039            self
7040        }
7041
7042        /// Sets all the options, replacing any prior values.
7043        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7044            self.0.options = v.into();
7045            self
7046        }
7047
7048        /// Sends the request.
7049        pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
7050            (*self.0.stub)
7051                .list_operations(self.0.request, self.0.options)
7052                .await
7053                .map(gax::response::Response::into_body)
7054        }
7055
7056        /// Streams each page in the collection.
7057        pub fn by_page(
7058            self,
7059        ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
7060        {
7061            use std::clone::Clone;
7062            let token = self.0.request.page_token.clone();
7063            let execute = move |token: String| {
7064                let mut builder = self.clone();
7065                builder.0.request = builder.0.request.set_page_token(token);
7066                builder.send()
7067            };
7068            gax::paginator::internal::new_paginator(token, execute)
7069        }
7070
7071        /// Streams each item in the collection.
7072        pub fn by_item(
7073            self,
7074        ) -> impl gax::paginator::ItemPaginator<
7075            longrunning::model::ListOperationsResponse,
7076            gax::error::Error,
7077        > {
7078            use gax::paginator::Paginator;
7079            self.by_page().items()
7080        }
7081
7082        /// Sets the value of [name][longrunning::model::ListOperationsRequest::name].
7083        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7084            self.0.request.name = v.into();
7085            self
7086        }
7087
7088        /// Sets the value of [filter][longrunning::model::ListOperationsRequest::filter].
7089        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
7090            self.0.request.filter = v.into();
7091            self
7092        }
7093
7094        /// Sets the value of [page_size][longrunning::model::ListOperationsRequest::page_size].
7095        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
7096            self.0.request.page_size = v.into();
7097            self
7098        }
7099
7100        /// Sets the value of [page_token][longrunning::model::ListOperationsRequest::page_token].
7101        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
7102            self.0.request.page_token = v.into();
7103            self
7104        }
7105
7106        /// Sets the value of [return_partial_success][longrunning::model::ListOperationsRequest::return_partial_success].
7107        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
7108            self.0.request.return_partial_success = v.into();
7109            self
7110        }
7111    }
7112
7113    #[doc(hidden)]
7114    impl gax::options::internal::RequestBuilder for ListOperations {
7115        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7116            &mut self.0.options
7117        }
7118    }
7119
7120    /// The request builder for [EngineService::get_operation][crate::client::EngineService::get_operation] calls.
7121    ///
7122    /// # Example
7123    /// ```
7124    /// # use google_cloud_discoveryengine_v1::builder::engine_service::GetOperation;
7125    /// # async fn sample() -> gax::Result<()> {
7126    ///
7127    /// let builder = prepare_request_builder();
7128    /// let response = builder.send().await?;
7129    /// # Ok(()) }
7130    ///
7131    /// fn prepare_request_builder() -> GetOperation {
7132    ///   # panic!();
7133    ///   // ... details omitted ...
7134    /// }
7135    /// ```
7136    #[derive(Clone, Debug)]
7137    pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
7138
7139    impl GetOperation {
7140        pub(crate) fn new(
7141            stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
7142        ) -> Self {
7143            Self(RequestBuilder::new(stub))
7144        }
7145
7146        /// Sets the full request, replacing any prior values.
7147        pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
7148            mut self,
7149            v: V,
7150        ) -> Self {
7151            self.0.request = v.into();
7152            self
7153        }
7154
7155        /// Sets all the options, replacing any prior values.
7156        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7157            self.0.options = v.into();
7158            self
7159        }
7160
7161        /// Sends the request.
7162        pub async fn send(self) -> Result<longrunning::model::Operation> {
7163            (*self.0.stub)
7164                .get_operation(self.0.request, self.0.options)
7165                .await
7166                .map(gax::response::Response::into_body)
7167        }
7168
7169        /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
7170        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7171            self.0.request.name = v.into();
7172            self
7173        }
7174    }
7175
7176    #[doc(hidden)]
7177    impl gax::options::internal::RequestBuilder for GetOperation {
7178        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7179            &mut self.0.options
7180        }
7181    }
7182
7183    /// The request builder for [EngineService::cancel_operation][crate::client::EngineService::cancel_operation] calls.
7184    ///
7185    /// # Example
7186    /// ```
7187    /// # use google_cloud_discoveryengine_v1::builder::engine_service::CancelOperation;
7188    /// # async fn sample() -> gax::Result<()> {
7189    ///
7190    /// let builder = prepare_request_builder();
7191    /// let response = builder.send().await?;
7192    /// # Ok(()) }
7193    ///
7194    /// fn prepare_request_builder() -> CancelOperation {
7195    ///   # panic!();
7196    ///   // ... details omitted ...
7197    /// }
7198    /// ```
7199    #[derive(Clone, Debug)]
7200    pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
7201
7202    impl CancelOperation {
7203        pub(crate) fn new(
7204            stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
7205        ) -> Self {
7206            Self(RequestBuilder::new(stub))
7207        }
7208
7209        /// Sets the full request, replacing any prior values.
7210        pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
7211            mut self,
7212            v: V,
7213        ) -> Self {
7214            self.0.request = v.into();
7215            self
7216        }
7217
7218        /// Sets all the options, replacing any prior values.
7219        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7220            self.0.options = v.into();
7221            self
7222        }
7223
7224        /// Sends the request.
7225        pub async fn send(self) -> Result<()> {
7226            (*self.0.stub)
7227                .cancel_operation(self.0.request, self.0.options)
7228                .await
7229                .map(gax::response::Response::into_body)
7230        }
7231
7232        /// Sets the value of [name][longrunning::model::CancelOperationRequest::name].
7233        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7234            self.0.request.name = v.into();
7235            self
7236        }
7237    }
7238
7239    #[doc(hidden)]
7240    impl gax::options::internal::RequestBuilder for CancelOperation {
7241        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7242            &mut self.0.options
7243        }
7244    }
7245}
7246
7247#[cfg(feature = "grounded-generation-service")]
7248#[cfg_attr(docsrs, doc(cfg(feature = "grounded-generation-service")))]
7249pub mod grounded_generation_service {
7250    use crate::Result;
7251
7252    /// A builder for [GroundedGenerationService][crate::client::GroundedGenerationService].
7253    ///
7254    /// ```
7255    /// # async fn sample() -> gax::client_builder::Result<()> {
7256    /// # use google_cloud_discoveryengine_v1::*;
7257    /// # use builder::grounded_generation_service::ClientBuilder;
7258    /// # use client::GroundedGenerationService;
7259    /// let builder : ClientBuilder = GroundedGenerationService::builder();
7260    /// let client = builder
7261    ///     .with_endpoint("https://discoveryengine.googleapis.com")
7262    ///     .build().await?;
7263    /// # Ok(()) }
7264    /// ```
7265    pub type ClientBuilder =
7266        gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
7267
7268    pub(crate) mod client {
7269        use super::super::super::client::GroundedGenerationService;
7270        pub struct Factory;
7271        impl gax::client_builder::internal::ClientFactory for Factory {
7272            type Client = GroundedGenerationService;
7273            type Credentials = gaxi::options::Credentials;
7274            async fn build(
7275                self,
7276                config: gaxi::options::ClientConfig,
7277            ) -> gax::client_builder::Result<Self::Client> {
7278                Self::Client::new(config).await
7279            }
7280        }
7281    }
7282
7283    /// Common implementation for [crate::client::GroundedGenerationService] request builders.
7284    #[derive(Clone, Debug)]
7285    pub(crate) struct RequestBuilder<R: std::default::Default> {
7286        stub: std::sync::Arc<dyn super::super::stub::dynamic::GroundedGenerationService>,
7287        request: R,
7288        options: gax::options::RequestOptions,
7289    }
7290
7291    impl<R> RequestBuilder<R>
7292    where
7293        R: std::default::Default,
7294    {
7295        pub(crate) fn new(
7296            stub: std::sync::Arc<dyn super::super::stub::dynamic::GroundedGenerationService>,
7297        ) -> Self {
7298            Self {
7299                stub,
7300                request: R::default(),
7301                options: gax::options::RequestOptions::default(),
7302            }
7303        }
7304    }
7305
7306    /// The request builder for [GroundedGenerationService::generate_grounded_content][crate::client::GroundedGenerationService::generate_grounded_content] calls.
7307    ///
7308    /// # Example
7309    /// ```
7310    /// # use google_cloud_discoveryengine_v1::builder::grounded_generation_service::GenerateGroundedContent;
7311    /// # async fn sample() -> gax::Result<()> {
7312    ///
7313    /// let builder = prepare_request_builder();
7314    /// let response = builder.send().await?;
7315    /// # Ok(()) }
7316    ///
7317    /// fn prepare_request_builder() -> GenerateGroundedContent {
7318    ///   # panic!();
7319    ///   // ... details omitted ...
7320    /// }
7321    /// ```
7322    #[derive(Clone, Debug)]
7323    pub struct GenerateGroundedContent(
7324        RequestBuilder<crate::model::GenerateGroundedContentRequest>,
7325    );
7326
7327    impl GenerateGroundedContent {
7328        pub(crate) fn new(
7329            stub: std::sync::Arc<dyn super::super::stub::dynamic::GroundedGenerationService>,
7330        ) -> Self {
7331            Self(RequestBuilder::new(stub))
7332        }
7333
7334        /// Sets the full request, replacing any prior values.
7335        pub fn with_request<V: Into<crate::model::GenerateGroundedContentRequest>>(
7336            mut self,
7337            v: V,
7338        ) -> Self {
7339            self.0.request = v.into();
7340            self
7341        }
7342
7343        /// Sets all the options, replacing any prior values.
7344        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7345            self.0.options = v.into();
7346            self
7347        }
7348
7349        /// Sends the request.
7350        pub async fn send(self) -> Result<crate::model::GenerateGroundedContentResponse> {
7351            (*self.0.stub)
7352                .generate_grounded_content(self.0.request, self.0.options)
7353                .await
7354                .map(gax::response::Response::into_body)
7355        }
7356
7357        /// Sets the value of [location][crate::model::GenerateGroundedContentRequest::location].
7358        ///
7359        /// This is a **required** field for requests.
7360        pub fn set_location<T: Into<std::string::String>>(mut self, v: T) -> Self {
7361            self.0.request.location = v.into();
7362            self
7363        }
7364
7365        /// Sets the value of [system_instruction][crate::model::GenerateGroundedContentRequest::system_instruction].
7366        pub fn set_system_instruction<T>(mut self, v: T) -> Self
7367        where
7368            T: std::convert::Into<crate::model::GroundedGenerationContent>,
7369        {
7370            self.0.request.system_instruction = std::option::Option::Some(v.into());
7371            self
7372        }
7373
7374        /// Sets or clears the value of [system_instruction][crate::model::GenerateGroundedContentRequest::system_instruction].
7375        pub fn set_or_clear_system_instruction<T>(mut self, v: std::option::Option<T>) -> Self
7376        where
7377            T: std::convert::Into<crate::model::GroundedGenerationContent>,
7378        {
7379            self.0.request.system_instruction = v.map(|x| x.into());
7380            self
7381        }
7382
7383        /// Sets the value of [contents][crate::model::GenerateGroundedContentRequest::contents].
7384        pub fn set_contents<T, V>(mut self, v: T) -> Self
7385        where
7386            T: std::iter::IntoIterator<Item = V>,
7387            V: std::convert::Into<crate::model::GroundedGenerationContent>,
7388        {
7389            use std::iter::Iterator;
7390            self.0.request.contents = v.into_iter().map(|i| i.into()).collect();
7391            self
7392        }
7393
7394        /// Sets the value of [generation_spec][crate::model::GenerateGroundedContentRequest::generation_spec].
7395        pub fn set_generation_spec<T>(mut self, v: T) -> Self
7396        where
7397            T: std::convert::Into<crate::model::generate_grounded_content_request::GenerationSpec>,
7398        {
7399            self.0.request.generation_spec = std::option::Option::Some(v.into());
7400            self
7401        }
7402
7403        /// Sets or clears the value of [generation_spec][crate::model::GenerateGroundedContentRequest::generation_spec].
7404        pub fn set_or_clear_generation_spec<T>(mut self, v: std::option::Option<T>) -> Self
7405        where
7406            T: std::convert::Into<crate::model::generate_grounded_content_request::GenerationSpec>,
7407        {
7408            self.0.request.generation_spec = v.map(|x| x.into());
7409            self
7410        }
7411
7412        /// Sets the value of [grounding_spec][crate::model::GenerateGroundedContentRequest::grounding_spec].
7413        pub fn set_grounding_spec<T>(mut self, v: T) -> Self
7414        where
7415            T: std::convert::Into<crate::model::generate_grounded_content_request::GroundingSpec>,
7416        {
7417            self.0.request.grounding_spec = std::option::Option::Some(v.into());
7418            self
7419        }
7420
7421        /// Sets or clears the value of [grounding_spec][crate::model::GenerateGroundedContentRequest::grounding_spec].
7422        pub fn set_or_clear_grounding_spec<T>(mut self, v: std::option::Option<T>) -> Self
7423        where
7424            T: std::convert::Into<crate::model::generate_grounded_content_request::GroundingSpec>,
7425        {
7426            self.0.request.grounding_spec = v.map(|x| x.into());
7427            self
7428        }
7429
7430        /// Sets the value of [user_labels][crate::model::GenerateGroundedContentRequest::user_labels].
7431        pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
7432        where
7433            T: std::iter::IntoIterator<Item = (K, V)>,
7434            K: std::convert::Into<std::string::String>,
7435            V: std::convert::Into<std::string::String>,
7436        {
7437            self.0.request.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
7438            self
7439        }
7440    }
7441
7442    #[doc(hidden)]
7443    impl gax::options::internal::RequestBuilder for GenerateGroundedContent {
7444        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7445            &mut self.0.options
7446        }
7447    }
7448
7449    /// The request builder for [GroundedGenerationService::check_grounding][crate::client::GroundedGenerationService::check_grounding] calls.
7450    ///
7451    /// # Example
7452    /// ```
7453    /// # use google_cloud_discoveryengine_v1::builder::grounded_generation_service::CheckGrounding;
7454    /// # async fn sample() -> gax::Result<()> {
7455    ///
7456    /// let builder = prepare_request_builder();
7457    /// let response = builder.send().await?;
7458    /// # Ok(()) }
7459    ///
7460    /// fn prepare_request_builder() -> CheckGrounding {
7461    ///   # panic!();
7462    ///   // ... details omitted ...
7463    /// }
7464    /// ```
7465    #[derive(Clone, Debug)]
7466    pub struct CheckGrounding(RequestBuilder<crate::model::CheckGroundingRequest>);
7467
7468    impl CheckGrounding {
7469        pub(crate) fn new(
7470            stub: std::sync::Arc<dyn super::super::stub::dynamic::GroundedGenerationService>,
7471        ) -> Self {
7472            Self(RequestBuilder::new(stub))
7473        }
7474
7475        /// Sets the full request, replacing any prior values.
7476        pub fn with_request<V: Into<crate::model::CheckGroundingRequest>>(mut self, v: V) -> Self {
7477            self.0.request = v.into();
7478            self
7479        }
7480
7481        /// Sets all the options, replacing any prior values.
7482        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7483            self.0.options = v.into();
7484            self
7485        }
7486
7487        /// Sends the request.
7488        pub async fn send(self) -> Result<crate::model::CheckGroundingResponse> {
7489            (*self.0.stub)
7490                .check_grounding(self.0.request, self.0.options)
7491                .await
7492                .map(gax::response::Response::into_body)
7493        }
7494
7495        /// Sets the value of [grounding_config][crate::model::CheckGroundingRequest::grounding_config].
7496        ///
7497        /// This is a **required** field for requests.
7498        pub fn set_grounding_config<T: Into<std::string::String>>(mut self, v: T) -> Self {
7499            self.0.request.grounding_config = v.into();
7500            self
7501        }
7502
7503        /// Sets the value of [answer_candidate][crate::model::CheckGroundingRequest::answer_candidate].
7504        pub fn set_answer_candidate<T: Into<std::string::String>>(mut self, v: T) -> Self {
7505            self.0.request.answer_candidate = v.into();
7506            self
7507        }
7508
7509        /// Sets the value of [facts][crate::model::CheckGroundingRequest::facts].
7510        pub fn set_facts<T, V>(mut self, v: T) -> Self
7511        where
7512            T: std::iter::IntoIterator<Item = V>,
7513            V: std::convert::Into<crate::model::GroundingFact>,
7514        {
7515            use std::iter::Iterator;
7516            self.0.request.facts = v.into_iter().map(|i| i.into()).collect();
7517            self
7518        }
7519
7520        /// Sets the value of [grounding_spec][crate::model::CheckGroundingRequest::grounding_spec].
7521        pub fn set_grounding_spec<T>(mut self, v: T) -> Self
7522        where
7523            T: std::convert::Into<crate::model::CheckGroundingSpec>,
7524        {
7525            self.0.request.grounding_spec = std::option::Option::Some(v.into());
7526            self
7527        }
7528
7529        /// Sets or clears the value of [grounding_spec][crate::model::CheckGroundingRequest::grounding_spec].
7530        pub fn set_or_clear_grounding_spec<T>(mut self, v: std::option::Option<T>) -> Self
7531        where
7532            T: std::convert::Into<crate::model::CheckGroundingSpec>,
7533        {
7534            self.0.request.grounding_spec = v.map(|x| x.into());
7535            self
7536        }
7537
7538        /// Sets the value of [user_labels][crate::model::CheckGroundingRequest::user_labels].
7539        pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
7540        where
7541            T: std::iter::IntoIterator<Item = (K, V)>,
7542            K: std::convert::Into<std::string::String>,
7543            V: std::convert::Into<std::string::String>,
7544        {
7545            self.0.request.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
7546            self
7547        }
7548    }
7549
7550    #[doc(hidden)]
7551    impl gax::options::internal::RequestBuilder for CheckGrounding {
7552        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7553            &mut self.0.options
7554        }
7555    }
7556
7557    /// The request builder for [GroundedGenerationService::list_operations][crate::client::GroundedGenerationService::list_operations] calls.
7558    ///
7559    /// # Example
7560    /// ```
7561    /// # use google_cloud_discoveryengine_v1::builder::grounded_generation_service::ListOperations;
7562    /// # async fn sample() -> gax::Result<()> {
7563    /// use gax::paginator::ItemPaginator;
7564    ///
7565    /// let builder = prepare_request_builder();
7566    /// let mut items = builder.by_item();
7567    /// while let Some(result) = items.next().await {
7568    ///   let item = result?;
7569    /// }
7570    /// # Ok(()) }
7571    ///
7572    /// fn prepare_request_builder() -> ListOperations {
7573    ///   # panic!();
7574    ///   // ... details omitted ...
7575    /// }
7576    /// ```
7577    #[derive(Clone, Debug)]
7578    pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
7579
7580    impl ListOperations {
7581        pub(crate) fn new(
7582            stub: std::sync::Arc<dyn super::super::stub::dynamic::GroundedGenerationService>,
7583        ) -> Self {
7584            Self(RequestBuilder::new(stub))
7585        }
7586
7587        /// Sets the full request, replacing any prior values.
7588        pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
7589            mut self,
7590            v: V,
7591        ) -> Self {
7592            self.0.request = v.into();
7593            self
7594        }
7595
7596        /// Sets all the options, replacing any prior values.
7597        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7598            self.0.options = v.into();
7599            self
7600        }
7601
7602        /// Sends the request.
7603        pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
7604            (*self.0.stub)
7605                .list_operations(self.0.request, self.0.options)
7606                .await
7607                .map(gax::response::Response::into_body)
7608        }
7609
7610        /// Streams each page in the collection.
7611        pub fn by_page(
7612            self,
7613        ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
7614        {
7615            use std::clone::Clone;
7616            let token = self.0.request.page_token.clone();
7617            let execute = move |token: String| {
7618                let mut builder = self.clone();
7619                builder.0.request = builder.0.request.set_page_token(token);
7620                builder.send()
7621            };
7622            gax::paginator::internal::new_paginator(token, execute)
7623        }
7624
7625        /// Streams each item in the collection.
7626        pub fn by_item(
7627            self,
7628        ) -> impl gax::paginator::ItemPaginator<
7629            longrunning::model::ListOperationsResponse,
7630            gax::error::Error,
7631        > {
7632            use gax::paginator::Paginator;
7633            self.by_page().items()
7634        }
7635
7636        /// Sets the value of [name][longrunning::model::ListOperationsRequest::name].
7637        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7638            self.0.request.name = v.into();
7639            self
7640        }
7641
7642        /// Sets the value of [filter][longrunning::model::ListOperationsRequest::filter].
7643        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
7644            self.0.request.filter = v.into();
7645            self
7646        }
7647
7648        /// Sets the value of [page_size][longrunning::model::ListOperationsRequest::page_size].
7649        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
7650            self.0.request.page_size = v.into();
7651            self
7652        }
7653
7654        /// Sets the value of [page_token][longrunning::model::ListOperationsRequest::page_token].
7655        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
7656            self.0.request.page_token = v.into();
7657            self
7658        }
7659
7660        /// Sets the value of [return_partial_success][longrunning::model::ListOperationsRequest::return_partial_success].
7661        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
7662            self.0.request.return_partial_success = v.into();
7663            self
7664        }
7665    }
7666
7667    #[doc(hidden)]
7668    impl gax::options::internal::RequestBuilder for ListOperations {
7669        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7670            &mut self.0.options
7671        }
7672    }
7673
7674    /// The request builder for [GroundedGenerationService::get_operation][crate::client::GroundedGenerationService::get_operation] calls.
7675    ///
7676    /// # Example
7677    /// ```
7678    /// # use google_cloud_discoveryengine_v1::builder::grounded_generation_service::GetOperation;
7679    /// # async fn sample() -> gax::Result<()> {
7680    ///
7681    /// let builder = prepare_request_builder();
7682    /// let response = builder.send().await?;
7683    /// # Ok(()) }
7684    ///
7685    /// fn prepare_request_builder() -> GetOperation {
7686    ///   # panic!();
7687    ///   // ... details omitted ...
7688    /// }
7689    /// ```
7690    #[derive(Clone, Debug)]
7691    pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
7692
7693    impl GetOperation {
7694        pub(crate) fn new(
7695            stub: std::sync::Arc<dyn super::super::stub::dynamic::GroundedGenerationService>,
7696        ) -> Self {
7697            Self(RequestBuilder::new(stub))
7698        }
7699
7700        /// Sets the full request, replacing any prior values.
7701        pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
7702            mut self,
7703            v: V,
7704        ) -> Self {
7705            self.0.request = v.into();
7706            self
7707        }
7708
7709        /// Sets all the options, replacing any prior values.
7710        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7711            self.0.options = v.into();
7712            self
7713        }
7714
7715        /// Sends the request.
7716        pub async fn send(self) -> Result<longrunning::model::Operation> {
7717            (*self.0.stub)
7718                .get_operation(self.0.request, self.0.options)
7719                .await
7720                .map(gax::response::Response::into_body)
7721        }
7722
7723        /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
7724        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7725            self.0.request.name = v.into();
7726            self
7727        }
7728    }
7729
7730    #[doc(hidden)]
7731    impl gax::options::internal::RequestBuilder for GetOperation {
7732        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7733            &mut self.0.options
7734        }
7735    }
7736
7737    /// The request builder for [GroundedGenerationService::cancel_operation][crate::client::GroundedGenerationService::cancel_operation] calls.
7738    ///
7739    /// # Example
7740    /// ```
7741    /// # use google_cloud_discoveryengine_v1::builder::grounded_generation_service::CancelOperation;
7742    /// # async fn sample() -> gax::Result<()> {
7743    ///
7744    /// let builder = prepare_request_builder();
7745    /// let response = builder.send().await?;
7746    /// # Ok(()) }
7747    ///
7748    /// fn prepare_request_builder() -> CancelOperation {
7749    ///   # panic!();
7750    ///   // ... details omitted ...
7751    /// }
7752    /// ```
7753    #[derive(Clone, Debug)]
7754    pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
7755
7756    impl CancelOperation {
7757        pub(crate) fn new(
7758            stub: std::sync::Arc<dyn super::super::stub::dynamic::GroundedGenerationService>,
7759        ) -> Self {
7760            Self(RequestBuilder::new(stub))
7761        }
7762
7763        /// Sets the full request, replacing any prior values.
7764        pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
7765            mut self,
7766            v: V,
7767        ) -> Self {
7768            self.0.request = v.into();
7769            self
7770        }
7771
7772        /// Sets all the options, replacing any prior values.
7773        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7774            self.0.options = v.into();
7775            self
7776        }
7777
7778        /// Sends the request.
7779        pub async fn send(self) -> Result<()> {
7780            (*self.0.stub)
7781                .cancel_operation(self.0.request, self.0.options)
7782                .await
7783                .map(gax::response::Response::into_body)
7784        }
7785
7786        /// Sets the value of [name][longrunning::model::CancelOperationRequest::name].
7787        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7788            self.0.request.name = v.into();
7789            self
7790        }
7791    }
7792
7793    #[doc(hidden)]
7794    impl gax::options::internal::RequestBuilder for CancelOperation {
7795        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7796            &mut self.0.options
7797        }
7798    }
7799}
7800
7801#[cfg(feature = "identity-mapping-store-service")]
7802#[cfg_attr(docsrs, doc(cfg(feature = "identity-mapping-store-service")))]
7803pub mod identity_mapping_store_service {
7804    use crate::Result;
7805
7806    /// A builder for [IdentityMappingStoreService][crate::client::IdentityMappingStoreService].
7807    ///
7808    /// ```
7809    /// # async fn sample() -> gax::client_builder::Result<()> {
7810    /// # use google_cloud_discoveryengine_v1::*;
7811    /// # use builder::identity_mapping_store_service::ClientBuilder;
7812    /// # use client::IdentityMappingStoreService;
7813    /// let builder : ClientBuilder = IdentityMappingStoreService::builder();
7814    /// let client = builder
7815    ///     .with_endpoint("https://discoveryengine.googleapis.com")
7816    ///     .build().await?;
7817    /// # Ok(()) }
7818    /// ```
7819    pub type ClientBuilder =
7820        gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
7821
7822    pub(crate) mod client {
7823        use super::super::super::client::IdentityMappingStoreService;
7824        pub struct Factory;
7825        impl gax::client_builder::internal::ClientFactory for Factory {
7826            type Client = IdentityMappingStoreService;
7827            type Credentials = gaxi::options::Credentials;
7828            async fn build(
7829                self,
7830                config: gaxi::options::ClientConfig,
7831            ) -> gax::client_builder::Result<Self::Client> {
7832                Self::Client::new(config).await
7833            }
7834        }
7835    }
7836
7837    /// Common implementation for [crate::client::IdentityMappingStoreService] request builders.
7838    #[derive(Clone, Debug)]
7839    pub(crate) struct RequestBuilder<R: std::default::Default> {
7840        stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
7841        request: R,
7842        options: gax::options::RequestOptions,
7843    }
7844
7845    impl<R> RequestBuilder<R>
7846    where
7847        R: std::default::Default,
7848    {
7849        pub(crate) fn new(
7850            stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
7851        ) -> Self {
7852            Self {
7853                stub,
7854                request: R::default(),
7855                options: gax::options::RequestOptions::default(),
7856            }
7857        }
7858    }
7859
7860    /// The request builder for [IdentityMappingStoreService::create_identity_mapping_store][crate::client::IdentityMappingStoreService::create_identity_mapping_store] calls.
7861    ///
7862    /// # Example
7863    /// ```
7864    /// # use google_cloud_discoveryengine_v1::builder::identity_mapping_store_service::CreateIdentityMappingStore;
7865    /// # async fn sample() -> gax::Result<()> {
7866    ///
7867    /// let builder = prepare_request_builder();
7868    /// let response = builder.send().await?;
7869    /// # Ok(()) }
7870    ///
7871    /// fn prepare_request_builder() -> CreateIdentityMappingStore {
7872    ///   # panic!();
7873    ///   // ... details omitted ...
7874    /// }
7875    /// ```
7876    #[derive(Clone, Debug)]
7877    pub struct CreateIdentityMappingStore(
7878        RequestBuilder<crate::model::CreateIdentityMappingStoreRequest>,
7879    );
7880
7881    impl CreateIdentityMappingStore {
7882        pub(crate) fn new(
7883            stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
7884        ) -> Self {
7885            Self(RequestBuilder::new(stub))
7886        }
7887
7888        /// Sets the full request, replacing any prior values.
7889        pub fn with_request<V: Into<crate::model::CreateIdentityMappingStoreRequest>>(
7890            mut self,
7891            v: V,
7892        ) -> Self {
7893            self.0.request = v.into();
7894            self
7895        }
7896
7897        /// Sets all the options, replacing any prior values.
7898        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7899            self.0.options = v.into();
7900            self
7901        }
7902
7903        /// Sends the request.
7904        pub async fn send(self) -> Result<crate::model::IdentityMappingStore> {
7905            (*self.0.stub)
7906                .create_identity_mapping_store(self.0.request, self.0.options)
7907                .await
7908                .map(gax::response::Response::into_body)
7909        }
7910
7911        /// Sets the value of [parent][crate::model::CreateIdentityMappingStoreRequest::parent].
7912        ///
7913        /// This is a **required** field for requests.
7914        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
7915            self.0.request.parent = v.into();
7916            self
7917        }
7918
7919        /// Sets the value of [identity_mapping_store_id][crate::model::CreateIdentityMappingStoreRequest::identity_mapping_store_id].
7920        ///
7921        /// This is a **required** field for requests.
7922        pub fn set_identity_mapping_store_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
7923            self.0.request.identity_mapping_store_id = v.into();
7924            self
7925        }
7926
7927        /// Sets the value of [identity_mapping_store][crate::model::CreateIdentityMappingStoreRequest::identity_mapping_store].
7928        ///
7929        /// This is a **required** field for requests.
7930        pub fn set_identity_mapping_store<T>(mut self, v: T) -> Self
7931        where
7932            T: std::convert::Into<crate::model::IdentityMappingStore>,
7933        {
7934            self.0.request.identity_mapping_store = std::option::Option::Some(v.into());
7935            self
7936        }
7937
7938        /// Sets or clears the value of [identity_mapping_store][crate::model::CreateIdentityMappingStoreRequest::identity_mapping_store].
7939        ///
7940        /// This is a **required** field for requests.
7941        pub fn set_or_clear_identity_mapping_store<T>(mut self, v: std::option::Option<T>) -> Self
7942        where
7943            T: std::convert::Into<crate::model::IdentityMappingStore>,
7944        {
7945            self.0.request.identity_mapping_store = v.map(|x| x.into());
7946            self
7947        }
7948
7949        /// Sets the value of [cmek_options][crate::model::CreateIdentityMappingStoreRequest::cmek_options].
7950        ///
7951        /// Note that all the setters affecting `cmek_options` are
7952        /// mutually exclusive.
7953        pub fn set_cmek_options<
7954            T: Into<Option<crate::model::create_identity_mapping_store_request::CmekOptions>>,
7955        >(
7956            mut self,
7957            v: T,
7958        ) -> Self {
7959            self.0.request.cmek_options = v.into();
7960            self
7961        }
7962
7963        /// Sets the value of [cmek_options][crate::model::CreateIdentityMappingStoreRequest::cmek_options]
7964        /// to hold a `CmekConfigName`.
7965        ///
7966        /// Note that all the setters affecting `cmek_options` are
7967        /// mutually exclusive.
7968        pub fn set_cmek_config_name<T: std::convert::Into<std::string::String>>(
7969            mut self,
7970            v: T,
7971        ) -> Self {
7972            self.0.request = self.0.request.set_cmek_config_name(v);
7973            self
7974        }
7975
7976        /// Sets the value of [cmek_options][crate::model::CreateIdentityMappingStoreRequest::cmek_options]
7977        /// to hold a `DisableCmek`.
7978        ///
7979        /// Note that all the setters affecting `cmek_options` are
7980        /// mutually exclusive.
7981        pub fn set_disable_cmek<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
7982            self.0.request = self.0.request.set_disable_cmek(v);
7983            self
7984        }
7985    }
7986
7987    #[doc(hidden)]
7988    impl gax::options::internal::RequestBuilder for CreateIdentityMappingStore {
7989        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7990            &mut self.0.options
7991        }
7992    }
7993
7994    /// The request builder for [IdentityMappingStoreService::get_identity_mapping_store][crate::client::IdentityMappingStoreService::get_identity_mapping_store] calls.
7995    ///
7996    /// # Example
7997    /// ```
7998    /// # use google_cloud_discoveryengine_v1::builder::identity_mapping_store_service::GetIdentityMappingStore;
7999    /// # async fn sample() -> gax::Result<()> {
8000    ///
8001    /// let builder = prepare_request_builder();
8002    /// let response = builder.send().await?;
8003    /// # Ok(()) }
8004    ///
8005    /// fn prepare_request_builder() -> GetIdentityMappingStore {
8006    ///   # panic!();
8007    ///   // ... details omitted ...
8008    /// }
8009    /// ```
8010    #[derive(Clone, Debug)]
8011    pub struct GetIdentityMappingStore(
8012        RequestBuilder<crate::model::GetIdentityMappingStoreRequest>,
8013    );
8014
8015    impl GetIdentityMappingStore {
8016        pub(crate) fn new(
8017            stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
8018        ) -> Self {
8019            Self(RequestBuilder::new(stub))
8020        }
8021
8022        /// Sets the full request, replacing any prior values.
8023        pub fn with_request<V: Into<crate::model::GetIdentityMappingStoreRequest>>(
8024            mut self,
8025            v: V,
8026        ) -> Self {
8027            self.0.request = v.into();
8028            self
8029        }
8030
8031        /// Sets all the options, replacing any prior values.
8032        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
8033            self.0.options = v.into();
8034            self
8035        }
8036
8037        /// Sends the request.
8038        pub async fn send(self) -> Result<crate::model::IdentityMappingStore> {
8039            (*self.0.stub)
8040                .get_identity_mapping_store(self.0.request, self.0.options)
8041                .await
8042                .map(gax::response::Response::into_body)
8043        }
8044
8045        /// Sets the value of [name][crate::model::GetIdentityMappingStoreRequest::name].
8046        ///
8047        /// This is a **required** field for requests.
8048        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
8049            self.0.request.name = v.into();
8050            self
8051        }
8052    }
8053
8054    #[doc(hidden)]
8055    impl gax::options::internal::RequestBuilder for GetIdentityMappingStore {
8056        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8057            &mut self.0.options
8058        }
8059    }
8060
8061    /// The request builder for [IdentityMappingStoreService::delete_identity_mapping_store][crate::client::IdentityMappingStoreService::delete_identity_mapping_store] calls.
8062    ///
8063    /// # Example
8064    /// ```
8065    /// # use google_cloud_discoveryengine_v1::builder::identity_mapping_store_service::DeleteIdentityMappingStore;
8066    /// # async fn sample() -> gax::Result<()> {
8067    /// use lro::Poller;
8068    ///
8069    /// let builder = prepare_request_builder();
8070    /// let response = builder.poller().until_done().await?;
8071    /// # Ok(()) }
8072    ///
8073    /// fn prepare_request_builder() -> DeleteIdentityMappingStore {
8074    ///   # panic!();
8075    ///   // ... details omitted ...
8076    /// }
8077    /// ```
8078    #[derive(Clone, Debug)]
8079    pub struct DeleteIdentityMappingStore(
8080        RequestBuilder<crate::model::DeleteIdentityMappingStoreRequest>,
8081    );
8082
8083    impl DeleteIdentityMappingStore {
8084        pub(crate) fn new(
8085            stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
8086        ) -> Self {
8087            Self(RequestBuilder::new(stub))
8088        }
8089
8090        /// Sets the full request, replacing any prior values.
8091        pub fn with_request<V: Into<crate::model::DeleteIdentityMappingStoreRequest>>(
8092            mut self,
8093            v: V,
8094        ) -> Self {
8095            self.0.request = v.into();
8096            self
8097        }
8098
8099        /// Sets all the options, replacing any prior values.
8100        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
8101            self.0.options = v.into();
8102            self
8103        }
8104
8105        /// Sends the request.
8106        ///
8107        /// # Long running operations
8108        ///
8109        /// This starts, but does not poll, a longrunning operation. More information
8110        /// on [delete_identity_mapping_store][crate::client::IdentityMappingStoreService::delete_identity_mapping_store].
8111        pub async fn send(self) -> Result<longrunning::model::Operation> {
8112            (*self.0.stub)
8113                .delete_identity_mapping_store(self.0.request, self.0.options)
8114                .await
8115                .map(gax::response::Response::into_body)
8116        }
8117
8118        /// Creates a [Poller][lro::Poller] to work with `delete_identity_mapping_store`.
8119        pub fn poller(
8120            self,
8121        ) -> impl lro::Poller<(), crate::model::DeleteIdentityMappingStoreMetadata> {
8122            type Operation = lro::internal::Operation<
8123                wkt::Empty,
8124                crate::model::DeleteIdentityMappingStoreMetadata,
8125            >;
8126            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
8127            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
8128
8129            let stub = self.0.stub.clone();
8130            let mut options = self.0.options.clone();
8131            options.set_retry_policy(gax::retry_policy::NeverRetry);
8132            let query = move |name| {
8133                let stub = stub.clone();
8134                let options = options.clone();
8135                async {
8136                    let op = GetOperation::new(stub)
8137                        .set_name(name)
8138                        .with_options(options)
8139                        .send()
8140                        .await?;
8141                    Ok(Operation::new(op))
8142                }
8143            };
8144
8145            let start = move || async {
8146                let op = self.send().await?;
8147                Ok(Operation::new(op))
8148            };
8149
8150            lro::internal::new_unit_response_poller(
8151                polling_error_policy,
8152                polling_backoff_policy,
8153                start,
8154                query,
8155            )
8156        }
8157
8158        /// Sets the value of [name][crate::model::DeleteIdentityMappingStoreRequest::name].
8159        ///
8160        /// This is a **required** field for requests.
8161        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
8162            self.0.request.name = v.into();
8163            self
8164        }
8165    }
8166
8167    #[doc(hidden)]
8168    impl gax::options::internal::RequestBuilder for DeleteIdentityMappingStore {
8169        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8170            &mut self.0.options
8171        }
8172    }
8173
8174    /// The request builder for [IdentityMappingStoreService::import_identity_mappings][crate::client::IdentityMappingStoreService::import_identity_mappings] calls.
8175    ///
8176    /// # Example
8177    /// ```
8178    /// # use google_cloud_discoveryengine_v1::builder::identity_mapping_store_service::ImportIdentityMappings;
8179    /// # async fn sample() -> gax::Result<()> {
8180    /// use lro::Poller;
8181    ///
8182    /// let builder = prepare_request_builder();
8183    /// let response = builder.poller().until_done().await?;
8184    /// # Ok(()) }
8185    ///
8186    /// fn prepare_request_builder() -> ImportIdentityMappings {
8187    ///   # panic!();
8188    ///   // ... details omitted ...
8189    /// }
8190    /// ```
8191    #[derive(Clone, Debug)]
8192    pub struct ImportIdentityMappings(RequestBuilder<crate::model::ImportIdentityMappingsRequest>);
8193
8194    impl ImportIdentityMappings {
8195        pub(crate) fn new(
8196            stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
8197        ) -> Self {
8198            Self(RequestBuilder::new(stub))
8199        }
8200
8201        /// Sets the full request, replacing any prior values.
8202        pub fn with_request<V: Into<crate::model::ImportIdentityMappingsRequest>>(
8203            mut self,
8204            v: V,
8205        ) -> Self {
8206            self.0.request = v.into();
8207            self
8208        }
8209
8210        /// Sets all the options, replacing any prior values.
8211        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
8212            self.0.options = v.into();
8213            self
8214        }
8215
8216        /// Sends the request.
8217        ///
8218        /// # Long running operations
8219        ///
8220        /// This starts, but does not poll, a longrunning operation. More information
8221        /// on [import_identity_mappings][crate::client::IdentityMappingStoreService::import_identity_mappings].
8222        pub async fn send(self) -> Result<longrunning::model::Operation> {
8223            (*self.0.stub)
8224                .import_identity_mappings(self.0.request, self.0.options)
8225                .await
8226                .map(gax::response::Response::into_body)
8227        }
8228
8229        /// Creates a [Poller][lro::Poller] to work with `import_identity_mappings`.
8230        pub fn poller(
8231            self,
8232        ) -> impl lro::Poller<
8233            crate::model::ImportIdentityMappingsResponse,
8234            crate::model::IdentityMappingEntryOperationMetadata,
8235        > {
8236            type Operation = lro::internal::Operation<
8237                crate::model::ImportIdentityMappingsResponse,
8238                crate::model::IdentityMappingEntryOperationMetadata,
8239            >;
8240            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
8241            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
8242
8243            let stub = self.0.stub.clone();
8244            let mut options = self.0.options.clone();
8245            options.set_retry_policy(gax::retry_policy::NeverRetry);
8246            let query = move |name| {
8247                let stub = stub.clone();
8248                let options = options.clone();
8249                async {
8250                    let op = GetOperation::new(stub)
8251                        .set_name(name)
8252                        .with_options(options)
8253                        .send()
8254                        .await?;
8255                    Ok(Operation::new(op))
8256                }
8257            };
8258
8259            let start = move || async {
8260                let op = self.send().await?;
8261                Ok(Operation::new(op))
8262            };
8263
8264            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
8265        }
8266
8267        /// Sets the value of [identity_mapping_store][crate::model::ImportIdentityMappingsRequest::identity_mapping_store].
8268        ///
8269        /// This is a **required** field for requests.
8270        pub fn set_identity_mapping_store<T: Into<std::string::String>>(mut self, v: T) -> Self {
8271            self.0.request.identity_mapping_store = v.into();
8272            self
8273        }
8274
8275        /// Sets the value of [source][crate::model::ImportIdentityMappingsRequest::source].
8276        ///
8277        /// Note that all the setters affecting `source` are
8278        /// mutually exclusive.
8279        pub fn set_source<
8280            T: Into<Option<crate::model::import_identity_mappings_request::Source>>,
8281        >(
8282            mut self,
8283            v: T,
8284        ) -> Self {
8285            self.0.request.source = v.into();
8286            self
8287        }
8288
8289        /// Sets the value of [source][crate::model::ImportIdentityMappingsRequest::source]
8290        /// to hold a `InlineSource`.
8291        ///
8292        /// Note that all the setters affecting `source` are
8293        /// mutually exclusive.
8294        pub fn set_inline_source<
8295            T: std::convert::Into<
8296                    std::boxed::Box<crate::model::import_identity_mappings_request::InlineSource>,
8297                >,
8298        >(
8299            mut self,
8300            v: T,
8301        ) -> Self {
8302            self.0.request = self.0.request.set_inline_source(v);
8303            self
8304        }
8305    }
8306
8307    #[doc(hidden)]
8308    impl gax::options::internal::RequestBuilder for ImportIdentityMappings {
8309        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8310            &mut self.0.options
8311        }
8312    }
8313
8314    /// The request builder for [IdentityMappingStoreService::purge_identity_mappings][crate::client::IdentityMappingStoreService::purge_identity_mappings] calls.
8315    ///
8316    /// # Example
8317    /// ```
8318    /// # use google_cloud_discoveryengine_v1::builder::identity_mapping_store_service::PurgeIdentityMappings;
8319    /// # async fn sample() -> gax::Result<()> {
8320    /// use lro::Poller;
8321    ///
8322    /// let builder = prepare_request_builder();
8323    /// let response = builder.poller().until_done().await?;
8324    /// # Ok(()) }
8325    ///
8326    /// fn prepare_request_builder() -> PurgeIdentityMappings {
8327    ///   # panic!();
8328    ///   // ... details omitted ...
8329    /// }
8330    /// ```
8331    #[derive(Clone, Debug)]
8332    pub struct PurgeIdentityMappings(RequestBuilder<crate::model::PurgeIdentityMappingsRequest>);
8333
8334    impl PurgeIdentityMappings {
8335        pub(crate) fn new(
8336            stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
8337        ) -> Self {
8338            Self(RequestBuilder::new(stub))
8339        }
8340
8341        /// Sets the full request, replacing any prior values.
8342        pub fn with_request<V: Into<crate::model::PurgeIdentityMappingsRequest>>(
8343            mut self,
8344            v: V,
8345        ) -> Self {
8346            self.0.request = v.into();
8347            self
8348        }
8349
8350        /// Sets all the options, replacing any prior values.
8351        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
8352            self.0.options = v.into();
8353            self
8354        }
8355
8356        /// Sends the request.
8357        ///
8358        /// # Long running operations
8359        ///
8360        /// This starts, but does not poll, a longrunning operation. More information
8361        /// on [purge_identity_mappings][crate::client::IdentityMappingStoreService::purge_identity_mappings].
8362        pub async fn send(self) -> Result<longrunning::model::Operation> {
8363            (*self.0.stub)
8364                .purge_identity_mappings(self.0.request, self.0.options)
8365                .await
8366                .map(gax::response::Response::into_body)
8367        }
8368
8369        /// Creates a [Poller][lro::Poller] to work with `purge_identity_mappings`.
8370        pub fn poller(
8371            self,
8372        ) -> impl lro::Poller<(), crate::model::IdentityMappingEntryOperationMetadata> {
8373            type Operation = lro::internal::Operation<
8374                wkt::Empty,
8375                crate::model::IdentityMappingEntryOperationMetadata,
8376            >;
8377            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
8378            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
8379
8380            let stub = self.0.stub.clone();
8381            let mut options = self.0.options.clone();
8382            options.set_retry_policy(gax::retry_policy::NeverRetry);
8383            let query = move |name| {
8384                let stub = stub.clone();
8385                let options = options.clone();
8386                async {
8387                    let op = GetOperation::new(stub)
8388                        .set_name(name)
8389                        .with_options(options)
8390                        .send()
8391                        .await?;
8392                    Ok(Operation::new(op))
8393                }
8394            };
8395
8396            let start = move || async {
8397                let op = self.send().await?;
8398                Ok(Operation::new(op))
8399            };
8400
8401            lro::internal::new_unit_response_poller(
8402                polling_error_policy,
8403                polling_backoff_policy,
8404                start,
8405                query,
8406            )
8407        }
8408
8409        /// Sets the value of [identity_mapping_store][crate::model::PurgeIdentityMappingsRequest::identity_mapping_store].
8410        ///
8411        /// This is a **required** field for requests.
8412        pub fn set_identity_mapping_store<T: Into<std::string::String>>(mut self, v: T) -> Self {
8413            self.0.request.identity_mapping_store = v.into();
8414            self
8415        }
8416
8417        /// Sets the value of [filter][crate::model::PurgeIdentityMappingsRequest::filter].
8418        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
8419            self.0.request.filter = v.into();
8420            self
8421        }
8422
8423        /// Sets the value of [force][crate::model::PurgeIdentityMappingsRequest::force].
8424        pub fn set_force<T>(mut self, v: T) -> Self
8425        where
8426            T: std::convert::Into<bool>,
8427        {
8428            self.0.request.force = std::option::Option::Some(v.into());
8429            self
8430        }
8431
8432        /// Sets or clears the value of [force][crate::model::PurgeIdentityMappingsRequest::force].
8433        pub fn set_or_clear_force<T>(mut self, v: std::option::Option<T>) -> Self
8434        where
8435            T: std::convert::Into<bool>,
8436        {
8437            self.0.request.force = v.map(|x| x.into());
8438            self
8439        }
8440
8441        /// Sets the value of [source][crate::model::PurgeIdentityMappingsRequest::source].
8442        ///
8443        /// Note that all the setters affecting `source` are
8444        /// mutually exclusive.
8445        pub fn set_source<
8446            T: Into<Option<crate::model::purge_identity_mappings_request::Source>>,
8447        >(
8448            mut self,
8449            v: T,
8450        ) -> Self {
8451            self.0.request.source = v.into();
8452            self
8453        }
8454
8455        /// Sets the value of [source][crate::model::PurgeIdentityMappingsRequest::source]
8456        /// to hold a `InlineSource`.
8457        ///
8458        /// Note that all the setters affecting `source` are
8459        /// mutually exclusive.
8460        pub fn set_inline_source<
8461            T: std::convert::Into<
8462                    std::boxed::Box<crate::model::purge_identity_mappings_request::InlineSource>,
8463                >,
8464        >(
8465            mut self,
8466            v: T,
8467        ) -> Self {
8468            self.0.request = self.0.request.set_inline_source(v);
8469            self
8470        }
8471    }
8472
8473    #[doc(hidden)]
8474    impl gax::options::internal::RequestBuilder for PurgeIdentityMappings {
8475        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8476            &mut self.0.options
8477        }
8478    }
8479
8480    /// The request builder for [IdentityMappingStoreService::list_identity_mappings][crate::client::IdentityMappingStoreService::list_identity_mappings] calls.
8481    ///
8482    /// # Example
8483    /// ```
8484    /// # use google_cloud_discoveryengine_v1::builder::identity_mapping_store_service::ListIdentityMappings;
8485    /// # async fn sample() -> gax::Result<()> {
8486    /// use gax::paginator::ItemPaginator;
8487    ///
8488    /// let builder = prepare_request_builder();
8489    /// let mut items = builder.by_item();
8490    /// while let Some(result) = items.next().await {
8491    ///   let item = result?;
8492    /// }
8493    /// # Ok(()) }
8494    ///
8495    /// fn prepare_request_builder() -> ListIdentityMappings {
8496    ///   # panic!();
8497    ///   // ... details omitted ...
8498    /// }
8499    /// ```
8500    #[derive(Clone, Debug)]
8501    pub struct ListIdentityMappings(RequestBuilder<crate::model::ListIdentityMappingsRequest>);
8502
8503    impl ListIdentityMappings {
8504        pub(crate) fn new(
8505            stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
8506        ) -> Self {
8507            Self(RequestBuilder::new(stub))
8508        }
8509
8510        /// Sets the full request, replacing any prior values.
8511        pub fn with_request<V: Into<crate::model::ListIdentityMappingsRequest>>(
8512            mut self,
8513            v: V,
8514        ) -> Self {
8515            self.0.request = v.into();
8516            self
8517        }
8518
8519        /// Sets all the options, replacing any prior values.
8520        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
8521            self.0.options = v.into();
8522            self
8523        }
8524
8525        /// Sends the request.
8526        pub async fn send(self) -> Result<crate::model::ListIdentityMappingsResponse> {
8527            (*self.0.stub)
8528                .list_identity_mappings(self.0.request, self.0.options)
8529                .await
8530                .map(gax::response::Response::into_body)
8531        }
8532
8533        /// Streams each page in the collection.
8534        pub fn by_page(
8535            self,
8536        ) -> impl gax::paginator::Paginator<crate::model::ListIdentityMappingsResponse, gax::error::Error>
8537        {
8538            use std::clone::Clone;
8539            let token = self.0.request.page_token.clone();
8540            let execute = move |token: String| {
8541                let mut builder = self.clone();
8542                builder.0.request = builder.0.request.set_page_token(token);
8543                builder.send()
8544            };
8545            gax::paginator::internal::new_paginator(token, execute)
8546        }
8547
8548        /// Streams each item in the collection.
8549        pub fn by_item(
8550            self,
8551        ) -> impl gax::paginator::ItemPaginator<
8552            crate::model::ListIdentityMappingsResponse,
8553            gax::error::Error,
8554        > {
8555            use gax::paginator::Paginator;
8556            self.by_page().items()
8557        }
8558
8559        /// Sets the value of [identity_mapping_store][crate::model::ListIdentityMappingsRequest::identity_mapping_store].
8560        ///
8561        /// This is a **required** field for requests.
8562        pub fn set_identity_mapping_store<T: Into<std::string::String>>(mut self, v: T) -> Self {
8563            self.0.request.identity_mapping_store = v.into();
8564            self
8565        }
8566
8567        /// Sets the value of [page_size][crate::model::ListIdentityMappingsRequest::page_size].
8568        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
8569            self.0.request.page_size = v.into();
8570            self
8571        }
8572
8573        /// Sets the value of [page_token][crate::model::ListIdentityMappingsRequest::page_token].
8574        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
8575            self.0.request.page_token = v.into();
8576            self
8577        }
8578    }
8579
8580    #[doc(hidden)]
8581    impl gax::options::internal::RequestBuilder for ListIdentityMappings {
8582        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8583            &mut self.0.options
8584        }
8585    }
8586
8587    /// The request builder for [IdentityMappingStoreService::list_identity_mapping_stores][crate::client::IdentityMappingStoreService::list_identity_mapping_stores] calls.
8588    ///
8589    /// # Example
8590    /// ```
8591    /// # use google_cloud_discoveryengine_v1::builder::identity_mapping_store_service::ListIdentityMappingStores;
8592    /// # async fn sample() -> gax::Result<()> {
8593    /// use gax::paginator::ItemPaginator;
8594    ///
8595    /// let builder = prepare_request_builder();
8596    /// let mut items = builder.by_item();
8597    /// while let Some(result) = items.next().await {
8598    ///   let item = result?;
8599    /// }
8600    /// # Ok(()) }
8601    ///
8602    /// fn prepare_request_builder() -> ListIdentityMappingStores {
8603    ///   # panic!();
8604    ///   // ... details omitted ...
8605    /// }
8606    /// ```
8607    #[derive(Clone, Debug)]
8608    pub struct ListIdentityMappingStores(
8609        RequestBuilder<crate::model::ListIdentityMappingStoresRequest>,
8610    );
8611
8612    impl ListIdentityMappingStores {
8613        pub(crate) fn new(
8614            stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
8615        ) -> Self {
8616            Self(RequestBuilder::new(stub))
8617        }
8618
8619        /// Sets the full request, replacing any prior values.
8620        pub fn with_request<V: Into<crate::model::ListIdentityMappingStoresRequest>>(
8621            mut self,
8622            v: V,
8623        ) -> Self {
8624            self.0.request = v.into();
8625            self
8626        }
8627
8628        /// Sets all the options, replacing any prior values.
8629        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
8630            self.0.options = v.into();
8631            self
8632        }
8633
8634        /// Sends the request.
8635        pub async fn send(self) -> Result<crate::model::ListIdentityMappingStoresResponse> {
8636            (*self.0.stub)
8637                .list_identity_mapping_stores(self.0.request, self.0.options)
8638                .await
8639                .map(gax::response::Response::into_body)
8640        }
8641
8642        /// Streams each page in the collection.
8643        pub fn by_page(
8644            self,
8645        ) -> impl gax::paginator::Paginator<
8646            crate::model::ListIdentityMappingStoresResponse,
8647            gax::error::Error,
8648        > {
8649            use std::clone::Clone;
8650            let token = self.0.request.page_token.clone();
8651            let execute = move |token: String| {
8652                let mut builder = self.clone();
8653                builder.0.request = builder.0.request.set_page_token(token);
8654                builder.send()
8655            };
8656            gax::paginator::internal::new_paginator(token, execute)
8657        }
8658
8659        /// Streams each item in the collection.
8660        pub fn by_item(
8661            self,
8662        ) -> impl gax::paginator::ItemPaginator<
8663            crate::model::ListIdentityMappingStoresResponse,
8664            gax::error::Error,
8665        > {
8666            use gax::paginator::Paginator;
8667            self.by_page().items()
8668        }
8669
8670        /// Sets the value of [parent][crate::model::ListIdentityMappingStoresRequest::parent].
8671        ///
8672        /// This is a **required** field for requests.
8673        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
8674            self.0.request.parent = v.into();
8675            self
8676        }
8677
8678        /// Sets the value of [page_size][crate::model::ListIdentityMappingStoresRequest::page_size].
8679        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
8680            self.0.request.page_size = v.into();
8681            self
8682        }
8683
8684        /// Sets the value of [page_token][crate::model::ListIdentityMappingStoresRequest::page_token].
8685        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
8686            self.0.request.page_token = v.into();
8687            self
8688        }
8689    }
8690
8691    #[doc(hidden)]
8692    impl gax::options::internal::RequestBuilder for ListIdentityMappingStores {
8693        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8694            &mut self.0.options
8695        }
8696    }
8697
8698    /// The request builder for [IdentityMappingStoreService::list_operations][crate::client::IdentityMappingStoreService::list_operations] calls.
8699    ///
8700    /// # Example
8701    /// ```
8702    /// # use google_cloud_discoveryengine_v1::builder::identity_mapping_store_service::ListOperations;
8703    /// # async fn sample() -> gax::Result<()> {
8704    /// use gax::paginator::ItemPaginator;
8705    ///
8706    /// let builder = prepare_request_builder();
8707    /// let mut items = builder.by_item();
8708    /// while let Some(result) = items.next().await {
8709    ///   let item = result?;
8710    /// }
8711    /// # Ok(()) }
8712    ///
8713    /// fn prepare_request_builder() -> ListOperations {
8714    ///   # panic!();
8715    ///   // ... details omitted ...
8716    /// }
8717    /// ```
8718    #[derive(Clone, Debug)]
8719    pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
8720
8721    impl ListOperations {
8722        pub(crate) fn new(
8723            stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
8724        ) -> Self {
8725            Self(RequestBuilder::new(stub))
8726        }
8727
8728        /// Sets the full request, replacing any prior values.
8729        pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
8730            mut self,
8731            v: V,
8732        ) -> Self {
8733            self.0.request = v.into();
8734            self
8735        }
8736
8737        /// Sets all the options, replacing any prior values.
8738        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
8739            self.0.options = v.into();
8740            self
8741        }
8742
8743        /// Sends the request.
8744        pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
8745            (*self.0.stub)
8746                .list_operations(self.0.request, self.0.options)
8747                .await
8748                .map(gax::response::Response::into_body)
8749        }
8750
8751        /// Streams each page in the collection.
8752        pub fn by_page(
8753            self,
8754        ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
8755        {
8756            use std::clone::Clone;
8757            let token = self.0.request.page_token.clone();
8758            let execute = move |token: String| {
8759                let mut builder = self.clone();
8760                builder.0.request = builder.0.request.set_page_token(token);
8761                builder.send()
8762            };
8763            gax::paginator::internal::new_paginator(token, execute)
8764        }
8765
8766        /// Streams each item in the collection.
8767        pub fn by_item(
8768            self,
8769        ) -> impl gax::paginator::ItemPaginator<
8770            longrunning::model::ListOperationsResponse,
8771            gax::error::Error,
8772        > {
8773            use gax::paginator::Paginator;
8774            self.by_page().items()
8775        }
8776
8777        /// Sets the value of [name][longrunning::model::ListOperationsRequest::name].
8778        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
8779            self.0.request.name = v.into();
8780            self
8781        }
8782
8783        /// Sets the value of [filter][longrunning::model::ListOperationsRequest::filter].
8784        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
8785            self.0.request.filter = v.into();
8786            self
8787        }
8788
8789        /// Sets the value of [page_size][longrunning::model::ListOperationsRequest::page_size].
8790        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
8791            self.0.request.page_size = v.into();
8792            self
8793        }
8794
8795        /// Sets the value of [page_token][longrunning::model::ListOperationsRequest::page_token].
8796        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
8797            self.0.request.page_token = v.into();
8798            self
8799        }
8800
8801        /// Sets the value of [return_partial_success][longrunning::model::ListOperationsRequest::return_partial_success].
8802        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
8803            self.0.request.return_partial_success = v.into();
8804            self
8805        }
8806    }
8807
8808    #[doc(hidden)]
8809    impl gax::options::internal::RequestBuilder for ListOperations {
8810        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8811            &mut self.0.options
8812        }
8813    }
8814
8815    /// The request builder for [IdentityMappingStoreService::get_operation][crate::client::IdentityMappingStoreService::get_operation] calls.
8816    ///
8817    /// # Example
8818    /// ```
8819    /// # use google_cloud_discoveryengine_v1::builder::identity_mapping_store_service::GetOperation;
8820    /// # async fn sample() -> gax::Result<()> {
8821    ///
8822    /// let builder = prepare_request_builder();
8823    /// let response = builder.send().await?;
8824    /// # Ok(()) }
8825    ///
8826    /// fn prepare_request_builder() -> GetOperation {
8827    ///   # panic!();
8828    ///   // ... details omitted ...
8829    /// }
8830    /// ```
8831    #[derive(Clone, Debug)]
8832    pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
8833
8834    impl GetOperation {
8835        pub(crate) fn new(
8836            stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
8837        ) -> Self {
8838            Self(RequestBuilder::new(stub))
8839        }
8840
8841        /// Sets the full request, replacing any prior values.
8842        pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
8843            mut self,
8844            v: V,
8845        ) -> Self {
8846            self.0.request = v.into();
8847            self
8848        }
8849
8850        /// Sets all the options, replacing any prior values.
8851        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
8852            self.0.options = v.into();
8853            self
8854        }
8855
8856        /// Sends the request.
8857        pub async fn send(self) -> Result<longrunning::model::Operation> {
8858            (*self.0.stub)
8859                .get_operation(self.0.request, self.0.options)
8860                .await
8861                .map(gax::response::Response::into_body)
8862        }
8863
8864        /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
8865        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
8866            self.0.request.name = v.into();
8867            self
8868        }
8869    }
8870
8871    #[doc(hidden)]
8872    impl gax::options::internal::RequestBuilder for GetOperation {
8873        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8874            &mut self.0.options
8875        }
8876    }
8877
8878    /// The request builder for [IdentityMappingStoreService::cancel_operation][crate::client::IdentityMappingStoreService::cancel_operation] calls.
8879    ///
8880    /// # Example
8881    /// ```
8882    /// # use google_cloud_discoveryengine_v1::builder::identity_mapping_store_service::CancelOperation;
8883    /// # async fn sample() -> gax::Result<()> {
8884    ///
8885    /// let builder = prepare_request_builder();
8886    /// let response = builder.send().await?;
8887    /// # Ok(()) }
8888    ///
8889    /// fn prepare_request_builder() -> CancelOperation {
8890    ///   # panic!();
8891    ///   // ... details omitted ...
8892    /// }
8893    /// ```
8894    #[derive(Clone, Debug)]
8895    pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
8896
8897    impl CancelOperation {
8898        pub(crate) fn new(
8899            stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
8900        ) -> Self {
8901            Self(RequestBuilder::new(stub))
8902        }
8903
8904        /// Sets the full request, replacing any prior values.
8905        pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
8906            mut self,
8907            v: V,
8908        ) -> Self {
8909            self.0.request = v.into();
8910            self
8911        }
8912
8913        /// Sets all the options, replacing any prior values.
8914        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
8915            self.0.options = v.into();
8916            self
8917        }
8918
8919        /// Sends the request.
8920        pub async fn send(self) -> Result<()> {
8921            (*self.0.stub)
8922                .cancel_operation(self.0.request, self.0.options)
8923                .await
8924                .map(gax::response::Response::into_body)
8925        }
8926
8927        /// Sets the value of [name][longrunning::model::CancelOperationRequest::name].
8928        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
8929            self.0.request.name = v.into();
8930            self
8931        }
8932    }
8933
8934    #[doc(hidden)]
8935    impl gax::options::internal::RequestBuilder for CancelOperation {
8936        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8937            &mut self.0.options
8938        }
8939    }
8940}
8941
8942#[cfg(feature = "project-service")]
8943#[cfg_attr(docsrs, doc(cfg(feature = "project-service")))]
8944pub mod project_service {
8945    use crate::Result;
8946
8947    /// A builder for [ProjectService][crate::client::ProjectService].
8948    ///
8949    /// ```
8950    /// # async fn sample() -> gax::client_builder::Result<()> {
8951    /// # use google_cloud_discoveryengine_v1::*;
8952    /// # use builder::project_service::ClientBuilder;
8953    /// # use client::ProjectService;
8954    /// let builder : ClientBuilder = ProjectService::builder();
8955    /// let client = builder
8956    ///     .with_endpoint("https://discoveryengine.googleapis.com")
8957    ///     .build().await?;
8958    /// # Ok(()) }
8959    /// ```
8960    pub type ClientBuilder =
8961        gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
8962
8963    pub(crate) mod client {
8964        use super::super::super::client::ProjectService;
8965        pub struct Factory;
8966        impl gax::client_builder::internal::ClientFactory for Factory {
8967            type Client = ProjectService;
8968            type Credentials = gaxi::options::Credentials;
8969            async fn build(
8970                self,
8971                config: gaxi::options::ClientConfig,
8972            ) -> gax::client_builder::Result<Self::Client> {
8973                Self::Client::new(config).await
8974            }
8975        }
8976    }
8977
8978    /// Common implementation for [crate::client::ProjectService] request builders.
8979    #[derive(Clone, Debug)]
8980    pub(crate) struct RequestBuilder<R: std::default::Default> {
8981        stub: std::sync::Arc<dyn super::super::stub::dynamic::ProjectService>,
8982        request: R,
8983        options: gax::options::RequestOptions,
8984    }
8985
8986    impl<R> RequestBuilder<R>
8987    where
8988        R: std::default::Default,
8989    {
8990        pub(crate) fn new(
8991            stub: std::sync::Arc<dyn super::super::stub::dynamic::ProjectService>,
8992        ) -> Self {
8993            Self {
8994                stub,
8995                request: R::default(),
8996                options: gax::options::RequestOptions::default(),
8997            }
8998        }
8999    }
9000
9001    /// The request builder for [ProjectService::provision_project][crate::client::ProjectService::provision_project] calls.
9002    ///
9003    /// # Example
9004    /// ```
9005    /// # use google_cloud_discoveryengine_v1::builder::project_service::ProvisionProject;
9006    /// # async fn sample() -> gax::Result<()> {
9007    /// use lro::Poller;
9008    ///
9009    /// let builder = prepare_request_builder();
9010    /// let response = builder.poller().until_done().await?;
9011    /// # Ok(()) }
9012    ///
9013    /// fn prepare_request_builder() -> ProvisionProject {
9014    ///   # panic!();
9015    ///   // ... details omitted ...
9016    /// }
9017    /// ```
9018    #[derive(Clone, Debug)]
9019    pub struct ProvisionProject(RequestBuilder<crate::model::ProvisionProjectRequest>);
9020
9021    impl ProvisionProject {
9022        pub(crate) fn new(
9023            stub: std::sync::Arc<dyn super::super::stub::dynamic::ProjectService>,
9024        ) -> Self {
9025            Self(RequestBuilder::new(stub))
9026        }
9027
9028        /// Sets the full request, replacing any prior values.
9029        pub fn with_request<V: Into<crate::model::ProvisionProjectRequest>>(
9030            mut self,
9031            v: V,
9032        ) -> Self {
9033            self.0.request = v.into();
9034            self
9035        }
9036
9037        /// Sets all the options, replacing any prior values.
9038        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
9039            self.0.options = v.into();
9040            self
9041        }
9042
9043        /// Sends the request.
9044        ///
9045        /// # Long running operations
9046        ///
9047        /// This starts, but does not poll, a longrunning operation. More information
9048        /// on [provision_project][crate::client::ProjectService::provision_project].
9049        pub async fn send(self) -> Result<longrunning::model::Operation> {
9050            (*self.0.stub)
9051                .provision_project(self.0.request, self.0.options)
9052                .await
9053                .map(gax::response::Response::into_body)
9054        }
9055
9056        /// Creates a [Poller][lro::Poller] to work with `provision_project`.
9057        pub fn poller(
9058            self,
9059        ) -> impl lro::Poller<crate::model::Project, crate::model::ProvisionProjectMetadata>
9060        {
9061            type Operation = lro::internal::Operation<
9062                crate::model::Project,
9063                crate::model::ProvisionProjectMetadata,
9064            >;
9065            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
9066            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
9067
9068            let stub = self.0.stub.clone();
9069            let mut options = self.0.options.clone();
9070            options.set_retry_policy(gax::retry_policy::NeverRetry);
9071            let query = move |name| {
9072                let stub = stub.clone();
9073                let options = options.clone();
9074                async {
9075                    let op = GetOperation::new(stub)
9076                        .set_name(name)
9077                        .with_options(options)
9078                        .send()
9079                        .await?;
9080                    Ok(Operation::new(op))
9081                }
9082            };
9083
9084            let start = move || async {
9085                let op = self.send().await?;
9086                Ok(Operation::new(op))
9087            };
9088
9089            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
9090        }
9091
9092        /// Sets the value of [name][crate::model::ProvisionProjectRequest::name].
9093        ///
9094        /// This is a **required** field for requests.
9095        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9096            self.0.request.name = v.into();
9097            self
9098        }
9099
9100        /// Sets the value of [accept_data_use_terms][crate::model::ProvisionProjectRequest::accept_data_use_terms].
9101        ///
9102        /// This is a **required** field for requests.
9103        pub fn set_accept_data_use_terms<T: Into<bool>>(mut self, v: T) -> Self {
9104            self.0.request.accept_data_use_terms = v.into();
9105            self
9106        }
9107
9108        /// Sets the value of [data_use_terms_version][crate::model::ProvisionProjectRequest::data_use_terms_version].
9109        ///
9110        /// This is a **required** field for requests.
9111        pub fn set_data_use_terms_version<T: Into<std::string::String>>(mut self, v: T) -> Self {
9112            self.0.request.data_use_terms_version = v.into();
9113            self
9114        }
9115    }
9116
9117    #[doc(hidden)]
9118    impl gax::options::internal::RequestBuilder for ProvisionProject {
9119        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
9120            &mut self.0.options
9121        }
9122    }
9123
9124    /// The request builder for [ProjectService::list_operations][crate::client::ProjectService::list_operations] calls.
9125    ///
9126    /// # Example
9127    /// ```
9128    /// # use google_cloud_discoveryengine_v1::builder::project_service::ListOperations;
9129    /// # async fn sample() -> gax::Result<()> {
9130    /// use gax::paginator::ItemPaginator;
9131    ///
9132    /// let builder = prepare_request_builder();
9133    /// let mut items = builder.by_item();
9134    /// while let Some(result) = items.next().await {
9135    ///   let item = result?;
9136    /// }
9137    /// # Ok(()) }
9138    ///
9139    /// fn prepare_request_builder() -> ListOperations {
9140    ///   # panic!();
9141    ///   // ... details omitted ...
9142    /// }
9143    /// ```
9144    #[derive(Clone, Debug)]
9145    pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
9146
9147    impl ListOperations {
9148        pub(crate) fn new(
9149            stub: std::sync::Arc<dyn super::super::stub::dynamic::ProjectService>,
9150        ) -> Self {
9151            Self(RequestBuilder::new(stub))
9152        }
9153
9154        /// Sets the full request, replacing any prior values.
9155        pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
9156            mut self,
9157            v: V,
9158        ) -> Self {
9159            self.0.request = v.into();
9160            self
9161        }
9162
9163        /// Sets all the options, replacing any prior values.
9164        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
9165            self.0.options = v.into();
9166            self
9167        }
9168
9169        /// Sends the request.
9170        pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
9171            (*self.0.stub)
9172                .list_operations(self.0.request, self.0.options)
9173                .await
9174                .map(gax::response::Response::into_body)
9175        }
9176
9177        /// Streams each page in the collection.
9178        pub fn by_page(
9179            self,
9180        ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
9181        {
9182            use std::clone::Clone;
9183            let token = self.0.request.page_token.clone();
9184            let execute = move |token: String| {
9185                let mut builder = self.clone();
9186                builder.0.request = builder.0.request.set_page_token(token);
9187                builder.send()
9188            };
9189            gax::paginator::internal::new_paginator(token, execute)
9190        }
9191
9192        /// Streams each item in the collection.
9193        pub fn by_item(
9194            self,
9195        ) -> impl gax::paginator::ItemPaginator<
9196            longrunning::model::ListOperationsResponse,
9197            gax::error::Error,
9198        > {
9199            use gax::paginator::Paginator;
9200            self.by_page().items()
9201        }
9202
9203        /// Sets the value of [name][longrunning::model::ListOperationsRequest::name].
9204        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9205            self.0.request.name = v.into();
9206            self
9207        }
9208
9209        /// Sets the value of [filter][longrunning::model::ListOperationsRequest::filter].
9210        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
9211            self.0.request.filter = v.into();
9212            self
9213        }
9214
9215        /// Sets the value of [page_size][longrunning::model::ListOperationsRequest::page_size].
9216        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
9217            self.0.request.page_size = v.into();
9218            self
9219        }
9220
9221        /// Sets the value of [page_token][longrunning::model::ListOperationsRequest::page_token].
9222        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
9223            self.0.request.page_token = v.into();
9224            self
9225        }
9226
9227        /// Sets the value of [return_partial_success][longrunning::model::ListOperationsRequest::return_partial_success].
9228        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
9229            self.0.request.return_partial_success = v.into();
9230            self
9231        }
9232    }
9233
9234    #[doc(hidden)]
9235    impl gax::options::internal::RequestBuilder for ListOperations {
9236        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
9237            &mut self.0.options
9238        }
9239    }
9240
9241    /// The request builder for [ProjectService::get_operation][crate::client::ProjectService::get_operation] calls.
9242    ///
9243    /// # Example
9244    /// ```
9245    /// # use google_cloud_discoveryengine_v1::builder::project_service::GetOperation;
9246    /// # async fn sample() -> gax::Result<()> {
9247    ///
9248    /// let builder = prepare_request_builder();
9249    /// let response = builder.send().await?;
9250    /// # Ok(()) }
9251    ///
9252    /// fn prepare_request_builder() -> GetOperation {
9253    ///   # panic!();
9254    ///   // ... details omitted ...
9255    /// }
9256    /// ```
9257    #[derive(Clone, Debug)]
9258    pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
9259
9260    impl GetOperation {
9261        pub(crate) fn new(
9262            stub: std::sync::Arc<dyn super::super::stub::dynamic::ProjectService>,
9263        ) -> Self {
9264            Self(RequestBuilder::new(stub))
9265        }
9266
9267        /// Sets the full request, replacing any prior values.
9268        pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
9269            mut self,
9270            v: V,
9271        ) -> Self {
9272            self.0.request = v.into();
9273            self
9274        }
9275
9276        /// Sets all the options, replacing any prior values.
9277        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
9278            self.0.options = v.into();
9279            self
9280        }
9281
9282        /// Sends the request.
9283        pub async fn send(self) -> Result<longrunning::model::Operation> {
9284            (*self.0.stub)
9285                .get_operation(self.0.request, self.0.options)
9286                .await
9287                .map(gax::response::Response::into_body)
9288        }
9289
9290        /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
9291        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9292            self.0.request.name = v.into();
9293            self
9294        }
9295    }
9296
9297    #[doc(hidden)]
9298    impl gax::options::internal::RequestBuilder for GetOperation {
9299        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
9300            &mut self.0.options
9301        }
9302    }
9303
9304    /// The request builder for [ProjectService::cancel_operation][crate::client::ProjectService::cancel_operation] calls.
9305    ///
9306    /// # Example
9307    /// ```
9308    /// # use google_cloud_discoveryengine_v1::builder::project_service::CancelOperation;
9309    /// # async fn sample() -> gax::Result<()> {
9310    ///
9311    /// let builder = prepare_request_builder();
9312    /// let response = builder.send().await?;
9313    /// # Ok(()) }
9314    ///
9315    /// fn prepare_request_builder() -> CancelOperation {
9316    ///   # panic!();
9317    ///   // ... details omitted ...
9318    /// }
9319    /// ```
9320    #[derive(Clone, Debug)]
9321    pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
9322
9323    impl CancelOperation {
9324        pub(crate) fn new(
9325            stub: std::sync::Arc<dyn super::super::stub::dynamic::ProjectService>,
9326        ) -> Self {
9327            Self(RequestBuilder::new(stub))
9328        }
9329
9330        /// Sets the full request, replacing any prior values.
9331        pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
9332            mut self,
9333            v: V,
9334        ) -> Self {
9335            self.0.request = v.into();
9336            self
9337        }
9338
9339        /// Sets all the options, replacing any prior values.
9340        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
9341            self.0.options = v.into();
9342            self
9343        }
9344
9345        /// Sends the request.
9346        pub async fn send(self) -> Result<()> {
9347            (*self.0.stub)
9348                .cancel_operation(self.0.request, self.0.options)
9349                .await
9350                .map(gax::response::Response::into_body)
9351        }
9352
9353        /// Sets the value of [name][longrunning::model::CancelOperationRequest::name].
9354        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9355            self.0.request.name = v.into();
9356            self
9357        }
9358    }
9359
9360    #[doc(hidden)]
9361    impl gax::options::internal::RequestBuilder for CancelOperation {
9362        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
9363            &mut self.0.options
9364        }
9365    }
9366}
9367
9368#[cfg(feature = "rank-service")]
9369#[cfg_attr(docsrs, doc(cfg(feature = "rank-service")))]
9370pub mod rank_service {
9371    use crate::Result;
9372
9373    /// A builder for [RankService][crate::client::RankService].
9374    ///
9375    /// ```
9376    /// # async fn sample() -> gax::client_builder::Result<()> {
9377    /// # use google_cloud_discoveryengine_v1::*;
9378    /// # use builder::rank_service::ClientBuilder;
9379    /// # use client::RankService;
9380    /// let builder : ClientBuilder = RankService::builder();
9381    /// let client = builder
9382    ///     .with_endpoint("https://discoveryengine.googleapis.com")
9383    ///     .build().await?;
9384    /// # Ok(()) }
9385    /// ```
9386    pub type ClientBuilder =
9387        gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
9388
9389    pub(crate) mod client {
9390        use super::super::super::client::RankService;
9391        pub struct Factory;
9392        impl gax::client_builder::internal::ClientFactory for Factory {
9393            type Client = RankService;
9394            type Credentials = gaxi::options::Credentials;
9395            async fn build(
9396                self,
9397                config: gaxi::options::ClientConfig,
9398            ) -> gax::client_builder::Result<Self::Client> {
9399                Self::Client::new(config).await
9400            }
9401        }
9402    }
9403
9404    /// Common implementation for [crate::client::RankService] request builders.
9405    #[derive(Clone, Debug)]
9406    pub(crate) struct RequestBuilder<R: std::default::Default> {
9407        stub: std::sync::Arc<dyn super::super::stub::dynamic::RankService>,
9408        request: R,
9409        options: gax::options::RequestOptions,
9410    }
9411
9412    impl<R> RequestBuilder<R>
9413    where
9414        R: std::default::Default,
9415    {
9416        pub(crate) fn new(
9417            stub: std::sync::Arc<dyn super::super::stub::dynamic::RankService>,
9418        ) -> Self {
9419            Self {
9420                stub,
9421                request: R::default(),
9422                options: gax::options::RequestOptions::default(),
9423            }
9424        }
9425    }
9426
9427    /// The request builder for [RankService::rank][crate::client::RankService::rank] calls.
9428    ///
9429    /// # Example
9430    /// ```
9431    /// # use google_cloud_discoveryengine_v1::builder::rank_service::Rank;
9432    /// # async fn sample() -> gax::Result<()> {
9433    ///
9434    /// let builder = prepare_request_builder();
9435    /// let response = builder.send().await?;
9436    /// # Ok(()) }
9437    ///
9438    /// fn prepare_request_builder() -> Rank {
9439    ///   # panic!();
9440    ///   // ... details omitted ...
9441    /// }
9442    /// ```
9443    #[derive(Clone, Debug)]
9444    pub struct Rank(RequestBuilder<crate::model::RankRequest>);
9445
9446    impl Rank {
9447        pub(crate) fn new(
9448            stub: std::sync::Arc<dyn super::super::stub::dynamic::RankService>,
9449        ) -> Self {
9450            Self(RequestBuilder::new(stub))
9451        }
9452
9453        /// Sets the full request, replacing any prior values.
9454        pub fn with_request<V: Into<crate::model::RankRequest>>(mut self, v: V) -> Self {
9455            self.0.request = v.into();
9456            self
9457        }
9458
9459        /// Sets all the options, replacing any prior values.
9460        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
9461            self.0.options = v.into();
9462            self
9463        }
9464
9465        /// Sends the request.
9466        pub async fn send(self) -> Result<crate::model::RankResponse> {
9467            (*self.0.stub)
9468                .rank(self.0.request, self.0.options)
9469                .await
9470                .map(gax::response::Response::into_body)
9471        }
9472
9473        /// Sets the value of [ranking_config][crate::model::RankRequest::ranking_config].
9474        ///
9475        /// This is a **required** field for requests.
9476        pub fn set_ranking_config<T: Into<std::string::String>>(mut self, v: T) -> Self {
9477            self.0.request.ranking_config = v.into();
9478            self
9479        }
9480
9481        /// Sets the value of [model][crate::model::RankRequest::model].
9482        pub fn set_model<T: Into<std::string::String>>(mut self, v: T) -> Self {
9483            self.0.request.model = v.into();
9484            self
9485        }
9486
9487        /// Sets the value of [top_n][crate::model::RankRequest::top_n].
9488        pub fn set_top_n<T: Into<i32>>(mut self, v: T) -> Self {
9489            self.0.request.top_n = v.into();
9490            self
9491        }
9492
9493        /// Sets the value of [query][crate::model::RankRequest::query].
9494        pub fn set_query<T: Into<std::string::String>>(mut self, v: T) -> Self {
9495            self.0.request.query = v.into();
9496            self
9497        }
9498
9499        /// Sets the value of [records][crate::model::RankRequest::records].
9500        ///
9501        /// This is a **required** field for requests.
9502        pub fn set_records<T, V>(mut self, v: T) -> Self
9503        where
9504            T: std::iter::IntoIterator<Item = V>,
9505            V: std::convert::Into<crate::model::RankingRecord>,
9506        {
9507            use std::iter::Iterator;
9508            self.0.request.records = v.into_iter().map(|i| i.into()).collect();
9509            self
9510        }
9511
9512        /// Sets the value of [ignore_record_details_in_response][crate::model::RankRequest::ignore_record_details_in_response].
9513        pub fn set_ignore_record_details_in_response<T: Into<bool>>(mut self, v: T) -> Self {
9514            self.0.request.ignore_record_details_in_response = v.into();
9515            self
9516        }
9517
9518        /// Sets the value of [user_labels][crate::model::RankRequest::user_labels].
9519        pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
9520        where
9521            T: std::iter::IntoIterator<Item = (K, V)>,
9522            K: std::convert::Into<std::string::String>,
9523            V: std::convert::Into<std::string::String>,
9524        {
9525            self.0.request.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
9526            self
9527        }
9528    }
9529
9530    #[doc(hidden)]
9531    impl gax::options::internal::RequestBuilder for Rank {
9532        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
9533            &mut self.0.options
9534        }
9535    }
9536
9537    /// The request builder for [RankService::list_operations][crate::client::RankService::list_operations] calls.
9538    ///
9539    /// # Example
9540    /// ```
9541    /// # use google_cloud_discoveryengine_v1::builder::rank_service::ListOperations;
9542    /// # async fn sample() -> gax::Result<()> {
9543    /// use gax::paginator::ItemPaginator;
9544    ///
9545    /// let builder = prepare_request_builder();
9546    /// let mut items = builder.by_item();
9547    /// while let Some(result) = items.next().await {
9548    ///   let item = result?;
9549    /// }
9550    /// # Ok(()) }
9551    ///
9552    /// fn prepare_request_builder() -> ListOperations {
9553    ///   # panic!();
9554    ///   // ... details omitted ...
9555    /// }
9556    /// ```
9557    #[derive(Clone, Debug)]
9558    pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
9559
9560    impl ListOperations {
9561        pub(crate) fn new(
9562            stub: std::sync::Arc<dyn super::super::stub::dynamic::RankService>,
9563        ) -> Self {
9564            Self(RequestBuilder::new(stub))
9565        }
9566
9567        /// Sets the full request, replacing any prior values.
9568        pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
9569            mut self,
9570            v: V,
9571        ) -> Self {
9572            self.0.request = v.into();
9573            self
9574        }
9575
9576        /// Sets all the options, replacing any prior values.
9577        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
9578            self.0.options = v.into();
9579            self
9580        }
9581
9582        /// Sends the request.
9583        pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
9584            (*self.0.stub)
9585                .list_operations(self.0.request, self.0.options)
9586                .await
9587                .map(gax::response::Response::into_body)
9588        }
9589
9590        /// Streams each page in the collection.
9591        pub fn by_page(
9592            self,
9593        ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
9594        {
9595            use std::clone::Clone;
9596            let token = self.0.request.page_token.clone();
9597            let execute = move |token: String| {
9598                let mut builder = self.clone();
9599                builder.0.request = builder.0.request.set_page_token(token);
9600                builder.send()
9601            };
9602            gax::paginator::internal::new_paginator(token, execute)
9603        }
9604
9605        /// Streams each item in the collection.
9606        pub fn by_item(
9607            self,
9608        ) -> impl gax::paginator::ItemPaginator<
9609            longrunning::model::ListOperationsResponse,
9610            gax::error::Error,
9611        > {
9612            use gax::paginator::Paginator;
9613            self.by_page().items()
9614        }
9615
9616        /// Sets the value of [name][longrunning::model::ListOperationsRequest::name].
9617        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9618            self.0.request.name = v.into();
9619            self
9620        }
9621
9622        /// Sets the value of [filter][longrunning::model::ListOperationsRequest::filter].
9623        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
9624            self.0.request.filter = v.into();
9625            self
9626        }
9627
9628        /// Sets the value of [page_size][longrunning::model::ListOperationsRequest::page_size].
9629        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
9630            self.0.request.page_size = v.into();
9631            self
9632        }
9633
9634        /// Sets the value of [page_token][longrunning::model::ListOperationsRequest::page_token].
9635        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
9636            self.0.request.page_token = v.into();
9637            self
9638        }
9639
9640        /// Sets the value of [return_partial_success][longrunning::model::ListOperationsRequest::return_partial_success].
9641        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
9642            self.0.request.return_partial_success = v.into();
9643            self
9644        }
9645    }
9646
9647    #[doc(hidden)]
9648    impl gax::options::internal::RequestBuilder for ListOperations {
9649        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
9650            &mut self.0.options
9651        }
9652    }
9653
9654    /// The request builder for [RankService::get_operation][crate::client::RankService::get_operation] calls.
9655    ///
9656    /// # Example
9657    /// ```
9658    /// # use google_cloud_discoveryengine_v1::builder::rank_service::GetOperation;
9659    /// # async fn sample() -> gax::Result<()> {
9660    ///
9661    /// let builder = prepare_request_builder();
9662    /// let response = builder.send().await?;
9663    /// # Ok(()) }
9664    ///
9665    /// fn prepare_request_builder() -> GetOperation {
9666    ///   # panic!();
9667    ///   // ... details omitted ...
9668    /// }
9669    /// ```
9670    #[derive(Clone, Debug)]
9671    pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
9672
9673    impl GetOperation {
9674        pub(crate) fn new(
9675            stub: std::sync::Arc<dyn super::super::stub::dynamic::RankService>,
9676        ) -> Self {
9677            Self(RequestBuilder::new(stub))
9678        }
9679
9680        /// Sets the full request, replacing any prior values.
9681        pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
9682            mut self,
9683            v: V,
9684        ) -> Self {
9685            self.0.request = v.into();
9686            self
9687        }
9688
9689        /// Sets all the options, replacing any prior values.
9690        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
9691            self.0.options = v.into();
9692            self
9693        }
9694
9695        /// Sends the request.
9696        pub async fn send(self) -> Result<longrunning::model::Operation> {
9697            (*self.0.stub)
9698                .get_operation(self.0.request, self.0.options)
9699                .await
9700                .map(gax::response::Response::into_body)
9701        }
9702
9703        /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
9704        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9705            self.0.request.name = v.into();
9706            self
9707        }
9708    }
9709
9710    #[doc(hidden)]
9711    impl gax::options::internal::RequestBuilder for GetOperation {
9712        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
9713            &mut self.0.options
9714        }
9715    }
9716
9717    /// The request builder for [RankService::cancel_operation][crate::client::RankService::cancel_operation] calls.
9718    ///
9719    /// # Example
9720    /// ```
9721    /// # use google_cloud_discoveryengine_v1::builder::rank_service::CancelOperation;
9722    /// # async fn sample() -> gax::Result<()> {
9723    ///
9724    /// let builder = prepare_request_builder();
9725    /// let response = builder.send().await?;
9726    /// # Ok(()) }
9727    ///
9728    /// fn prepare_request_builder() -> CancelOperation {
9729    ///   # panic!();
9730    ///   // ... details omitted ...
9731    /// }
9732    /// ```
9733    #[derive(Clone, Debug)]
9734    pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
9735
9736    impl CancelOperation {
9737        pub(crate) fn new(
9738            stub: std::sync::Arc<dyn super::super::stub::dynamic::RankService>,
9739        ) -> Self {
9740            Self(RequestBuilder::new(stub))
9741        }
9742
9743        /// Sets the full request, replacing any prior values.
9744        pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
9745            mut self,
9746            v: V,
9747        ) -> Self {
9748            self.0.request = v.into();
9749            self
9750        }
9751
9752        /// Sets all the options, replacing any prior values.
9753        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
9754            self.0.options = v.into();
9755            self
9756        }
9757
9758        /// Sends the request.
9759        pub async fn send(self) -> Result<()> {
9760            (*self.0.stub)
9761                .cancel_operation(self.0.request, self.0.options)
9762                .await
9763                .map(gax::response::Response::into_body)
9764        }
9765
9766        /// Sets the value of [name][longrunning::model::CancelOperationRequest::name].
9767        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9768            self.0.request.name = v.into();
9769            self
9770        }
9771    }
9772
9773    #[doc(hidden)]
9774    impl gax::options::internal::RequestBuilder for CancelOperation {
9775        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
9776            &mut self.0.options
9777        }
9778    }
9779}
9780
9781#[cfg(feature = "recommendation-service")]
9782#[cfg_attr(docsrs, doc(cfg(feature = "recommendation-service")))]
9783pub mod recommendation_service {
9784    use crate::Result;
9785
9786    /// A builder for [RecommendationService][crate::client::RecommendationService].
9787    ///
9788    /// ```
9789    /// # async fn sample() -> gax::client_builder::Result<()> {
9790    /// # use google_cloud_discoveryengine_v1::*;
9791    /// # use builder::recommendation_service::ClientBuilder;
9792    /// # use client::RecommendationService;
9793    /// let builder : ClientBuilder = RecommendationService::builder();
9794    /// let client = builder
9795    ///     .with_endpoint("https://discoveryengine.googleapis.com")
9796    ///     .build().await?;
9797    /// # Ok(()) }
9798    /// ```
9799    pub type ClientBuilder =
9800        gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
9801
9802    pub(crate) mod client {
9803        use super::super::super::client::RecommendationService;
9804        pub struct Factory;
9805        impl gax::client_builder::internal::ClientFactory for Factory {
9806            type Client = RecommendationService;
9807            type Credentials = gaxi::options::Credentials;
9808            async fn build(
9809                self,
9810                config: gaxi::options::ClientConfig,
9811            ) -> gax::client_builder::Result<Self::Client> {
9812                Self::Client::new(config).await
9813            }
9814        }
9815    }
9816
9817    /// Common implementation for [crate::client::RecommendationService] request builders.
9818    #[derive(Clone, Debug)]
9819    pub(crate) struct RequestBuilder<R: std::default::Default> {
9820        stub: std::sync::Arc<dyn super::super::stub::dynamic::RecommendationService>,
9821        request: R,
9822        options: gax::options::RequestOptions,
9823    }
9824
9825    impl<R> RequestBuilder<R>
9826    where
9827        R: std::default::Default,
9828    {
9829        pub(crate) fn new(
9830            stub: std::sync::Arc<dyn super::super::stub::dynamic::RecommendationService>,
9831        ) -> Self {
9832            Self {
9833                stub,
9834                request: R::default(),
9835                options: gax::options::RequestOptions::default(),
9836            }
9837        }
9838    }
9839
9840    /// The request builder for [RecommendationService::recommend][crate::client::RecommendationService::recommend] calls.
9841    ///
9842    /// # Example
9843    /// ```
9844    /// # use google_cloud_discoveryengine_v1::builder::recommendation_service::Recommend;
9845    /// # async fn sample() -> gax::Result<()> {
9846    ///
9847    /// let builder = prepare_request_builder();
9848    /// let response = builder.send().await?;
9849    /// # Ok(()) }
9850    ///
9851    /// fn prepare_request_builder() -> Recommend {
9852    ///   # panic!();
9853    ///   // ... details omitted ...
9854    /// }
9855    /// ```
9856    #[derive(Clone, Debug)]
9857    pub struct Recommend(RequestBuilder<crate::model::RecommendRequest>);
9858
9859    impl Recommend {
9860        pub(crate) fn new(
9861            stub: std::sync::Arc<dyn super::super::stub::dynamic::RecommendationService>,
9862        ) -> Self {
9863            Self(RequestBuilder::new(stub))
9864        }
9865
9866        /// Sets the full request, replacing any prior values.
9867        pub fn with_request<V: Into<crate::model::RecommendRequest>>(mut self, v: V) -> Self {
9868            self.0.request = v.into();
9869            self
9870        }
9871
9872        /// Sets all the options, replacing any prior values.
9873        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
9874            self.0.options = v.into();
9875            self
9876        }
9877
9878        /// Sends the request.
9879        pub async fn send(self) -> Result<crate::model::RecommendResponse> {
9880            (*self.0.stub)
9881                .recommend(self.0.request, self.0.options)
9882                .await
9883                .map(gax::response::Response::into_body)
9884        }
9885
9886        /// Sets the value of [serving_config][crate::model::RecommendRequest::serving_config].
9887        ///
9888        /// This is a **required** field for requests.
9889        pub fn set_serving_config<T: Into<std::string::String>>(mut self, v: T) -> Self {
9890            self.0.request.serving_config = v.into();
9891            self
9892        }
9893
9894        /// Sets the value of [user_event][crate::model::RecommendRequest::user_event].
9895        ///
9896        /// This is a **required** field for requests.
9897        pub fn set_user_event<T>(mut self, v: T) -> Self
9898        where
9899            T: std::convert::Into<crate::model::UserEvent>,
9900        {
9901            self.0.request.user_event = std::option::Option::Some(v.into());
9902            self
9903        }
9904
9905        /// Sets or clears the value of [user_event][crate::model::RecommendRequest::user_event].
9906        ///
9907        /// This is a **required** field for requests.
9908        pub fn set_or_clear_user_event<T>(mut self, v: std::option::Option<T>) -> Self
9909        where
9910            T: std::convert::Into<crate::model::UserEvent>,
9911        {
9912            self.0.request.user_event = v.map(|x| x.into());
9913            self
9914        }
9915
9916        /// Sets the value of [page_size][crate::model::RecommendRequest::page_size].
9917        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
9918            self.0.request.page_size = v.into();
9919            self
9920        }
9921
9922        /// Sets the value of [filter][crate::model::RecommendRequest::filter].
9923        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
9924            self.0.request.filter = v.into();
9925            self
9926        }
9927
9928        /// Sets the value of [validate_only][crate::model::RecommendRequest::validate_only].
9929        pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
9930            self.0.request.validate_only = v.into();
9931            self
9932        }
9933
9934        /// Sets the value of [params][crate::model::RecommendRequest::params].
9935        pub fn set_params<T, K, V>(mut self, v: T) -> Self
9936        where
9937            T: std::iter::IntoIterator<Item = (K, V)>,
9938            K: std::convert::Into<std::string::String>,
9939            V: std::convert::Into<wkt::Value>,
9940        {
9941            self.0.request.params = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
9942            self
9943        }
9944
9945        /// Sets the value of [user_labels][crate::model::RecommendRequest::user_labels].
9946        pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
9947        where
9948            T: std::iter::IntoIterator<Item = (K, V)>,
9949            K: std::convert::Into<std::string::String>,
9950            V: std::convert::Into<std::string::String>,
9951        {
9952            self.0.request.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
9953            self
9954        }
9955    }
9956
9957    #[doc(hidden)]
9958    impl gax::options::internal::RequestBuilder for Recommend {
9959        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
9960            &mut self.0.options
9961        }
9962    }
9963
9964    /// The request builder for [RecommendationService::list_operations][crate::client::RecommendationService::list_operations] calls.
9965    ///
9966    /// # Example
9967    /// ```
9968    /// # use google_cloud_discoveryengine_v1::builder::recommendation_service::ListOperations;
9969    /// # async fn sample() -> gax::Result<()> {
9970    /// use gax::paginator::ItemPaginator;
9971    ///
9972    /// let builder = prepare_request_builder();
9973    /// let mut items = builder.by_item();
9974    /// while let Some(result) = items.next().await {
9975    ///   let item = result?;
9976    /// }
9977    /// # Ok(()) }
9978    ///
9979    /// fn prepare_request_builder() -> ListOperations {
9980    ///   # panic!();
9981    ///   // ... details omitted ...
9982    /// }
9983    /// ```
9984    #[derive(Clone, Debug)]
9985    pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
9986
9987    impl ListOperations {
9988        pub(crate) fn new(
9989            stub: std::sync::Arc<dyn super::super::stub::dynamic::RecommendationService>,
9990        ) -> Self {
9991            Self(RequestBuilder::new(stub))
9992        }
9993
9994        /// Sets the full request, replacing any prior values.
9995        pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
9996            mut self,
9997            v: V,
9998        ) -> Self {
9999            self.0.request = v.into();
10000            self
10001        }
10002
10003        /// Sets all the options, replacing any prior values.
10004        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
10005            self.0.options = v.into();
10006            self
10007        }
10008
10009        /// Sends the request.
10010        pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
10011            (*self.0.stub)
10012                .list_operations(self.0.request, self.0.options)
10013                .await
10014                .map(gax::response::Response::into_body)
10015        }
10016
10017        /// Streams each page in the collection.
10018        pub fn by_page(
10019            self,
10020        ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
10021        {
10022            use std::clone::Clone;
10023            let token = self.0.request.page_token.clone();
10024            let execute = move |token: String| {
10025                let mut builder = self.clone();
10026                builder.0.request = builder.0.request.set_page_token(token);
10027                builder.send()
10028            };
10029            gax::paginator::internal::new_paginator(token, execute)
10030        }
10031
10032        /// Streams each item in the collection.
10033        pub fn by_item(
10034            self,
10035        ) -> impl gax::paginator::ItemPaginator<
10036            longrunning::model::ListOperationsResponse,
10037            gax::error::Error,
10038        > {
10039            use gax::paginator::Paginator;
10040            self.by_page().items()
10041        }
10042
10043        /// Sets the value of [name][longrunning::model::ListOperationsRequest::name].
10044        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
10045            self.0.request.name = v.into();
10046            self
10047        }
10048
10049        /// Sets the value of [filter][longrunning::model::ListOperationsRequest::filter].
10050        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
10051            self.0.request.filter = v.into();
10052            self
10053        }
10054
10055        /// Sets the value of [page_size][longrunning::model::ListOperationsRequest::page_size].
10056        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
10057            self.0.request.page_size = v.into();
10058            self
10059        }
10060
10061        /// Sets the value of [page_token][longrunning::model::ListOperationsRequest::page_token].
10062        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
10063            self.0.request.page_token = v.into();
10064            self
10065        }
10066
10067        /// Sets the value of [return_partial_success][longrunning::model::ListOperationsRequest::return_partial_success].
10068        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
10069            self.0.request.return_partial_success = v.into();
10070            self
10071        }
10072    }
10073
10074    #[doc(hidden)]
10075    impl gax::options::internal::RequestBuilder for ListOperations {
10076        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
10077            &mut self.0.options
10078        }
10079    }
10080
10081    /// The request builder for [RecommendationService::get_operation][crate::client::RecommendationService::get_operation] calls.
10082    ///
10083    /// # Example
10084    /// ```
10085    /// # use google_cloud_discoveryengine_v1::builder::recommendation_service::GetOperation;
10086    /// # async fn sample() -> gax::Result<()> {
10087    ///
10088    /// let builder = prepare_request_builder();
10089    /// let response = builder.send().await?;
10090    /// # Ok(()) }
10091    ///
10092    /// fn prepare_request_builder() -> GetOperation {
10093    ///   # panic!();
10094    ///   // ... details omitted ...
10095    /// }
10096    /// ```
10097    #[derive(Clone, Debug)]
10098    pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
10099
10100    impl GetOperation {
10101        pub(crate) fn new(
10102            stub: std::sync::Arc<dyn super::super::stub::dynamic::RecommendationService>,
10103        ) -> Self {
10104            Self(RequestBuilder::new(stub))
10105        }
10106
10107        /// Sets the full request, replacing any prior values.
10108        pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
10109            mut self,
10110            v: V,
10111        ) -> Self {
10112            self.0.request = v.into();
10113            self
10114        }
10115
10116        /// Sets all the options, replacing any prior values.
10117        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
10118            self.0.options = v.into();
10119            self
10120        }
10121
10122        /// Sends the request.
10123        pub async fn send(self) -> Result<longrunning::model::Operation> {
10124            (*self.0.stub)
10125                .get_operation(self.0.request, self.0.options)
10126                .await
10127                .map(gax::response::Response::into_body)
10128        }
10129
10130        /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
10131        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
10132            self.0.request.name = v.into();
10133            self
10134        }
10135    }
10136
10137    #[doc(hidden)]
10138    impl gax::options::internal::RequestBuilder for GetOperation {
10139        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
10140            &mut self.0.options
10141        }
10142    }
10143
10144    /// The request builder for [RecommendationService::cancel_operation][crate::client::RecommendationService::cancel_operation] calls.
10145    ///
10146    /// # Example
10147    /// ```
10148    /// # use google_cloud_discoveryengine_v1::builder::recommendation_service::CancelOperation;
10149    /// # async fn sample() -> gax::Result<()> {
10150    ///
10151    /// let builder = prepare_request_builder();
10152    /// let response = builder.send().await?;
10153    /// # Ok(()) }
10154    ///
10155    /// fn prepare_request_builder() -> CancelOperation {
10156    ///   # panic!();
10157    ///   // ... details omitted ...
10158    /// }
10159    /// ```
10160    #[derive(Clone, Debug)]
10161    pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
10162
10163    impl CancelOperation {
10164        pub(crate) fn new(
10165            stub: std::sync::Arc<dyn super::super::stub::dynamic::RecommendationService>,
10166        ) -> Self {
10167            Self(RequestBuilder::new(stub))
10168        }
10169
10170        /// Sets the full request, replacing any prior values.
10171        pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
10172            mut self,
10173            v: V,
10174        ) -> Self {
10175            self.0.request = v.into();
10176            self
10177        }
10178
10179        /// Sets all the options, replacing any prior values.
10180        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
10181            self.0.options = v.into();
10182            self
10183        }
10184
10185        /// Sends the request.
10186        pub async fn send(self) -> Result<()> {
10187            (*self.0.stub)
10188                .cancel_operation(self.0.request, self.0.options)
10189                .await
10190                .map(gax::response::Response::into_body)
10191        }
10192
10193        /// Sets the value of [name][longrunning::model::CancelOperationRequest::name].
10194        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
10195            self.0.request.name = v.into();
10196            self
10197        }
10198    }
10199
10200    #[doc(hidden)]
10201    impl gax::options::internal::RequestBuilder for CancelOperation {
10202        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
10203            &mut self.0.options
10204        }
10205    }
10206}
10207
10208#[cfg(feature = "schema-service")]
10209#[cfg_attr(docsrs, doc(cfg(feature = "schema-service")))]
10210pub mod schema_service {
10211    use crate::Result;
10212
10213    /// A builder for [SchemaService][crate::client::SchemaService].
10214    ///
10215    /// ```
10216    /// # async fn sample() -> gax::client_builder::Result<()> {
10217    /// # use google_cloud_discoveryengine_v1::*;
10218    /// # use builder::schema_service::ClientBuilder;
10219    /// # use client::SchemaService;
10220    /// let builder : ClientBuilder = SchemaService::builder();
10221    /// let client = builder
10222    ///     .with_endpoint("https://discoveryengine.googleapis.com")
10223    ///     .build().await?;
10224    /// # Ok(()) }
10225    /// ```
10226    pub type ClientBuilder =
10227        gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
10228
10229    pub(crate) mod client {
10230        use super::super::super::client::SchemaService;
10231        pub struct Factory;
10232        impl gax::client_builder::internal::ClientFactory for Factory {
10233            type Client = SchemaService;
10234            type Credentials = gaxi::options::Credentials;
10235            async fn build(
10236                self,
10237                config: gaxi::options::ClientConfig,
10238            ) -> gax::client_builder::Result<Self::Client> {
10239                Self::Client::new(config).await
10240            }
10241        }
10242    }
10243
10244    /// Common implementation for [crate::client::SchemaService] request builders.
10245    #[derive(Clone, Debug)]
10246    pub(crate) struct RequestBuilder<R: std::default::Default> {
10247        stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
10248        request: R,
10249        options: gax::options::RequestOptions,
10250    }
10251
10252    impl<R> RequestBuilder<R>
10253    where
10254        R: std::default::Default,
10255    {
10256        pub(crate) fn new(
10257            stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
10258        ) -> Self {
10259            Self {
10260                stub,
10261                request: R::default(),
10262                options: gax::options::RequestOptions::default(),
10263            }
10264        }
10265    }
10266
10267    /// The request builder for [SchemaService::get_schema][crate::client::SchemaService::get_schema] calls.
10268    ///
10269    /// # Example
10270    /// ```
10271    /// # use google_cloud_discoveryengine_v1::builder::schema_service::GetSchema;
10272    /// # async fn sample() -> gax::Result<()> {
10273    ///
10274    /// let builder = prepare_request_builder();
10275    /// let response = builder.send().await?;
10276    /// # Ok(()) }
10277    ///
10278    /// fn prepare_request_builder() -> GetSchema {
10279    ///   # panic!();
10280    ///   // ... details omitted ...
10281    /// }
10282    /// ```
10283    #[derive(Clone, Debug)]
10284    pub struct GetSchema(RequestBuilder<crate::model::GetSchemaRequest>);
10285
10286    impl GetSchema {
10287        pub(crate) fn new(
10288            stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
10289        ) -> Self {
10290            Self(RequestBuilder::new(stub))
10291        }
10292
10293        /// Sets the full request, replacing any prior values.
10294        pub fn with_request<V: Into<crate::model::GetSchemaRequest>>(mut self, v: V) -> Self {
10295            self.0.request = v.into();
10296            self
10297        }
10298
10299        /// Sets all the options, replacing any prior values.
10300        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
10301            self.0.options = v.into();
10302            self
10303        }
10304
10305        /// Sends the request.
10306        pub async fn send(self) -> Result<crate::model::Schema> {
10307            (*self.0.stub)
10308                .get_schema(self.0.request, self.0.options)
10309                .await
10310                .map(gax::response::Response::into_body)
10311        }
10312
10313        /// Sets the value of [name][crate::model::GetSchemaRequest::name].
10314        ///
10315        /// This is a **required** field for requests.
10316        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
10317            self.0.request.name = v.into();
10318            self
10319        }
10320    }
10321
10322    #[doc(hidden)]
10323    impl gax::options::internal::RequestBuilder for GetSchema {
10324        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
10325            &mut self.0.options
10326        }
10327    }
10328
10329    /// The request builder for [SchemaService::list_schemas][crate::client::SchemaService::list_schemas] calls.
10330    ///
10331    /// # Example
10332    /// ```
10333    /// # use google_cloud_discoveryengine_v1::builder::schema_service::ListSchemas;
10334    /// # async fn sample() -> gax::Result<()> {
10335    /// use gax::paginator::ItemPaginator;
10336    ///
10337    /// let builder = prepare_request_builder();
10338    /// let mut items = builder.by_item();
10339    /// while let Some(result) = items.next().await {
10340    ///   let item = result?;
10341    /// }
10342    /// # Ok(()) }
10343    ///
10344    /// fn prepare_request_builder() -> ListSchemas {
10345    ///   # panic!();
10346    ///   // ... details omitted ...
10347    /// }
10348    /// ```
10349    #[derive(Clone, Debug)]
10350    pub struct ListSchemas(RequestBuilder<crate::model::ListSchemasRequest>);
10351
10352    impl ListSchemas {
10353        pub(crate) fn new(
10354            stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
10355        ) -> Self {
10356            Self(RequestBuilder::new(stub))
10357        }
10358
10359        /// Sets the full request, replacing any prior values.
10360        pub fn with_request<V: Into<crate::model::ListSchemasRequest>>(mut self, v: V) -> Self {
10361            self.0.request = v.into();
10362            self
10363        }
10364
10365        /// Sets all the options, replacing any prior values.
10366        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
10367            self.0.options = v.into();
10368            self
10369        }
10370
10371        /// Sends the request.
10372        pub async fn send(self) -> Result<crate::model::ListSchemasResponse> {
10373            (*self.0.stub)
10374                .list_schemas(self.0.request, self.0.options)
10375                .await
10376                .map(gax::response::Response::into_body)
10377        }
10378
10379        /// Streams each page in the collection.
10380        pub fn by_page(
10381            self,
10382        ) -> impl gax::paginator::Paginator<crate::model::ListSchemasResponse, gax::error::Error>
10383        {
10384            use std::clone::Clone;
10385            let token = self.0.request.page_token.clone();
10386            let execute = move |token: String| {
10387                let mut builder = self.clone();
10388                builder.0.request = builder.0.request.set_page_token(token);
10389                builder.send()
10390            };
10391            gax::paginator::internal::new_paginator(token, execute)
10392        }
10393
10394        /// Streams each item in the collection.
10395        pub fn by_item(
10396            self,
10397        ) -> impl gax::paginator::ItemPaginator<crate::model::ListSchemasResponse, gax::error::Error>
10398        {
10399            use gax::paginator::Paginator;
10400            self.by_page().items()
10401        }
10402
10403        /// Sets the value of [parent][crate::model::ListSchemasRequest::parent].
10404        ///
10405        /// This is a **required** field for requests.
10406        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
10407            self.0.request.parent = v.into();
10408            self
10409        }
10410
10411        /// Sets the value of [page_size][crate::model::ListSchemasRequest::page_size].
10412        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
10413            self.0.request.page_size = v.into();
10414            self
10415        }
10416
10417        /// Sets the value of [page_token][crate::model::ListSchemasRequest::page_token].
10418        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
10419            self.0.request.page_token = v.into();
10420            self
10421        }
10422    }
10423
10424    #[doc(hidden)]
10425    impl gax::options::internal::RequestBuilder for ListSchemas {
10426        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
10427            &mut self.0.options
10428        }
10429    }
10430
10431    /// The request builder for [SchemaService::create_schema][crate::client::SchemaService::create_schema] calls.
10432    ///
10433    /// # Example
10434    /// ```
10435    /// # use google_cloud_discoveryengine_v1::builder::schema_service::CreateSchema;
10436    /// # async fn sample() -> gax::Result<()> {
10437    /// use lro::Poller;
10438    ///
10439    /// let builder = prepare_request_builder();
10440    /// let response = builder.poller().until_done().await?;
10441    /// # Ok(()) }
10442    ///
10443    /// fn prepare_request_builder() -> CreateSchema {
10444    ///   # panic!();
10445    ///   // ... details omitted ...
10446    /// }
10447    /// ```
10448    #[derive(Clone, Debug)]
10449    pub struct CreateSchema(RequestBuilder<crate::model::CreateSchemaRequest>);
10450
10451    impl CreateSchema {
10452        pub(crate) fn new(
10453            stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
10454        ) -> Self {
10455            Self(RequestBuilder::new(stub))
10456        }
10457
10458        /// Sets the full request, replacing any prior values.
10459        pub fn with_request<V: Into<crate::model::CreateSchemaRequest>>(mut self, v: V) -> Self {
10460            self.0.request = v.into();
10461            self
10462        }
10463
10464        /// Sets all the options, replacing any prior values.
10465        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
10466            self.0.options = v.into();
10467            self
10468        }
10469
10470        /// Sends the request.
10471        ///
10472        /// # Long running operations
10473        ///
10474        /// This starts, but does not poll, a longrunning operation. More information
10475        /// on [create_schema][crate::client::SchemaService::create_schema].
10476        pub async fn send(self) -> Result<longrunning::model::Operation> {
10477            (*self.0.stub)
10478                .create_schema(self.0.request, self.0.options)
10479                .await
10480                .map(gax::response::Response::into_body)
10481        }
10482
10483        /// Creates a [Poller][lro::Poller] to work with `create_schema`.
10484        pub fn poller(
10485            self,
10486        ) -> impl lro::Poller<crate::model::Schema, crate::model::CreateSchemaMetadata> {
10487            type Operation =
10488                lro::internal::Operation<crate::model::Schema, crate::model::CreateSchemaMetadata>;
10489            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
10490            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
10491
10492            let stub = self.0.stub.clone();
10493            let mut options = self.0.options.clone();
10494            options.set_retry_policy(gax::retry_policy::NeverRetry);
10495            let query = move |name| {
10496                let stub = stub.clone();
10497                let options = options.clone();
10498                async {
10499                    let op = GetOperation::new(stub)
10500                        .set_name(name)
10501                        .with_options(options)
10502                        .send()
10503                        .await?;
10504                    Ok(Operation::new(op))
10505                }
10506            };
10507
10508            let start = move || async {
10509                let op = self.send().await?;
10510                Ok(Operation::new(op))
10511            };
10512
10513            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
10514        }
10515
10516        /// Sets the value of [parent][crate::model::CreateSchemaRequest::parent].
10517        ///
10518        /// This is a **required** field for requests.
10519        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
10520            self.0.request.parent = v.into();
10521            self
10522        }
10523
10524        /// Sets the value of [schema][crate::model::CreateSchemaRequest::schema].
10525        ///
10526        /// This is a **required** field for requests.
10527        pub fn set_schema<T>(mut self, v: T) -> Self
10528        where
10529            T: std::convert::Into<crate::model::Schema>,
10530        {
10531            self.0.request.schema = std::option::Option::Some(v.into());
10532            self
10533        }
10534
10535        /// Sets or clears the value of [schema][crate::model::CreateSchemaRequest::schema].
10536        ///
10537        /// This is a **required** field for requests.
10538        pub fn set_or_clear_schema<T>(mut self, v: std::option::Option<T>) -> Self
10539        where
10540            T: std::convert::Into<crate::model::Schema>,
10541        {
10542            self.0.request.schema = v.map(|x| x.into());
10543            self
10544        }
10545
10546        /// Sets the value of [schema_id][crate::model::CreateSchemaRequest::schema_id].
10547        ///
10548        /// This is a **required** field for requests.
10549        pub fn set_schema_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
10550            self.0.request.schema_id = v.into();
10551            self
10552        }
10553    }
10554
10555    #[doc(hidden)]
10556    impl gax::options::internal::RequestBuilder for CreateSchema {
10557        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
10558            &mut self.0.options
10559        }
10560    }
10561
10562    /// The request builder for [SchemaService::update_schema][crate::client::SchemaService::update_schema] calls.
10563    ///
10564    /// # Example
10565    /// ```
10566    /// # use google_cloud_discoveryengine_v1::builder::schema_service::UpdateSchema;
10567    /// # async fn sample() -> gax::Result<()> {
10568    /// use lro::Poller;
10569    ///
10570    /// let builder = prepare_request_builder();
10571    /// let response = builder.poller().until_done().await?;
10572    /// # Ok(()) }
10573    ///
10574    /// fn prepare_request_builder() -> UpdateSchema {
10575    ///   # panic!();
10576    ///   // ... details omitted ...
10577    /// }
10578    /// ```
10579    #[derive(Clone, Debug)]
10580    pub struct UpdateSchema(RequestBuilder<crate::model::UpdateSchemaRequest>);
10581
10582    impl UpdateSchema {
10583        pub(crate) fn new(
10584            stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
10585        ) -> Self {
10586            Self(RequestBuilder::new(stub))
10587        }
10588
10589        /// Sets the full request, replacing any prior values.
10590        pub fn with_request<V: Into<crate::model::UpdateSchemaRequest>>(mut self, v: V) -> Self {
10591            self.0.request = v.into();
10592            self
10593        }
10594
10595        /// Sets all the options, replacing any prior values.
10596        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
10597            self.0.options = v.into();
10598            self
10599        }
10600
10601        /// Sends the request.
10602        ///
10603        /// # Long running operations
10604        ///
10605        /// This starts, but does not poll, a longrunning operation. More information
10606        /// on [update_schema][crate::client::SchemaService::update_schema].
10607        pub async fn send(self) -> Result<longrunning::model::Operation> {
10608            (*self.0.stub)
10609                .update_schema(self.0.request, self.0.options)
10610                .await
10611                .map(gax::response::Response::into_body)
10612        }
10613
10614        /// Creates a [Poller][lro::Poller] to work with `update_schema`.
10615        pub fn poller(
10616            self,
10617        ) -> impl lro::Poller<crate::model::Schema, crate::model::UpdateSchemaMetadata> {
10618            type Operation =
10619                lro::internal::Operation<crate::model::Schema, crate::model::UpdateSchemaMetadata>;
10620            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
10621            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
10622
10623            let stub = self.0.stub.clone();
10624            let mut options = self.0.options.clone();
10625            options.set_retry_policy(gax::retry_policy::NeverRetry);
10626            let query = move |name| {
10627                let stub = stub.clone();
10628                let options = options.clone();
10629                async {
10630                    let op = GetOperation::new(stub)
10631                        .set_name(name)
10632                        .with_options(options)
10633                        .send()
10634                        .await?;
10635                    Ok(Operation::new(op))
10636                }
10637            };
10638
10639            let start = move || async {
10640                let op = self.send().await?;
10641                Ok(Operation::new(op))
10642            };
10643
10644            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
10645        }
10646
10647        /// Sets the value of [schema][crate::model::UpdateSchemaRequest::schema].
10648        ///
10649        /// This is a **required** field for requests.
10650        pub fn set_schema<T>(mut self, v: T) -> Self
10651        where
10652            T: std::convert::Into<crate::model::Schema>,
10653        {
10654            self.0.request.schema = std::option::Option::Some(v.into());
10655            self
10656        }
10657
10658        /// Sets or clears the value of [schema][crate::model::UpdateSchemaRequest::schema].
10659        ///
10660        /// This is a **required** field for requests.
10661        pub fn set_or_clear_schema<T>(mut self, v: std::option::Option<T>) -> Self
10662        where
10663            T: std::convert::Into<crate::model::Schema>,
10664        {
10665            self.0.request.schema = v.map(|x| x.into());
10666            self
10667        }
10668
10669        /// Sets the value of [allow_missing][crate::model::UpdateSchemaRequest::allow_missing].
10670        pub fn set_allow_missing<T: Into<bool>>(mut self, v: T) -> Self {
10671            self.0.request.allow_missing = v.into();
10672            self
10673        }
10674    }
10675
10676    #[doc(hidden)]
10677    impl gax::options::internal::RequestBuilder for UpdateSchema {
10678        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
10679            &mut self.0.options
10680        }
10681    }
10682
10683    /// The request builder for [SchemaService::delete_schema][crate::client::SchemaService::delete_schema] calls.
10684    ///
10685    /// # Example
10686    /// ```
10687    /// # use google_cloud_discoveryengine_v1::builder::schema_service::DeleteSchema;
10688    /// # async fn sample() -> gax::Result<()> {
10689    /// use lro::Poller;
10690    ///
10691    /// let builder = prepare_request_builder();
10692    /// let response = builder.poller().until_done().await?;
10693    /// # Ok(()) }
10694    ///
10695    /// fn prepare_request_builder() -> DeleteSchema {
10696    ///   # panic!();
10697    ///   // ... details omitted ...
10698    /// }
10699    /// ```
10700    #[derive(Clone, Debug)]
10701    pub struct DeleteSchema(RequestBuilder<crate::model::DeleteSchemaRequest>);
10702
10703    impl DeleteSchema {
10704        pub(crate) fn new(
10705            stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
10706        ) -> Self {
10707            Self(RequestBuilder::new(stub))
10708        }
10709
10710        /// Sets the full request, replacing any prior values.
10711        pub fn with_request<V: Into<crate::model::DeleteSchemaRequest>>(mut self, v: V) -> Self {
10712            self.0.request = v.into();
10713            self
10714        }
10715
10716        /// Sets all the options, replacing any prior values.
10717        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
10718            self.0.options = v.into();
10719            self
10720        }
10721
10722        /// Sends the request.
10723        ///
10724        /// # Long running operations
10725        ///
10726        /// This starts, but does not poll, a longrunning operation. More information
10727        /// on [delete_schema][crate::client::SchemaService::delete_schema].
10728        pub async fn send(self) -> Result<longrunning::model::Operation> {
10729            (*self.0.stub)
10730                .delete_schema(self.0.request, self.0.options)
10731                .await
10732                .map(gax::response::Response::into_body)
10733        }
10734
10735        /// Creates a [Poller][lro::Poller] to work with `delete_schema`.
10736        pub fn poller(self) -> impl lro::Poller<(), crate::model::DeleteSchemaMetadata> {
10737            type Operation =
10738                lro::internal::Operation<wkt::Empty, crate::model::DeleteSchemaMetadata>;
10739            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
10740            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
10741
10742            let stub = self.0.stub.clone();
10743            let mut options = self.0.options.clone();
10744            options.set_retry_policy(gax::retry_policy::NeverRetry);
10745            let query = move |name| {
10746                let stub = stub.clone();
10747                let options = options.clone();
10748                async {
10749                    let op = GetOperation::new(stub)
10750                        .set_name(name)
10751                        .with_options(options)
10752                        .send()
10753                        .await?;
10754                    Ok(Operation::new(op))
10755                }
10756            };
10757
10758            let start = move || async {
10759                let op = self.send().await?;
10760                Ok(Operation::new(op))
10761            };
10762
10763            lro::internal::new_unit_response_poller(
10764                polling_error_policy,
10765                polling_backoff_policy,
10766                start,
10767                query,
10768            )
10769        }
10770
10771        /// Sets the value of [name][crate::model::DeleteSchemaRequest::name].
10772        ///
10773        /// This is a **required** field for requests.
10774        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
10775            self.0.request.name = v.into();
10776            self
10777        }
10778    }
10779
10780    #[doc(hidden)]
10781    impl gax::options::internal::RequestBuilder for DeleteSchema {
10782        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
10783            &mut self.0.options
10784        }
10785    }
10786
10787    /// The request builder for [SchemaService::list_operations][crate::client::SchemaService::list_operations] calls.
10788    ///
10789    /// # Example
10790    /// ```
10791    /// # use google_cloud_discoveryengine_v1::builder::schema_service::ListOperations;
10792    /// # async fn sample() -> gax::Result<()> {
10793    /// use gax::paginator::ItemPaginator;
10794    ///
10795    /// let builder = prepare_request_builder();
10796    /// let mut items = builder.by_item();
10797    /// while let Some(result) = items.next().await {
10798    ///   let item = result?;
10799    /// }
10800    /// # Ok(()) }
10801    ///
10802    /// fn prepare_request_builder() -> ListOperations {
10803    ///   # panic!();
10804    ///   // ... details omitted ...
10805    /// }
10806    /// ```
10807    #[derive(Clone, Debug)]
10808    pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
10809
10810    impl ListOperations {
10811        pub(crate) fn new(
10812            stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
10813        ) -> Self {
10814            Self(RequestBuilder::new(stub))
10815        }
10816
10817        /// Sets the full request, replacing any prior values.
10818        pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
10819            mut self,
10820            v: V,
10821        ) -> Self {
10822            self.0.request = v.into();
10823            self
10824        }
10825
10826        /// Sets all the options, replacing any prior values.
10827        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
10828            self.0.options = v.into();
10829            self
10830        }
10831
10832        /// Sends the request.
10833        pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
10834            (*self.0.stub)
10835                .list_operations(self.0.request, self.0.options)
10836                .await
10837                .map(gax::response::Response::into_body)
10838        }
10839
10840        /// Streams each page in the collection.
10841        pub fn by_page(
10842            self,
10843        ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
10844        {
10845            use std::clone::Clone;
10846            let token = self.0.request.page_token.clone();
10847            let execute = move |token: String| {
10848                let mut builder = self.clone();
10849                builder.0.request = builder.0.request.set_page_token(token);
10850                builder.send()
10851            };
10852            gax::paginator::internal::new_paginator(token, execute)
10853        }
10854
10855        /// Streams each item in the collection.
10856        pub fn by_item(
10857            self,
10858        ) -> impl gax::paginator::ItemPaginator<
10859            longrunning::model::ListOperationsResponse,
10860            gax::error::Error,
10861        > {
10862            use gax::paginator::Paginator;
10863            self.by_page().items()
10864        }
10865
10866        /// Sets the value of [name][longrunning::model::ListOperationsRequest::name].
10867        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
10868            self.0.request.name = v.into();
10869            self
10870        }
10871
10872        /// Sets the value of [filter][longrunning::model::ListOperationsRequest::filter].
10873        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
10874            self.0.request.filter = v.into();
10875            self
10876        }
10877
10878        /// Sets the value of [page_size][longrunning::model::ListOperationsRequest::page_size].
10879        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
10880            self.0.request.page_size = v.into();
10881            self
10882        }
10883
10884        /// Sets the value of [page_token][longrunning::model::ListOperationsRequest::page_token].
10885        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
10886            self.0.request.page_token = v.into();
10887            self
10888        }
10889
10890        /// Sets the value of [return_partial_success][longrunning::model::ListOperationsRequest::return_partial_success].
10891        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
10892            self.0.request.return_partial_success = v.into();
10893            self
10894        }
10895    }
10896
10897    #[doc(hidden)]
10898    impl gax::options::internal::RequestBuilder for ListOperations {
10899        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
10900            &mut self.0.options
10901        }
10902    }
10903
10904    /// The request builder for [SchemaService::get_operation][crate::client::SchemaService::get_operation] calls.
10905    ///
10906    /// # Example
10907    /// ```
10908    /// # use google_cloud_discoveryengine_v1::builder::schema_service::GetOperation;
10909    /// # async fn sample() -> gax::Result<()> {
10910    ///
10911    /// let builder = prepare_request_builder();
10912    /// let response = builder.send().await?;
10913    /// # Ok(()) }
10914    ///
10915    /// fn prepare_request_builder() -> GetOperation {
10916    ///   # panic!();
10917    ///   // ... details omitted ...
10918    /// }
10919    /// ```
10920    #[derive(Clone, Debug)]
10921    pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
10922
10923    impl GetOperation {
10924        pub(crate) fn new(
10925            stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
10926        ) -> Self {
10927            Self(RequestBuilder::new(stub))
10928        }
10929
10930        /// Sets the full request, replacing any prior values.
10931        pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
10932            mut self,
10933            v: V,
10934        ) -> Self {
10935            self.0.request = v.into();
10936            self
10937        }
10938
10939        /// Sets all the options, replacing any prior values.
10940        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
10941            self.0.options = v.into();
10942            self
10943        }
10944
10945        /// Sends the request.
10946        pub async fn send(self) -> Result<longrunning::model::Operation> {
10947            (*self.0.stub)
10948                .get_operation(self.0.request, self.0.options)
10949                .await
10950                .map(gax::response::Response::into_body)
10951        }
10952
10953        /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
10954        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
10955            self.0.request.name = v.into();
10956            self
10957        }
10958    }
10959
10960    #[doc(hidden)]
10961    impl gax::options::internal::RequestBuilder for GetOperation {
10962        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
10963            &mut self.0.options
10964        }
10965    }
10966
10967    /// The request builder for [SchemaService::cancel_operation][crate::client::SchemaService::cancel_operation] calls.
10968    ///
10969    /// # Example
10970    /// ```
10971    /// # use google_cloud_discoveryengine_v1::builder::schema_service::CancelOperation;
10972    /// # async fn sample() -> gax::Result<()> {
10973    ///
10974    /// let builder = prepare_request_builder();
10975    /// let response = builder.send().await?;
10976    /// # Ok(()) }
10977    ///
10978    /// fn prepare_request_builder() -> CancelOperation {
10979    ///   # panic!();
10980    ///   // ... details omitted ...
10981    /// }
10982    /// ```
10983    #[derive(Clone, Debug)]
10984    pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
10985
10986    impl CancelOperation {
10987        pub(crate) fn new(
10988            stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
10989        ) -> Self {
10990            Self(RequestBuilder::new(stub))
10991        }
10992
10993        /// Sets the full request, replacing any prior values.
10994        pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
10995            mut self,
10996            v: V,
10997        ) -> Self {
10998            self.0.request = v.into();
10999            self
11000        }
11001
11002        /// Sets all the options, replacing any prior values.
11003        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
11004            self.0.options = v.into();
11005            self
11006        }
11007
11008        /// Sends the request.
11009        pub async fn send(self) -> Result<()> {
11010            (*self.0.stub)
11011                .cancel_operation(self.0.request, self.0.options)
11012                .await
11013                .map(gax::response::Response::into_body)
11014        }
11015
11016        /// Sets the value of [name][longrunning::model::CancelOperationRequest::name].
11017        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
11018            self.0.request.name = v.into();
11019            self
11020        }
11021    }
11022
11023    #[doc(hidden)]
11024    impl gax::options::internal::RequestBuilder for CancelOperation {
11025        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
11026            &mut self.0.options
11027        }
11028    }
11029}
11030
11031#[cfg(feature = "search-service")]
11032#[cfg_attr(docsrs, doc(cfg(feature = "search-service")))]
11033pub mod search_service {
11034    use crate::Result;
11035
11036    /// A builder for [SearchService][crate::client::SearchService].
11037    ///
11038    /// ```
11039    /// # async fn sample() -> gax::client_builder::Result<()> {
11040    /// # use google_cloud_discoveryengine_v1::*;
11041    /// # use builder::search_service::ClientBuilder;
11042    /// # use client::SearchService;
11043    /// let builder : ClientBuilder = SearchService::builder();
11044    /// let client = builder
11045    ///     .with_endpoint("https://discoveryengine.googleapis.com")
11046    ///     .build().await?;
11047    /// # Ok(()) }
11048    /// ```
11049    pub type ClientBuilder =
11050        gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
11051
11052    pub(crate) mod client {
11053        use super::super::super::client::SearchService;
11054        pub struct Factory;
11055        impl gax::client_builder::internal::ClientFactory for Factory {
11056            type Client = SearchService;
11057            type Credentials = gaxi::options::Credentials;
11058            async fn build(
11059                self,
11060                config: gaxi::options::ClientConfig,
11061            ) -> gax::client_builder::Result<Self::Client> {
11062                Self::Client::new(config).await
11063            }
11064        }
11065    }
11066
11067    /// Common implementation for [crate::client::SearchService] request builders.
11068    #[derive(Clone, Debug)]
11069    pub(crate) struct RequestBuilder<R: std::default::Default> {
11070        stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchService>,
11071        request: R,
11072        options: gax::options::RequestOptions,
11073    }
11074
11075    impl<R> RequestBuilder<R>
11076    where
11077        R: std::default::Default,
11078    {
11079        pub(crate) fn new(
11080            stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchService>,
11081        ) -> Self {
11082            Self {
11083                stub,
11084                request: R::default(),
11085                options: gax::options::RequestOptions::default(),
11086            }
11087        }
11088    }
11089
11090    /// The request builder for [SearchService::search][crate::client::SearchService::search] calls.
11091    ///
11092    /// # Example
11093    /// ```
11094    /// # use google_cloud_discoveryengine_v1::builder::search_service::Search;
11095    /// # async fn sample() -> gax::Result<()> {
11096    /// use gax::paginator::ItemPaginator;
11097    ///
11098    /// let builder = prepare_request_builder();
11099    /// let mut items = builder.by_item();
11100    /// while let Some(result) = items.next().await {
11101    ///   let item = result?;
11102    /// }
11103    /// # Ok(()) }
11104    ///
11105    /// fn prepare_request_builder() -> Search {
11106    ///   # panic!();
11107    ///   // ... details omitted ...
11108    /// }
11109    /// ```
11110    #[derive(Clone, Debug)]
11111    pub struct Search(RequestBuilder<crate::model::SearchRequest>);
11112
11113    impl Search {
11114        pub(crate) fn new(
11115            stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchService>,
11116        ) -> Self {
11117            Self(RequestBuilder::new(stub))
11118        }
11119
11120        /// Sets the full request, replacing any prior values.
11121        pub fn with_request<V: Into<crate::model::SearchRequest>>(mut self, v: V) -> Self {
11122            self.0.request = v.into();
11123            self
11124        }
11125
11126        /// Sets all the options, replacing any prior values.
11127        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
11128            self.0.options = v.into();
11129            self
11130        }
11131
11132        /// Sends the request.
11133        pub async fn send(self) -> Result<crate::model::SearchResponse> {
11134            (*self.0.stub)
11135                .search(self.0.request, self.0.options)
11136                .await
11137                .map(gax::response::Response::into_body)
11138        }
11139
11140        /// Streams each page in the collection.
11141        pub fn by_page(
11142            self,
11143        ) -> impl gax::paginator::Paginator<crate::model::SearchResponse, gax::error::Error>
11144        {
11145            use std::clone::Clone;
11146            let token = self.0.request.page_token.clone();
11147            let execute = move |token: String| {
11148                let mut builder = self.clone();
11149                builder.0.request = builder.0.request.set_page_token(token);
11150                builder.send()
11151            };
11152            gax::paginator::internal::new_paginator(token, execute)
11153        }
11154
11155        /// Streams each item in the collection.
11156        pub fn by_item(
11157            self,
11158        ) -> impl gax::paginator::ItemPaginator<crate::model::SearchResponse, gax::error::Error>
11159        {
11160            use gax::paginator::Paginator;
11161            self.by_page().items()
11162        }
11163
11164        /// Sets the value of [serving_config][crate::model::SearchRequest::serving_config].
11165        ///
11166        /// This is a **required** field for requests.
11167        pub fn set_serving_config<T: Into<std::string::String>>(mut self, v: T) -> Self {
11168            self.0.request.serving_config = v.into();
11169            self
11170        }
11171
11172        /// Sets the value of [branch][crate::model::SearchRequest::branch].
11173        pub fn set_branch<T: Into<std::string::String>>(mut self, v: T) -> Self {
11174            self.0.request.branch = v.into();
11175            self
11176        }
11177
11178        /// Sets the value of [query][crate::model::SearchRequest::query].
11179        pub fn set_query<T: Into<std::string::String>>(mut self, v: T) -> Self {
11180            self.0.request.query = v.into();
11181            self
11182        }
11183
11184        /// Sets the value of [image_query][crate::model::SearchRequest::image_query].
11185        pub fn set_image_query<T>(mut self, v: T) -> Self
11186        where
11187            T: std::convert::Into<crate::model::search_request::ImageQuery>,
11188        {
11189            self.0.request.image_query = std::option::Option::Some(v.into());
11190            self
11191        }
11192
11193        /// Sets or clears the value of [image_query][crate::model::SearchRequest::image_query].
11194        pub fn set_or_clear_image_query<T>(mut self, v: std::option::Option<T>) -> Self
11195        where
11196            T: std::convert::Into<crate::model::search_request::ImageQuery>,
11197        {
11198            self.0.request.image_query = v.map(|x| x.into());
11199            self
11200        }
11201
11202        /// Sets the value of [page_size][crate::model::SearchRequest::page_size].
11203        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
11204            self.0.request.page_size = v.into();
11205            self
11206        }
11207
11208        /// Sets the value of [page_token][crate::model::SearchRequest::page_token].
11209        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
11210            self.0.request.page_token = v.into();
11211            self
11212        }
11213
11214        /// Sets the value of [offset][crate::model::SearchRequest::offset].
11215        pub fn set_offset<T: Into<i32>>(mut self, v: T) -> Self {
11216            self.0.request.offset = v.into();
11217            self
11218        }
11219
11220        /// Sets the value of [one_box_page_size][crate::model::SearchRequest::one_box_page_size].
11221        pub fn set_one_box_page_size<T: Into<i32>>(mut self, v: T) -> Self {
11222            self.0.request.one_box_page_size = v.into();
11223            self
11224        }
11225
11226        /// Sets the value of [data_store_specs][crate::model::SearchRequest::data_store_specs].
11227        pub fn set_data_store_specs<T, V>(mut self, v: T) -> Self
11228        where
11229            T: std::iter::IntoIterator<Item = V>,
11230            V: std::convert::Into<crate::model::search_request::DataStoreSpec>,
11231        {
11232            use std::iter::Iterator;
11233            self.0.request.data_store_specs = v.into_iter().map(|i| i.into()).collect();
11234            self
11235        }
11236
11237        /// Sets the value of [filter][crate::model::SearchRequest::filter].
11238        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
11239            self.0.request.filter = v.into();
11240            self
11241        }
11242
11243        /// Sets the value of [canonical_filter][crate::model::SearchRequest::canonical_filter].
11244        pub fn set_canonical_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
11245            self.0.request.canonical_filter = v.into();
11246            self
11247        }
11248
11249        /// Sets the value of [order_by][crate::model::SearchRequest::order_by].
11250        pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
11251            self.0.request.order_by = v.into();
11252            self
11253        }
11254
11255        /// Sets the value of [user_info][crate::model::SearchRequest::user_info].
11256        pub fn set_user_info<T>(mut self, v: T) -> Self
11257        where
11258            T: std::convert::Into<crate::model::UserInfo>,
11259        {
11260            self.0.request.user_info = std::option::Option::Some(v.into());
11261            self
11262        }
11263
11264        /// Sets or clears the value of [user_info][crate::model::SearchRequest::user_info].
11265        pub fn set_or_clear_user_info<T>(mut self, v: std::option::Option<T>) -> Self
11266        where
11267            T: std::convert::Into<crate::model::UserInfo>,
11268        {
11269            self.0.request.user_info = v.map(|x| x.into());
11270            self
11271        }
11272
11273        /// Sets the value of [language_code][crate::model::SearchRequest::language_code].
11274        pub fn set_language_code<T: Into<std::string::String>>(mut self, v: T) -> Self {
11275            self.0.request.language_code = v.into();
11276            self
11277        }
11278
11279        /// Sets the value of [facet_specs][crate::model::SearchRequest::facet_specs].
11280        pub fn set_facet_specs<T, V>(mut self, v: T) -> Self
11281        where
11282            T: std::iter::IntoIterator<Item = V>,
11283            V: std::convert::Into<crate::model::search_request::FacetSpec>,
11284        {
11285            use std::iter::Iterator;
11286            self.0.request.facet_specs = v.into_iter().map(|i| i.into()).collect();
11287            self
11288        }
11289
11290        /// Sets the value of [boost_spec][crate::model::SearchRequest::boost_spec].
11291        pub fn set_boost_spec<T>(mut self, v: T) -> Self
11292        where
11293            T: std::convert::Into<crate::model::search_request::BoostSpec>,
11294        {
11295            self.0.request.boost_spec = std::option::Option::Some(v.into());
11296            self
11297        }
11298
11299        /// Sets or clears the value of [boost_spec][crate::model::SearchRequest::boost_spec].
11300        pub fn set_or_clear_boost_spec<T>(mut self, v: std::option::Option<T>) -> Self
11301        where
11302            T: std::convert::Into<crate::model::search_request::BoostSpec>,
11303        {
11304            self.0.request.boost_spec = v.map(|x| x.into());
11305            self
11306        }
11307
11308        /// Sets the value of [params][crate::model::SearchRequest::params].
11309        pub fn set_params<T, K, V>(mut self, v: T) -> Self
11310        where
11311            T: std::iter::IntoIterator<Item = (K, V)>,
11312            K: std::convert::Into<std::string::String>,
11313            V: std::convert::Into<wkt::Value>,
11314        {
11315            self.0.request.params = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
11316            self
11317        }
11318
11319        /// Sets the value of [query_expansion_spec][crate::model::SearchRequest::query_expansion_spec].
11320        pub fn set_query_expansion_spec<T>(mut self, v: T) -> Self
11321        where
11322            T: std::convert::Into<crate::model::search_request::QueryExpansionSpec>,
11323        {
11324            self.0.request.query_expansion_spec = std::option::Option::Some(v.into());
11325            self
11326        }
11327
11328        /// Sets or clears the value of [query_expansion_spec][crate::model::SearchRequest::query_expansion_spec].
11329        pub fn set_or_clear_query_expansion_spec<T>(mut self, v: std::option::Option<T>) -> Self
11330        where
11331            T: std::convert::Into<crate::model::search_request::QueryExpansionSpec>,
11332        {
11333            self.0.request.query_expansion_spec = v.map(|x| x.into());
11334            self
11335        }
11336
11337        /// Sets the value of [spell_correction_spec][crate::model::SearchRequest::spell_correction_spec].
11338        pub fn set_spell_correction_spec<T>(mut self, v: T) -> Self
11339        where
11340            T: std::convert::Into<crate::model::search_request::SpellCorrectionSpec>,
11341        {
11342            self.0.request.spell_correction_spec = std::option::Option::Some(v.into());
11343            self
11344        }
11345
11346        /// Sets or clears the value of [spell_correction_spec][crate::model::SearchRequest::spell_correction_spec].
11347        pub fn set_or_clear_spell_correction_spec<T>(mut self, v: std::option::Option<T>) -> Self
11348        where
11349            T: std::convert::Into<crate::model::search_request::SpellCorrectionSpec>,
11350        {
11351            self.0.request.spell_correction_spec = v.map(|x| x.into());
11352            self
11353        }
11354
11355        /// Sets the value of [user_pseudo_id][crate::model::SearchRequest::user_pseudo_id].
11356        pub fn set_user_pseudo_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
11357            self.0.request.user_pseudo_id = v.into();
11358            self
11359        }
11360
11361        /// Sets the value of [content_search_spec][crate::model::SearchRequest::content_search_spec].
11362        pub fn set_content_search_spec<T>(mut self, v: T) -> Self
11363        where
11364            T: std::convert::Into<crate::model::search_request::ContentSearchSpec>,
11365        {
11366            self.0.request.content_search_spec = std::option::Option::Some(v.into());
11367            self
11368        }
11369
11370        /// Sets or clears the value of [content_search_spec][crate::model::SearchRequest::content_search_spec].
11371        pub fn set_or_clear_content_search_spec<T>(mut self, v: std::option::Option<T>) -> Self
11372        where
11373            T: std::convert::Into<crate::model::search_request::ContentSearchSpec>,
11374        {
11375            self.0.request.content_search_spec = v.map(|x| x.into());
11376            self
11377        }
11378
11379        /// Sets the value of [safe_search][crate::model::SearchRequest::safe_search].
11380        pub fn set_safe_search<T: Into<bool>>(mut self, v: T) -> Self {
11381            self.0.request.safe_search = v.into();
11382            self
11383        }
11384
11385        /// Sets the value of [user_labels][crate::model::SearchRequest::user_labels].
11386        pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
11387        where
11388            T: std::iter::IntoIterator<Item = (K, V)>,
11389            K: std::convert::Into<std::string::String>,
11390            V: std::convert::Into<std::string::String>,
11391        {
11392            self.0.request.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
11393            self
11394        }
11395
11396        /// Sets the value of [search_as_you_type_spec][crate::model::SearchRequest::search_as_you_type_spec].
11397        pub fn set_search_as_you_type_spec<T>(mut self, v: T) -> Self
11398        where
11399            T: std::convert::Into<crate::model::search_request::SearchAsYouTypeSpec>,
11400        {
11401            self.0.request.search_as_you_type_spec = std::option::Option::Some(v.into());
11402            self
11403        }
11404
11405        /// Sets or clears the value of [search_as_you_type_spec][crate::model::SearchRequest::search_as_you_type_spec].
11406        pub fn set_or_clear_search_as_you_type_spec<T>(mut self, v: std::option::Option<T>) -> Self
11407        where
11408            T: std::convert::Into<crate::model::search_request::SearchAsYouTypeSpec>,
11409        {
11410            self.0.request.search_as_you_type_spec = v.map(|x| x.into());
11411            self
11412        }
11413
11414        /// Sets the value of [display_spec][crate::model::SearchRequest::display_spec].
11415        pub fn set_display_spec<T>(mut self, v: T) -> Self
11416        where
11417            T: std::convert::Into<crate::model::search_request::DisplaySpec>,
11418        {
11419            self.0.request.display_spec = std::option::Option::Some(v.into());
11420            self
11421        }
11422
11423        /// Sets or clears the value of [display_spec][crate::model::SearchRequest::display_spec].
11424        pub fn set_or_clear_display_spec<T>(mut self, v: std::option::Option<T>) -> Self
11425        where
11426            T: std::convert::Into<crate::model::search_request::DisplaySpec>,
11427        {
11428            self.0.request.display_spec = v.map(|x| x.into());
11429            self
11430        }
11431
11432        /// Sets the value of [session][crate::model::SearchRequest::session].
11433        pub fn set_session<T: Into<std::string::String>>(mut self, v: T) -> Self {
11434            self.0.request.session = v.into();
11435            self
11436        }
11437
11438        /// Sets the value of [session_spec][crate::model::SearchRequest::session_spec].
11439        pub fn set_session_spec<T>(mut self, v: T) -> Self
11440        where
11441            T: std::convert::Into<crate::model::search_request::SessionSpec>,
11442        {
11443            self.0.request.session_spec = std::option::Option::Some(v.into());
11444            self
11445        }
11446
11447        /// Sets or clears the value of [session_spec][crate::model::SearchRequest::session_spec].
11448        pub fn set_or_clear_session_spec<T>(mut self, v: std::option::Option<T>) -> Self
11449        where
11450            T: std::convert::Into<crate::model::search_request::SessionSpec>,
11451        {
11452            self.0.request.session_spec = v.map(|x| x.into());
11453            self
11454        }
11455
11456        /// Sets the value of [relevance_threshold][crate::model::SearchRequest::relevance_threshold].
11457        pub fn set_relevance_threshold<
11458            T: Into<crate::model::search_request::RelevanceThreshold>,
11459        >(
11460            mut self,
11461            v: T,
11462        ) -> Self {
11463            self.0.request.relevance_threshold = v.into();
11464            self
11465        }
11466
11467        /// Sets the value of [relevance_score_spec][crate::model::SearchRequest::relevance_score_spec].
11468        pub fn set_relevance_score_spec<T>(mut self, v: T) -> Self
11469        where
11470            T: std::convert::Into<crate::model::search_request::RelevanceScoreSpec>,
11471        {
11472            self.0.request.relevance_score_spec = std::option::Option::Some(v.into());
11473            self
11474        }
11475
11476        /// Sets or clears the value of [relevance_score_spec][crate::model::SearchRequest::relevance_score_spec].
11477        pub fn set_or_clear_relevance_score_spec<T>(mut self, v: std::option::Option<T>) -> Self
11478        where
11479            T: std::convert::Into<crate::model::search_request::RelevanceScoreSpec>,
11480        {
11481            self.0.request.relevance_score_spec = v.map(|x| x.into());
11482            self
11483        }
11484
11485        /// Sets the value of [ranking_expression][crate::model::SearchRequest::ranking_expression].
11486        pub fn set_ranking_expression<T: Into<std::string::String>>(mut self, v: T) -> Self {
11487            self.0.request.ranking_expression = v.into();
11488            self
11489        }
11490
11491        /// Sets the value of [ranking_expression_backend][crate::model::SearchRequest::ranking_expression_backend].
11492        pub fn set_ranking_expression_backend<
11493            T: Into<crate::model::search_request::RankingExpressionBackend>,
11494        >(
11495            mut self,
11496            v: T,
11497        ) -> Self {
11498            self.0.request.ranking_expression_backend = v.into();
11499            self
11500        }
11501    }
11502
11503    #[doc(hidden)]
11504    impl gax::options::internal::RequestBuilder for Search {
11505        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
11506            &mut self.0.options
11507        }
11508    }
11509
11510    /// The request builder for [SearchService::search_lite][crate::client::SearchService::search_lite] calls.
11511    ///
11512    /// # Example
11513    /// ```
11514    /// # use google_cloud_discoveryengine_v1::builder::search_service::SearchLite;
11515    /// # async fn sample() -> gax::Result<()> {
11516    /// use gax::paginator::ItemPaginator;
11517    ///
11518    /// let builder = prepare_request_builder();
11519    /// let mut items = builder.by_item();
11520    /// while let Some(result) = items.next().await {
11521    ///   let item = result?;
11522    /// }
11523    /// # Ok(()) }
11524    ///
11525    /// fn prepare_request_builder() -> SearchLite {
11526    ///   # panic!();
11527    ///   // ... details omitted ...
11528    /// }
11529    /// ```
11530    #[derive(Clone, Debug)]
11531    pub struct SearchLite(RequestBuilder<crate::model::SearchRequest>);
11532
11533    impl SearchLite {
11534        pub(crate) fn new(
11535            stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchService>,
11536        ) -> Self {
11537            Self(RequestBuilder::new(stub))
11538        }
11539
11540        /// Sets the full request, replacing any prior values.
11541        pub fn with_request<V: Into<crate::model::SearchRequest>>(mut self, v: V) -> Self {
11542            self.0.request = v.into();
11543            self
11544        }
11545
11546        /// Sets all the options, replacing any prior values.
11547        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
11548            self.0.options = v.into();
11549            self
11550        }
11551
11552        /// Sends the request.
11553        pub async fn send(self) -> Result<crate::model::SearchResponse> {
11554            (*self.0.stub)
11555                .search_lite(self.0.request, self.0.options)
11556                .await
11557                .map(gax::response::Response::into_body)
11558        }
11559
11560        /// Streams each page in the collection.
11561        pub fn by_page(
11562            self,
11563        ) -> impl gax::paginator::Paginator<crate::model::SearchResponse, gax::error::Error>
11564        {
11565            use std::clone::Clone;
11566            let token = self.0.request.page_token.clone();
11567            let execute = move |token: String| {
11568                let mut builder = self.clone();
11569                builder.0.request = builder.0.request.set_page_token(token);
11570                builder.send()
11571            };
11572            gax::paginator::internal::new_paginator(token, execute)
11573        }
11574
11575        /// Streams each item in the collection.
11576        pub fn by_item(
11577            self,
11578        ) -> impl gax::paginator::ItemPaginator<crate::model::SearchResponse, gax::error::Error>
11579        {
11580            use gax::paginator::Paginator;
11581            self.by_page().items()
11582        }
11583
11584        /// Sets the value of [serving_config][crate::model::SearchRequest::serving_config].
11585        ///
11586        /// This is a **required** field for requests.
11587        pub fn set_serving_config<T: Into<std::string::String>>(mut self, v: T) -> Self {
11588            self.0.request.serving_config = v.into();
11589            self
11590        }
11591
11592        /// Sets the value of [branch][crate::model::SearchRequest::branch].
11593        pub fn set_branch<T: Into<std::string::String>>(mut self, v: T) -> Self {
11594            self.0.request.branch = v.into();
11595            self
11596        }
11597
11598        /// Sets the value of [query][crate::model::SearchRequest::query].
11599        pub fn set_query<T: Into<std::string::String>>(mut self, v: T) -> Self {
11600            self.0.request.query = v.into();
11601            self
11602        }
11603
11604        /// Sets the value of [image_query][crate::model::SearchRequest::image_query].
11605        pub fn set_image_query<T>(mut self, v: T) -> Self
11606        where
11607            T: std::convert::Into<crate::model::search_request::ImageQuery>,
11608        {
11609            self.0.request.image_query = std::option::Option::Some(v.into());
11610            self
11611        }
11612
11613        /// Sets or clears the value of [image_query][crate::model::SearchRequest::image_query].
11614        pub fn set_or_clear_image_query<T>(mut self, v: std::option::Option<T>) -> Self
11615        where
11616            T: std::convert::Into<crate::model::search_request::ImageQuery>,
11617        {
11618            self.0.request.image_query = v.map(|x| x.into());
11619            self
11620        }
11621
11622        /// Sets the value of [page_size][crate::model::SearchRequest::page_size].
11623        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
11624            self.0.request.page_size = v.into();
11625            self
11626        }
11627
11628        /// Sets the value of [page_token][crate::model::SearchRequest::page_token].
11629        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
11630            self.0.request.page_token = v.into();
11631            self
11632        }
11633
11634        /// Sets the value of [offset][crate::model::SearchRequest::offset].
11635        pub fn set_offset<T: Into<i32>>(mut self, v: T) -> Self {
11636            self.0.request.offset = v.into();
11637            self
11638        }
11639
11640        /// Sets the value of [one_box_page_size][crate::model::SearchRequest::one_box_page_size].
11641        pub fn set_one_box_page_size<T: Into<i32>>(mut self, v: T) -> Self {
11642            self.0.request.one_box_page_size = v.into();
11643            self
11644        }
11645
11646        /// Sets the value of [data_store_specs][crate::model::SearchRequest::data_store_specs].
11647        pub fn set_data_store_specs<T, V>(mut self, v: T) -> Self
11648        where
11649            T: std::iter::IntoIterator<Item = V>,
11650            V: std::convert::Into<crate::model::search_request::DataStoreSpec>,
11651        {
11652            use std::iter::Iterator;
11653            self.0.request.data_store_specs = v.into_iter().map(|i| i.into()).collect();
11654            self
11655        }
11656
11657        /// Sets the value of [filter][crate::model::SearchRequest::filter].
11658        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
11659            self.0.request.filter = v.into();
11660            self
11661        }
11662
11663        /// Sets the value of [canonical_filter][crate::model::SearchRequest::canonical_filter].
11664        pub fn set_canonical_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
11665            self.0.request.canonical_filter = v.into();
11666            self
11667        }
11668
11669        /// Sets the value of [order_by][crate::model::SearchRequest::order_by].
11670        pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
11671            self.0.request.order_by = v.into();
11672            self
11673        }
11674
11675        /// Sets the value of [user_info][crate::model::SearchRequest::user_info].
11676        pub fn set_user_info<T>(mut self, v: T) -> Self
11677        where
11678            T: std::convert::Into<crate::model::UserInfo>,
11679        {
11680            self.0.request.user_info = std::option::Option::Some(v.into());
11681            self
11682        }
11683
11684        /// Sets or clears the value of [user_info][crate::model::SearchRequest::user_info].
11685        pub fn set_or_clear_user_info<T>(mut self, v: std::option::Option<T>) -> Self
11686        where
11687            T: std::convert::Into<crate::model::UserInfo>,
11688        {
11689            self.0.request.user_info = v.map(|x| x.into());
11690            self
11691        }
11692
11693        /// Sets the value of [language_code][crate::model::SearchRequest::language_code].
11694        pub fn set_language_code<T: Into<std::string::String>>(mut self, v: T) -> Self {
11695            self.0.request.language_code = v.into();
11696            self
11697        }
11698
11699        /// Sets the value of [facet_specs][crate::model::SearchRequest::facet_specs].
11700        pub fn set_facet_specs<T, V>(mut self, v: T) -> Self
11701        where
11702            T: std::iter::IntoIterator<Item = V>,
11703            V: std::convert::Into<crate::model::search_request::FacetSpec>,
11704        {
11705            use std::iter::Iterator;
11706            self.0.request.facet_specs = v.into_iter().map(|i| i.into()).collect();
11707            self
11708        }
11709
11710        /// Sets the value of [boost_spec][crate::model::SearchRequest::boost_spec].
11711        pub fn set_boost_spec<T>(mut self, v: T) -> Self
11712        where
11713            T: std::convert::Into<crate::model::search_request::BoostSpec>,
11714        {
11715            self.0.request.boost_spec = std::option::Option::Some(v.into());
11716            self
11717        }
11718
11719        /// Sets or clears the value of [boost_spec][crate::model::SearchRequest::boost_spec].
11720        pub fn set_or_clear_boost_spec<T>(mut self, v: std::option::Option<T>) -> Self
11721        where
11722            T: std::convert::Into<crate::model::search_request::BoostSpec>,
11723        {
11724            self.0.request.boost_spec = v.map(|x| x.into());
11725            self
11726        }
11727
11728        /// Sets the value of [params][crate::model::SearchRequest::params].
11729        pub fn set_params<T, K, V>(mut self, v: T) -> Self
11730        where
11731            T: std::iter::IntoIterator<Item = (K, V)>,
11732            K: std::convert::Into<std::string::String>,
11733            V: std::convert::Into<wkt::Value>,
11734        {
11735            self.0.request.params = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
11736            self
11737        }
11738
11739        /// Sets the value of [query_expansion_spec][crate::model::SearchRequest::query_expansion_spec].
11740        pub fn set_query_expansion_spec<T>(mut self, v: T) -> Self
11741        where
11742            T: std::convert::Into<crate::model::search_request::QueryExpansionSpec>,
11743        {
11744            self.0.request.query_expansion_spec = std::option::Option::Some(v.into());
11745            self
11746        }
11747
11748        /// Sets or clears the value of [query_expansion_spec][crate::model::SearchRequest::query_expansion_spec].
11749        pub fn set_or_clear_query_expansion_spec<T>(mut self, v: std::option::Option<T>) -> Self
11750        where
11751            T: std::convert::Into<crate::model::search_request::QueryExpansionSpec>,
11752        {
11753            self.0.request.query_expansion_spec = v.map(|x| x.into());
11754            self
11755        }
11756
11757        /// Sets the value of [spell_correction_spec][crate::model::SearchRequest::spell_correction_spec].
11758        pub fn set_spell_correction_spec<T>(mut self, v: T) -> Self
11759        where
11760            T: std::convert::Into<crate::model::search_request::SpellCorrectionSpec>,
11761        {
11762            self.0.request.spell_correction_spec = std::option::Option::Some(v.into());
11763            self
11764        }
11765
11766        /// Sets or clears the value of [spell_correction_spec][crate::model::SearchRequest::spell_correction_spec].
11767        pub fn set_or_clear_spell_correction_spec<T>(mut self, v: std::option::Option<T>) -> Self
11768        where
11769            T: std::convert::Into<crate::model::search_request::SpellCorrectionSpec>,
11770        {
11771            self.0.request.spell_correction_spec = v.map(|x| x.into());
11772            self
11773        }
11774
11775        /// Sets the value of [user_pseudo_id][crate::model::SearchRequest::user_pseudo_id].
11776        pub fn set_user_pseudo_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
11777            self.0.request.user_pseudo_id = v.into();
11778            self
11779        }
11780
11781        /// Sets the value of [content_search_spec][crate::model::SearchRequest::content_search_spec].
11782        pub fn set_content_search_spec<T>(mut self, v: T) -> Self
11783        where
11784            T: std::convert::Into<crate::model::search_request::ContentSearchSpec>,
11785        {
11786            self.0.request.content_search_spec = std::option::Option::Some(v.into());
11787            self
11788        }
11789
11790        /// Sets or clears the value of [content_search_spec][crate::model::SearchRequest::content_search_spec].
11791        pub fn set_or_clear_content_search_spec<T>(mut self, v: std::option::Option<T>) -> Self
11792        where
11793            T: std::convert::Into<crate::model::search_request::ContentSearchSpec>,
11794        {
11795            self.0.request.content_search_spec = v.map(|x| x.into());
11796            self
11797        }
11798
11799        /// Sets the value of [safe_search][crate::model::SearchRequest::safe_search].
11800        pub fn set_safe_search<T: Into<bool>>(mut self, v: T) -> Self {
11801            self.0.request.safe_search = v.into();
11802            self
11803        }
11804
11805        /// Sets the value of [user_labels][crate::model::SearchRequest::user_labels].
11806        pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
11807        where
11808            T: std::iter::IntoIterator<Item = (K, V)>,
11809            K: std::convert::Into<std::string::String>,
11810            V: std::convert::Into<std::string::String>,
11811        {
11812            self.0.request.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
11813            self
11814        }
11815
11816        /// Sets the value of [search_as_you_type_spec][crate::model::SearchRequest::search_as_you_type_spec].
11817        pub fn set_search_as_you_type_spec<T>(mut self, v: T) -> Self
11818        where
11819            T: std::convert::Into<crate::model::search_request::SearchAsYouTypeSpec>,
11820        {
11821            self.0.request.search_as_you_type_spec = std::option::Option::Some(v.into());
11822            self
11823        }
11824
11825        /// Sets or clears the value of [search_as_you_type_spec][crate::model::SearchRequest::search_as_you_type_spec].
11826        pub fn set_or_clear_search_as_you_type_spec<T>(mut self, v: std::option::Option<T>) -> Self
11827        where
11828            T: std::convert::Into<crate::model::search_request::SearchAsYouTypeSpec>,
11829        {
11830            self.0.request.search_as_you_type_spec = v.map(|x| x.into());
11831            self
11832        }
11833
11834        /// Sets the value of [display_spec][crate::model::SearchRequest::display_spec].
11835        pub fn set_display_spec<T>(mut self, v: T) -> Self
11836        where
11837            T: std::convert::Into<crate::model::search_request::DisplaySpec>,
11838        {
11839            self.0.request.display_spec = std::option::Option::Some(v.into());
11840            self
11841        }
11842
11843        /// Sets or clears the value of [display_spec][crate::model::SearchRequest::display_spec].
11844        pub fn set_or_clear_display_spec<T>(mut self, v: std::option::Option<T>) -> Self
11845        where
11846            T: std::convert::Into<crate::model::search_request::DisplaySpec>,
11847        {
11848            self.0.request.display_spec = v.map(|x| x.into());
11849            self
11850        }
11851
11852        /// Sets the value of [session][crate::model::SearchRequest::session].
11853        pub fn set_session<T: Into<std::string::String>>(mut self, v: T) -> Self {
11854            self.0.request.session = v.into();
11855            self
11856        }
11857
11858        /// Sets the value of [session_spec][crate::model::SearchRequest::session_spec].
11859        pub fn set_session_spec<T>(mut self, v: T) -> Self
11860        where
11861            T: std::convert::Into<crate::model::search_request::SessionSpec>,
11862        {
11863            self.0.request.session_spec = std::option::Option::Some(v.into());
11864            self
11865        }
11866
11867        /// Sets or clears the value of [session_spec][crate::model::SearchRequest::session_spec].
11868        pub fn set_or_clear_session_spec<T>(mut self, v: std::option::Option<T>) -> Self
11869        where
11870            T: std::convert::Into<crate::model::search_request::SessionSpec>,
11871        {
11872            self.0.request.session_spec = v.map(|x| x.into());
11873            self
11874        }
11875
11876        /// Sets the value of [relevance_threshold][crate::model::SearchRequest::relevance_threshold].
11877        pub fn set_relevance_threshold<
11878            T: Into<crate::model::search_request::RelevanceThreshold>,
11879        >(
11880            mut self,
11881            v: T,
11882        ) -> Self {
11883            self.0.request.relevance_threshold = v.into();
11884            self
11885        }
11886
11887        /// Sets the value of [relevance_score_spec][crate::model::SearchRequest::relevance_score_spec].
11888        pub fn set_relevance_score_spec<T>(mut self, v: T) -> Self
11889        where
11890            T: std::convert::Into<crate::model::search_request::RelevanceScoreSpec>,
11891        {
11892            self.0.request.relevance_score_spec = std::option::Option::Some(v.into());
11893            self
11894        }
11895
11896        /// Sets or clears the value of [relevance_score_spec][crate::model::SearchRequest::relevance_score_spec].
11897        pub fn set_or_clear_relevance_score_spec<T>(mut self, v: std::option::Option<T>) -> Self
11898        where
11899            T: std::convert::Into<crate::model::search_request::RelevanceScoreSpec>,
11900        {
11901            self.0.request.relevance_score_spec = v.map(|x| x.into());
11902            self
11903        }
11904
11905        /// Sets the value of [ranking_expression][crate::model::SearchRequest::ranking_expression].
11906        pub fn set_ranking_expression<T: Into<std::string::String>>(mut self, v: T) -> Self {
11907            self.0.request.ranking_expression = v.into();
11908            self
11909        }
11910
11911        /// Sets the value of [ranking_expression_backend][crate::model::SearchRequest::ranking_expression_backend].
11912        pub fn set_ranking_expression_backend<
11913            T: Into<crate::model::search_request::RankingExpressionBackend>,
11914        >(
11915            mut self,
11916            v: T,
11917        ) -> Self {
11918            self.0.request.ranking_expression_backend = v.into();
11919            self
11920        }
11921    }
11922
11923    #[doc(hidden)]
11924    impl gax::options::internal::RequestBuilder for SearchLite {
11925        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
11926            &mut self.0.options
11927        }
11928    }
11929
11930    /// The request builder for [SearchService::list_operations][crate::client::SearchService::list_operations] calls.
11931    ///
11932    /// # Example
11933    /// ```
11934    /// # use google_cloud_discoveryengine_v1::builder::search_service::ListOperations;
11935    /// # async fn sample() -> gax::Result<()> {
11936    /// use gax::paginator::ItemPaginator;
11937    ///
11938    /// let builder = prepare_request_builder();
11939    /// let mut items = builder.by_item();
11940    /// while let Some(result) = items.next().await {
11941    ///   let item = result?;
11942    /// }
11943    /// # Ok(()) }
11944    ///
11945    /// fn prepare_request_builder() -> ListOperations {
11946    ///   # panic!();
11947    ///   // ... details omitted ...
11948    /// }
11949    /// ```
11950    #[derive(Clone, Debug)]
11951    pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
11952
11953    impl ListOperations {
11954        pub(crate) fn new(
11955            stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchService>,
11956        ) -> Self {
11957            Self(RequestBuilder::new(stub))
11958        }
11959
11960        /// Sets the full request, replacing any prior values.
11961        pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
11962            mut self,
11963            v: V,
11964        ) -> Self {
11965            self.0.request = v.into();
11966            self
11967        }
11968
11969        /// Sets all the options, replacing any prior values.
11970        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
11971            self.0.options = v.into();
11972            self
11973        }
11974
11975        /// Sends the request.
11976        pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
11977            (*self.0.stub)
11978                .list_operations(self.0.request, self.0.options)
11979                .await
11980                .map(gax::response::Response::into_body)
11981        }
11982
11983        /// Streams each page in the collection.
11984        pub fn by_page(
11985            self,
11986        ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
11987        {
11988            use std::clone::Clone;
11989            let token = self.0.request.page_token.clone();
11990            let execute = move |token: String| {
11991                let mut builder = self.clone();
11992                builder.0.request = builder.0.request.set_page_token(token);
11993                builder.send()
11994            };
11995            gax::paginator::internal::new_paginator(token, execute)
11996        }
11997
11998        /// Streams each item in the collection.
11999        pub fn by_item(
12000            self,
12001        ) -> impl gax::paginator::ItemPaginator<
12002            longrunning::model::ListOperationsResponse,
12003            gax::error::Error,
12004        > {
12005            use gax::paginator::Paginator;
12006            self.by_page().items()
12007        }
12008
12009        /// Sets the value of [name][longrunning::model::ListOperationsRequest::name].
12010        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
12011            self.0.request.name = v.into();
12012            self
12013        }
12014
12015        /// Sets the value of [filter][longrunning::model::ListOperationsRequest::filter].
12016        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
12017            self.0.request.filter = v.into();
12018            self
12019        }
12020
12021        /// Sets the value of [page_size][longrunning::model::ListOperationsRequest::page_size].
12022        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
12023            self.0.request.page_size = v.into();
12024            self
12025        }
12026
12027        /// Sets the value of [page_token][longrunning::model::ListOperationsRequest::page_token].
12028        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
12029            self.0.request.page_token = v.into();
12030            self
12031        }
12032
12033        /// Sets the value of [return_partial_success][longrunning::model::ListOperationsRequest::return_partial_success].
12034        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
12035            self.0.request.return_partial_success = v.into();
12036            self
12037        }
12038    }
12039
12040    #[doc(hidden)]
12041    impl gax::options::internal::RequestBuilder for ListOperations {
12042        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
12043            &mut self.0.options
12044        }
12045    }
12046
12047    /// The request builder for [SearchService::get_operation][crate::client::SearchService::get_operation] calls.
12048    ///
12049    /// # Example
12050    /// ```
12051    /// # use google_cloud_discoveryengine_v1::builder::search_service::GetOperation;
12052    /// # async fn sample() -> gax::Result<()> {
12053    ///
12054    /// let builder = prepare_request_builder();
12055    /// let response = builder.send().await?;
12056    /// # Ok(()) }
12057    ///
12058    /// fn prepare_request_builder() -> GetOperation {
12059    ///   # panic!();
12060    ///   // ... details omitted ...
12061    /// }
12062    /// ```
12063    #[derive(Clone, Debug)]
12064    pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
12065
12066    impl GetOperation {
12067        pub(crate) fn new(
12068            stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchService>,
12069        ) -> Self {
12070            Self(RequestBuilder::new(stub))
12071        }
12072
12073        /// Sets the full request, replacing any prior values.
12074        pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
12075            mut self,
12076            v: V,
12077        ) -> Self {
12078            self.0.request = v.into();
12079            self
12080        }
12081
12082        /// Sets all the options, replacing any prior values.
12083        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
12084            self.0.options = v.into();
12085            self
12086        }
12087
12088        /// Sends the request.
12089        pub async fn send(self) -> Result<longrunning::model::Operation> {
12090            (*self.0.stub)
12091                .get_operation(self.0.request, self.0.options)
12092                .await
12093                .map(gax::response::Response::into_body)
12094        }
12095
12096        /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
12097        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
12098            self.0.request.name = v.into();
12099            self
12100        }
12101    }
12102
12103    #[doc(hidden)]
12104    impl gax::options::internal::RequestBuilder for GetOperation {
12105        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
12106            &mut self.0.options
12107        }
12108    }
12109
12110    /// The request builder for [SearchService::cancel_operation][crate::client::SearchService::cancel_operation] calls.
12111    ///
12112    /// # Example
12113    /// ```
12114    /// # use google_cloud_discoveryengine_v1::builder::search_service::CancelOperation;
12115    /// # async fn sample() -> gax::Result<()> {
12116    ///
12117    /// let builder = prepare_request_builder();
12118    /// let response = builder.send().await?;
12119    /// # Ok(()) }
12120    ///
12121    /// fn prepare_request_builder() -> CancelOperation {
12122    ///   # panic!();
12123    ///   // ... details omitted ...
12124    /// }
12125    /// ```
12126    #[derive(Clone, Debug)]
12127    pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
12128
12129    impl CancelOperation {
12130        pub(crate) fn new(
12131            stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchService>,
12132        ) -> Self {
12133            Self(RequestBuilder::new(stub))
12134        }
12135
12136        /// Sets the full request, replacing any prior values.
12137        pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
12138            mut self,
12139            v: V,
12140        ) -> Self {
12141            self.0.request = v.into();
12142            self
12143        }
12144
12145        /// Sets all the options, replacing any prior values.
12146        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
12147            self.0.options = v.into();
12148            self
12149        }
12150
12151        /// Sends the request.
12152        pub async fn send(self) -> Result<()> {
12153            (*self.0.stub)
12154                .cancel_operation(self.0.request, self.0.options)
12155                .await
12156                .map(gax::response::Response::into_body)
12157        }
12158
12159        /// Sets the value of [name][longrunning::model::CancelOperationRequest::name].
12160        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
12161            self.0.request.name = v.into();
12162            self
12163        }
12164    }
12165
12166    #[doc(hidden)]
12167    impl gax::options::internal::RequestBuilder for CancelOperation {
12168        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
12169            &mut self.0.options
12170        }
12171    }
12172}
12173
12174#[cfg(feature = "search-tuning-service")]
12175#[cfg_attr(docsrs, doc(cfg(feature = "search-tuning-service")))]
12176pub mod search_tuning_service {
12177    use crate::Result;
12178
12179    /// A builder for [SearchTuningService][crate::client::SearchTuningService].
12180    ///
12181    /// ```
12182    /// # async fn sample() -> gax::client_builder::Result<()> {
12183    /// # use google_cloud_discoveryengine_v1::*;
12184    /// # use builder::search_tuning_service::ClientBuilder;
12185    /// # use client::SearchTuningService;
12186    /// let builder : ClientBuilder = SearchTuningService::builder();
12187    /// let client = builder
12188    ///     .with_endpoint("https://discoveryengine.googleapis.com")
12189    ///     .build().await?;
12190    /// # Ok(()) }
12191    /// ```
12192    pub type ClientBuilder =
12193        gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
12194
12195    pub(crate) mod client {
12196        use super::super::super::client::SearchTuningService;
12197        pub struct Factory;
12198        impl gax::client_builder::internal::ClientFactory for Factory {
12199            type Client = SearchTuningService;
12200            type Credentials = gaxi::options::Credentials;
12201            async fn build(
12202                self,
12203                config: gaxi::options::ClientConfig,
12204            ) -> gax::client_builder::Result<Self::Client> {
12205                Self::Client::new(config).await
12206            }
12207        }
12208    }
12209
12210    /// Common implementation for [crate::client::SearchTuningService] request builders.
12211    #[derive(Clone, Debug)]
12212    pub(crate) struct RequestBuilder<R: std::default::Default> {
12213        stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchTuningService>,
12214        request: R,
12215        options: gax::options::RequestOptions,
12216    }
12217
12218    impl<R> RequestBuilder<R>
12219    where
12220        R: std::default::Default,
12221    {
12222        pub(crate) fn new(
12223            stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchTuningService>,
12224        ) -> Self {
12225            Self {
12226                stub,
12227                request: R::default(),
12228                options: gax::options::RequestOptions::default(),
12229            }
12230        }
12231    }
12232
12233    /// The request builder for [SearchTuningService::train_custom_model][crate::client::SearchTuningService::train_custom_model] calls.
12234    ///
12235    /// # Example
12236    /// ```
12237    /// # use google_cloud_discoveryengine_v1::builder::search_tuning_service::TrainCustomModel;
12238    /// # async fn sample() -> gax::Result<()> {
12239    /// use lro::Poller;
12240    ///
12241    /// let builder = prepare_request_builder();
12242    /// let response = builder.poller().until_done().await?;
12243    /// # Ok(()) }
12244    ///
12245    /// fn prepare_request_builder() -> TrainCustomModel {
12246    ///   # panic!();
12247    ///   // ... details omitted ...
12248    /// }
12249    /// ```
12250    #[derive(Clone, Debug)]
12251    pub struct TrainCustomModel(RequestBuilder<crate::model::TrainCustomModelRequest>);
12252
12253    impl TrainCustomModel {
12254        pub(crate) fn new(
12255            stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchTuningService>,
12256        ) -> Self {
12257            Self(RequestBuilder::new(stub))
12258        }
12259
12260        /// Sets the full request, replacing any prior values.
12261        pub fn with_request<V: Into<crate::model::TrainCustomModelRequest>>(
12262            mut self,
12263            v: V,
12264        ) -> Self {
12265            self.0.request = v.into();
12266            self
12267        }
12268
12269        /// Sets all the options, replacing any prior values.
12270        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
12271            self.0.options = v.into();
12272            self
12273        }
12274
12275        /// Sends the request.
12276        ///
12277        /// # Long running operations
12278        ///
12279        /// This starts, but does not poll, a longrunning operation. More information
12280        /// on [train_custom_model][crate::client::SearchTuningService::train_custom_model].
12281        pub async fn send(self) -> Result<longrunning::model::Operation> {
12282            (*self.0.stub)
12283                .train_custom_model(self.0.request, self.0.options)
12284                .await
12285                .map(gax::response::Response::into_body)
12286        }
12287
12288        /// Creates a [Poller][lro::Poller] to work with `train_custom_model`.
12289        pub fn poller(
12290            self,
12291        ) -> impl lro::Poller<
12292            crate::model::TrainCustomModelResponse,
12293            crate::model::TrainCustomModelMetadata,
12294        > {
12295            type Operation = lro::internal::Operation<
12296                crate::model::TrainCustomModelResponse,
12297                crate::model::TrainCustomModelMetadata,
12298            >;
12299            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
12300            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
12301
12302            let stub = self.0.stub.clone();
12303            let mut options = self.0.options.clone();
12304            options.set_retry_policy(gax::retry_policy::NeverRetry);
12305            let query = move |name| {
12306                let stub = stub.clone();
12307                let options = options.clone();
12308                async {
12309                    let op = GetOperation::new(stub)
12310                        .set_name(name)
12311                        .with_options(options)
12312                        .send()
12313                        .await?;
12314                    Ok(Operation::new(op))
12315                }
12316            };
12317
12318            let start = move || async {
12319                let op = self.send().await?;
12320                Ok(Operation::new(op))
12321            };
12322
12323            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
12324        }
12325
12326        /// Sets the value of [data_store][crate::model::TrainCustomModelRequest::data_store].
12327        ///
12328        /// This is a **required** field for requests.
12329        pub fn set_data_store<T: Into<std::string::String>>(mut self, v: T) -> Self {
12330            self.0.request.data_store = v.into();
12331            self
12332        }
12333
12334        /// Sets the value of [model_type][crate::model::TrainCustomModelRequest::model_type].
12335        pub fn set_model_type<T: Into<std::string::String>>(mut self, v: T) -> Self {
12336            self.0.request.model_type = v.into();
12337            self
12338        }
12339
12340        /// Sets the value of [error_config][crate::model::TrainCustomModelRequest::error_config].
12341        pub fn set_error_config<T>(mut self, v: T) -> Self
12342        where
12343            T: std::convert::Into<crate::model::ImportErrorConfig>,
12344        {
12345            self.0.request.error_config = std::option::Option::Some(v.into());
12346            self
12347        }
12348
12349        /// Sets or clears the value of [error_config][crate::model::TrainCustomModelRequest::error_config].
12350        pub fn set_or_clear_error_config<T>(mut self, v: std::option::Option<T>) -> Self
12351        where
12352            T: std::convert::Into<crate::model::ImportErrorConfig>,
12353        {
12354            self.0.request.error_config = v.map(|x| x.into());
12355            self
12356        }
12357
12358        /// Sets the value of [model_id][crate::model::TrainCustomModelRequest::model_id].
12359        pub fn set_model_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
12360            self.0.request.model_id = v.into();
12361            self
12362        }
12363
12364        /// Sets the value of [training_input][crate::model::TrainCustomModelRequest::training_input].
12365        ///
12366        /// Note that all the setters affecting `training_input` are
12367        /// mutually exclusive.
12368        pub fn set_training_input<
12369            T: Into<Option<crate::model::train_custom_model_request::TrainingInput>>,
12370        >(
12371            mut self,
12372            v: T,
12373        ) -> Self {
12374            self.0.request.training_input = v.into();
12375            self
12376        }
12377
12378        /// Sets the value of [training_input][crate::model::TrainCustomModelRequest::training_input]
12379        /// to hold a `GcsTrainingInput`.
12380        ///
12381        /// Note that all the setters affecting `training_input` are
12382        /// mutually exclusive.
12383        pub fn set_gcs_training_input<
12384            T: std::convert::Into<
12385                    std::boxed::Box<crate::model::train_custom_model_request::GcsTrainingInput>,
12386                >,
12387        >(
12388            mut self,
12389            v: T,
12390        ) -> Self {
12391            self.0.request = self.0.request.set_gcs_training_input(v);
12392            self
12393        }
12394    }
12395
12396    #[doc(hidden)]
12397    impl gax::options::internal::RequestBuilder for TrainCustomModel {
12398        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
12399            &mut self.0.options
12400        }
12401    }
12402
12403    /// The request builder for [SearchTuningService::list_custom_models][crate::client::SearchTuningService::list_custom_models] calls.
12404    ///
12405    /// # Example
12406    /// ```
12407    /// # use google_cloud_discoveryengine_v1::builder::search_tuning_service::ListCustomModels;
12408    /// # async fn sample() -> gax::Result<()> {
12409    ///
12410    /// let builder = prepare_request_builder();
12411    /// let response = builder.send().await?;
12412    /// # Ok(()) }
12413    ///
12414    /// fn prepare_request_builder() -> ListCustomModels {
12415    ///   # panic!();
12416    ///   // ... details omitted ...
12417    /// }
12418    /// ```
12419    #[derive(Clone, Debug)]
12420    pub struct ListCustomModels(RequestBuilder<crate::model::ListCustomModelsRequest>);
12421
12422    impl ListCustomModels {
12423        pub(crate) fn new(
12424            stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchTuningService>,
12425        ) -> Self {
12426            Self(RequestBuilder::new(stub))
12427        }
12428
12429        /// Sets the full request, replacing any prior values.
12430        pub fn with_request<V: Into<crate::model::ListCustomModelsRequest>>(
12431            mut self,
12432            v: V,
12433        ) -> Self {
12434            self.0.request = v.into();
12435            self
12436        }
12437
12438        /// Sets all the options, replacing any prior values.
12439        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
12440            self.0.options = v.into();
12441            self
12442        }
12443
12444        /// Sends the request.
12445        pub async fn send(self) -> Result<crate::model::ListCustomModelsResponse> {
12446            (*self.0.stub)
12447                .list_custom_models(self.0.request, self.0.options)
12448                .await
12449                .map(gax::response::Response::into_body)
12450        }
12451
12452        /// Sets the value of [data_store][crate::model::ListCustomModelsRequest::data_store].
12453        ///
12454        /// This is a **required** field for requests.
12455        pub fn set_data_store<T: Into<std::string::String>>(mut self, v: T) -> Self {
12456            self.0.request.data_store = v.into();
12457            self
12458        }
12459    }
12460
12461    #[doc(hidden)]
12462    impl gax::options::internal::RequestBuilder for ListCustomModels {
12463        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
12464            &mut self.0.options
12465        }
12466    }
12467
12468    /// The request builder for [SearchTuningService::list_operations][crate::client::SearchTuningService::list_operations] calls.
12469    ///
12470    /// # Example
12471    /// ```
12472    /// # use google_cloud_discoveryengine_v1::builder::search_tuning_service::ListOperations;
12473    /// # async fn sample() -> gax::Result<()> {
12474    /// use gax::paginator::ItemPaginator;
12475    ///
12476    /// let builder = prepare_request_builder();
12477    /// let mut items = builder.by_item();
12478    /// while let Some(result) = items.next().await {
12479    ///   let item = result?;
12480    /// }
12481    /// # Ok(()) }
12482    ///
12483    /// fn prepare_request_builder() -> ListOperations {
12484    ///   # panic!();
12485    ///   // ... details omitted ...
12486    /// }
12487    /// ```
12488    #[derive(Clone, Debug)]
12489    pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
12490
12491    impl ListOperations {
12492        pub(crate) fn new(
12493            stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchTuningService>,
12494        ) -> Self {
12495            Self(RequestBuilder::new(stub))
12496        }
12497
12498        /// Sets the full request, replacing any prior values.
12499        pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
12500            mut self,
12501            v: V,
12502        ) -> Self {
12503            self.0.request = v.into();
12504            self
12505        }
12506
12507        /// Sets all the options, replacing any prior values.
12508        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
12509            self.0.options = v.into();
12510            self
12511        }
12512
12513        /// Sends the request.
12514        pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
12515            (*self.0.stub)
12516                .list_operations(self.0.request, self.0.options)
12517                .await
12518                .map(gax::response::Response::into_body)
12519        }
12520
12521        /// Streams each page in the collection.
12522        pub fn by_page(
12523            self,
12524        ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
12525        {
12526            use std::clone::Clone;
12527            let token = self.0.request.page_token.clone();
12528            let execute = move |token: String| {
12529                let mut builder = self.clone();
12530                builder.0.request = builder.0.request.set_page_token(token);
12531                builder.send()
12532            };
12533            gax::paginator::internal::new_paginator(token, execute)
12534        }
12535
12536        /// Streams each item in the collection.
12537        pub fn by_item(
12538            self,
12539        ) -> impl gax::paginator::ItemPaginator<
12540            longrunning::model::ListOperationsResponse,
12541            gax::error::Error,
12542        > {
12543            use gax::paginator::Paginator;
12544            self.by_page().items()
12545        }
12546
12547        /// Sets the value of [name][longrunning::model::ListOperationsRequest::name].
12548        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
12549            self.0.request.name = v.into();
12550            self
12551        }
12552
12553        /// Sets the value of [filter][longrunning::model::ListOperationsRequest::filter].
12554        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
12555            self.0.request.filter = v.into();
12556            self
12557        }
12558
12559        /// Sets the value of [page_size][longrunning::model::ListOperationsRequest::page_size].
12560        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
12561            self.0.request.page_size = v.into();
12562            self
12563        }
12564
12565        /// Sets the value of [page_token][longrunning::model::ListOperationsRequest::page_token].
12566        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
12567            self.0.request.page_token = v.into();
12568            self
12569        }
12570
12571        /// Sets the value of [return_partial_success][longrunning::model::ListOperationsRequest::return_partial_success].
12572        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
12573            self.0.request.return_partial_success = v.into();
12574            self
12575        }
12576    }
12577
12578    #[doc(hidden)]
12579    impl gax::options::internal::RequestBuilder for ListOperations {
12580        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
12581            &mut self.0.options
12582        }
12583    }
12584
12585    /// The request builder for [SearchTuningService::get_operation][crate::client::SearchTuningService::get_operation] calls.
12586    ///
12587    /// # Example
12588    /// ```
12589    /// # use google_cloud_discoveryengine_v1::builder::search_tuning_service::GetOperation;
12590    /// # async fn sample() -> gax::Result<()> {
12591    ///
12592    /// let builder = prepare_request_builder();
12593    /// let response = builder.send().await?;
12594    /// # Ok(()) }
12595    ///
12596    /// fn prepare_request_builder() -> GetOperation {
12597    ///   # panic!();
12598    ///   // ... details omitted ...
12599    /// }
12600    /// ```
12601    #[derive(Clone, Debug)]
12602    pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
12603
12604    impl GetOperation {
12605        pub(crate) fn new(
12606            stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchTuningService>,
12607        ) -> Self {
12608            Self(RequestBuilder::new(stub))
12609        }
12610
12611        /// Sets the full request, replacing any prior values.
12612        pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
12613            mut self,
12614            v: V,
12615        ) -> Self {
12616            self.0.request = v.into();
12617            self
12618        }
12619
12620        /// Sets all the options, replacing any prior values.
12621        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
12622            self.0.options = v.into();
12623            self
12624        }
12625
12626        /// Sends the request.
12627        pub async fn send(self) -> Result<longrunning::model::Operation> {
12628            (*self.0.stub)
12629                .get_operation(self.0.request, self.0.options)
12630                .await
12631                .map(gax::response::Response::into_body)
12632        }
12633
12634        /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
12635        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
12636            self.0.request.name = v.into();
12637            self
12638        }
12639    }
12640
12641    #[doc(hidden)]
12642    impl gax::options::internal::RequestBuilder for GetOperation {
12643        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
12644            &mut self.0.options
12645        }
12646    }
12647
12648    /// The request builder for [SearchTuningService::cancel_operation][crate::client::SearchTuningService::cancel_operation] calls.
12649    ///
12650    /// # Example
12651    /// ```
12652    /// # use google_cloud_discoveryengine_v1::builder::search_tuning_service::CancelOperation;
12653    /// # async fn sample() -> gax::Result<()> {
12654    ///
12655    /// let builder = prepare_request_builder();
12656    /// let response = builder.send().await?;
12657    /// # Ok(()) }
12658    ///
12659    /// fn prepare_request_builder() -> CancelOperation {
12660    ///   # panic!();
12661    ///   // ... details omitted ...
12662    /// }
12663    /// ```
12664    #[derive(Clone, Debug)]
12665    pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
12666
12667    impl CancelOperation {
12668        pub(crate) fn new(
12669            stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchTuningService>,
12670        ) -> Self {
12671            Self(RequestBuilder::new(stub))
12672        }
12673
12674        /// Sets the full request, replacing any prior values.
12675        pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
12676            mut self,
12677            v: V,
12678        ) -> Self {
12679            self.0.request = v.into();
12680            self
12681        }
12682
12683        /// Sets all the options, replacing any prior values.
12684        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
12685            self.0.options = v.into();
12686            self
12687        }
12688
12689        /// Sends the request.
12690        pub async fn send(self) -> Result<()> {
12691            (*self.0.stub)
12692                .cancel_operation(self.0.request, self.0.options)
12693                .await
12694                .map(gax::response::Response::into_body)
12695        }
12696
12697        /// Sets the value of [name][longrunning::model::CancelOperationRequest::name].
12698        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
12699            self.0.request.name = v.into();
12700            self
12701        }
12702    }
12703
12704    #[doc(hidden)]
12705    impl gax::options::internal::RequestBuilder for CancelOperation {
12706        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
12707            &mut self.0.options
12708        }
12709    }
12710}
12711
12712#[cfg(feature = "serving-config-service")]
12713#[cfg_attr(docsrs, doc(cfg(feature = "serving-config-service")))]
12714pub mod serving_config_service {
12715    use crate::Result;
12716
12717    /// A builder for [ServingConfigService][crate::client::ServingConfigService].
12718    ///
12719    /// ```
12720    /// # async fn sample() -> gax::client_builder::Result<()> {
12721    /// # use google_cloud_discoveryengine_v1::*;
12722    /// # use builder::serving_config_service::ClientBuilder;
12723    /// # use client::ServingConfigService;
12724    /// let builder : ClientBuilder = ServingConfigService::builder();
12725    /// let client = builder
12726    ///     .with_endpoint("https://discoveryengine.googleapis.com")
12727    ///     .build().await?;
12728    /// # Ok(()) }
12729    /// ```
12730    pub type ClientBuilder =
12731        gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
12732
12733    pub(crate) mod client {
12734        use super::super::super::client::ServingConfigService;
12735        pub struct Factory;
12736        impl gax::client_builder::internal::ClientFactory for Factory {
12737            type Client = ServingConfigService;
12738            type Credentials = gaxi::options::Credentials;
12739            async fn build(
12740                self,
12741                config: gaxi::options::ClientConfig,
12742            ) -> gax::client_builder::Result<Self::Client> {
12743                Self::Client::new(config).await
12744            }
12745        }
12746    }
12747
12748    /// Common implementation for [crate::client::ServingConfigService] request builders.
12749    #[derive(Clone, Debug)]
12750    pub(crate) struct RequestBuilder<R: std::default::Default> {
12751        stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
12752        request: R,
12753        options: gax::options::RequestOptions,
12754    }
12755
12756    impl<R> RequestBuilder<R>
12757    where
12758        R: std::default::Default,
12759    {
12760        pub(crate) fn new(
12761            stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
12762        ) -> Self {
12763            Self {
12764                stub,
12765                request: R::default(),
12766                options: gax::options::RequestOptions::default(),
12767            }
12768        }
12769    }
12770
12771    /// The request builder for [ServingConfigService::update_serving_config][crate::client::ServingConfigService::update_serving_config] calls.
12772    ///
12773    /// # Example
12774    /// ```
12775    /// # use google_cloud_discoveryengine_v1::builder::serving_config_service::UpdateServingConfig;
12776    /// # async fn sample() -> gax::Result<()> {
12777    ///
12778    /// let builder = prepare_request_builder();
12779    /// let response = builder.send().await?;
12780    /// # Ok(()) }
12781    ///
12782    /// fn prepare_request_builder() -> UpdateServingConfig {
12783    ///   # panic!();
12784    ///   // ... details omitted ...
12785    /// }
12786    /// ```
12787    #[derive(Clone, Debug)]
12788    pub struct UpdateServingConfig(RequestBuilder<crate::model::UpdateServingConfigRequest>);
12789
12790    impl UpdateServingConfig {
12791        pub(crate) fn new(
12792            stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
12793        ) -> Self {
12794            Self(RequestBuilder::new(stub))
12795        }
12796
12797        /// Sets the full request, replacing any prior values.
12798        pub fn with_request<V: Into<crate::model::UpdateServingConfigRequest>>(
12799            mut self,
12800            v: V,
12801        ) -> Self {
12802            self.0.request = v.into();
12803            self
12804        }
12805
12806        /// Sets all the options, replacing any prior values.
12807        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
12808            self.0.options = v.into();
12809            self
12810        }
12811
12812        /// Sends the request.
12813        pub async fn send(self) -> Result<crate::model::ServingConfig> {
12814            (*self.0.stub)
12815                .update_serving_config(self.0.request, self.0.options)
12816                .await
12817                .map(gax::response::Response::into_body)
12818        }
12819
12820        /// Sets the value of [serving_config][crate::model::UpdateServingConfigRequest::serving_config].
12821        ///
12822        /// This is a **required** field for requests.
12823        pub fn set_serving_config<T>(mut self, v: T) -> Self
12824        where
12825            T: std::convert::Into<crate::model::ServingConfig>,
12826        {
12827            self.0.request.serving_config = std::option::Option::Some(v.into());
12828            self
12829        }
12830
12831        /// Sets or clears the value of [serving_config][crate::model::UpdateServingConfigRequest::serving_config].
12832        ///
12833        /// This is a **required** field for requests.
12834        pub fn set_or_clear_serving_config<T>(mut self, v: std::option::Option<T>) -> Self
12835        where
12836            T: std::convert::Into<crate::model::ServingConfig>,
12837        {
12838            self.0.request.serving_config = v.map(|x| x.into());
12839            self
12840        }
12841
12842        /// Sets the value of [update_mask][crate::model::UpdateServingConfigRequest::update_mask].
12843        pub fn set_update_mask<T>(mut self, v: T) -> Self
12844        where
12845            T: std::convert::Into<wkt::FieldMask>,
12846        {
12847            self.0.request.update_mask = std::option::Option::Some(v.into());
12848            self
12849        }
12850
12851        /// Sets or clears the value of [update_mask][crate::model::UpdateServingConfigRequest::update_mask].
12852        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
12853        where
12854            T: std::convert::Into<wkt::FieldMask>,
12855        {
12856            self.0.request.update_mask = v.map(|x| x.into());
12857            self
12858        }
12859    }
12860
12861    #[doc(hidden)]
12862    impl gax::options::internal::RequestBuilder for UpdateServingConfig {
12863        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
12864            &mut self.0.options
12865        }
12866    }
12867
12868    /// The request builder for [ServingConfigService::list_operations][crate::client::ServingConfigService::list_operations] calls.
12869    ///
12870    /// # Example
12871    /// ```
12872    /// # use google_cloud_discoveryengine_v1::builder::serving_config_service::ListOperations;
12873    /// # async fn sample() -> gax::Result<()> {
12874    /// use gax::paginator::ItemPaginator;
12875    ///
12876    /// let builder = prepare_request_builder();
12877    /// let mut items = builder.by_item();
12878    /// while let Some(result) = items.next().await {
12879    ///   let item = result?;
12880    /// }
12881    /// # Ok(()) }
12882    ///
12883    /// fn prepare_request_builder() -> ListOperations {
12884    ///   # panic!();
12885    ///   // ... details omitted ...
12886    /// }
12887    /// ```
12888    #[derive(Clone, Debug)]
12889    pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
12890
12891    impl ListOperations {
12892        pub(crate) fn new(
12893            stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
12894        ) -> Self {
12895            Self(RequestBuilder::new(stub))
12896        }
12897
12898        /// Sets the full request, replacing any prior values.
12899        pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
12900            mut self,
12901            v: V,
12902        ) -> Self {
12903            self.0.request = v.into();
12904            self
12905        }
12906
12907        /// Sets all the options, replacing any prior values.
12908        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
12909            self.0.options = v.into();
12910            self
12911        }
12912
12913        /// Sends the request.
12914        pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
12915            (*self.0.stub)
12916                .list_operations(self.0.request, self.0.options)
12917                .await
12918                .map(gax::response::Response::into_body)
12919        }
12920
12921        /// Streams each page in the collection.
12922        pub fn by_page(
12923            self,
12924        ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
12925        {
12926            use std::clone::Clone;
12927            let token = self.0.request.page_token.clone();
12928            let execute = move |token: String| {
12929                let mut builder = self.clone();
12930                builder.0.request = builder.0.request.set_page_token(token);
12931                builder.send()
12932            };
12933            gax::paginator::internal::new_paginator(token, execute)
12934        }
12935
12936        /// Streams each item in the collection.
12937        pub fn by_item(
12938            self,
12939        ) -> impl gax::paginator::ItemPaginator<
12940            longrunning::model::ListOperationsResponse,
12941            gax::error::Error,
12942        > {
12943            use gax::paginator::Paginator;
12944            self.by_page().items()
12945        }
12946
12947        /// Sets the value of [name][longrunning::model::ListOperationsRequest::name].
12948        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
12949            self.0.request.name = v.into();
12950            self
12951        }
12952
12953        /// Sets the value of [filter][longrunning::model::ListOperationsRequest::filter].
12954        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
12955            self.0.request.filter = v.into();
12956            self
12957        }
12958
12959        /// Sets the value of [page_size][longrunning::model::ListOperationsRequest::page_size].
12960        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
12961            self.0.request.page_size = v.into();
12962            self
12963        }
12964
12965        /// Sets the value of [page_token][longrunning::model::ListOperationsRequest::page_token].
12966        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
12967            self.0.request.page_token = v.into();
12968            self
12969        }
12970
12971        /// Sets the value of [return_partial_success][longrunning::model::ListOperationsRequest::return_partial_success].
12972        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
12973            self.0.request.return_partial_success = v.into();
12974            self
12975        }
12976    }
12977
12978    #[doc(hidden)]
12979    impl gax::options::internal::RequestBuilder for ListOperations {
12980        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
12981            &mut self.0.options
12982        }
12983    }
12984
12985    /// The request builder for [ServingConfigService::get_operation][crate::client::ServingConfigService::get_operation] calls.
12986    ///
12987    /// # Example
12988    /// ```
12989    /// # use google_cloud_discoveryengine_v1::builder::serving_config_service::GetOperation;
12990    /// # async fn sample() -> gax::Result<()> {
12991    ///
12992    /// let builder = prepare_request_builder();
12993    /// let response = builder.send().await?;
12994    /// # Ok(()) }
12995    ///
12996    /// fn prepare_request_builder() -> GetOperation {
12997    ///   # panic!();
12998    ///   // ... details omitted ...
12999    /// }
13000    /// ```
13001    #[derive(Clone, Debug)]
13002    pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
13003
13004    impl GetOperation {
13005        pub(crate) fn new(
13006            stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
13007        ) -> Self {
13008            Self(RequestBuilder::new(stub))
13009        }
13010
13011        /// Sets the full request, replacing any prior values.
13012        pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
13013            mut self,
13014            v: V,
13015        ) -> Self {
13016            self.0.request = v.into();
13017            self
13018        }
13019
13020        /// Sets all the options, replacing any prior values.
13021        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
13022            self.0.options = v.into();
13023            self
13024        }
13025
13026        /// Sends the request.
13027        pub async fn send(self) -> Result<longrunning::model::Operation> {
13028            (*self.0.stub)
13029                .get_operation(self.0.request, self.0.options)
13030                .await
13031                .map(gax::response::Response::into_body)
13032        }
13033
13034        /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
13035        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13036            self.0.request.name = v.into();
13037            self
13038        }
13039    }
13040
13041    #[doc(hidden)]
13042    impl gax::options::internal::RequestBuilder for GetOperation {
13043        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
13044            &mut self.0.options
13045        }
13046    }
13047
13048    /// The request builder for [ServingConfigService::cancel_operation][crate::client::ServingConfigService::cancel_operation] calls.
13049    ///
13050    /// # Example
13051    /// ```
13052    /// # use google_cloud_discoveryengine_v1::builder::serving_config_service::CancelOperation;
13053    /// # async fn sample() -> gax::Result<()> {
13054    ///
13055    /// let builder = prepare_request_builder();
13056    /// let response = builder.send().await?;
13057    /// # Ok(()) }
13058    ///
13059    /// fn prepare_request_builder() -> CancelOperation {
13060    ///   # panic!();
13061    ///   // ... details omitted ...
13062    /// }
13063    /// ```
13064    #[derive(Clone, Debug)]
13065    pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
13066
13067    impl CancelOperation {
13068        pub(crate) fn new(
13069            stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
13070        ) -> Self {
13071            Self(RequestBuilder::new(stub))
13072        }
13073
13074        /// Sets the full request, replacing any prior values.
13075        pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
13076            mut self,
13077            v: V,
13078        ) -> Self {
13079            self.0.request = v.into();
13080            self
13081        }
13082
13083        /// Sets all the options, replacing any prior values.
13084        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
13085            self.0.options = v.into();
13086            self
13087        }
13088
13089        /// Sends the request.
13090        pub async fn send(self) -> Result<()> {
13091            (*self.0.stub)
13092                .cancel_operation(self.0.request, self.0.options)
13093                .await
13094                .map(gax::response::Response::into_body)
13095        }
13096
13097        /// Sets the value of [name][longrunning::model::CancelOperationRequest::name].
13098        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13099            self.0.request.name = v.into();
13100            self
13101        }
13102    }
13103
13104    #[doc(hidden)]
13105    impl gax::options::internal::RequestBuilder for CancelOperation {
13106        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
13107            &mut self.0.options
13108        }
13109    }
13110}
13111
13112#[cfg(feature = "session-service")]
13113#[cfg_attr(docsrs, doc(cfg(feature = "session-service")))]
13114pub mod session_service {
13115    use crate::Result;
13116
13117    /// A builder for [SessionService][crate::client::SessionService].
13118    ///
13119    /// ```
13120    /// # async fn sample() -> gax::client_builder::Result<()> {
13121    /// # use google_cloud_discoveryengine_v1::*;
13122    /// # use builder::session_service::ClientBuilder;
13123    /// # use client::SessionService;
13124    /// let builder : ClientBuilder = SessionService::builder();
13125    /// let client = builder
13126    ///     .with_endpoint("https://discoveryengine.googleapis.com")
13127    ///     .build().await?;
13128    /// # Ok(()) }
13129    /// ```
13130    pub type ClientBuilder =
13131        gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
13132
13133    pub(crate) mod client {
13134        use super::super::super::client::SessionService;
13135        pub struct Factory;
13136        impl gax::client_builder::internal::ClientFactory for Factory {
13137            type Client = SessionService;
13138            type Credentials = gaxi::options::Credentials;
13139            async fn build(
13140                self,
13141                config: gaxi::options::ClientConfig,
13142            ) -> gax::client_builder::Result<Self::Client> {
13143                Self::Client::new(config).await
13144            }
13145        }
13146    }
13147
13148    /// Common implementation for [crate::client::SessionService] request builders.
13149    #[derive(Clone, Debug)]
13150    pub(crate) struct RequestBuilder<R: std::default::Default> {
13151        stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
13152        request: R,
13153        options: gax::options::RequestOptions,
13154    }
13155
13156    impl<R> RequestBuilder<R>
13157    where
13158        R: std::default::Default,
13159    {
13160        pub(crate) fn new(
13161            stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
13162        ) -> Self {
13163            Self {
13164                stub,
13165                request: R::default(),
13166                options: gax::options::RequestOptions::default(),
13167            }
13168        }
13169    }
13170
13171    /// The request builder for [SessionService::create_session][crate::client::SessionService::create_session] calls.
13172    ///
13173    /// # Example
13174    /// ```
13175    /// # use google_cloud_discoveryengine_v1::builder::session_service::CreateSession;
13176    /// # async fn sample() -> gax::Result<()> {
13177    ///
13178    /// let builder = prepare_request_builder();
13179    /// let response = builder.send().await?;
13180    /// # Ok(()) }
13181    ///
13182    /// fn prepare_request_builder() -> CreateSession {
13183    ///   # panic!();
13184    ///   // ... details omitted ...
13185    /// }
13186    /// ```
13187    #[derive(Clone, Debug)]
13188    pub struct CreateSession(RequestBuilder<crate::model::CreateSessionRequest>);
13189
13190    impl CreateSession {
13191        pub(crate) fn new(
13192            stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
13193        ) -> Self {
13194            Self(RequestBuilder::new(stub))
13195        }
13196
13197        /// Sets the full request, replacing any prior values.
13198        pub fn with_request<V: Into<crate::model::CreateSessionRequest>>(mut self, v: V) -> Self {
13199            self.0.request = v.into();
13200            self
13201        }
13202
13203        /// Sets all the options, replacing any prior values.
13204        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
13205            self.0.options = v.into();
13206            self
13207        }
13208
13209        /// Sends the request.
13210        pub async fn send(self) -> Result<crate::model::Session> {
13211            (*self.0.stub)
13212                .create_session(self.0.request, self.0.options)
13213                .await
13214                .map(gax::response::Response::into_body)
13215        }
13216
13217        /// Sets the value of [parent][crate::model::CreateSessionRequest::parent].
13218        ///
13219        /// This is a **required** field for requests.
13220        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
13221            self.0.request.parent = v.into();
13222            self
13223        }
13224
13225        /// Sets the value of [session][crate::model::CreateSessionRequest::session].
13226        ///
13227        /// This is a **required** field for requests.
13228        pub fn set_session<T>(mut self, v: T) -> Self
13229        where
13230            T: std::convert::Into<crate::model::Session>,
13231        {
13232            self.0.request.session = std::option::Option::Some(v.into());
13233            self
13234        }
13235
13236        /// Sets or clears the value of [session][crate::model::CreateSessionRequest::session].
13237        ///
13238        /// This is a **required** field for requests.
13239        pub fn set_or_clear_session<T>(mut self, v: std::option::Option<T>) -> Self
13240        where
13241            T: std::convert::Into<crate::model::Session>,
13242        {
13243            self.0.request.session = v.map(|x| x.into());
13244            self
13245        }
13246    }
13247
13248    #[doc(hidden)]
13249    impl gax::options::internal::RequestBuilder for CreateSession {
13250        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
13251            &mut self.0.options
13252        }
13253    }
13254
13255    /// The request builder for [SessionService::delete_session][crate::client::SessionService::delete_session] calls.
13256    ///
13257    /// # Example
13258    /// ```
13259    /// # use google_cloud_discoveryengine_v1::builder::session_service::DeleteSession;
13260    /// # async fn sample() -> gax::Result<()> {
13261    ///
13262    /// let builder = prepare_request_builder();
13263    /// let response = builder.send().await?;
13264    /// # Ok(()) }
13265    ///
13266    /// fn prepare_request_builder() -> DeleteSession {
13267    ///   # panic!();
13268    ///   // ... details omitted ...
13269    /// }
13270    /// ```
13271    #[derive(Clone, Debug)]
13272    pub struct DeleteSession(RequestBuilder<crate::model::DeleteSessionRequest>);
13273
13274    impl DeleteSession {
13275        pub(crate) fn new(
13276            stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
13277        ) -> Self {
13278            Self(RequestBuilder::new(stub))
13279        }
13280
13281        /// Sets the full request, replacing any prior values.
13282        pub fn with_request<V: Into<crate::model::DeleteSessionRequest>>(mut self, v: V) -> Self {
13283            self.0.request = v.into();
13284            self
13285        }
13286
13287        /// Sets all the options, replacing any prior values.
13288        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
13289            self.0.options = v.into();
13290            self
13291        }
13292
13293        /// Sends the request.
13294        pub async fn send(self) -> Result<()> {
13295            (*self.0.stub)
13296                .delete_session(self.0.request, self.0.options)
13297                .await
13298                .map(gax::response::Response::into_body)
13299        }
13300
13301        /// Sets the value of [name][crate::model::DeleteSessionRequest::name].
13302        ///
13303        /// This is a **required** field for requests.
13304        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13305            self.0.request.name = v.into();
13306            self
13307        }
13308    }
13309
13310    #[doc(hidden)]
13311    impl gax::options::internal::RequestBuilder for DeleteSession {
13312        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
13313            &mut self.0.options
13314        }
13315    }
13316
13317    /// The request builder for [SessionService::update_session][crate::client::SessionService::update_session] calls.
13318    ///
13319    /// # Example
13320    /// ```
13321    /// # use google_cloud_discoveryengine_v1::builder::session_service::UpdateSession;
13322    /// # async fn sample() -> gax::Result<()> {
13323    ///
13324    /// let builder = prepare_request_builder();
13325    /// let response = builder.send().await?;
13326    /// # Ok(()) }
13327    ///
13328    /// fn prepare_request_builder() -> UpdateSession {
13329    ///   # panic!();
13330    ///   // ... details omitted ...
13331    /// }
13332    /// ```
13333    #[derive(Clone, Debug)]
13334    pub struct UpdateSession(RequestBuilder<crate::model::UpdateSessionRequest>);
13335
13336    impl UpdateSession {
13337        pub(crate) fn new(
13338            stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
13339        ) -> Self {
13340            Self(RequestBuilder::new(stub))
13341        }
13342
13343        /// Sets the full request, replacing any prior values.
13344        pub fn with_request<V: Into<crate::model::UpdateSessionRequest>>(mut self, v: V) -> Self {
13345            self.0.request = v.into();
13346            self
13347        }
13348
13349        /// Sets all the options, replacing any prior values.
13350        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
13351            self.0.options = v.into();
13352            self
13353        }
13354
13355        /// Sends the request.
13356        pub async fn send(self) -> Result<crate::model::Session> {
13357            (*self.0.stub)
13358                .update_session(self.0.request, self.0.options)
13359                .await
13360                .map(gax::response::Response::into_body)
13361        }
13362
13363        /// Sets the value of [session][crate::model::UpdateSessionRequest::session].
13364        ///
13365        /// This is a **required** field for requests.
13366        pub fn set_session<T>(mut self, v: T) -> Self
13367        where
13368            T: std::convert::Into<crate::model::Session>,
13369        {
13370            self.0.request.session = std::option::Option::Some(v.into());
13371            self
13372        }
13373
13374        /// Sets or clears the value of [session][crate::model::UpdateSessionRequest::session].
13375        ///
13376        /// This is a **required** field for requests.
13377        pub fn set_or_clear_session<T>(mut self, v: std::option::Option<T>) -> Self
13378        where
13379            T: std::convert::Into<crate::model::Session>,
13380        {
13381            self.0.request.session = v.map(|x| x.into());
13382            self
13383        }
13384
13385        /// Sets the value of [update_mask][crate::model::UpdateSessionRequest::update_mask].
13386        pub fn set_update_mask<T>(mut self, v: T) -> Self
13387        where
13388            T: std::convert::Into<wkt::FieldMask>,
13389        {
13390            self.0.request.update_mask = std::option::Option::Some(v.into());
13391            self
13392        }
13393
13394        /// Sets or clears the value of [update_mask][crate::model::UpdateSessionRequest::update_mask].
13395        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
13396        where
13397            T: std::convert::Into<wkt::FieldMask>,
13398        {
13399            self.0.request.update_mask = v.map(|x| x.into());
13400            self
13401        }
13402    }
13403
13404    #[doc(hidden)]
13405    impl gax::options::internal::RequestBuilder for UpdateSession {
13406        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
13407            &mut self.0.options
13408        }
13409    }
13410
13411    /// The request builder for [SessionService::get_session][crate::client::SessionService::get_session] calls.
13412    ///
13413    /// # Example
13414    /// ```
13415    /// # use google_cloud_discoveryengine_v1::builder::session_service::GetSession;
13416    /// # async fn sample() -> gax::Result<()> {
13417    ///
13418    /// let builder = prepare_request_builder();
13419    /// let response = builder.send().await?;
13420    /// # Ok(()) }
13421    ///
13422    /// fn prepare_request_builder() -> GetSession {
13423    ///   # panic!();
13424    ///   // ... details omitted ...
13425    /// }
13426    /// ```
13427    #[derive(Clone, Debug)]
13428    pub struct GetSession(RequestBuilder<crate::model::GetSessionRequest>);
13429
13430    impl GetSession {
13431        pub(crate) fn new(
13432            stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
13433        ) -> Self {
13434            Self(RequestBuilder::new(stub))
13435        }
13436
13437        /// Sets the full request, replacing any prior values.
13438        pub fn with_request<V: Into<crate::model::GetSessionRequest>>(mut self, v: V) -> Self {
13439            self.0.request = v.into();
13440            self
13441        }
13442
13443        /// Sets all the options, replacing any prior values.
13444        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
13445            self.0.options = v.into();
13446            self
13447        }
13448
13449        /// Sends the request.
13450        pub async fn send(self) -> Result<crate::model::Session> {
13451            (*self.0.stub)
13452                .get_session(self.0.request, self.0.options)
13453                .await
13454                .map(gax::response::Response::into_body)
13455        }
13456
13457        /// Sets the value of [name][crate::model::GetSessionRequest::name].
13458        ///
13459        /// This is a **required** field for requests.
13460        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13461            self.0.request.name = v.into();
13462            self
13463        }
13464
13465        /// Sets the value of [include_answer_details][crate::model::GetSessionRequest::include_answer_details].
13466        pub fn set_include_answer_details<T: Into<bool>>(mut self, v: T) -> Self {
13467            self.0.request.include_answer_details = v.into();
13468            self
13469        }
13470    }
13471
13472    #[doc(hidden)]
13473    impl gax::options::internal::RequestBuilder for GetSession {
13474        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
13475            &mut self.0.options
13476        }
13477    }
13478
13479    /// The request builder for [SessionService::list_sessions][crate::client::SessionService::list_sessions] calls.
13480    ///
13481    /// # Example
13482    /// ```
13483    /// # use google_cloud_discoveryengine_v1::builder::session_service::ListSessions;
13484    /// # async fn sample() -> gax::Result<()> {
13485    /// use gax::paginator::ItemPaginator;
13486    ///
13487    /// let builder = prepare_request_builder();
13488    /// let mut items = builder.by_item();
13489    /// while let Some(result) = items.next().await {
13490    ///   let item = result?;
13491    /// }
13492    /// # Ok(()) }
13493    ///
13494    /// fn prepare_request_builder() -> ListSessions {
13495    ///   # panic!();
13496    ///   // ... details omitted ...
13497    /// }
13498    /// ```
13499    #[derive(Clone, Debug)]
13500    pub struct ListSessions(RequestBuilder<crate::model::ListSessionsRequest>);
13501
13502    impl ListSessions {
13503        pub(crate) fn new(
13504            stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
13505        ) -> Self {
13506            Self(RequestBuilder::new(stub))
13507        }
13508
13509        /// Sets the full request, replacing any prior values.
13510        pub fn with_request<V: Into<crate::model::ListSessionsRequest>>(mut self, v: V) -> Self {
13511            self.0.request = v.into();
13512            self
13513        }
13514
13515        /// Sets all the options, replacing any prior values.
13516        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
13517            self.0.options = v.into();
13518            self
13519        }
13520
13521        /// Sends the request.
13522        pub async fn send(self) -> Result<crate::model::ListSessionsResponse> {
13523            (*self.0.stub)
13524                .list_sessions(self.0.request, self.0.options)
13525                .await
13526                .map(gax::response::Response::into_body)
13527        }
13528
13529        /// Streams each page in the collection.
13530        pub fn by_page(
13531            self,
13532        ) -> impl gax::paginator::Paginator<crate::model::ListSessionsResponse, gax::error::Error>
13533        {
13534            use std::clone::Clone;
13535            let token = self.0.request.page_token.clone();
13536            let execute = move |token: String| {
13537                let mut builder = self.clone();
13538                builder.0.request = builder.0.request.set_page_token(token);
13539                builder.send()
13540            };
13541            gax::paginator::internal::new_paginator(token, execute)
13542        }
13543
13544        /// Streams each item in the collection.
13545        pub fn by_item(
13546            self,
13547        ) -> impl gax::paginator::ItemPaginator<crate::model::ListSessionsResponse, gax::error::Error>
13548        {
13549            use gax::paginator::Paginator;
13550            self.by_page().items()
13551        }
13552
13553        /// Sets the value of [parent][crate::model::ListSessionsRequest::parent].
13554        ///
13555        /// This is a **required** field for requests.
13556        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
13557            self.0.request.parent = v.into();
13558            self
13559        }
13560
13561        /// Sets the value of [page_size][crate::model::ListSessionsRequest::page_size].
13562        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
13563            self.0.request.page_size = v.into();
13564            self
13565        }
13566
13567        /// Sets the value of [page_token][crate::model::ListSessionsRequest::page_token].
13568        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
13569            self.0.request.page_token = v.into();
13570            self
13571        }
13572
13573        /// Sets the value of [filter][crate::model::ListSessionsRequest::filter].
13574        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
13575            self.0.request.filter = v.into();
13576            self
13577        }
13578
13579        /// Sets the value of [order_by][crate::model::ListSessionsRequest::order_by].
13580        pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
13581            self.0.request.order_by = v.into();
13582            self
13583        }
13584    }
13585
13586    #[doc(hidden)]
13587    impl gax::options::internal::RequestBuilder for ListSessions {
13588        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
13589            &mut self.0.options
13590        }
13591    }
13592
13593    /// The request builder for [SessionService::list_operations][crate::client::SessionService::list_operations] calls.
13594    ///
13595    /// # Example
13596    /// ```
13597    /// # use google_cloud_discoveryengine_v1::builder::session_service::ListOperations;
13598    /// # async fn sample() -> gax::Result<()> {
13599    /// use gax::paginator::ItemPaginator;
13600    ///
13601    /// let builder = prepare_request_builder();
13602    /// let mut items = builder.by_item();
13603    /// while let Some(result) = items.next().await {
13604    ///   let item = result?;
13605    /// }
13606    /// # Ok(()) }
13607    ///
13608    /// fn prepare_request_builder() -> ListOperations {
13609    ///   # panic!();
13610    ///   // ... details omitted ...
13611    /// }
13612    /// ```
13613    #[derive(Clone, Debug)]
13614    pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
13615
13616    impl ListOperations {
13617        pub(crate) fn new(
13618            stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
13619        ) -> Self {
13620            Self(RequestBuilder::new(stub))
13621        }
13622
13623        /// Sets the full request, replacing any prior values.
13624        pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
13625            mut self,
13626            v: V,
13627        ) -> Self {
13628            self.0.request = v.into();
13629            self
13630        }
13631
13632        /// Sets all the options, replacing any prior values.
13633        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
13634            self.0.options = v.into();
13635            self
13636        }
13637
13638        /// Sends the request.
13639        pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
13640            (*self.0.stub)
13641                .list_operations(self.0.request, self.0.options)
13642                .await
13643                .map(gax::response::Response::into_body)
13644        }
13645
13646        /// Streams each page in the collection.
13647        pub fn by_page(
13648            self,
13649        ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
13650        {
13651            use std::clone::Clone;
13652            let token = self.0.request.page_token.clone();
13653            let execute = move |token: String| {
13654                let mut builder = self.clone();
13655                builder.0.request = builder.0.request.set_page_token(token);
13656                builder.send()
13657            };
13658            gax::paginator::internal::new_paginator(token, execute)
13659        }
13660
13661        /// Streams each item in the collection.
13662        pub fn by_item(
13663            self,
13664        ) -> impl gax::paginator::ItemPaginator<
13665            longrunning::model::ListOperationsResponse,
13666            gax::error::Error,
13667        > {
13668            use gax::paginator::Paginator;
13669            self.by_page().items()
13670        }
13671
13672        /// Sets the value of [name][longrunning::model::ListOperationsRequest::name].
13673        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13674            self.0.request.name = v.into();
13675            self
13676        }
13677
13678        /// Sets the value of [filter][longrunning::model::ListOperationsRequest::filter].
13679        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
13680            self.0.request.filter = v.into();
13681            self
13682        }
13683
13684        /// Sets the value of [page_size][longrunning::model::ListOperationsRequest::page_size].
13685        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
13686            self.0.request.page_size = v.into();
13687            self
13688        }
13689
13690        /// Sets the value of [page_token][longrunning::model::ListOperationsRequest::page_token].
13691        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
13692            self.0.request.page_token = v.into();
13693            self
13694        }
13695
13696        /// Sets the value of [return_partial_success][longrunning::model::ListOperationsRequest::return_partial_success].
13697        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
13698            self.0.request.return_partial_success = v.into();
13699            self
13700        }
13701    }
13702
13703    #[doc(hidden)]
13704    impl gax::options::internal::RequestBuilder for ListOperations {
13705        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
13706            &mut self.0.options
13707        }
13708    }
13709
13710    /// The request builder for [SessionService::get_operation][crate::client::SessionService::get_operation] calls.
13711    ///
13712    /// # Example
13713    /// ```
13714    /// # use google_cloud_discoveryengine_v1::builder::session_service::GetOperation;
13715    /// # async fn sample() -> gax::Result<()> {
13716    ///
13717    /// let builder = prepare_request_builder();
13718    /// let response = builder.send().await?;
13719    /// # Ok(()) }
13720    ///
13721    /// fn prepare_request_builder() -> GetOperation {
13722    ///   # panic!();
13723    ///   // ... details omitted ...
13724    /// }
13725    /// ```
13726    #[derive(Clone, Debug)]
13727    pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
13728
13729    impl GetOperation {
13730        pub(crate) fn new(
13731            stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
13732        ) -> Self {
13733            Self(RequestBuilder::new(stub))
13734        }
13735
13736        /// Sets the full request, replacing any prior values.
13737        pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
13738            mut self,
13739            v: V,
13740        ) -> Self {
13741            self.0.request = v.into();
13742            self
13743        }
13744
13745        /// Sets all the options, replacing any prior values.
13746        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
13747            self.0.options = v.into();
13748            self
13749        }
13750
13751        /// Sends the request.
13752        pub async fn send(self) -> Result<longrunning::model::Operation> {
13753            (*self.0.stub)
13754                .get_operation(self.0.request, self.0.options)
13755                .await
13756                .map(gax::response::Response::into_body)
13757        }
13758
13759        /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
13760        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13761            self.0.request.name = v.into();
13762            self
13763        }
13764    }
13765
13766    #[doc(hidden)]
13767    impl gax::options::internal::RequestBuilder for GetOperation {
13768        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
13769            &mut self.0.options
13770        }
13771    }
13772
13773    /// The request builder for [SessionService::cancel_operation][crate::client::SessionService::cancel_operation] calls.
13774    ///
13775    /// # Example
13776    /// ```
13777    /// # use google_cloud_discoveryengine_v1::builder::session_service::CancelOperation;
13778    /// # async fn sample() -> gax::Result<()> {
13779    ///
13780    /// let builder = prepare_request_builder();
13781    /// let response = builder.send().await?;
13782    /// # Ok(()) }
13783    ///
13784    /// fn prepare_request_builder() -> CancelOperation {
13785    ///   # panic!();
13786    ///   // ... details omitted ...
13787    /// }
13788    /// ```
13789    #[derive(Clone, Debug)]
13790    pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
13791
13792    impl CancelOperation {
13793        pub(crate) fn new(
13794            stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
13795        ) -> Self {
13796            Self(RequestBuilder::new(stub))
13797        }
13798
13799        /// Sets the full request, replacing any prior values.
13800        pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
13801            mut self,
13802            v: V,
13803        ) -> Self {
13804            self.0.request = v.into();
13805            self
13806        }
13807
13808        /// Sets all the options, replacing any prior values.
13809        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
13810            self.0.options = v.into();
13811            self
13812        }
13813
13814        /// Sends the request.
13815        pub async fn send(self) -> Result<()> {
13816            (*self.0.stub)
13817                .cancel_operation(self.0.request, self.0.options)
13818                .await
13819                .map(gax::response::Response::into_body)
13820        }
13821
13822        /// Sets the value of [name][longrunning::model::CancelOperationRequest::name].
13823        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13824            self.0.request.name = v.into();
13825            self
13826        }
13827    }
13828
13829    #[doc(hidden)]
13830    impl gax::options::internal::RequestBuilder for CancelOperation {
13831        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
13832            &mut self.0.options
13833        }
13834    }
13835}
13836
13837#[cfg(feature = "site-search-engine-service")]
13838#[cfg_attr(docsrs, doc(cfg(feature = "site-search-engine-service")))]
13839pub mod site_search_engine_service {
13840    use crate::Result;
13841
13842    /// A builder for [SiteSearchEngineService][crate::client::SiteSearchEngineService].
13843    ///
13844    /// ```
13845    /// # async fn sample() -> gax::client_builder::Result<()> {
13846    /// # use google_cloud_discoveryengine_v1::*;
13847    /// # use builder::site_search_engine_service::ClientBuilder;
13848    /// # use client::SiteSearchEngineService;
13849    /// let builder : ClientBuilder = SiteSearchEngineService::builder();
13850    /// let client = builder
13851    ///     .with_endpoint("https://discoveryengine.googleapis.com")
13852    ///     .build().await?;
13853    /// # Ok(()) }
13854    /// ```
13855    pub type ClientBuilder =
13856        gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
13857
13858    pub(crate) mod client {
13859        use super::super::super::client::SiteSearchEngineService;
13860        pub struct Factory;
13861        impl gax::client_builder::internal::ClientFactory for Factory {
13862            type Client = SiteSearchEngineService;
13863            type Credentials = gaxi::options::Credentials;
13864            async fn build(
13865                self,
13866                config: gaxi::options::ClientConfig,
13867            ) -> gax::client_builder::Result<Self::Client> {
13868                Self::Client::new(config).await
13869            }
13870        }
13871    }
13872
13873    /// Common implementation for [crate::client::SiteSearchEngineService] request builders.
13874    #[derive(Clone, Debug)]
13875    pub(crate) struct RequestBuilder<R: std::default::Default> {
13876        stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
13877        request: R,
13878        options: gax::options::RequestOptions,
13879    }
13880
13881    impl<R> RequestBuilder<R>
13882    where
13883        R: std::default::Default,
13884    {
13885        pub(crate) fn new(
13886            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
13887        ) -> Self {
13888            Self {
13889                stub,
13890                request: R::default(),
13891                options: gax::options::RequestOptions::default(),
13892            }
13893        }
13894    }
13895
13896    /// The request builder for [SiteSearchEngineService::get_site_search_engine][crate::client::SiteSearchEngineService::get_site_search_engine] calls.
13897    ///
13898    /// # Example
13899    /// ```
13900    /// # use google_cloud_discoveryengine_v1::builder::site_search_engine_service::GetSiteSearchEngine;
13901    /// # async fn sample() -> gax::Result<()> {
13902    ///
13903    /// let builder = prepare_request_builder();
13904    /// let response = builder.send().await?;
13905    /// # Ok(()) }
13906    ///
13907    /// fn prepare_request_builder() -> GetSiteSearchEngine {
13908    ///   # panic!();
13909    ///   // ... details omitted ...
13910    /// }
13911    /// ```
13912    #[derive(Clone, Debug)]
13913    pub struct GetSiteSearchEngine(RequestBuilder<crate::model::GetSiteSearchEngineRequest>);
13914
13915    impl GetSiteSearchEngine {
13916        pub(crate) fn new(
13917            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
13918        ) -> Self {
13919            Self(RequestBuilder::new(stub))
13920        }
13921
13922        /// Sets the full request, replacing any prior values.
13923        pub fn with_request<V: Into<crate::model::GetSiteSearchEngineRequest>>(
13924            mut self,
13925            v: V,
13926        ) -> Self {
13927            self.0.request = v.into();
13928            self
13929        }
13930
13931        /// Sets all the options, replacing any prior values.
13932        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
13933            self.0.options = v.into();
13934            self
13935        }
13936
13937        /// Sends the request.
13938        pub async fn send(self) -> Result<crate::model::SiteSearchEngine> {
13939            (*self.0.stub)
13940                .get_site_search_engine(self.0.request, self.0.options)
13941                .await
13942                .map(gax::response::Response::into_body)
13943        }
13944
13945        /// Sets the value of [name][crate::model::GetSiteSearchEngineRequest::name].
13946        ///
13947        /// This is a **required** field for requests.
13948        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13949            self.0.request.name = v.into();
13950            self
13951        }
13952    }
13953
13954    #[doc(hidden)]
13955    impl gax::options::internal::RequestBuilder for GetSiteSearchEngine {
13956        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
13957            &mut self.0.options
13958        }
13959    }
13960
13961    /// The request builder for [SiteSearchEngineService::create_target_site][crate::client::SiteSearchEngineService::create_target_site] calls.
13962    ///
13963    /// # Example
13964    /// ```
13965    /// # use google_cloud_discoveryengine_v1::builder::site_search_engine_service::CreateTargetSite;
13966    /// # async fn sample() -> gax::Result<()> {
13967    /// use lro::Poller;
13968    ///
13969    /// let builder = prepare_request_builder();
13970    /// let response = builder.poller().until_done().await?;
13971    /// # Ok(()) }
13972    ///
13973    /// fn prepare_request_builder() -> CreateTargetSite {
13974    ///   # panic!();
13975    ///   // ... details omitted ...
13976    /// }
13977    /// ```
13978    #[derive(Clone, Debug)]
13979    pub struct CreateTargetSite(RequestBuilder<crate::model::CreateTargetSiteRequest>);
13980
13981    impl CreateTargetSite {
13982        pub(crate) fn new(
13983            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
13984        ) -> Self {
13985            Self(RequestBuilder::new(stub))
13986        }
13987
13988        /// Sets the full request, replacing any prior values.
13989        pub fn with_request<V: Into<crate::model::CreateTargetSiteRequest>>(
13990            mut self,
13991            v: V,
13992        ) -> Self {
13993            self.0.request = v.into();
13994            self
13995        }
13996
13997        /// Sets all the options, replacing any prior values.
13998        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
13999            self.0.options = v.into();
14000            self
14001        }
14002
14003        /// Sends the request.
14004        ///
14005        /// # Long running operations
14006        ///
14007        /// This starts, but does not poll, a longrunning operation. More information
14008        /// on [create_target_site][crate::client::SiteSearchEngineService::create_target_site].
14009        pub async fn send(self) -> Result<longrunning::model::Operation> {
14010            (*self.0.stub)
14011                .create_target_site(self.0.request, self.0.options)
14012                .await
14013                .map(gax::response::Response::into_body)
14014        }
14015
14016        /// Creates a [Poller][lro::Poller] to work with `create_target_site`.
14017        pub fn poller(
14018            self,
14019        ) -> impl lro::Poller<crate::model::TargetSite, crate::model::CreateTargetSiteMetadata>
14020        {
14021            type Operation = lro::internal::Operation<
14022                crate::model::TargetSite,
14023                crate::model::CreateTargetSiteMetadata,
14024            >;
14025            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
14026            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
14027
14028            let stub = self.0.stub.clone();
14029            let mut options = self.0.options.clone();
14030            options.set_retry_policy(gax::retry_policy::NeverRetry);
14031            let query = move |name| {
14032                let stub = stub.clone();
14033                let options = options.clone();
14034                async {
14035                    let op = GetOperation::new(stub)
14036                        .set_name(name)
14037                        .with_options(options)
14038                        .send()
14039                        .await?;
14040                    Ok(Operation::new(op))
14041                }
14042            };
14043
14044            let start = move || async {
14045                let op = self.send().await?;
14046                Ok(Operation::new(op))
14047            };
14048
14049            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
14050        }
14051
14052        /// Sets the value of [parent][crate::model::CreateTargetSiteRequest::parent].
14053        ///
14054        /// This is a **required** field for requests.
14055        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
14056            self.0.request.parent = v.into();
14057            self
14058        }
14059
14060        /// Sets the value of [target_site][crate::model::CreateTargetSiteRequest::target_site].
14061        ///
14062        /// This is a **required** field for requests.
14063        pub fn set_target_site<T>(mut self, v: T) -> Self
14064        where
14065            T: std::convert::Into<crate::model::TargetSite>,
14066        {
14067            self.0.request.target_site = std::option::Option::Some(v.into());
14068            self
14069        }
14070
14071        /// Sets or clears the value of [target_site][crate::model::CreateTargetSiteRequest::target_site].
14072        ///
14073        /// This is a **required** field for requests.
14074        pub fn set_or_clear_target_site<T>(mut self, v: std::option::Option<T>) -> Self
14075        where
14076            T: std::convert::Into<crate::model::TargetSite>,
14077        {
14078            self.0.request.target_site = v.map(|x| x.into());
14079            self
14080        }
14081    }
14082
14083    #[doc(hidden)]
14084    impl gax::options::internal::RequestBuilder for CreateTargetSite {
14085        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
14086            &mut self.0.options
14087        }
14088    }
14089
14090    /// The request builder for [SiteSearchEngineService::batch_create_target_sites][crate::client::SiteSearchEngineService::batch_create_target_sites] calls.
14091    ///
14092    /// # Example
14093    /// ```
14094    /// # use google_cloud_discoveryengine_v1::builder::site_search_engine_service::BatchCreateTargetSites;
14095    /// # async fn sample() -> gax::Result<()> {
14096    /// use lro::Poller;
14097    ///
14098    /// let builder = prepare_request_builder();
14099    /// let response = builder.poller().until_done().await?;
14100    /// # Ok(()) }
14101    ///
14102    /// fn prepare_request_builder() -> BatchCreateTargetSites {
14103    ///   # panic!();
14104    ///   // ... details omitted ...
14105    /// }
14106    /// ```
14107    #[derive(Clone, Debug)]
14108    pub struct BatchCreateTargetSites(RequestBuilder<crate::model::BatchCreateTargetSitesRequest>);
14109
14110    impl BatchCreateTargetSites {
14111        pub(crate) fn new(
14112            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14113        ) -> Self {
14114            Self(RequestBuilder::new(stub))
14115        }
14116
14117        /// Sets the full request, replacing any prior values.
14118        pub fn with_request<V: Into<crate::model::BatchCreateTargetSitesRequest>>(
14119            mut self,
14120            v: V,
14121        ) -> Self {
14122            self.0.request = v.into();
14123            self
14124        }
14125
14126        /// Sets all the options, replacing any prior values.
14127        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
14128            self.0.options = v.into();
14129            self
14130        }
14131
14132        /// Sends the request.
14133        ///
14134        /// # Long running operations
14135        ///
14136        /// This starts, but does not poll, a longrunning operation. More information
14137        /// on [batch_create_target_sites][crate::client::SiteSearchEngineService::batch_create_target_sites].
14138        pub async fn send(self) -> Result<longrunning::model::Operation> {
14139            (*self.0.stub)
14140                .batch_create_target_sites(self.0.request, self.0.options)
14141                .await
14142                .map(gax::response::Response::into_body)
14143        }
14144
14145        /// Creates a [Poller][lro::Poller] to work with `batch_create_target_sites`.
14146        pub fn poller(
14147            self,
14148        ) -> impl lro::Poller<
14149            crate::model::BatchCreateTargetSitesResponse,
14150            crate::model::BatchCreateTargetSiteMetadata,
14151        > {
14152            type Operation = lro::internal::Operation<
14153                crate::model::BatchCreateTargetSitesResponse,
14154                crate::model::BatchCreateTargetSiteMetadata,
14155            >;
14156            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
14157            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
14158
14159            let stub = self.0.stub.clone();
14160            let mut options = self.0.options.clone();
14161            options.set_retry_policy(gax::retry_policy::NeverRetry);
14162            let query = move |name| {
14163                let stub = stub.clone();
14164                let options = options.clone();
14165                async {
14166                    let op = GetOperation::new(stub)
14167                        .set_name(name)
14168                        .with_options(options)
14169                        .send()
14170                        .await?;
14171                    Ok(Operation::new(op))
14172                }
14173            };
14174
14175            let start = move || async {
14176                let op = self.send().await?;
14177                Ok(Operation::new(op))
14178            };
14179
14180            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
14181        }
14182
14183        /// Sets the value of [parent][crate::model::BatchCreateTargetSitesRequest::parent].
14184        ///
14185        /// This is a **required** field for requests.
14186        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
14187            self.0.request.parent = v.into();
14188            self
14189        }
14190
14191        /// Sets the value of [requests][crate::model::BatchCreateTargetSitesRequest::requests].
14192        ///
14193        /// This is a **required** field for requests.
14194        pub fn set_requests<T, V>(mut self, v: T) -> Self
14195        where
14196            T: std::iter::IntoIterator<Item = V>,
14197            V: std::convert::Into<crate::model::CreateTargetSiteRequest>,
14198        {
14199            use std::iter::Iterator;
14200            self.0.request.requests = v.into_iter().map(|i| i.into()).collect();
14201            self
14202        }
14203    }
14204
14205    #[doc(hidden)]
14206    impl gax::options::internal::RequestBuilder for BatchCreateTargetSites {
14207        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
14208            &mut self.0.options
14209        }
14210    }
14211
14212    /// The request builder for [SiteSearchEngineService::get_target_site][crate::client::SiteSearchEngineService::get_target_site] calls.
14213    ///
14214    /// # Example
14215    /// ```
14216    /// # use google_cloud_discoveryengine_v1::builder::site_search_engine_service::GetTargetSite;
14217    /// # async fn sample() -> gax::Result<()> {
14218    ///
14219    /// let builder = prepare_request_builder();
14220    /// let response = builder.send().await?;
14221    /// # Ok(()) }
14222    ///
14223    /// fn prepare_request_builder() -> GetTargetSite {
14224    ///   # panic!();
14225    ///   // ... details omitted ...
14226    /// }
14227    /// ```
14228    #[derive(Clone, Debug)]
14229    pub struct GetTargetSite(RequestBuilder<crate::model::GetTargetSiteRequest>);
14230
14231    impl GetTargetSite {
14232        pub(crate) fn new(
14233            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14234        ) -> Self {
14235            Self(RequestBuilder::new(stub))
14236        }
14237
14238        /// Sets the full request, replacing any prior values.
14239        pub fn with_request<V: Into<crate::model::GetTargetSiteRequest>>(mut self, v: V) -> Self {
14240            self.0.request = v.into();
14241            self
14242        }
14243
14244        /// Sets all the options, replacing any prior values.
14245        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
14246            self.0.options = v.into();
14247            self
14248        }
14249
14250        /// Sends the request.
14251        pub async fn send(self) -> Result<crate::model::TargetSite> {
14252            (*self.0.stub)
14253                .get_target_site(self.0.request, self.0.options)
14254                .await
14255                .map(gax::response::Response::into_body)
14256        }
14257
14258        /// Sets the value of [name][crate::model::GetTargetSiteRequest::name].
14259        ///
14260        /// This is a **required** field for requests.
14261        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
14262            self.0.request.name = v.into();
14263            self
14264        }
14265    }
14266
14267    #[doc(hidden)]
14268    impl gax::options::internal::RequestBuilder for GetTargetSite {
14269        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
14270            &mut self.0.options
14271        }
14272    }
14273
14274    /// The request builder for [SiteSearchEngineService::update_target_site][crate::client::SiteSearchEngineService::update_target_site] calls.
14275    ///
14276    /// # Example
14277    /// ```
14278    /// # use google_cloud_discoveryengine_v1::builder::site_search_engine_service::UpdateTargetSite;
14279    /// # async fn sample() -> gax::Result<()> {
14280    /// use lro::Poller;
14281    ///
14282    /// let builder = prepare_request_builder();
14283    /// let response = builder.poller().until_done().await?;
14284    /// # Ok(()) }
14285    ///
14286    /// fn prepare_request_builder() -> UpdateTargetSite {
14287    ///   # panic!();
14288    ///   // ... details omitted ...
14289    /// }
14290    /// ```
14291    #[derive(Clone, Debug)]
14292    pub struct UpdateTargetSite(RequestBuilder<crate::model::UpdateTargetSiteRequest>);
14293
14294    impl UpdateTargetSite {
14295        pub(crate) fn new(
14296            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14297        ) -> Self {
14298            Self(RequestBuilder::new(stub))
14299        }
14300
14301        /// Sets the full request, replacing any prior values.
14302        pub fn with_request<V: Into<crate::model::UpdateTargetSiteRequest>>(
14303            mut self,
14304            v: V,
14305        ) -> Self {
14306            self.0.request = v.into();
14307            self
14308        }
14309
14310        /// Sets all the options, replacing any prior values.
14311        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
14312            self.0.options = v.into();
14313            self
14314        }
14315
14316        /// Sends the request.
14317        ///
14318        /// # Long running operations
14319        ///
14320        /// This starts, but does not poll, a longrunning operation. More information
14321        /// on [update_target_site][crate::client::SiteSearchEngineService::update_target_site].
14322        pub async fn send(self) -> Result<longrunning::model::Operation> {
14323            (*self.0.stub)
14324                .update_target_site(self.0.request, self.0.options)
14325                .await
14326                .map(gax::response::Response::into_body)
14327        }
14328
14329        /// Creates a [Poller][lro::Poller] to work with `update_target_site`.
14330        pub fn poller(
14331            self,
14332        ) -> impl lro::Poller<crate::model::TargetSite, crate::model::UpdateTargetSiteMetadata>
14333        {
14334            type Operation = lro::internal::Operation<
14335                crate::model::TargetSite,
14336                crate::model::UpdateTargetSiteMetadata,
14337            >;
14338            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
14339            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
14340
14341            let stub = self.0.stub.clone();
14342            let mut options = self.0.options.clone();
14343            options.set_retry_policy(gax::retry_policy::NeverRetry);
14344            let query = move |name| {
14345                let stub = stub.clone();
14346                let options = options.clone();
14347                async {
14348                    let op = GetOperation::new(stub)
14349                        .set_name(name)
14350                        .with_options(options)
14351                        .send()
14352                        .await?;
14353                    Ok(Operation::new(op))
14354                }
14355            };
14356
14357            let start = move || async {
14358                let op = self.send().await?;
14359                Ok(Operation::new(op))
14360            };
14361
14362            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
14363        }
14364
14365        /// Sets the value of [target_site][crate::model::UpdateTargetSiteRequest::target_site].
14366        ///
14367        /// This is a **required** field for requests.
14368        pub fn set_target_site<T>(mut self, v: T) -> Self
14369        where
14370            T: std::convert::Into<crate::model::TargetSite>,
14371        {
14372            self.0.request.target_site = std::option::Option::Some(v.into());
14373            self
14374        }
14375
14376        /// Sets or clears the value of [target_site][crate::model::UpdateTargetSiteRequest::target_site].
14377        ///
14378        /// This is a **required** field for requests.
14379        pub fn set_or_clear_target_site<T>(mut self, v: std::option::Option<T>) -> Self
14380        where
14381            T: std::convert::Into<crate::model::TargetSite>,
14382        {
14383            self.0.request.target_site = v.map(|x| x.into());
14384            self
14385        }
14386    }
14387
14388    #[doc(hidden)]
14389    impl gax::options::internal::RequestBuilder for UpdateTargetSite {
14390        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
14391            &mut self.0.options
14392        }
14393    }
14394
14395    /// The request builder for [SiteSearchEngineService::delete_target_site][crate::client::SiteSearchEngineService::delete_target_site] calls.
14396    ///
14397    /// # Example
14398    /// ```
14399    /// # use google_cloud_discoveryengine_v1::builder::site_search_engine_service::DeleteTargetSite;
14400    /// # async fn sample() -> gax::Result<()> {
14401    /// use lro::Poller;
14402    ///
14403    /// let builder = prepare_request_builder();
14404    /// let response = builder.poller().until_done().await?;
14405    /// # Ok(()) }
14406    ///
14407    /// fn prepare_request_builder() -> DeleteTargetSite {
14408    ///   # panic!();
14409    ///   // ... details omitted ...
14410    /// }
14411    /// ```
14412    #[derive(Clone, Debug)]
14413    pub struct DeleteTargetSite(RequestBuilder<crate::model::DeleteTargetSiteRequest>);
14414
14415    impl DeleteTargetSite {
14416        pub(crate) fn new(
14417            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14418        ) -> Self {
14419            Self(RequestBuilder::new(stub))
14420        }
14421
14422        /// Sets the full request, replacing any prior values.
14423        pub fn with_request<V: Into<crate::model::DeleteTargetSiteRequest>>(
14424            mut self,
14425            v: V,
14426        ) -> Self {
14427            self.0.request = v.into();
14428            self
14429        }
14430
14431        /// Sets all the options, replacing any prior values.
14432        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
14433            self.0.options = v.into();
14434            self
14435        }
14436
14437        /// Sends the request.
14438        ///
14439        /// # Long running operations
14440        ///
14441        /// This starts, but does not poll, a longrunning operation. More information
14442        /// on [delete_target_site][crate::client::SiteSearchEngineService::delete_target_site].
14443        pub async fn send(self) -> Result<longrunning::model::Operation> {
14444            (*self.0.stub)
14445                .delete_target_site(self.0.request, self.0.options)
14446                .await
14447                .map(gax::response::Response::into_body)
14448        }
14449
14450        /// Creates a [Poller][lro::Poller] to work with `delete_target_site`.
14451        pub fn poller(self) -> impl lro::Poller<(), crate::model::DeleteTargetSiteMetadata> {
14452            type Operation =
14453                lro::internal::Operation<wkt::Empty, crate::model::DeleteTargetSiteMetadata>;
14454            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
14455            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
14456
14457            let stub = self.0.stub.clone();
14458            let mut options = self.0.options.clone();
14459            options.set_retry_policy(gax::retry_policy::NeverRetry);
14460            let query = move |name| {
14461                let stub = stub.clone();
14462                let options = options.clone();
14463                async {
14464                    let op = GetOperation::new(stub)
14465                        .set_name(name)
14466                        .with_options(options)
14467                        .send()
14468                        .await?;
14469                    Ok(Operation::new(op))
14470                }
14471            };
14472
14473            let start = move || async {
14474                let op = self.send().await?;
14475                Ok(Operation::new(op))
14476            };
14477
14478            lro::internal::new_unit_response_poller(
14479                polling_error_policy,
14480                polling_backoff_policy,
14481                start,
14482                query,
14483            )
14484        }
14485
14486        /// Sets the value of [name][crate::model::DeleteTargetSiteRequest::name].
14487        ///
14488        /// This is a **required** field for requests.
14489        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
14490            self.0.request.name = v.into();
14491            self
14492        }
14493    }
14494
14495    #[doc(hidden)]
14496    impl gax::options::internal::RequestBuilder for DeleteTargetSite {
14497        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
14498            &mut self.0.options
14499        }
14500    }
14501
14502    /// The request builder for [SiteSearchEngineService::list_target_sites][crate::client::SiteSearchEngineService::list_target_sites] calls.
14503    ///
14504    /// # Example
14505    /// ```
14506    /// # use google_cloud_discoveryengine_v1::builder::site_search_engine_service::ListTargetSites;
14507    /// # async fn sample() -> gax::Result<()> {
14508    /// use gax::paginator::ItemPaginator;
14509    ///
14510    /// let builder = prepare_request_builder();
14511    /// let mut items = builder.by_item();
14512    /// while let Some(result) = items.next().await {
14513    ///   let item = result?;
14514    /// }
14515    /// # Ok(()) }
14516    ///
14517    /// fn prepare_request_builder() -> ListTargetSites {
14518    ///   # panic!();
14519    ///   // ... details omitted ...
14520    /// }
14521    /// ```
14522    #[derive(Clone, Debug)]
14523    pub struct ListTargetSites(RequestBuilder<crate::model::ListTargetSitesRequest>);
14524
14525    impl ListTargetSites {
14526        pub(crate) fn new(
14527            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14528        ) -> Self {
14529            Self(RequestBuilder::new(stub))
14530        }
14531
14532        /// Sets the full request, replacing any prior values.
14533        pub fn with_request<V: Into<crate::model::ListTargetSitesRequest>>(mut self, v: V) -> Self {
14534            self.0.request = v.into();
14535            self
14536        }
14537
14538        /// Sets all the options, replacing any prior values.
14539        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
14540            self.0.options = v.into();
14541            self
14542        }
14543
14544        /// Sends the request.
14545        pub async fn send(self) -> Result<crate::model::ListTargetSitesResponse> {
14546            (*self.0.stub)
14547                .list_target_sites(self.0.request, self.0.options)
14548                .await
14549                .map(gax::response::Response::into_body)
14550        }
14551
14552        /// Streams each page in the collection.
14553        pub fn by_page(
14554            self,
14555        ) -> impl gax::paginator::Paginator<crate::model::ListTargetSitesResponse, gax::error::Error>
14556        {
14557            use std::clone::Clone;
14558            let token = self.0.request.page_token.clone();
14559            let execute = move |token: String| {
14560                let mut builder = self.clone();
14561                builder.0.request = builder.0.request.set_page_token(token);
14562                builder.send()
14563            };
14564            gax::paginator::internal::new_paginator(token, execute)
14565        }
14566
14567        /// Streams each item in the collection.
14568        pub fn by_item(
14569            self,
14570        ) -> impl gax::paginator::ItemPaginator<crate::model::ListTargetSitesResponse, gax::error::Error>
14571        {
14572            use gax::paginator::Paginator;
14573            self.by_page().items()
14574        }
14575
14576        /// Sets the value of [parent][crate::model::ListTargetSitesRequest::parent].
14577        ///
14578        /// This is a **required** field for requests.
14579        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
14580            self.0.request.parent = v.into();
14581            self
14582        }
14583
14584        /// Sets the value of [page_size][crate::model::ListTargetSitesRequest::page_size].
14585        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
14586            self.0.request.page_size = v.into();
14587            self
14588        }
14589
14590        /// Sets the value of [page_token][crate::model::ListTargetSitesRequest::page_token].
14591        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
14592            self.0.request.page_token = v.into();
14593            self
14594        }
14595    }
14596
14597    #[doc(hidden)]
14598    impl gax::options::internal::RequestBuilder for ListTargetSites {
14599        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
14600            &mut self.0.options
14601        }
14602    }
14603
14604    /// The request builder for [SiteSearchEngineService::create_sitemap][crate::client::SiteSearchEngineService::create_sitemap] calls.
14605    ///
14606    /// # Example
14607    /// ```
14608    /// # use google_cloud_discoveryengine_v1::builder::site_search_engine_service::CreateSitemap;
14609    /// # async fn sample() -> gax::Result<()> {
14610    /// use lro::Poller;
14611    ///
14612    /// let builder = prepare_request_builder();
14613    /// let response = builder.poller().until_done().await?;
14614    /// # Ok(()) }
14615    ///
14616    /// fn prepare_request_builder() -> CreateSitemap {
14617    ///   # panic!();
14618    ///   // ... details omitted ...
14619    /// }
14620    /// ```
14621    #[derive(Clone, Debug)]
14622    pub struct CreateSitemap(RequestBuilder<crate::model::CreateSitemapRequest>);
14623
14624    impl CreateSitemap {
14625        pub(crate) fn new(
14626            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14627        ) -> Self {
14628            Self(RequestBuilder::new(stub))
14629        }
14630
14631        /// Sets the full request, replacing any prior values.
14632        pub fn with_request<V: Into<crate::model::CreateSitemapRequest>>(mut self, v: V) -> Self {
14633            self.0.request = v.into();
14634            self
14635        }
14636
14637        /// Sets all the options, replacing any prior values.
14638        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
14639            self.0.options = v.into();
14640            self
14641        }
14642
14643        /// Sends the request.
14644        ///
14645        /// # Long running operations
14646        ///
14647        /// This starts, but does not poll, a longrunning operation. More information
14648        /// on [create_sitemap][crate::client::SiteSearchEngineService::create_sitemap].
14649        pub async fn send(self) -> Result<longrunning::model::Operation> {
14650            (*self.0.stub)
14651                .create_sitemap(self.0.request, self.0.options)
14652                .await
14653                .map(gax::response::Response::into_body)
14654        }
14655
14656        /// Creates a [Poller][lro::Poller] to work with `create_sitemap`.
14657        pub fn poller(
14658            self,
14659        ) -> impl lro::Poller<crate::model::Sitemap, crate::model::CreateSitemapMetadata> {
14660            type Operation = lro::internal::Operation<
14661                crate::model::Sitemap,
14662                crate::model::CreateSitemapMetadata,
14663            >;
14664            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
14665            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
14666
14667            let stub = self.0.stub.clone();
14668            let mut options = self.0.options.clone();
14669            options.set_retry_policy(gax::retry_policy::NeverRetry);
14670            let query = move |name| {
14671                let stub = stub.clone();
14672                let options = options.clone();
14673                async {
14674                    let op = GetOperation::new(stub)
14675                        .set_name(name)
14676                        .with_options(options)
14677                        .send()
14678                        .await?;
14679                    Ok(Operation::new(op))
14680                }
14681            };
14682
14683            let start = move || async {
14684                let op = self.send().await?;
14685                Ok(Operation::new(op))
14686            };
14687
14688            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
14689        }
14690
14691        /// Sets the value of [parent][crate::model::CreateSitemapRequest::parent].
14692        ///
14693        /// This is a **required** field for requests.
14694        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
14695            self.0.request.parent = v.into();
14696            self
14697        }
14698
14699        /// Sets the value of [sitemap][crate::model::CreateSitemapRequest::sitemap].
14700        ///
14701        /// This is a **required** field for requests.
14702        pub fn set_sitemap<T>(mut self, v: T) -> Self
14703        where
14704            T: std::convert::Into<crate::model::Sitemap>,
14705        {
14706            self.0.request.sitemap = std::option::Option::Some(v.into());
14707            self
14708        }
14709
14710        /// Sets or clears the value of [sitemap][crate::model::CreateSitemapRequest::sitemap].
14711        ///
14712        /// This is a **required** field for requests.
14713        pub fn set_or_clear_sitemap<T>(mut self, v: std::option::Option<T>) -> Self
14714        where
14715            T: std::convert::Into<crate::model::Sitemap>,
14716        {
14717            self.0.request.sitemap = v.map(|x| x.into());
14718            self
14719        }
14720    }
14721
14722    #[doc(hidden)]
14723    impl gax::options::internal::RequestBuilder for CreateSitemap {
14724        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
14725            &mut self.0.options
14726        }
14727    }
14728
14729    /// The request builder for [SiteSearchEngineService::delete_sitemap][crate::client::SiteSearchEngineService::delete_sitemap] calls.
14730    ///
14731    /// # Example
14732    /// ```
14733    /// # use google_cloud_discoveryengine_v1::builder::site_search_engine_service::DeleteSitemap;
14734    /// # async fn sample() -> gax::Result<()> {
14735    /// use lro::Poller;
14736    ///
14737    /// let builder = prepare_request_builder();
14738    /// let response = builder.poller().until_done().await?;
14739    /// # Ok(()) }
14740    ///
14741    /// fn prepare_request_builder() -> DeleteSitemap {
14742    ///   # panic!();
14743    ///   // ... details omitted ...
14744    /// }
14745    /// ```
14746    #[derive(Clone, Debug)]
14747    pub struct DeleteSitemap(RequestBuilder<crate::model::DeleteSitemapRequest>);
14748
14749    impl DeleteSitemap {
14750        pub(crate) fn new(
14751            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14752        ) -> Self {
14753            Self(RequestBuilder::new(stub))
14754        }
14755
14756        /// Sets the full request, replacing any prior values.
14757        pub fn with_request<V: Into<crate::model::DeleteSitemapRequest>>(mut self, v: V) -> Self {
14758            self.0.request = v.into();
14759            self
14760        }
14761
14762        /// Sets all the options, replacing any prior values.
14763        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
14764            self.0.options = v.into();
14765            self
14766        }
14767
14768        /// Sends the request.
14769        ///
14770        /// # Long running operations
14771        ///
14772        /// This starts, but does not poll, a longrunning operation. More information
14773        /// on [delete_sitemap][crate::client::SiteSearchEngineService::delete_sitemap].
14774        pub async fn send(self) -> Result<longrunning::model::Operation> {
14775            (*self.0.stub)
14776                .delete_sitemap(self.0.request, self.0.options)
14777                .await
14778                .map(gax::response::Response::into_body)
14779        }
14780
14781        /// Creates a [Poller][lro::Poller] to work with `delete_sitemap`.
14782        pub fn poller(self) -> impl lro::Poller<(), crate::model::DeleteSitemapMetadata> {
14783            type Operation =
14784                lro::internal::Operation<wkt::Empty, crate::model::DeleteSitemapMetadata>;
14785            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
14786            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
14787
14788            let stub = self.0.stub.clone();
14789            let mut options = self.0.options.clone();
14790            options.set_retry_policy(gax::retry_policy::NeverRetry);
14791            let query = move |name| {
14792                let stub = stub.clone();
14793                let options = options.clone();
14794                async {
14795                    let op = GetOperation::new(stub)
14796                        .set_name(name)
14797                        .with_options(options)
14798                        .send()
14799                        .await?;
14800                    Ok(Operation::new(op))
14801                }
14802            };
14803
14804            let start = move || async {
14805                let op = self.send().await?;
14806                Ok(Operation::new(op))
14807            };
14808
14809            lro::internal::new_unit_response_poller(
14810                polling_error_policy,
14811                polling_backoff_policy,
14812                start,
14813                query,
14814            )
14815        }
14816
14817        /// Sets the value of [name][crate::model::DeleteSitemapRequest::name].
14818        ///
14819        /// This is a **required** field for requests.
14820        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
14821            self.0.request.name = v.into();
14822            self
14823        }
14824    }
14825
14826    #[doc(hidden)]
14827    impl gax::options::internal::RequestBuilder for DeleteSitemap {
14828        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
14829            &mut self.0.options
14830        }
14831    }
14832
14833    /// The request builder for [SiteSearchEngineService::fetch_sitemaps][crate::client::SiteSearchEngineService::fetch_sitemaps] calls.
14834    ///
14835    /// # Example
14836    /// ```
14837    /// # use google_cloud_discoveryengine_v1::builder::site_search_engine_service::FetchSitemaps;
14838    /// # async fn sample() -> gax::Result<()> {
14839    ///
14840    /// let builder = prepare_request_builder();
14841    /// let response = builder.send().await?;
14842    /// # Ok(()) }
14843    ///
14844    /// fn prepare_request_builder() -> FetchSitemaps {
14845    ///   # panic!();
14846    ///   // ... details omitted ...
14847    /// }
14848    /// ```
14849    #[derive(Clone, Debug)]
14850    pub struct FetchSitemaps(RequestBuilder<crate::model::FetchSitemapsRequest>);
14851
14852    impl FetchSitemaps {
14853        pub(crate) fn new(
14854            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14855        ) -> Self {
14856            Self(RequestBuilder::new(stub))
14857        }
14858
14859        /// Sets the full request, replacing any prior values.
14860        pub fn with_request<V: Into<crate::model::FetchSitemapsRequest>>(mut self, v: V) -> Self {
14861            self.0.request = v.into();
14862            self
14863        }
14864
14865        /// Sets all the options, replacing any prior values.
14866        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
14867            self.0.options = v.into();
14868            self
14869        }
14870
14871        /// Sends the request.
14872        pub async fn send(self) -> Result<crate::model::FetchSitemapsResponse> {
14873            (*self.0.stub)
14874                .fetch_sitemaps(self.0.request, self.0.options)
14875                .await
14876                .map(gax::response::Response::into_body)
14877        }
14878
14879        /// Sets the value of [parent][crate::model::FetchSitemapsRequest::parent].
14880        ///
14881        /// This is a **required** field for requests.
14882        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
14883            self.0.request.parent = v.into();
14884            self
14885        }
14886
14887        /// Sets the value of [matcher][crate::model::FetchSitemapsRequest::matcher].
14888        pub fn set_matcher<T>(mut self, v: T) -> Self
14889        where
14890            T: std::convert::Into<crate::model::fetch_sitemaps_request::Matcher>,
14891        {
14892            self.0.request.matcher = std::option::Option::Some(v.into());
14893            self
14894        }
14895
14896        /// Sets or clears the value of [matcher][crate::model::FetchSitemapsRequest::matcher].
14897        pub fn set_or_clear_matcher<T>(mut self, v: std::option::Option<T>) -> Self
14898        where
14899            T: std::convert::Into<crate::model::fetch_sitemaps_request::Matcher>,
14900        {
14901            self.0.request.matcher = v.map(|x| x.into());
14902            self
14903        }
14904    }
14905
14906    #[doc(hidden)]
14907    impl gax::options::internal::RequestBuilder for FetchSitemaps {
14908        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
14909            &mut self.0.options
14910        }
14911    }
14912
14913    /// The request builder for [SiteSearchEngineService::enable_advanced_site_search][crate::client::SiteSearchEngineService::enable_advanced_site_search] calls.
14914    ///
14915    /// # Example
14916    /// ```
14917    /// # use google_cloud_discoveryengine_v1::builder::site_search_engine_service::EnableAdvancedSiteSearch;
14918    /// # async fn sample() -> gax::Result<()> {
14919    /// use lro::Poller;
14920    ///
14921    /// let builder = prepare_request_builder();
14922    /// let response = builder.poller().until_done().await?;
14923    /// # Ok(()) }
14924    ///
14925    /// fn prepare_request_builder() -> EnableAdvancedSiteSearch {
14926    ///   # panic!();
14927    ///   // ... details omitted ...
14928    /// }
14929    /// ```
14930    #[derive(Clone, Debug)]
14931    pub struct EnableAdvancedSiteSearch(
14932        RequestBuilder<crate::model::EnableAdvancedSiteSearchRequest>,
14933    );
14934
14935    impl EnableAdvancedSiteSearch {
14936        pub(crate) fn new(
14937            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14938        ) -> Self {
14939            Self(RequestBuilder::new(stub))
14940        }
14941
14942        /// Sets the full request, replacing any prior values.
14943        pub fn with_request<V: Into<crate::model::EnableAdvancedSiteSearchRequest>>(
14944            mut self,
14945            v: V,
14946        ) -> Self {
14947            self.0.request = v.into();
14948            self
14949        }
14950
14951        /// Sets all the options, replacing any prior values.
14952        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
14953            self.0.options = v.into();
14954            self
14955        }
14956
14957        /// Sends the request.
14958        ///
14959        /// # Long running operations
14960        ///
14961        /// This starts, but does not poll, a longrunning operation. More information
14962        /// on [enable_advanced_site_search][crate::client::SiteSearchEngineService::enable_advanced_site_search].
14963        pub async fn send(self) -> Result<longrunning::model::Operation> {
14964            (*self.0.stub)
14965                .enable_advanced_site_search(self.0.request, self.0.options)
14966                .await
14967                .map(gax::response::Response::into_body)
14968        }
14969
14970        /// Creates a [Poller][lro::Poller] to work with `enable_advanced_site_search`.
14971        pub fn poller(
14972            self,
14973        ) -> impl lro::Poller<
14974            crate::model::EnableAdvancedSiteSearchResponse,
14975            crate::model::EnableAdvancedSiteSearchMetadata,
14976        > {
14977            type Operation = lro::internal::Operation<
14978                crate::model::EnableAdvancedSiteSearchResponse,
14979                crate::model::EnableAdvancedSiteSearchMetadata,
14980            >;
14981            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
14982            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
14983
14984            let stub = self.0.stub.clone();
14985            let mut options = self.0.options.clone();
14986            options.set_retry_policy(gax::retry_policy::NeverRetry);
14987            let query = move |name| {
14988                let stub = stub.clone();
14989                let options = options.clone();
14990                async {
14991                    let op = GetOperation::new(stub)
14992                        .set_name(name)
14993                        .with_options(options)
14994                        .send()
14995                        .await?;
14996                    Ok(Operation::new(op))
14997                }
14998            };
14999
15000            let start = move || async {
15001                let op = self.send().await?;
15002                Ok(Operation::new(op))
15003            };
15004
15005            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
15006        }
15007
15008        /// Sets the value of [site_search_engine][crate::model::EnableAdvancedSiteSearchRequest::site_search_engine].
15009        ///
15010        /// This is a **required** field for requests.
15011        pub fn set_site_search_engine<T: Into<std::string::String>>(mut self, v: T) -> Self {
15012            self.0.request.site_search_engine = v.into();
15013            self
15014        }
15015    }
15016
15017    #[doc(hidden)]
15018    impl gax::options::internal::RequestBuilder for EnableAdvancedSiteSearch {
15019        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
15020            &mut self.0.options
15021        }
15022    }
15023
15024    /// The request builder for [SiteSearchEngineService::disable_advanced_site_search][crate::client::SiteSearchEngineService::disable_advanced_site_search] calls.
15025    ///
15026    /// # Example
15027    /// ```
15028    /// # use google_cloud_discoveryengine_v1::builder::site_search_engine_service::DisableAdvancedSiteSearch;
15029    /// # async fn sample() -> gax::Result<()> {
15030    /// use lro::Poller;
15031    ///
15032    /// let builder = prepare_request_builder();
15033    /// let response = builder.poller().until_done().await?;
15034    /// # Ok(()) }
15035    ///
15036    /// fn prepare_request_builder() -> DisableAdvancedSiteSearch {
15037    ///   # panic!();
15038    ///   // ... details omitted ...
15039    /// }
15040    /// ```
15041    #[derive(Clone, Debug)]
15042    pub struct DisableAdvancedSiteSearch(
15043        RequestBuilder<crate::model::DisableAdvancedSiteSearchRequest>,
15044    );
15045
15046    impl DisableAdvancedSiteSearch {
15047        pub(crate) fn new(
15048            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
15049        ) -> Self {
15050            Self(RequestBuilder::new(stub))
15051        }
15052
15053        /// Sets the full request, replacing any prior values.
15054        pub fn with_request<V: Into<crate::model::DisableAdvancedSiteSearchRequest>>(
15055            mut self,
15056            v: V,
15057        ) -> Self {
15058            self.0.request = v.into();
15059            self
15060        }
15061
15062        /// Sets all the options, replacing any prior values.
15063        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
15064            self.0.options = v.into();
15065            self
15066        }
15067
15068        /// Sends the request.
15069        ///
15070        /// # Long running operations
15071        ///
15072        /// This starts, but does not poll, a longrunning operation. More information
15073        /// on [disable_advanced_site_search][crate::client::SiteSearchEngineService::disable_advanced_site_search].
15074        pub async fn send(self) -> Result<longrunning::model::Operation> {
15075            (*self.0.stub)
15076                .disable_advanced_site_search(self.0.request, self.0.options)
15077                .await
15078                .map(gax::response::Response::into_body)
15079        }
15080
15081        /// Creates a [Poller][lro::Poller] to work with `disable_advanced_site_search`.
15082        pub fn poller(
15083            self,
15084        ) -> impl lro::Poller<
15085            crate::model::DisableAdvancedSiteSearchResponse,
15086            crate::model::DisableAdvancedSiteSearchMetadata,
15087        > {
15088            type Operation = lro::internal::Operation<
15089                crate::model::DisableAdvancedSiteSearchResponse,
15090                crate::model::DisableAdvancedSiteSearchMetadata,
15091            >;
15092            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
15093            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
15094
15095            let stub = self.0.stub.clone();
15096            let mut options = self.0.options.clone();
15097            options.set_retry_policy(gax::retry_policy::NeverRetry);
15098            let query = move |name| {
15099                let stub = stub.clone();
15100                let options = options.clone();
15101                async {
15102                    let op = GetOperation::new(stub)
15103                        .set_name(name)
15104                        .with_options(options)
15105                        .send()
15106                        .await?;
15107                    Ok(Operation::new(op))
15108                }
15109            };
15110
15111            let start = move || async {
15112                let op = self.send().await?;
15113                Ok(Operation::new(op))
15114            };
15115
15116            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
15117        }
15118
15119        /// Sets the value of [site_search_engine][crate::model::DisableAdvancedSiteSearchRequest::site_search_engine].
15120        ///
15121        /// This is a **required** field for requests.
15122        pub fn set_site_search_engine<T: Into<std::string::String>>(mut self, v: T) -> Self {
15123            self.0.request.site_search_engine = v.into();
15124            self
15125        }
15126    }
15127
15128    #[doc(hidden)]
15129    impl gax::options::internal::RequestBuilder for DisableAdvancedSiteSearch {
15130        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
15131            &mut self.0.options
15132        }
15133    }
15134
15135    /// The request builder for [SiteSearchEngineService::recrawl_uris][crate::client::SiteSearchEngineService::recrawl_uris] calls.
15136    ///
15137    /// # Example
15138    /// ```
15139    /// # use google_cloud_discoveryengine_v1::builder::site_search_engine_service::RecrawlUris;
15140    /// # async fn sample() -> gax::Result<()> {
15141    /// use lro::Poller;
15142    ///
15143    /// let builder = prepare_request_builder();
15144    /// let response = builder.poller().until_done().await?;
15145    /// # Ok(()) }
15146    ///
15147    /// fn prepare_request_builder() -> RecrawlUris {
15148    ///   # panic!();
15149    ///   // ... details omitted ...
15150    /// }
15151    /// ```
15152    #[derive(Clone, Debug)]
15153    pub struct RecrawlUris(RequestBuilder<crate::model::RecrawlUrisRequest>);
15154
15155    impl RecrawlUris {
15156        pub(crate) fn new(
15157            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
15158        ) -> Self {
15159            Self(RequestBuilder::new(stub))
15160        }
15161
15162        /// Sets the full request, replacing any prior values.
15163        pub fn with_request<V: Into<crate::model::RecrawlUrisRequest>>(mut self, v: V) -> Self {
15164            self.0.request = v.into();
15165            self
15166        }
15167
15168        /// Sets all the options, replacing any prior values.
15169        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
15170            self.0.options = v.into();
15171            self
15172        }
15173
15174        /// Sends the request.
15175        ///
15176        /// # Long running operations
15177        ///
15178        /// This starts, but does not poll, a longrunning operation. More information
15179        /// on [recrawl_uris][crate::client::SiteSearchEngineService::recrawl_uris].
15180        pub async fn send(self) -> Result<longrunning::model::Operation> {
15181            (*self.0.stub)
15182                .recrawl_uris(self.0.request, self.0.options)
15183                .await
15184                .map(gax::response::Response::into_body)
15185        }
15186
15187        /// Creates a [Poller][lro::Poller] to work with `recrawl_uris`.
15188        pub fn poller(
15189            self,
15190        ) -> impl lro::Poller<crate::model::RecrawlUrisResponse, crate::model::RecrawlUrisMetadata>
15191        {
15192            type Operation = lro::internal::Operation<
15193                crate::model::RecrawlUrisResponse,
15194                crate::model::RecrawlUrisMetadata,
15195            >;
15196            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
15197            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
15198
15199            let stub = self.0.stub.clone();
15200            let mut options = self.0.options.clone();
15201            options.set_retry_policy(gax::retry_policy::NeverRetry);
15202            let query = move |name| {
15203                let stub = stub.clone();
15204                let options = options.clone();
15205                async {
15206                    let op = GetOperation::new(stub)
15207                        .set_name(name)
15208                        .with_options(options)
15209                        .send()
15210                        .await?;
15211                    Ok(Operation::new(op))
15212                }
15213            };
15214
15215            let start = move || async {
15216                let op = self.send().await?;
15217                Ok(Operation::new(op))
15218            };
15219
15220            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
15221        }
15222
15223        /// Sets the value of [site_search_engine][crate::model::RecrawlUrisRequest::site_search_engine].
15224        ///
15225        /// This is a **required** field for requests.
15226        pub fn set_site_search_engine<T: Into<std::string::String>>(mut self, v: T) -> Self {
15227            self.0.request.site_search_engine = v.into();
15228            self
15229        }
15230
15231        /// Sets the value of [uris][crate::model::RecrawlUrisRequest::uris].
15232        ///
15233        /// This is a **required** field for requests.
15234        pub fn set_uris<T, V>(mut self, v: T) -> Self
15235        where
15236            T: std::iter::IntoIterator<Item = V>,
15237            V: std::convert::Into<std::string::String>,
15238        {
15239            use std::iter::Iterator;
15240            self.0.request.uris = v.into_iter().map(|i| i.into()).collect();
15241            self
15242        }
15243
15244        /// Sets the value of [site_credential][crate::model::RecrawlUrisRequest::site_credential].
15245        pub fn set_site_credential<T: Into<std::string::String>>(mut self, v: T) -> Self {
15246            self.0.request.site_credential = v.into();
15247            self
15248        }
15249    }
15250
15251    #[doc(hidden)]
15252    impl gax::options::internal::RequestBuilder for RecrawlUris {
15253        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
15254            &mut self.0.options
15255        }
15256    }
15257
15258    /// The request builder for [SiteSearchEngineService::batch_verify_target_sites][crate::client::SiteSearchEngineService::batch_verify_target_sites] calls.
15259    ///
15260    /// # Example
15261    /// ```
15262    /// # use google_cloud_discoveryengine_v1::builder::site_search_engine_service::BatchVerifyTargetSites;
15263    /// # async fn sample() -> gax::Result<()> {
15264    /// use lro::Poller;
15265    ///
15266    /// let builder = prepare_request_builder();
15267    /// let response = builder.poller().until_done().await?;
15268    /// # Ok(()) }
15269    ///
15270    /// fn prepare_request_builder() -> BatchVerifyTargetSites {
15271    ///   # panic!();
15272    ///   // ... details omitted ...
15273    /// }
15274    /// ```
15275    #[derive(Clone, Debug)]
15276    pub struct BatchVerifyTargetSites(RequestBuilder<crate::model::BatchVerifyTargetSitesRequest>);
15277
15278    impl BatchVerifyTargetSites {
15279        pub(crate) fn new(
15280            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
15281        ) -> Self {
15282            Self(RequestBuilder::new(stub))
15283        }
15284
15285        /// Sets the full request, replacing any prior values.
15286        pub fn with_request<V: Into<crate::model::BatchVerifyTargetSitesRequest>>(
15287            mut self,
15288            v: V,
15289        ) -> Self {
15290            self.0.request = v.into();
15291            self
15292        }
15293
15294        /// Sets all the options, replacing any prior values.
15295        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
15296            self.0.options = v.into();
15297            self
15298        }
15299
15300        /// Sends the request.
15301        ///
15302        /// # Long running operations
15303        ///
15304        /// This starts, but does not poll, a longrunning operation. More information
15305        /// on [batch_verify_target_sites][crate::client::SiteSearchEngineService::batch_verify_target_sites].
15306        pub async fn send(self) -> Result<longrunning::model::Operation> {
15307            (*self.0.stub)
15308                .batch_verify_target_sites(self.0.request, self.0.options)
15309                .await
15310                .map(gax::response::Response::into_body)
15311        }
15312
15313        /// Creates a [Poller][lro::Poller] to work with `batch_verify_target_sites`.
15314        pub fn poller(
15315            self,
15316        ) -> impl lro::Poller<
15317            crate::model::BatchVerifyTargetSitesResponse,
15318            crate::model::BatchVerifyTargetSitesMetadata,
15319        > {
15320            type Operation = lro::internal::Operation<
15321                crate::model::BatchVerifyTargetSitesResponse,
15322                crate::model::BatchVerifyTargetSitesMetadata,
15323            >;
15324            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
15325            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
15326
15327            let stub = self.0.stub.clone();
15328            let mut options = self.0.options.clone();
15329            options.set_retry_policy(gax::retry_policy::NeverRetry);
15330            let query = move |name| {
15331                let stub = stub.clone();
15332                let options = options.clone();
15333                async {
15334                    let op = GetOperation::new(stub)
15335                        .set_name(name)
15336                        .with_options(options)
15337                        .send()
15338                        .await?;
15339                    Ok(Operation::new(op))
15340                }
15341            };
15342
15343            let start = move || async {
15344                let op = self.send().await?;
15345                Ok(Operation::new(op))
15346            };
15347
15348            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
15349        }
15350
15351        /// Sets the value of [parent][crate::model::BatchVerifyTargetSitesRequest::parent].
15352        ///
15353        /// This is a **required** field for requests.
15354        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
15355            self.0.request.parent = v.into();
15356            self
15357        }
15358    }
15359
15360    #[doc(hidden)]
15361    impl gax::options::internal::RequestBuilder for BatchVerifyTargetSites {
15362        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
15363            &mut self.0.options
15364        }
15365    }
15366
15367    /// The request builder for [SiteSearchEngineService::fetch_domain_verification_status][crate::client::SiteSearchEngineService::fetch_domain_verification_status] calls.
15368    ///
15369    /// # Example
15370    /// ```
15371    /// # use google_cloud_discoveryengine_v1::builder::site_search_engine_service::FetchDomainVerificationStatus;
15372    /// # async fn sample() -> gax::Result<()> {
15373    /// use gax::paginator::ItemPaginator;
15374    ///
15375    /// let builder = prepare_request_builder();
15376    /// let mut items = builder.by_item();
15377    /// while let Some(result) = items.next().await {
15378    ///   let item = result?;
15379    /// }
15380    /// # Ok(()) }
15381    ///
15382    /// fn prepare_request_builder() -> FetchDomainVerificationStatus {
15383    ///   # panic!();
15384    ///   // ... details omitted ...
15385    /// }
15386    /// ```
15387    #[derive(Clone, Debug)]
15388    pub struct FetchDomainVerificationStatus(
15389        RequestBuilder<crate::model::FetchDomainVerificationStatusRequest>,
15390    );
15391
15392    impl FetchDomainVerificationStatus {
15393        pub(crate) fn new(
15394            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
15395        ) -> Self {
15396            Self(RequestBuilder::new(stub))
15397        }
15398
15399        /// Sets the full request, replacing any prior values.
15400        pub fn with_request<V: Into<crate::model::FetchDomainVerificationStatusRequest>>(
15401            mut self,
15402            v: V,
15403        ) -> Self {
15404            self.0.request = v.into();
15405            self
15406        }
15407
15408        /// Sets all the options, replacing any prior values.
15409        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
15410            self.0.options = v.into();
15411            self
15412        }
15413
15414        /// Sends the request.
15415        pub async fn send(self) -> Result<crate::model::FetchDomainVerificationStatusResponse> {
15416            (*self.0.stub)
15417                .fetch_domain_verification_status(self.0.request, self.0.options)
15418                .await
15419                .map(gax::response::Response::into_body)
15420        }
15421
15422        /// Streams each page in the collection.
15423        pub fn by_page(
15424            self,
15425        ) -> impl gax::paginator::Paginator<
15426            crate::model::FetchDomainVerificationStatusResponse,
15427            gax::error::Error,
15428        > {
15429            use std::clone::Clone;
15430            let token = self.0.request.page_token.clone();
15431            let execute = move |token: String| {
15432                let mut builder = self.clone();
15433                builder.0.request = builder.0.request.set_page_token(token);
15434                builder.send()
15435            };
15436            gax::paginator::internal::new_paginator(token, execute)
15437        }
15438
15439        /// Streams each item in the collection.
15440        pub fn by_item(
15441            self,
15442        ) -> impl gax::paginator::ItemPaginator<
15443            crate::model::FetchDomainVerificationStatusResponse,
15444            gax::error::Error,
15445        > {
15446            use gax::paginator::Paginator;
15447            self.by_page().items()
15448        }
15449
15450        /// Sets the value of [site_search_engine][crate::model::FetchDomainVerificationStatusRequest::site_search_engine].
15451        ///
15452        /// This is a **required** field for requests.
15453        pub fn set_site_search_engine<T: Into<std::string::String>>(mut self, v: T) -> Self {
15454            self.0.request.site_search_engine = v.into();
15455            self
15456        }
15457
15458        /// Sets the value of [page_size][crate::model::FetchDomainVerificationStatusRequest::page_size].
15459        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
15460            self.0.request.page_size = v.into();
15461            self
15462        }
15463
15464        /// Sets the value of [page_token][crate::model::FetchDomainVerificationStatusRequest::page_token].
15465        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
15466            self.0.request.page_token = v.into();
15467            self
15468        }
15469    }
15470
15471    #[doc(hidden)]
15472    impl gax::options::internal::RequestBuilder for FetchDomainVerificationStatus {
15473        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
15474            &mut self.0.options
15475        }
15476    }
15477
15478    /// The request builder for [SiteSearchEngineService::list_operations][crate::client::SiteSearchEngineService::list_operations] calls.
15479    ///
15480    /// # Example
15481    /// ```
15482    /// # use google_cloud_discoveryengine_v1::builder::site_search_engine_service::ListOperations;
15483    /// # async fn sample() -> gax::Result<()> {
15484    /// use gax::paginator::ItemPaginator;
15485    ///
15486    /// let builder = prepare_request_builder();
15487    /// let mut items = builder.by_item();
15488    /// while let Some(result) = items.next().await {
15489    ///   let item = result?;
15490    /// }
15491    /// # Ok(()) }
15492    ///
15493    /// fn prepare_request_builder() -> ListOperations {
15494    ///   # panic!();
15495    ///   // ... details omitted ...
15496    /// }
15497    /// ```
15498    #[derive(Clone, Debug)]
15499    pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
15500
15501    impl ListOperations {
15502        pub(crate) fn new(
15503            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
15504        ) -> Self {
15505            Self(RequestBuilder::new(stub))
15506        }
15507
15508        /// Sets the full request, replacing any prior values.
15509        pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
15510            mut self,
15511            v: V,
15512        ) -> Self {
15513            self.0.request = v.into();
15514            self
15515        }
15516
15517        /// Sets all the options, replacing any prior values.
15518        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
15519            self.0.options = v.into();
15520            self
15521        }
15522
15523        /// Sends the request.
15524        pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
15525            (*self.0.stub)
15526                .list_operations(self.0.request, self.0.options)
15527                .await
15528                .map(gax::response::Response::into_body)
15529        }
15530
15531        /// Streams each page in the collection.
15532        pub fn by_page(
15533            self,
15534        ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
15535        {
15536            use std::clone::Clone;
15537            let token = self.0.request.page_token.clone();
15538            let execute = move |token: String| {
15539                let mut builder = self.clone();
15540                builder.0.request = builder.0.request.set_page_token(token);
15541                builder.send()
15542            };
15543            gax::paginator::internal::new_paginator(token, execute)
15544        }
15545
15546        /// Streams each item in the collection.
15547        pub fn by_item(
15548            self,
15549        ) -> impl gax::paginator::ItemPaginator<
15550            longrunning::model::ListOperationsResponse,
15551            gax::error::Error,
15552        > {
15553            use gax::paginator::Paginator;
15554            self.by_page().items()
15555        }
15556
15557        /// Sets the value of [name][longrunning::model::ListOperationsRequest::name].
15558        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
15559            self.0.request.name = v.into();
15560            self
15561        }
15562
15563        /// Sets the value of [filter][longrunning::model::ListOperationsRequest::filter].
15564        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
15565            self.0.request.filter = v.into();
15566            self
15567        }
15568
15569        /// Sets the value of [page_size][longrunning::model::ListOperationsRequest::page_size].
15570        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
15571            self.0.request.page_size = v.into();
15572            self
15573        }
15574
15575        /// Sets the value of [page_token][longrunning::model::ListOperationsRequest::page_token].
15576        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
15577            self.0.request.page_token = v.into();
15578            self
15579        }
15580
15581        /// Sets the value of [return_partial_success][longrunning::model::ListOperationsRequest::return_partial_success].
15582        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
15583            self.0.request.return_partial_success = v.into();
15584            self
15585        }
15586    }
15587
15588    #[doc(hidden)]
15589    impl gax::options::internal::RequestBuilder for ListOperations {
15590        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
15591            &mut self.0.options
15592        }
15593    }
15594
15595    /// The request builder for [SiteSearchEngineService::get_operation][crate::client::SiteSearchEngineService::get_operation] calls.
15596    ///
15597    /// # Example
15598    /// ```
15599    /// # use google_cloud_discoveryengine_v1::builder::site_search_engine_service::GetOperation;
15600    /// # async fn sample() -> gax::Result<()> {
15601    ///
15602    /// let builder = prepare_request_builder();
15603    /// let response = builder.send().await?;
15604    /// # Ok(()) }
15605    ///
15606    /// fn prepare_request_builder() -> GetOperation {
15607    ///   # panic!();
15608    ///   // ... details omitted ...
15609    /// }
15610    /// ```
15611    #[derive(Clone, Debug)]
15612    pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
15613
15614    impl GetOperation {
15615        pub(crate) fn new(
15616            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
15617        ) -> Self {
15618            Self(RequestBuilder::new(stub))
15619        }
15620
15621        /// Sets the full request, replacing any prior values.
15622        pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
15623            mut self,
15624            v: V,
15625        ) -> Self {
15626            self.0.request = v.into();
15627            self
15628        }
15629
15630        /// Sets all the options, replacing any prior values.
15631        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
15632            self.0.options = v.into();
15633            self
15634        }
15635
15636        /// Sends the request.
15637        pub async fn send(self) -> Result<longrunning::model::Operation> {
15638            (*self.0.stub)
15639                .get_operation(self.0.request, self.0.options)
15640                .await
15641                .map(gax::response::Response::into_body)
15642        }
15643
15644        /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
15645        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
15646            self.0.request.name = v.into();
15647            self
15648        }
15649    }
15650
15651    #[doc(hidden)]
15652    impl gax::options::internal::RequestBuilder for GetOperation {
15653        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
15654            &mut self.0.options
15655        }
15656    }
15657
15658    /// The request builder for [SiteSearchEngineService::cancel_operation][crate::client::SiteSearchEngineService::cancel_operation] calls.
15659    ///
15660    /// # Example
15661    /// ```
15662    /// # use google_cloud_discoveryengine_v1::builder::site_search_engine_service::CancelOperation;
15663    /// # async fn sample() -> gax::Result<()> {
15664    ///
15665    /// let builder = prepare_request_builder();
15666    /// let response = builder.send().await?;
15667    /// # Ok(()) }
15668    ///
15669    /// fn prepare_request_builder() -> CancelOperation {
15670    ///   # panic!();
15671    ///   // ... details omitted ...
15672    /// }
15673    /// ```
15674    #[derive(Clone, Debug)]
15675    pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
15676
15677    impl CancelOperation {
15678        pub(crate) fn new(
15679            stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
15680        ) -> Self {
15681            Self(RequestBuilder::new(stub))
15682        }
15683
15684        /// Sets the full request, replacing any prior values.
15685        pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
15686            mut self,
15687            v: V,
15688        ) -> Self {
15689            self.0.request = v.into();
15690            self
15691        }
15692
15693        /// Sets all the options, replacing any prior values.
15694        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
15695            self.0.options = v.into();
15696            self
15697        }
15698
15699        /// Sends the request.
15700        pub async fn send(self) -> Result<()> {
15701            (*self.0.stub)
15702                .cancel_operation(self.0.request, self.0.options)
15703                .await
15704                .map(gax::response::Response::into_body)
15705        }
15706
15707        /// Sets the value of [name][longrunning::model::CancelOperationRequest::name].
15708        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
15709            self.0.request.name = v.into();
15710            self
15711        }
15712    }
15713
15714    #[doc(hidden)]
15715    impl gax::options::internal::RequestBuilder for CancelOperation {
15716        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
15717            &mut self.0.options
15718        }
15719    }
15720}
15721
15722#[cfg(feature = "user-event-service")]
15723#[cfg_attr(docsrs, doc(cfg(feature = "user-event-service")))]
15724pub mod user_event_service {
15725    use crate::Result;
15726
15727    /// A builder for [UserEventService][crate::client::UserEventService].
15728    ///
15729    /// ```
15730    /// # async fn sample() -> gax::client_builder::Result<()> {
15731    /// # use google_cloud_discoveryengine_v1::*;
15732    /// # use builder::user_event_service::ClientBuilder;
15733    /// # use client::UserEventService;
15734    /// let builder : ClientBuilder = UserEventService::builder();
15735    /// let client = builder
15736    ///     .with_endpoint("https://discoveryengine.googleapis.com")
15737    ///     .build().await?;
15738    /// # Ok(()) }
15739    /// ```
15740    pub type ClientBuilder =
15741        gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
15742
15743    pub(crate) mod client {
15744        use super::super::super::client::UserEventService;
15745        pub struct Factory;
15746        impl gax::client_builder::internal::ClientFactory for Factory {
15747            type Client = UserEventService;
15748            type Credentials = gaxi::options::Credentials;
15749            async fn build(
15750                self,
15751                config: gaxi::options::ClientConfig,
15752            ) -> gax::client_builder::Result<Self::Client> {
15753                Self::Client::new(config).await
15754            }
15755        }
15756    }
15757
15758    /// Common implementation for [crate::client::UserEventService] request builders.
15759    #[derive(Clone, Debug)]
15760    pub(crate) struct RequestBuilder<R: std::default::Default> {
15761        stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
15762        request: R,
15763        options: gax::options::RequestOptions,
15764    }
15765
15766    impl<R> RequestBuilder<R>
15767    where
15768        R: std::default::Default,
15769    {
15770        pub(crate) fn new(
15771            stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
15772        ) -> Self {
15773            Self {
15774                stub,
15775                request: R::default(),
15776                options: gax::options::RequestOptions::default(),
15777            }
15778        }
15779    }
15780
15781    /// The request builder for [UserEventService::write_user_event][crate::client::UserEventService::write_user_event] calls.
15782    ///
15783    /// # Example
15784    /// ```
15785    /// # use google_cloud_discoveryengine_v1::builder::user_event_service::WriteUserEvent;
15786    /// # async fn sample() -> gax::Result<()> {
15787    ///
15788    /// let builder = prepare_request_builder();
15789    /// let response = builder.send().await?;
15790    /// # Ok(()) }
15791    ///
15792    /// fn prepare_request_builder() -> WriteUserEvent {
15793    ///   # panic!();
15794    ///   // ... details omitted ...
15795    /// }
15796    /// ```
15797    #[derive(Clone, Debug)]
15798    pub struct WriteUserEvent(RequestBuilder<crate::model::WriteUserEventRequest>);
15799
15800    impl WriteUserEvent {
15801        pub(crate) fn new(
15802            stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
15803        ) -> Self {
15804            Self(RequestBuilder::new(stub))
15805        }
15806
15807        /// Sets the full request, replacing any prior values.
15808        pub fn with_request<V: Into<crate::model::WriteUserEventRequest>>(mut self, v: V) -> Self {
15809            self.0.request = v.into();
15810            self
15811        }
15812
15813        /// Sets all the options, replacing any prior values.
15814        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
15815            self.0.options = v.into();
15816            self
15817        }
15818
15819        /// Sends the request.
15820        pub async fn send(self) -> Result<crate::model::UserEvent> {
15821            (*self.0.stub)
15822                .write_user_event(self.0.request, self.0.options)
15823                .await
15824                .map(gax::response::Response::into_body)
15825        }
15826
15827        /// Sets the value of [parent][crate::model::WriteUserEventRequest::parent].
15828        ///
15829        /// This is a **required** field for requests.
15830        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
15831            self.0.request.parent = v.into();
15832            self
15833        }
15834
15835        /// Sets the value of [user_event][crate::model::WriteUserEventRequest::user_event].
15836        ///
15837        /// This is a **required** field for requests.
15838        pub fn set_user_event<T>(mut self, v: T) -> Self
15839        where
15840            T: std::convert::Into<crate::model::UserEvent>,
15841        {
15842            self.0.request.user_event = std::option::Option::Some(v.into());
15843            self
15844        }
15845
15846        /// Sets or clears the value of [user_event][crate::model::WriteUserEventRequest::user_event].
15847        ///
15848        /// This is a **required** field for requests.
15849        pub fn set_or_clear_user_event<T>(mut self, v: std::option::Option<T>) -> Self
15850        where
15851            T: std::convert::Into<crate::model::UserEvent>,
15852        {
15853            self.0.request.user_event = v.map(|x| x.into());
15854            self
15855        }
15856
15857        /// Sets the value of [write_async][crate::model::WriteUserEventRequest::write_async].
15858        pub fn set_write_async<T: Into<bool>>(mut self, v: T) -> Self {
15859            self.0.request.write_async = v.into();
15860            self
15861        }
15862    }
15863
15864    #[doc(hidden)]
15865    impl gax::options::internal::RequestBuilder for WriteUserEvent {
15866        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
15867            &mut self.0.options
15868        }
15869    }
15870
15871    /// The request builder for [UserEventService::collect_user_event][crate::client::UserEventService::collect_user_event] calls.
15872    ///
15873    /// # Example
15874    /// ```
15875    /// # use google_cloud_discoveryengine_v1::builder::user_event_service::CollectUserEvent;
15876    /// # async fn sample() -> gax::Result<()> {
15877    ///
15878    /// let builder = prepare_request_builder();
15879    /// let response = builder.send().await?;
15880    /// # Ok(()) }
15881    ///
15882    /// fn prepare_request_builder() -> CollectUserEvent {
15883    ///   # panic!();
15884    ///   // ... details omitted ...
15885    /// }
15886    /// ```
15887    #[derive(Clone, Debug)]
15888    pub struct CollectUserEvent(RequestBuilder<crate::model::CollectUserEventRequest>);
15889
15890    impl CollectUserEvent {
15891        pub(crate) fn new(
15892            stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
15893        ) -> Self {
15894            Self(RequestBuilder::new(stub))
15895        }
15896
15897        /// Sets the full request, replacing any prior values.
15898        pub fn with_request<V: Into<crate::model::CollectUserEventRequest>>(
15899            mut self,
15900            v: V,
15901        ) -> Self {
15902            self.0.request = v.into();
15903            self
15904        }
15905
15906        /// Sets all the options, replacing any prior values.
15907        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
15908            self.0.options = v.into();
15909            self
15910        }
15911
15912        /// Sends the request.
15913        pub async fn send(self) -> Result<api::model::HttpBody> {
15914            (*self.0.stub)
15915                .collect_user_event(self.0.request, self.0.options)
15916                .await
15917                .map(gax::response::Response::into_body)
15918        }
15919
15920        /// Sets the value of [parent][crate::model::CollectUserEventRequest::parent].
15921        ///
15922        /// This is a **required** field for requests.
15923        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
15924            self.0.request.parent = v.into();
15925            self
15926        }
15927
15928        /// Sets the value of [user_event][crate::model::CollectUserEventRequest::user_event].
15929        ///
15930        /// This is a **required** field for requests.
15931        pub fn set_user_event<T: Into<std::string::String>>(mut self, v: T) -> Self {
15932            self.0.request.user_event = v.into();
15933            self
15934        }
15935
15936        /// Sets the value of [uri][crate::model::CollectUserEventRequest::uri].
15937        pub fn set_uri<T>(mut self, v: T) -> Self
15938        where
15939            T: std::convert::Into<std::string::String>,
15940        {
15941            self.0.request.uri = std::option::Option::Some(v.into());
15942            self
15943        }
15944
15945        /// Sets or clears the value of [uri][crate::model::CollectUserEventRequest::uri].
15946        pub fn set_or_clear_uri<T>(mut self, v: std::option::Option<T>) -> Self
15947        where
15948            T: std::convert::Into<std::string::String>,
15949        {
15950            self.0.request.uri = v.map(|x| x.into());
15951            self
15952        }
15953
15954        /// Sets the value of [ets][crate::model::CollectUserEventRequest::ets].
15955        pub fn set_ets<T>(mut self, v: T) -> Self
15956        where
15957            T: std::convert::Into<i64>,
15958        {
15959            self.0.request.ets = std::option::Option::Some(v.into());
15960            self
15961        }
15962
15963        /// Sets or clears the value of [ets][crate::model::CollectUserEventRequest::ets].
15964        pub fn set_or_clear_ets<T>(mut self, v: std::option::Option<T>) -> Self
15965        where
15966            T: std::convert::Into<i64>,
15967        {
15968            self.0.request.ets = v.map(|x| x.into());
15969            self
15970        }
15971    }
15972
15973    #[doc(hidden)]
15974    impl gax::options::internal::RequestBuilder for CollectUserEvent {
15975        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
15976            &mut self.0.options
15977        }
15978    }
15979
15980    /// The request builder for [UserEventService::purge_user_events][crate::client::UserEventService::purge_user_events] calls.
15981    ///
15982    /// # Example
15983    /// ```
15984    /// # use google_cloud_discoveryengine_v1::builder::user_event_service::PurgeUserEvents;
15985    /// # async fn sample() -> gax::Result<()> {
15986    /// use lro::Poller;
15987    ///
15988    /// let builder = prepare_request_builder();
15989    /// let response = builder.poller().until_done().await?;
15990    /// # Ok(()) }
15991    ///
15992    /// fn prepare_request_builder() -> PurgeUserEvents {
15993    ///   # panic!();
15994    ///   // ... details omitted ...
15995    /// }
15996    /// ```
15997    #[derive(Clone, Debug)]
15998    pub struct PurgeUserEvents(RequestBuilder<crate::model::PurgeUserEventsRequest>);
15999
16000    impl PurgeUserEvents {
16001        pub(crate) fn new(
16002            stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
16003        ) -> Self {
16004            Self(RequestBuilder::new(stub))
16005        }
16006
16007        /// Sets the full request, replacing any prior values.
16008        pub fn with_request<V: Into<crate::model::PurgeUserEventsRequest>>(mut self, v: V) -> Self {
16009            self.0.request = v.into();
16010            self
16011        }
16012
16013        /// Sets all the options, replacing any prior values.
16014        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
16015            self.0.options = v.into();
16016            self
16017        }
16018
16019        /// Sends the request.
16020        ///
16021        /// # Long running operations
16022        ///
16023        /// This starts, but does not poll, a longrunning operation. More information
16024        /// on [purge_user_events][crate::client::UserEventService::purge_user_events].
16025        pub async fn send(self) -> Result<longrunning::model::Operation> {
16026            (*self.0.stub)
16027                .purge_user_events(self.0.request, self.0.options)
16028                .await
16029                .map(gax::response::Response::into_body)
16030        }
16031
16032        /// Creates a [Poller][lro::Poller] to work with `purge_user_events`.
16033        pub fn poller(
16034            self,
16035        ) -> impl lro::Poller<crate::model::PurgeUserEventsResponse, crate::model::PurgeUserEventsMetadata>
16036        {
16037            type Operation = lro::internal::Operation<
16038                crate::model::PurgeUserEventsResponse,
16039                crate::model::PurgeUserEventsMetadata,
16040            >;
16041            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
16042            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
16043
16044            let stub = self.0.stub.clone();
16045            let mut options = self.0.options.clone();
16046            options.set_retry_policy(gax::retry_policy::NeverRetry);
16047            let query = move |name| {
16048                let stub = stub.clone();
16049                let options = options.clone();
16050                async {
16051                    let op = GetOperation::new(stub)
16052                        .set_name(name)
16053                        .with_options(options)
16054                        .send()
16055                        .await?;
16056                    Ok(Operation::new(op))
16057                }
16058            };
16059
16060            let start = move || async {
16061                let op = self.send().await?;
16062                Ok(Operation::new(op))
16063            };
16064
16065            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
16066        }
16067
16068        /// Sets the value of [parent][crate::model::PurgeUserEventsRequest::parent].
16069        ///
16070        /// This is a **required** field for requests.
16071        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
16072            self.0.request.parent = v.into();
16073            self
16074        }
16075
16076        /// Sets the value of [filter][crate::model::PurgeUserEventsRequest::filter].
16077        ///
16078        /// This is a **required** field for requests.
16079        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
16080            self.0.request.filter = v.into();
16081            self
16082        }
16083
16084        /// Sets the value of [force][crate::model::PurgeUserEventsRequest::force].
16085        pub fn set_force<T: Into<bool>>(mut self, v: T) -> Self {
16086            self.0.request.force = v.into();
16087            self
16088        }
16089    }
16090
16091    #[doc(hidden)]
16092    impl gax::options::internal::RequestBuilder for PurgeUserEvents {
16093        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
16094            &mut self.0.options
16095        }
16096    }
16097
16098    /// The request builder for [UserEventService::import_user_events][crate::client::UserEventService::import_user_events] calls.
16099    ///
16100    /// # Example
16101    /// ```
16102    /// # use google_cloud_discoveryengine_v1::builder::user_event_service::ImportUserEvents;
16103    /// # async fn sample() -> gax::Result<()> {
16104    /// use lro::Poller;
16105    ///
16106    /// let builder = prepare_request_builder();
16107    /// let response = builder.poller().until_done().await?;
16108    /// # Ok(()) }
16109    ///
16110    /// fn prepare_request_builder() -> ImportUserEvents {
16111    ///   # panic!();
16112    ///   // ... details omitted ...
16113    /// }
16114    /// ```
16115    #[derive(Clone, Debug)]
16116    pub struct ImportUserEvents(RequestBuilder<crate::model::ImportUserEventsRequest>);
16117
16118    impl ImportUserEvents {
16119        pub(crate) fn new(
16120            stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
16121        ) -> Self {
16122            Self(RequestBuilder::new(stub))
16123        }
16124
16125        /// Sets the full request, replacing any prior values.
16126        pub fn with_request<V: Into<crate::model::ImportUserEventsRequest>>(
16127            mut self,
16128            v: V,
16129        ) -> Self {
16130            self.0.request = v.into();
16131            self
16132        }
16133
16134        /// Sets all the options, replacing any prior values.
16135        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
16136            self.0.options = v.into();
16137            self
16138        }
16139
16140        /// Sends the request.
16141        ///
16142        /// # Long running operations
16143        ///
16144        /// This starts, but does not poll, a longrunning operation. More information
16145        /// on [import_user_events][crate::client::UserEventService::import_user_events].
16146        pub async fn send(self) -> Result<longrunning::model::Operation> {
16147            (*self.0.stub)
16148                .import_user_events(self.0.request, self.0.options)
16149                .await
16150                .map(gax::response::Response::into_body)
16151        }
16152
16153        /// Creates a [Poller][lro::Poller] to work with `import_user_events`.
16154        pub fn poller(
16155            self,
16156        ) -> impl lro::Poller<
16157            crate::model::ImportUserEventsResponse,
16158            crate::model::ImportUserEventsMetadata,
16159        > {
16160            type Operation = lro::internal::Operation<
16161                crate::model::ImportUserEventsResponse,
16162                crate::model::ImportUserEventsMetadata,
16163            >;
16164            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
16165            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
16166
16167            let stub = self.0.stub.clone();
16168            let mut options = self.0.options.clone();
16169            options.set_retry_policy(gax::retry_policy::NeverRetry);
16170            let query = move |name| {
16171                let stub = stub.clone();
16172                let options = options.clone();
16173                async {
16174                    let op = GetOperation::new(stub)
16175                        .set_name(name)
16176                        .with_options(options)
16177                        .send()
16178                        .await?;
16179                    Ok(Operation::new(op))
16180                }
16181            };
16182
16183            let start = move || async {
16184                let op = self.send().await?;
16185                Ok(Operation::new(op))
16186            };
16187
16188            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
16189        }
16190
16191        /// Sets the value of [parent][crate::model::ImportUserEventsRequest::parent].
16192        ///
16193        /// This is a **required** field for requests.
16194        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
16195            self.0.request.parent = v.into();
16196            self
16197        }
16198
16199        /// Sets the value of [error_config][crate::model::ImportUserEventsRequest::error_config].
16200        pub fn set_error_config<T>(mut self, v: T) -> Self
16201        where
16202            T: std::convert::Into<crate::model::ImportErrorConfig>,
16203        {
16204            self.0.request.error_config = std::option::Option::Some(v.into());
16205            self
16206        }
16207
16208        /// Sets or clears the value of [error_config][crate::model::ImportUserEventsRequest::error_config].
16209        pub fn set_or_clear_error_config<T>(mut self, v: std::option::Option<T>) -> Self
16210        where
16211            T: std::convert::Into<crate::model::ImportErrorConfig>,
16212        {
16213            self.0.request.error_config = v.map(|x| x.into());
16214            self
16215        }
16216
16217        /// Sets the value of [source][crate::model::ImportUserEventsRequest::source].
16218        ///
16219        /// Note that all the setters affecting `source` are
16220        /// mutually exclusive.
16221        pub fn set_source<T: Into<Option<crate::model::import_user_events_request::Source>>>(
16222            mut self,
16223            v: T,
16224        ) -> Self {
16225            self.0.request.source = v.into();
16226            self
16227        }
16228
16229        /// Sets the value of [source][crate::model::ImportUserEventsRequest::source]
16230        /// to hold a `InlineSource`.
16231        ///
16232        /// Note that all the setters affecting `source` are
16233        /// mutually exclusive.
16234        pub fn set_inline_source<
16235            T: std::convert::Into<
16236                    std::boxed::Box<crate::model::import_user_events_request::InlineSource>,
16237                >,
16238        >(
16239            mut self,
16240            v: T,
16241        ) -> Self {
16242            self.0.request = self.0.request.set_inline_source(v);
16243            self
16244        }
16245
16246        /// Sets the value of [source][crate::model::ImportUserEventsRequest::source]
16247        /// to hold a `GcsSource`.
16248        ///
16249        /// Note that all the setters affecting `source` are
16250        /// mutually exclusive.
16251        pub fn set_gcs_source<T: std::convert::Into<std::boxed::Box<crate::model::GcsSource>>>(
16252            mut self,
16253            v: T,
16254        ) -> Self {
16255            self.0.request = self.0.request.set_gcs_source(v);
16256            self
16257        }
16258
16259        /// Sets the value of [source][crate::model::ImportUserEventsRequest::source]
16260        /// to hold a `BigquerySource`.
16261        ///
16262        /// Note that all the setters affecting `source` are
16263        /// mutually exclusive.
16264        pub fn set_bigquery_source<
16265            T: std::convert::Into<std::boxed::Box<crate::model::BigQuerySource>>,
16266        >(
16267            mut self,
16268            v: T,
16269        ) -> Self {
16270            self.0.request = self.0.request.set_bigquery_source(v);
16271            self
16272        }
16273    }
16274
16275    #[doc(hidden)]
16276    impl gax::options::internal::RequestBuilder for ImportUserEvents {
16277        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
16278            &mut self.0.options
16279        }
16280    }
16281
16282    /// The request builder for [UserEventService::list_operations][crate::client::UserEventService::list_operations] calls.
16283    ///
16284    /// # Example
16285    /// ```
16286    /// # use google_cloud_discoveryengine_v1::builder::user_event_service::ListOperations;
16287    /// # async fn sample() -> gax::Result<()> {
16288    /// use gax::paginator::ItemPaginator;
16289    ///
16290    /// let builder = prepare_request_builder();
16291    /// let mut items = builder.by_item();
16292    /// while let Some(result) = items.next().await {
16293    ///   let item = result?;
16294    /// }
16295    /// # Ok(()) }
16296    ///
16297    /// fn prepare_request_builder() -> ListOperations {
16298    ///   # panic!();
16299    ///   // ... details omitted ...
16300    /// }
16301    /// ```
16302    #[derive(Clone, Debug)]
16303    pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
16304
16305    impl ListOperations {
16306        pub(crate) fn new(
16307            stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
16308        ) -> Self {
16309            Self(RequestBuilder::new(stub))
16310        }
16311
16312        /// Sets the full request, replacing any prior values.
16313        pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
16314            mut self,
16315            v: V,
16316        ) -> Self {
16317            self.0.request = v.into();
16318            self
16319        }
16320
16321        /// Sets all the options, replacing any prior values.
16322        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
16323            self.0.options = v.into();
16324            self
16325        }
16326
16327        /// Sends the request.
16328        pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
16329            (*self.0.stub)
16330                .list_operations(self.0.request, self.0.options)
16331                .await
16332                .map(gax::response::Response::into_body)
16333        }
16334
16335        /// Streams each page in the collection.
16336        pub fn by_page(
16337            self,
16338        ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
16339        {
16340            use std::clone::Clone;
16341            let token = self.0.request.page_token.clone();
16342            let execute = move |token: String| {
16343                let mut builder = self.clone();
16344                builder.0.request = builder.0.request.set_page_token(token);
16345                builder.send()
16346            };
16347            gax::paginator::internal::new_paginator(token, execute)
16348        }
16349
16350        /// Streams each item in the collection.
16351        pub fn by_item(
16352            self,
16353        ) -> impl gax::paginator::ItemPaginator<
16354            longrunning::model::ListOperationsResponse,
16355            gax::error::Error,
16356        > {
16357            use gax::paginator::Paginator;
16358            self.by_page().items()
16359        }
16360
16361        /// Sets the value of [name][longrunning::model::ListOperationsRequest::name].
16362        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
16363            self.0.request.name = v.into();
16364            self
16365        }
16366
16367        /// Sets the value of [filter][longrunning::model::ListOperationsRequest::filter].
16368        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
16369            self.0.request.filter = v.into();
16370            self
16371        }
16372
16373        /// Sets the value of [page_size][longrunning::model::ListOperationsRequest::page_size].
16374        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
16375            self.0.request.page_size = v.into();
16376            self
16377        }
16378
16379        /// Sets the value of [page_token][longrunning::model::ListOperationsRequest::page_token].
16380        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
16381            self.0.request.page_token = v.into();
16382            self
16383        }
16384
16385        /// Sets the value of [return_partial_success][longrunning::model::ListOperationsRequest::return_partial_success].
16386        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
16387            self.0.request.return_partial_success = v.into();
16388            self
16389        }
16390    }
16391
16392    #[doc(hidden)]
16393    impl gax::options::internal::RequestBuilder for ListOperations {
16394        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
16395            &mut self.0.options
16396        }
16397    }
16398
16399    /// The request builder for [UserEventService::get_operation][crate::client::UserEventService::get_operation] calls.
16400    ///
16401    /// # Example
16402    /// ```
16403    /// # use google_cloud_discoveryengine_v1::builder::user_event_service::GetOperation;
16404    /// # async fn sample() -> gax::Result<()> {
16405    ///
16406    /// let builder = prepare_request_builder();
16407    /// let response = builder.send().await?;
16408    /// # Ok(()) }
16409    ///
16410    /// fn prepare_request_builder() -> GetOperation {
16411    ///   # panic!();
16412    ///   // ... details omitted ...
16413    /// }
16414    /// ```
16415    #[derive(Clone, Debug)]
16416    pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
16417
16418    impl GetOperation {
16419        pub(crate) fn new(
16420            stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
16421        ) -> Self {
16422            Self(RequestBuilder::new(stub))
16423        }
16424
16425        /// Sets the full request, replacing any prior values.
16426        pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
16427            mut self,
16428            v: V,
16429        ) -> Self {
16430            self.0.request = v.into();
16431            self
16432        }
16433
16434        /// Sets all the options, replacing any prior values.
16435        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
16436            self.0.options = v.into();
16437            self
16438        }
16439
16440        /// Sends the request.
16441        pub async fn send(self) -> Result<longrunning::model::Operation> {
16442            (*self.0.stub)
16443                .get_operation(self.0.request, self.0.options)
16444                .await
16445                .map(gax::response::Response::into_body)
16446        }
16447
16448        /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
16449        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
16450            self.0.request.name = v.into();
16451            self
16452        }
16453    }
16454
16455    #[doc(hidden)]
16456    impl gax::options::internal::RequestBuilder for GetOperation {
16457        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
16458            &mut self.0.options
16459        }
16460    }
16461
16462    /// The request builder for [UserEventService::cancel_operation][crate::client::UserEventService::cancel_operation] calls.
16463    ///
16464    /// # Example
16465    /// ```
16466    /// # use google_cloud_discoveryengine_v1::builder::user_event_service::CancelOperation;
16467    /// # async fn sample() -> gax::Result<()> {
16468    ///
16469    /// let builder = prepare_request_builder();
16470    /// let response = builder.send().await?;
16471    /// # Ok(()) }
16472    ///
16473    /// fn prepare_request_builder() -> CancelOperation {
16474    ///   # panic!();
16475    ///   // ... details omitted ...
16476    /// }
16477    /// ```
16478    #[derive(Clone, Debug)]
16479    pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
16480
16481    impl CancelOperation {
16482        pub(crate) fn new(
16483            stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
16484        ) -> Self {
16485            Self(RequestBuilder::new(stub))
16486        }
16487
16488        /// Sets the full request, replacing any prior values.
16489        pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
16490            mut self,
16491            v: V,
16492        ) -> Self {
16493            self.0.request = v.into();
16494            self
16495        }
16496
16497        /// Sets all the options, replacing any prior values.
16498        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
16499            self.0.options = v.into();
16500            self
16501        }
16502
16503        /// Sends the request.
16504        pub async fn send(self) -> Result<()> {
16505            (*self.0.stub)
16506                .cancel_operation(self.0.request, self.0.options)
16507                .await
16508                .map(gax::response::Response::into_body)
16509        }
16510
16511        /// Sets the value of [name][longrunning::model::CancelOperationRequest::name].
16512        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
16513            self.0.request.name = v.into();
16514            self
16515        }
16516    }
16517
16518    #[doc(hidden)]
16519    impl gax::options::internal::RequestBuilder for CancelOperation {
16520        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
16521            &mut self.0.options
16522        }
16523    }
16524}
16525
16526#[cfg(feature = "user-license-service")]
16527#[cfg_attr(docsrs, doc(cfg(feature = "user-license-service")))]
16528pub mod user_license_service {
16529    use crate::Result;
16530
16531    /// A builder for [UserLicenseService][crate::client::UserLicenseService].
16532    ///
16533    /// ```
16534    /// # async fn sample() -> gax::client_builder::Result<()> {
16535    /// # use google_cloud_discoveryengine_v1::*;
16536    /// # use builder::user_license_service::ClientBuilder;
16537    /// # use client::UserLicenseService;
16538    /// let builder : ClientBuilder = UserLicenseService::builder();
16539    /// let client = builder
16540    ///     .with_endpoint("https://discoveryengine.googleapis.com")
16541    ///     .build().await?;
16542    /// # Ok(()) }
16543    /// ```
16544    pub type ClientBuilder =
16545        gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
16546
16547    pub(crate) mod client {
16548        use super::super::super::client::UserLicenseService;
16549        pub struct Factory;
16550        impl gax::client_builder::internal::ClientFactory for Factory {
16551            type Client = UserLicenseService;
16552            type Credentials = gaxi::options::Credentials;
16553            async fn build(
16554                self,
16555                config: gaxi::options::ClientConfig,
16556            ) -> gax::client_builder::Result<Self::Client> {
16557                Self::Client::new(config).await
16558            }
16559        }
16560    }
16561
16562    /// Common implementation for [crate::client::UserLicenseService] request builders.
16563    #[derive(Clone, Debug)]
16564    pub(crate) struct RequestBuilder<R: std::default::Default> {
16565        stub: std::sync::Arc<dyn super::super::stub::dynamic::UserLicenseService>,
16566        request: R,
16567        options: gax::options::RequestOptions,
16568    }
16569
16570    impl<R> RequestBuilder<R>
16571    where
16572        R: std::default::Default,
16573    {
16574        pub(crate) fn new(
16575            stub: std::sync::Arc<dyn super::super::stub::dynamic::UserLicenseService>,
16576        ) -> Self {
16577            Self {
16578                stub,
16579                request: R::default(),
16580                options: gax::options::RequestOptions::default(),
16581            }
16582        }
16583    }
16584
16585    /// The request builder for [UserLicenseService::list_user_licenses][crate::client::UserLicenseService::list_user_licenses] calls.
16586    ///
16587    /// # Example
16588    /// ```
16589    /// # use google_cloud_discoveryengine_v1::builder::user_license_service::ListUserLicenses;
16590    /// # async fn sample() -> gax::Result<()> {
16591    /// use gax::paginator::ItemPaginator;
16592    ///
16593    /// let builder = prepare_request_builder();
16594    /// let mut items = builder.by_item();
16595    /// while let Some(result) = items.next().await {
16596    ///   let item = result?;
16597    /// }
16598    /// # Ok(()) }
16599    ///
16600    /// fn prepare_request_builder() -> ListUserLicenses {
16601    ///   # panic!();
16602    ///   // ... details omitted ...
16603    /// }
16604    /// ```
16605    #[derive(Clone, Debug)]
16606    pub struct ListUserLicenses(RequestBuilder<crate::model::ListUserLicensesRequest>);
16607
16608    impl ListUserLicenses {
16609        pub(crate) fn new(
16610            stub: std::sync::Arc<dyn super::super::stub::dynamic::UserLicenseService>,
16611        ) -> Self {
16612            Self(RequestBuilder::new(stub))
16613        }
16614
16615        /// Sets the full request, replacing any prior values.
16616        pub fn with_request<V: Into<crate::model::ListUserLicensesRequest>>(
16617            mut self,
16618            v: V,
16619        ) -> Self {
16620            self.0.request = v.into();
16621            self
16622        }
16623
16624        /// Sets all the options, replacing any prior values.
16625        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
16626            self.0.options = v.into();
16627            self
16628        }
16629
16630        /// Sends the request.
16631        pub async fn send(self) -> Result<crate::model::ListUserLicensesResponse> {
16632            (*self.0.stub)
16633                .list_user_licenses(self.0.request, self.0.options)
16634                .await
16635                .map(gax::response::Response::into_body)
16636        }
16637
16638        /// Streams each page in the collection.
16639        pub fn by_page(
16640            self,
16641        ) -> impl gax::paginator::Paginator<crate::model::ListUserLicensesResponse, gax::error::Error>
16642        {
16643            use std::clone::Clone;
16644            let token = self.0.request.page_token.clone();
16645            let execute = move |token: String| {
16646                let mut builder = self.clone();
16647                builder.0.request = builder.0.request.set_page_token(token);
16648                builder.send()
16649            };
16650            gax::paginator::internal::new_paginator(token, execute)
16651        }
16652
16653        /// Streams each item in the collection.
16654        pub fn by_item(
16655            self,
16656        ) -> impl gax::paginator::ItemPaginator<crate::model::ListUserLicensesResponse, gax::error::Error>
16657        {
16658            use gax::paginator::Paginator;
16659            self.by_page().items()
16660        }
16661
16662        /// Sets the value of [parent][crate::model::ListUserLicensesRequest::parent].
16663        ///
16664        /// This is a **required** field for requests.
16665        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
16666            self.0.request.parent = v.into();
16667            self
16668        }
16669
16670        /// Sets the value of [page_size][crate::model::ListUserLicensesRequest::page_size].
16671        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
16672            self.0.request.page_size = v.into();
16673            self
16674        }
16675
16676        /// Sets the value of [page_token][crate::model::ListUserLicensesRequest::page_token].
16677        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
16678            self.0.request.page_token = v.into();
16679            self
16680        }
16681
16682        /// Sets the value of [filter][crate::model::ListUserLicensesRequest::filter].
16683        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
16684            self.0.request.filter = v.into();
16685            self
16686        }
16687    }
16688
16689    #[doc(hidden)]
16690    impl gax::options::internal::RequestBuilder for ListUserLicenses {
16691        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
16692            &mut self.0.options
16693        }
16694    }
16695
16696    /// The request builder for [UserLicenseService::batch_update_user_licenses][crate::client::UserLicenseService::batch_update_user_licenses] calls.
16697    ///
16698    /// # Example
16699    /// ```
16700    /// # use google_cloud_discoveryengine_v1::builder::user_license_service::BatchUpdateUserLicenses;
16701    /// # async fn sample() -> gax::Result<()> {
16702    /// use lro::Poller;
16703    ///
16704    /// let builder = prepare_request_builder();
16705    /// let response = builder.poller().until_done().await?;
16706    /// # Ok(()) }
16707    ///
16708    /// fn prepare_request_builder() -> BatchUpdateUserLicenses {
16709    ///   # panic!();
16710    ///   // ... details omitted ...
16711    /// }
16712    /// ```
16713    #[derive(Clone, Debug)]
16714    pub struct BatchUpdateUserLicenses(
16715        RequestBuilder<crate::model::BatchUpdateUserLicensesRequest>,
16716    );
16717
16718    impl BatchUpdateUserLicenses {
16719        pub(crate) fn new(
16720            stub: std::sync::Arc<dyn super::super::stub::dynamic::UserLicenseService>,
16721        ) -> Self {
16722            Self(RequestBuilder::new(stub))
16723        }
16724
16725        /// Sets the full request, replacing any prior values.
16726        pub fn with_request<V: Into<crate::model::BatchUpdateUserLicensesRequest>>(
16727            mut self,
16728            v: V,
16729        ) -> Self {
16730            self.0.request = v.into();
16731            self
16732        }
16733
16734        /// Sets all the options, replacing any prior values.
16735        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
16736            self.0.options = v.into();
16737            self
16738        }
16739
16740        /// Sends the request.
16741        ///
16742        /// # Long running operations
16743        ///
16744        /// This starts, but does not poll, a longrunning operation. More information
16745        /// on [batch_update_user_licenses][crate::client::UserLicenseService::batch_update_user_licenses].
16746        pub async fn send(self) -> Result<longrunning::model::Operation> {
16747            (*self.0.stub)
16748                .batch_update_user_licenses(self.0.request, self.0.options)
16749                .await
16750                .map(gax::response::Response::into_body)
16751        }
16752
16753        /// Creates a [Poller][lro::Poller] to work with `batch_update_user_licenses`.
16754        pub fn poller(
16755            self,
16756        ) -> impl lro::Poller<
16757            crate::model::BatchUpdateUserLicensesResponse,
16758            crate::model::BatchUpdateUserLicensesMetadata,
16759        > {
16760            type Operation = lro::internal::Operation<
16761                crate::model::BatchUpdateUserLicensesResponse,
16762                crate::model::BatchUpdateUserLicensesMetadata,
16763            >;
16764            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
16765            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
16766
16767            let stub = self.0.stub.clone();
16768            let mut options = self.0.options.clone();
16769            options.set_retry_policy(gax::retry_policy::NeverRetry);
16770            let query = move |name| {
16771                let stub = stub.clone();
16772                let options = options.clone();
16773                async {
16774                    let op = GetOperation::new(stub)
16775                        .set_name(name)
16776                        .with_options(options)
16777                        .send()
16778                        .await?;
16779                    Ok(Operation::new(op))
16780                }
16781            };
16782
16783            let start = move || async {
16784                let op = self.send().await?;
16785                Ok(Operation::new(op))
16786            };
16787
16788            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
16789        }
16790
16791        /// Sets the value of [parent][crate::model::BatchUpdateUserLicensesRequest::parent].
16792        ///
16793        /// This is a **required** field for requests.
16794        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
16795            self.0.request.parent = v.into();
16796            self
16797        }
16798
16799        /// Sets the value of [delete_unassigned_user_licenses][crate::model::BatchUpdateUserLicensesRequest::delete_unassigned_user_licenses].
16800        pub fn set_delete_unassigned_user_licenses<T: Into<bool>>(mut self, v: T) -> Self {
16801            self.0.request.delete_unassigned_user_licenses = v.into();
16802            self
16803        }
16804
16805        /// Sets the value of [source][crate::model::BatchUpdateUserLicensesRequest::source].
16806        ///
16807        /// Note that all the setters affecting `source` are
16808        /// mutually exclusive.
16809        pub fn set_source<
16810            T: Into<Option<crate::model::batch_update_user_licenses_request::Source>>,
16811        >(
16812            mut self,
16813            v: T,
16814        ) -> Self {
16815            self.0.request.source = v.into();
16816            self
16817        }
16818
16819        /// Sets the value of [source][crate::model::BatchUpdateUserLicensesRequest::source]
16820        /// to hold a `InlineSource`.
16821        ///
16822        /// Note that all the setters affecting `source` are
16823        /// mutually exclusive.
16824        pub fn set_inline_source<
16825            T: std::convert::Into<
16826                    std::boxed::Box<crate::model::batch_update_user_licenses_request::InlineSource>,
16827                >,
16828        >(
16829            mut self,
16830            v: T,
16831        ) -> Self {
16832            self.0.request = self.0.request.set_inline_source(v);
16833            self
16834        }
16835    }
16836
16837    #[doc(hidden)]
16838    impl gax::options::internal::RequestBuilder for BatchUpdateUserLicenses {
16839        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
16840            &mut self.0.options
16841        }
16842    }
16843
16844    /// The request builder for [UserLicenseService::list_operations][crate::client::UserLicenseService::list_operations] calls.
16845    ///
16846    /// # Example
16847    /// ```
16848    /// # use google_cloud_discoveryengine_v1::builder::user_license_service::ListOperations;
16849    /// # async fn sample() -> gax::Result<()> {
16850    /// use gax::paginator::ItemPaginator;
16851    ///
16852    /// let builder = prepare_request_builder();
16853    /// let mut items = builder.by_item();
16854    /// while let Some(result) = items.next().await {
16855    ///   let item = result?;
16856    /// }
16857    /// # Ok(()) }
16858    ///
16859    /// fn prepare_request_builder() -> ListOperations {
16860    ///   # panic!();
16861    ///   // ... details omitted ...
16862    /// }
16863    /// ```
16864    #[derive(Clone, Debug)]
16865    pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
16866
16867    impl ListOperations {
16868        pub(crate) fn new(
16869            stub: std::sync::Arc<dyn super::super::stub::dynamic::UserLicenseService>,
16870        ) -> Self {
16871            Self(RequestBuilder::new(stub))
16872        }
16873
16874        /// Sets the full request, replacing any prior values.
16875        pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
16876            mut self,
16877            v: V,
16878        ) -> Self {
16879            self.0.request = v.into();
16880            self
16881        }
16882
16883        /// Sets all the options, replacing any prior values.
16884        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
16885            self.0.options = v.into();
16886            self
16887        }
16888
16889        /// Sends the request.
16890        pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
16891            (*self.0.stub)
16892                .list_operations(self.0.request, self.0.options)
16893                .await
16894                .map(gax::response::Response::into_body)
16895        }
16896
16897        /// Streams each page in the collection.
16898        pub fn by_page(
16899            self,
16900        ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
16901        {
16902            use std::clone::Clone;
16903            let token = self.0.request.page_token.clone();
16904            let execute = move |token: String| {
16905                let mut builder = self.clone();
16906                builder.0.request = builder.0.request.set_page_token(token);
16907                builder.send()
16908            };
16909            gax::paginator::internal::new_paginator(token, execute)
16910        }
16911
16912        /// Streams each item in the collection.
16913        pub fn by_item(
16914            self,
16915        ) -> impl gax::paginator::ItemPaginator<
16916            longrunning::model::ListOperationsResponse,
16917            gax::error::Error,
16918        > {
16919            use gax::paginator::Paginator;
16920            self.by_page().items()
16921        }
16922
16923        /// Sets the value of [name][longrunning::model::ListOperationsRequest::name].
16924        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
16925            self.0.request.name = v.into();
16926            self
16927        }
16928
16929        /// Sets the value of [filter][longrunning::model::ListOperationsRequest::filter].
16930        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
16931            self.0.request.filter = v.into();
16932            self
16933        }
16934
16935        /// Sets the value of [page_size][longrunning::model::ListOperationsRequest::page_size].
16936        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
16937            self.0.request.page_size = v.into();
16938            self
16939        }
16940
16941        /// Sets the value of [page_token][longrunning::model::ListOperationsRequest::page_token].
16942        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
16943            self.0.request.page_token = v.into();
16944            self
16945        }
16946
16947        /// Sets the value of [return_partial_success][longrunning::model::ListOperationsRequest::return_partial_success].
16948        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
16949            self.0.request.return_partial_success = v.into();
16950            self
16951        }
16952    }
16953
16954    #[doc(hidden)]
16955    impl gax::options::internal::RequestBuilder for ListOperations {
16956        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
16957            &mut self.0.options
16958        }
16959    }
16960
16961    /// The request builder for [UserLicenseService::get_operation][crate::client::UserLicenseService::get_operation] calls.
16962    ///
16963    /// # Example
16964    /// ```
16965    /// # use google_cloud_discoveryengine_v1::builder::user_license_service::GetOperation;
16966    /// # async fn sample() -> gax::Result<()> {
16967    ///
16968    /// let builder = prepare_request_builder();
16969    /// let response = builder.send().await?;
16970    /// # Ok(()) }
16971    ///
16972    /// fn prepare_request_builder() -> GetOperation {
16973    ///   # panic!();
16974    ///   // ... details omitted ...
16975    /// }
16976    /// ```
16977    #[derive(Clone, Debug)]
16978    pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
16979
16980    impl GetOperation {
16981        pub(crate) fn new(
16982            stub: std::sync::Arc<dyn super::super::stub::dynamic::UserLicenseService>,
16983        ) -> Self {
16984            Self(RequestBuilder::new(stub))
16985        }
16986
16987        /// Sets the full request, replacing any prior values.
16988        pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
16989            mut self,
16990            v: V,
16991        ) -> Self {
16992            self.0.request = v.into();
16993            self
16994        }
16995
16996        /// Sets all the options, replacing any prior values.
16997        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
16998            self.0.options = v.into();
16999            self
17000        }
17001
17002        /// Sends the request.
17003        pub async fn send(self) -> Result<longrunning::model::Operation> {
17004            (*self.0.stub)
17005                .get_operation(self.0.request, self.0.options)
17006                .await
17007                .map(gax::response::Response::into_body)
17008        }
17009
17010        /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
17011        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
17012            self.0.request.name = v.into();
17013            self
17014        }
17015    }
17016
17017    #[doc(hidden)]
17018    impl gax::options::internal::RequestBuilder for GetOperation {
17019        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
17020            &mut self.0.options
17021        }
17022    }
17023
17024    /// The request builder for [UserLicenseService::cancel_operation][crate::client::UserLicenseService::cancel_operation] calls.
17025    ///
17026    /// # Example
17027    /// ```
17028    /// # use google_cloud_discoveryengine_v1::builder::user_license_service::CancelOperation;
17029    /// # async fn sample() -> gax::Result<()> {
17030    ///
17031    /// let builder = prepare_request_builder();
17032    /// let response = builder.send().await?;
17033    /// # Ok(()) }
17034    ///
17035    /// fn prepare_request_builder() -> CancelOperation {
17036    ///   # panic!();
17037    ///   // ... details omitted ...
17038    /// }
17039    /// ```
17040    #[derive(Clone, Debug)]
17041    pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
17042
17043    impl CancelOperation {
17044        pub(crate) fn new(
17045            stub: std::sync::Arc<dyn super::super::stub::dynamic::UserLicenseService>,
17046        ) -> Self {
17047            Self(RequestBuilder::new(stub))
17048        }
17049
17050        /// Sets the full request, replacing any prior values.
17051        pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
17052            mut self,
17053            v: V,
17054        ) -> Self {
17055            self.0.request = v.into();
17056            self
17057        }
17058
17059        /// Sets all the options, replacing any prior values.
17060        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
17061            self.0.options = v.into();
17062            self
17063        }
17064
17065        /// Sends the request.
17066        pub async fn send(self) -> Result<()> {
17067            (*self.0.stub)
17068                .cancel_operation(self.0.request, self.0.options)
17069                .await
17070                .map(gax::response::Response::into_body)
17071        }
17072
17073        /// Sets the value of [name][longrunning::model::CancelOperationRequest::name].
17074        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
17075            self.0.request.name = v.into();
17076            self
17077        }
17078    }
17079
17080    #[doc(hidden)]
17081    impl gax::options::internal::RequestBuilder for CancelOperation {
17082        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
17083            &mut self.0.options
17084        }
17085    }
17086}